private void btnSaveTodo_Click(object sender, RoutedEventArgs e) { if (ValidateBaseInputs()) { if (ucState == CustomUCState.CREATE) { Data.Todo newTodo = new Data.Todo(); newTodo.Title = this.inputTitle.GetInput(); newTodo.Description = this.inputDescription.Text; newTodo.Priority = this.comboPriority.SelectedIndex + 1; // TODO: Empty Values as NULL in DB (for better search quality) if (this.dateDeadline.SelectedDate != null) { newTodo.Deadline = this.dateDeadline.SelectedDate.Value; } newTodo.Asignee = this.inputAsignee.GetInput(); newTodo.Place = this.inputPlace.GetInput(); newTodo.TelNumber = this.inputPhoneNr.GetInput(); newTodo.Created = DateTime.Now; newTodo.Create(); // Save Todo in DB WindowStateShowNew?.Invoke(this, EventArgs.Empty); } else if (ucState == CustomUCState.EDIT) { this.currentTodo.Title = this.inputTitle.GetInput(); this.currentTodo.Description = this.inputDescription.Text; this.currentTodo.Priority = this.comboPriority.SelectedIndex + 1; if (this.dateDeadline.SelectedDate != null) { this.currentTodo.Deadline = this.dateDeadline.SelectedDate.Value; } this.currentTodo.Asignee = this.inputAsignee.GetInput(); this.currentTodo.Place = this.inputPlace.GetInput(); this.currentTodo.TelNumber = this.inputPhoneNr.GetInput(); this.currentTodo.Created = DateTime.Now; this.currentTodo.Update(); WindowStateShow?.Invoke(this, EventArgs.Empty); } } }
public void CloseWindow() { if (showCancelDialog) { MessageBoxResult result = MessageBox.Show("Wollen Sie das Erstellen des Todos wirklich beenden?\nAlle Ă„nderungen werden verworfen!", "Ă„nderungen verwerfen", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { WindowStateShow?.Invoke(this, EventArgs.Empty); } } else { WindowStateShow?.Invoke(this, EventArgs.Empty); } }