private void reminderButtonCreate_Click(object sender, RoutedEventArgs e) { string result = ReminderCRUDOperations.CreateReminder(comboBoxReminders, getDictionaryFromReminder(reminderForBinding), ref reminderCounter); if (result != "Correct") { MessageBox.Show(result, "Error", MessageBoxButton.OK); } }
private void reminderButtonDelete_Click(object sender, RoutedEventArgs e) { string result = ReminderCRUDOperations.DeleteReminderById(Singleton.GetInstance().ActualReminder.Id, comboBoxReminders); if (result != "Removed") { MessageBox.Show(result, "Error", MessageBoxButton.OK); } else { MessageBox.Show(result, "Info", MessageBoxButton.OK); } }
private void reminderButtonUpdate_Click(object sender, RoutedEventArgs e) { string result = ReminderCRUDOperations.UpdateReminder(getDictionaryFromReminder(reminderForBinding)); if (result != "Update") { MessageBox.Show(result, "Error", MessageBoxButton.OK); } else { MessageBox.Show(result, "Info", MessageBoxButton.OK); } }
private void comboBoxReminders_SelectionChanged(object sender, SelectionChangedEventArgs e) { var item = (CmbElement)comboBoxReminders.SelectedItem; string value; if (item == null) { value = "<Create>"; } else { value = item.Value; } if (value == "<Create>") { setReminderButtonsForCreating(); reminderForBinding = new Reminder(); } else { try { setReminderButtonsForUpdatingAndDeleting(); Reminder reminder = ReminderCRUDOperations.ReadReminderById(Int32.Parse(value)); reminderForBinding = reminder; } catch (Exception) { ShowErrorInfo("Error in reading proper id."); CmbElement cmbElementDefault = new CmbElement { Id = 0, Value = "<Create>" }; comboBoxReminders.SelectedItem = cmbElementDefault; return; } } RemindersTab.DataContext = reminderForBinding; }