Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button1_Click(object sender, EventArgs e)
- {
- string ime = textBox1.Text;
- var kolekcija1 = Properties.Settings.Default.Doktori;
- var kolekcija2 = Properties.Settings.Default.brojki;
- string broj = "";
- foreach (string doktor in Properties.Settings.Default.Doktori)
- {
- broj = kolekcija2[Properties.Settings.Default.Doktori.IndexOf(doktor)];
- string url = "http://mojtermin.mk/api/pp/resources/" + broj + "/slots_availability";
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
- string res = Convert.ToString(new StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd());
- MessageBox.Show(res);
- if (res.Contains("true") && Properties.Settings.Default.imat[Properties.Settings.Default.Doktori.IndexOf(doktor)] != "imat")
- {
- Properties.Settings.Default.imat[Properties.Settings.Default.Doktori.IndexOf(doktor)] = "imat";
- try
- {
- string prakac = "arsova2@gmail.com";
- string primac = prakac;
- using (MailMessage mm = new MailMessage(prakac, primac))
- {
- mm.Subject = "СЛОБОДЕН ТЕРМИН";
- mm.Body = "Има слободен термин кај Д-р " + doktor + ".";
- mm.IsBodyHtml = true;
- SmtpClient smtp = new SmtpClient();
- smtp.Host = "smtp.gmail.com";
- NetworkCredential credential = new NetworkCredential();
- credential.UserName = "arsova2@gmail.com";
- credential.Password = "Suze55PC";
- smtp.UseDefaultCredentials = true;
- smtp.Credentials = credential;
- smtp.Port = 587;
- smtp.EnableSsl = true;
- smtp.Send(mm);
- }
- }
- catch (Exception ex)
- {
- };
- MessageBox.Show("Има слободен термин кај Д-р " + doktor + ".", "Слободен термин", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- }
- }
- System.Threading.Thread.Sleep(900000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement