/// <summary> /// Method that clears form /// </summary> private void clearForm() { this.btnClear.clearFields(); this.AuxTask = null; this.enabledCreate(true); this.cbIdTeams.SelectedIndex = -1; this.cbImportance.SelectedIndex = 0; }
/// <summary> /// Shows the management view window of the tasks. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnManagementTasks_Click(object sender, EventArgs e) { model.pojo.Task _oSelectedTask = null; if (dgvTasks.SelectedRows.Count == 1) //If the row selected { int _iIndexSelected = dgvTasks.SelectedRows[0].Index; // Recover the index of selected row Object _cell = dgvTasks.Rows[_iIndexSelected].Cells[1].Value; //Modified: Pablo Ardèvol, Cells[2] to Cell[1] due to Database Change if (_cell != null) { String _strSelectedRowCode = (String)_cell; //_cell.ToString(); // Recover the code _oSelectedTask = Controller.TaskService.readTask(_strSelectedRowCode); // We look for the task code this.Controller.TaskMgtView.AuxTask = _oSelectedTask; // We assign the task to form task management } } this.Controller.TaskMgtView.ShowDialog(); }
/// <summary> /// Event that runs when the button is clicked to delete a task /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDeleteTask_Click(object sender, EventArgs e) { if (clMessageBox.confirmationDialog(Literal.CONFIRMATION_DELETE_TASK, this.Text)) { model.pojo.Task deleteTask = Controller.TaskService.deleteTask(AuxTask); if (deleteTask != null) { clMessageBox.showMessage(Literal.DELETE_TASK_CORRETLY, true, this); this.btnClear_Click(sender, e); this.Close(); } else { clMessageBox.showMessage(Literal.DELETE_TASK_FAILED, false, this); } } }
/// <summary> /// Method that checks if the code task is correct /// </summary> /// <returns>Return true if its correct or false if its wrong</returns> private bool checkCode() { if (AuxTask == null) { String _strIdCode = txtCode.Text; model.pojo.Task foundTask = Controller.TaskService.readTask(_strIdCode); // We look for if the task already exists if (txtCode.Text.Equals("") || foundTask != null) // If the task exists and the string is empty, we show a message { lblCode.ForeColor = Color.Red; return(false); } else { lblCode.ForeColor = Color.Black; return(true); } } else { return(true); } }