示例#1
0
 private void deleteReminderButton_Click(object sender, EventArgs e)
 {
     if (IsRemindsNotNull())
     {
         if (IsCurentRowNotNull(reminderDataGridView.CurrentRow))
         {
             var indexToDelete = reminderDataGridView.CurrentRow.Index;
             if (indexToDelete < remindersList.Count)
             {
                 var listElementToDelete = FindIndexInArray(indexToDelete);
                 remindersList.RemoveAt(listElementToDelete);
                 reminderDataGridView.Rows.RemoveAt(indexToDelete);
                 repository.Save(remindersList);
             }
             else
             {
                 MessageBox.Show("Пожалуйста, выберите строку корректно");
             }
         }
     }
 }
示例#2
0
 private void saveRemindButton_Click(object sender, EventArgs e)
 {
     if (Validation.HasValidationErrors(Controls))
     {
         return;
     }
     try
     {
         Remind.StartDate     = startDateTimePicker.Value;
         Remind.Name          = reminderNameTextBox.Text;
         Remind.EndDate       = endDateTimePicker.Value;
         Remind.Description   = reminderDescriptionTextBox.Text;
         Remind.Notifications = new List <Notification> {
         };
         for (int i = 0; i < panelsList.Count; i++)
         {
             if (comboBoxesList[i].Text != "")
             {
                 Remind.Notifications.Add(new Notification((int)numericsUpDownList[i].Value, (NotificationPeriod)comboBoxesList[i].SelectedValue));
             }
         }
         if (cyclicalNotificationComboBox.Text != "")
         {
             Remind.CyclicalNotification = new CyclicalNotifications(startCyclicalNotification.Value,
                                                                     endDateTimePicker.Value, (int)cyclicalNotificationNumeric.Value,
                                                                     (NotificationPeriod)cyclicalNotificationComboBox.SelectedValue);
         }
         else
         {
             Remind.CyclicalNotification = null;
         }
         Remind.TasksList = toDoReminderTasksRichTextBox.Text.Split(new string[] { "\n" }
                                                                    , StringSplitOptions.RemoveEmptyEntries)
                            .Select(x => new RemindTask(x)).ToList();
         Remind.TasksList.AddRange(inProgressReminderTasksRichTextBox.Text.Split(new string[] { "\n" }
                                                                                 , StringSplitOptions.RemoveEmptyEntries)
                                   .Select(x => new RemindTask(x, TaskStatus.InProgress)).ToList());
         Remind.TasksList.AddRange(doneReminderTasksRichTextBox.Text.Split(new string[] { "\n" }
                                                                           , StringSplitOptions.RemoveEmptyEntries)
                                   .Select(x => new RemindTask(x, TaskStatus.Done)).ToList());
         repository.Save(Remind);
         SaveButtonClicked = true;
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#3
0
 private void Kanban_FormClosing(object sender, FormClosingEventArgs e)
 {
     repository.Save(Remind);
 }