private void SaveBtn_Click(object sender, EventArgs e) { var date = new DateTime(); try { date = DateTime.Parse(DeadLineTxtB.Text.ToString()); } catch (Exception) { MessageBox.Show("Incorrect DataTime Format"); } var newMyTask = new Task() { Task_Id = MyTask.Task_Id, Project_Id = MyTask.Project_Id, Description = DescriptionTxtB.Text, DeadLine = DateTime.Parse(DeadLineTxtB.Text) }; try { EditTaskController.UpdateTask(unit, newMyTask); } catch (Exception) { MessageBox.Show($"Error ocurred saving changes"); } MyBoolE = true; this.Close(); }
public EditTask(string project_Id, int task_Id) { InitializeComponent(); Project_Id = project_Id; unit = new UnityOfWork(new ProjectTracerEntities()); try { MyTask = EditTaskController.GetTaskById(unit, Project_Id, task_Id); DescriptionTxtB.Text = MyTask.Description; string DateString = MyTask.DeadLine.Date.ToString(); DeadLineTxtB.Text = DateString; } catch (Exception) { MessageBox.Show("Error getting the task"); } myBoolE = new bool(); }