Exemplo n.º 1
0
 public void InsertTask(TaskObject task)
 {
     using (MySqlConnection conn = GetConnection()) {
         conn.Open();
         MySqlCommand cmd = new MySqlCommand("INSERT INTO Tasks(TaskName,TaskDescription,TaskProgress,StartDate,EndDate,TaskStatus,ModuleID) VALUES(@TaskName, @TaskDescription, @TaskProgress, @StartDate, @EndDate, @TaskStatus, @ModuleID)", conn);
         cmd.Parameters.AddWithValue("@TaskName", task.TaskName);
         cmd.Parameters.AddWithValue("@TaskDescription", task.TaskDescription);
         cmd.Parameters.AddWithValue("@TaskProgress", 0);
         cmd.Parameters.AddWithValue("@StartDate", task.StartDate);
         cmd.Parameters.AddWithValue("@EndDate", task.EndDate);
         cmd.Parameters.AddWithValue("@TaskStatus", 0);
         cmd.Parameters.AddWithValue("@ModuleID", task.ModuleID);
         cmd.ExecuteNonQuery();
     }
 }
Exemplo n.º 2
0
 public void UpdateTask(TaskObject task)
 {
     using (MySqlConnection conn = GetConnection()) {
         conn.Open();
         MySqlCommand cmd = new MySqlCommand("UPDATE Tasks SET(TaskName,TaskDescription,TaskProgress,StartDate,EndDate,TaskStatus, ModuleID) VALUES(@TaskName, @TaskDescription, @TaskProgress, @StartDate, @EndDate, @TaskStatus, @ModuleID) WHERE TaskID = @TaskID", conn);
         cmd.Parameters.AddWithValue("@TaskID", task.TaskID);
         cmd.Parameters.AddWithValue("@TaskName", task.TaskName);
         cmd.Parameters.AddWithValue("@TaskDescription", task.TaskDescription);
         cmd.Parameters.AddWithValue("@TaskProgress", task.TaskProgress);
         cmd.Parameters.AddWithValue("@StartDate", task.StartDate);
         cmd.Parameters.AddWithValue("@EndDate", task.EndDate);
         cmd.Parameters.AddWithValue("@TaskStatus", task.Status);
         cmd.Parameters.AddWithValue("@ModuleID", task.ModuleID);
         cmd.ExecuteNonQuery();
     }
 }