private void btEdit_Click(object sender, EventArgs e) { if (lbID.Text == "ID") { return; } if (!CheckInput.CheckInputAddTask(txbTitle, tbPercentCompleted, dtpFromDate, dtpToDate, cbbPriority, errorProvider1)) { return; } TaskWork task = new TaskWork(); task.ID = Convert.ToInt32(lbID.Text); task.description = tbDexcription.Text; task.Url = rtbLink.Text; task.Priority = cbbPriority.Text; task.Title = txbTitle.Text; task.ToDate = dtpToDate.Value; task.FromDate = dtpFromDate.Value; task.PercentCompleted = Convert.ToInt32(tbPercentCompleted.Text); task.Users = new List <User>(); foreach (object item in lstUser.Items) { task.Users.Add(UserController.GetUser(item.ToString())); } TaskController.EditTask(task); //myPanel.ListTask = TaskController.GetListTask(); HienThi(); RefreshControll(); }
private void tbAdd_Click(object sender, EventArgs e) { if (!CheckInput.CheckInputAddTask(tbTitle, tbPercentCompleted, dtpFDate, dtpTDate, cmbPriority, errorProvider1)) { return; } TaskWork taskWork = new TaskWork(); taskWork.Title = tbTitle.Text; taskWork.Priority = cmbPriority.Text; taskWork.Url = rtbLink.Text; taskWork.description = tbDescription.Text; taskWork.FromDate = dtpFDate.Value; taskWork.ToDate = dtpTDate.Value; taskWork.PercentCompleted = Convert.ToInt32(tbPercentCompleted.Text); taskWork.Users = new List <User>(); foreach (Object item in lsbUsers.Items) { taskWork.Users.Add(UserController.GetUser(item.ToString())); } TaskController.AddTask(taskWork); HienThi(TaskController.GetListTask()); }