示例#1
0
 /// <summary>
 /// Adauga un task.
 /// </summary>
 /// <param name="task">Task-ul de adaugat.</param>
 public static void AddTask(Task task)
 {
     string query = string.Format("INSERT INTO {0}(name, description, initiator_id, executor_id, project_id, team_id, status) VALUES(@name, @description, @init_id, @exec_id, @proj_id, @team_id, @status)", Globals.TABLE_TASK);
     MySqlCommand command = new MySqlCommand(query, connection);
     command.Parameters.AddWithValue("@name", task.Name);
     command.Parameters.AddWithValue("@description", task.Description);
     command.Parameters.AddWithValue("@init_id", task.Initiator_id);
     command.Parameters.AddWithValue("@exec_id", task.Executor_id);
     command.Parameters.AddWithValue("@proj_id", task.Project_id);
     command.Parameters.AddWithValue("@team_id", task.Team_id);
     command.Parameters.AddWithValue("@status", task.Status);
     command.ExecuteNonQuery();
     Destroy(command);
 }
示例#2
0
 private void addTaskButton_Click(object sender, EventArgs e)
 {
     string taskName = taskNameTextBox.Text;
     string taskDesc = taskDescriptionRichTextBox.Text;
     if (taskName != String.Empty && taskDesc != String.Empty)
     {
         int leaderIndex = taskLeadersComboBox.SelectedIndex;
         int projIndex = taskProjectsComboBox.SelectedIndex;
         if (leaderIndex * projIndex > 0)
         {
             int exec_id = (taskLeadersComboBox.SelectedItem as User).Id;
             int proj_id = (taskProjectsComboBox.SelectedItem as Project).Id;
             int init_id = user.Id;
             int team_id = user.Team_id;
             Task task = new Task(taskName, taskDesc, init_id, exec_id, proj_id, team_id, true);
             Conexiune.AddTask(task);
             taskNameTextBox.Text = String.Empty;
             taskDescriptionRichTextBox.Text = String.Empty;
             ShowNotifyMessage("Task-ul a fost adăugat.", 0);
         }
         else
         {
             if (leaderIndex == 0 && projIndex == 0)
                 ShowNotifyMessage("Trebuie să selectezi un responsabil si un proiect pentru task.", 2);
             else
                 if (leaderIndex == 0)
                     ShowNotifyMessage("Trebuie să selectezi un responsabil pentru task.", 2);
                 else
                     ShowNotifyMessage("Trebuie să selectezi un proiect pentru task.", 2);
         }
     }
     else
     {
         if (taskName == String.Empty && taskDesc == String.Empty)
             ShowNotifyMessage("Task-ul trebuie sa aibă un nume și o descriere.", 2);
         else
             if (taskName == String.Empty)
                 ShowNotifyMessage("Task-ul trebuie sa aibă un nume.", 2);
             else
                 ShowNotifyMessage("Task-ul trebuie sa aibă o descriere.", 2);
     }
 }