Advertisement
Guest User

dsdsd

a guest
Mar 22nd, 2019
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3. string ime = textBox1.Text;
  4.  
  5. var kolekcija1 = Properties.Settings.Default.Doktori;
  6. var kolekcija2 = Properties.Settings.Default.brojki;
  7.  
  8. string broj = "";
  9. foreach (string doktor in Properties.Settings.Default.Doktori)
  10. {
  11. broj = kolekcija2[Properties.Settings.Default.Doktori.IndexOf(doktor)];
  12.  
  13. string url = "http://mojtermin.mk/api/pp/resources/" + broj + "/slots_availability";
  14.  
  15. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  16. string res = Convert.ToString(new StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd());
  17.  
  18. MessageBox.Show(res);
  19.  
  20. if (res.Contains("true") && Properties.Settings.Default.imat[Properties.Settings.Default.Doktori.IndexOf(doktor)] != "imat")
  21. {
  22. Properties.Settings.Default.imat[Properties.Settings.Default.Doktori.IndexOf(doktor)] = "imat";
  23. try
  24. {
  25. string prakac = "arsova2@gmail.com";
  26. string primac = prakac;
  27. using (MailMessage mm = new MailMessage(prakac, primac))
  28. {
  29. mm.Subject = "СЛОБОДЕН ТЕРМИН";
  30. mm.Body = "Има слободен термин кај Д-р " + doktor + ".";
  31. mm.IsBodyHtml = true;
  32. SmtpClient smtp = new SmtpClient();
  33. smtp.Host = "smtp.gmail.com";
  34. NetworkCredential credential = new NetworkCredential();
  35. credential.UserName = "arsova2@gmail.com";
  36. credential.Password = "Suze55PC";
  37. smtp.UseDefaultCredentials = true;
  38. smtp.Credentials = credential;
  39. smtp.Port = 587;
  40. smtp.EnableSsl = true;
  41. smtp.Send(mm);
  42. }
  43. }
  44. catch (Exception ex)
  45. {
  46.  
  47. };
  48. MessageBox.Show("Има слободен термин кај Д-р " + doktor + ".", "Слободен термин", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  49. }
  50. }
  51.  
  52. System.Threading.Thread.Sleep(900000);
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement