private void showEvent(Event _event) { hoursNumeric.Value = _event.SendDate.Hour; minutesNumeric.Value = _event.SendDate.Minute; EventTypeComboBox.SelectedIndex = (int)_event.Type; commentTextBox.Text = _event.Comment; messageTextBox.Text = _event.MessageText; selectedUsers = selectUsersFromEvent(_event); showUsers(selectedUsers); }
private void Timer_Tick(object sender, EventArgs e) { DateTime now = DateTime.Now; currentEvent = DataManager.Shedule.Find( _event => _event.SendDate.Month == now.Month && _event.SendDate.Day == now.Day && _event.SendDate.Hour == now.Hour && _event.SendDate.Minute == now.Minute ); // есть ли более простой способ игнорировать секунды в сравнении с DateTime? // гугл не помог if (currentEvent == null) return; selectedUsers = selectUsersFromEvent(currentEvent); BackgroundWorker sendMessagesWorker = new BackgroundWorker(); sendMessagesWorker.DoWork += SendMessagesWorker_DoWork; sendMessagesWorker.RunWorkerAsync(); }
private List<User> selectUsersFromEvent(Event _event) { return (from e in _event.UsersID join u in DataManager.Users on e equals u.ID select u).ToList(); }