public NewTaskPage(TimeTable.Common.Task t = null) { InitializeComponent(); task = t; if (t != null) { NameEntry.Text = t.Name; DueDatePicker.Date = new DateTime(t.DueDateTicks); NotesEditor.Text = t.Notes; } }
private void SaveButton_Clicked(object sender, EventArgs e) { DbTask dbt = new DbTask(); if (task == null) { task = new TimeTable.Common.Task(); task.Name = this.NameEntry.Text; task.DueDateTicks = this.DueDatePicker.Date.Ticks; task.Notes = this.NotesEditor.Text; task.Id = dbt.Insert(task); } else { task.Name = this.NameEntry.Text; task.DueDateTicks = this.DueDatePicker.Date.Ticks; task.Notes = this.NotesEditor.Text; dbt.Update(task); } }