private void button1_Click(object sender, EventArgs e) { ProjectManagmentSystem.Task task = new ProjectManagmentSystem.Task(); task.Project = project; task.ProjectCode = project.ProjectCode; // task.User = (User)cmbDevelopers.SelectedItem; if (cmbDevelopers.SelectedItem != null && cmbDevelopers.SelectedItem.ToString() != "") { task.Assignee = ((User)cmbDevelopers.SelectedItem).Username; } else { task.Assignee = ""; } task.Description = tbxDescription.Text; task.Deadline = dtpDeadline.Value; task.Progress = 0; task.Status = 0; task.TaskID = broker.returnTaskId(); project.Tasks.Add(task); bool pass = broker.createTask(task); if (pass) { MessageBox.Show("Task added succesfuly"); } else { MessageBox.Show("System can't save task"); } }
public bool createTask(Task task) { try { DBBroker broker = new DBBroker(); return broker.createTask(task); } catch (Exception) { throw; } }