//add main window buttons functionality public void DayEvent(string nameStart) { AppView view = new AppView(); List <string> notesNames = Note.GetSearch(nameStart); List <string> mailsNames = CustomMail.GetSearch(nameStart); List <string> eventsNames = MyEvent.GetSearch(nameStart); if (notesNames.Count != 0) { foreach (string name in notesNames) { Note note = new Note(name); view.ShowNoteDisplay(note); } } if (mailsNames.Count != 0) { foreach (string name in mailsNames) { CustomMail mail = new CustomMail(name); view.ShowMailDisplay(mail); } } if (eventsNames.Count != 0) { foreach (string name in eventsNames) { MyEvent mevent = new MyEvent(name); view.ShowEventDisplay(mevent); } } }
//method to send mail every 1 hour private string SendEmail() { if (Note.CheckForTable("Mails")) { List <string> mails = CustomMail.GetSearch(DateTime.Today.Year.ToString() + DateTime.Today.Month.ToString("D2") + DateTime.Today.Day.ToString()); foreach (string mail in mails) { CustomMail.StaticSendMail(mail); } Thread.Sleep(3600000); return($"Planned mails sended up to:{DateTime.Today.Year.ToString()}-{DateTime.Today.Month.ToString("D2")}-{DateTime.Today.Day.ToString()} {DateTime.Today.Hour.ToString()}:{DateTime.Today.Minute.ToString()}"); } else { return("none"); } }