public void ChangeWindowStateShowNew(Object sender, EventArgs args) { this.windowState = CustomWindowState.SHOW; this.currentTodo = Data.Todo.GetLatest(); this.newTodo = true; BuildFromState(); }
public void ChangeWindowStateShow(Object sender, EventArgs args) { if (currentTodo != null) { this.windowState = CustomWindowState.SHOW; this.currentTodo = Data.Todo.GetById(currentTodo.TodoID); BuildFromState(); } else { this.Close(); } }
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 SetupValues(Data.Todo currentTodo) { this.currentTodo = currentTodo; this.inputTitle.SetContent(currentTodo.Title); this.inputDescription.Text = currentTodo.Description; this.comboPriority.SelectedIndex = (int)currentTodo.Priority - 1; if (currentTodo.Deadline != null && currentTodo.Deadline != DateTime.MinValue) { this.cbHasDeadline.IsChecked = true; this.dateDeadline.SelectedDate = currentTodo.Deadline; } this.inputAsignee.SetContent(currentTodo.Asignee); this.inputPlace.SetContent(currentTodo.Place); this.inputPhoneNr.SetContent(currentTodo.TelNumber); this.showCancelDialog = false; }
public TodoWindow(int?id) { InitializeComponent(); Owner = Application.Current.MainWindow; WindowStartupLocation = WindowStartupLocation.CenterOwner; this.Left += Owner.Width; if (id == null) { this.windowState = CustomWindowState.CREATE; } else { this.currentTodo = Data.Todo.GetById((int)id); } this.todoUC.lblNew.Foreground = new SolidColorBrush(Colors.Green); this.BuildFromState(); }
public async Task <Models.Responses.Todo> Handle(TodoAnlegen request, CancellationToken cancellationToken) { var dbTodo = new Data.Todo { ErstellZeitpunkt = DateTime.UtcNow, Typ = this.db.TodoArten.SingleOrDefault(x => x.Name == "Eingang") }; this.mapper.CopyProperties(request, dbTodo); this.db.Add(dbTodo); await this.db.SaveChangesAsync(); var response = new Models.Responses.Todo { Art = "Eingang", }; this.mapper.CopyProperties(dbTodo, response); return(response); }
public async Task Put([FromServices] TodoContext todoContext, int id, [FromBody] Data.Todo value) { value.Id = id; todoContext.Todos.Update(value); await todoContext.SaveChangesAsync(); }
public void SetupTodo(Data.Todo currentTodo) { this.currentTodo = currentTodo; this.lblTitle.Content = this.currentTodo.Title; if (this.currentTodo.Description == null || this.currentTodo.Description == "") { this.lblDescription.Visibility = Visibility.Collapsed; } else { this.lblDescription.Visibility = Visibility.Visible; this.lblDescription.Content = this.currentTodo.Description; } if (this.currentTodo.Done) { this.lblDone.Foreground = new SolidColorBrush(Colors.ForestGreen); this.lblDone.Content = "Erledigt!"; } else { this.lblDone.Foreground = new SolidColorBrush(Colors.Red); this.lblDone.Content = "Nicht Erledigt!"; } if (this.currentTodo.Deadline != null && this.currentTodo.Deadline != DateTime.MinValue) { this.lblDeadline.Visibility = Visibility.Visible; this.lblDeadline.Content = this.currentTodo.Deadline.ToString("dd.MM.yyyy"); this.lblDeadlineLabel.Content = "Erledigen bis:"; } else { this.lblDeadline.Visibility = Visibility.Hidden; this.lblDeadlineLabel.Content = "Keine Frist"; } if (this.currentTodo.Asignee != null && this.currentTodo.Asignee != "") { this.lblAsignee.Foreground = new SolidColorBrush(Colors.Black); this.lblAsignee.Content = this.currentTodo.Asignee; } else { this.lblAsignee.Foreground = new SolidColorBrush(Colors.Red); this.lblAsignee.Content = "Keiner"; } // if (this.currentTodo.Place != null && this.currentTodo.Place != "") { this.lblPlace.Foreground = new SolidColorBrush(Colors.Black); this.lblPlace.Content = this.currentTodo.Place; } else { this.lblPlace.Foreground = new SolidColorBrush(Colors.Red); this.lblPlace.Content = "Keiner"; } // if (this.currentTodo.TelNumber != null && this.currentTodo.TelNumber != "") { this.lblPhone.Foreground = new SolidColorBrush(Colors.Black); this.lblPhone.Content = this.currentTodo.TelNumber; } else { this.lblPhone.Foreground = new SolidColorBrush(Colors.Red); this.lblPhone.Content = "Keine"; } // }