// Görev ekler. public void AddTask(int projectID, int taskStatuID, string projectName, string technicalExpert, int predictTime, int actualTime, string workDetail, string nots, List <Work> workList) { SqlConnection connection = database.OpenConnection(); SqlCommand sqlCommand; sqlCommand = database.CreateConnection("INSERT INTO dbo.Task (ProjeID, TaskStatuID, ProjeAdi,TeknikUzman,Tarih,TahminiSure,GerceklesenSure, IsAciklamasi,Notlar) " + "VALUES (@projectID, @taskStatuID, @projectName, @technicalExpert, GETDATE(), @predictTime, @actualTime, @workDetail, @nots)"); sqlCommand.Parameters.AddWithValue("@projectID", projectID); sqlCommand.Parameters.AddWithValue("@taskStatuID", taskStatuID); sqlCommand.Parameters.AddWithValue("@projectName", projectName); sqlCommand.Parameters.AddWithValue("@technicalExpert", technicalExpert); sqlCommand.Parameters.AddWithValue("@predictTime", predictTime); sqlCommand.Parameters.AddWithValue("@actualTime", actualTime); sqlCommand.Parameters.AddWithValue("@workDetail", workDetail); sqlCommand.Parameters.AddWithValue("@nots", nots); sqlCommand.ExecuteNonQuery(); connection.Close(); WorkBLL workBll = new WorkBLL(); workBll.AddWork(GetLastAddedTaskID(), projectID, workList); }
// Projedeki tüm görevleri siler. public void DeleteTasks(int projectID) { WorkBLL workBll = new WorkBLL(); workBll.DeleteWorks(projectID); SqlConnection connection = database.OpenConnection(); SqlCommand sqlCommand = database.CreateConnection("DELETE FROM dbo.Task WHERE ProjeID=@projectID;"); sqlCommand.Parameters.AddWithValue("@projectID", projectID); sqlCommand.ExecuteNonQuery(); connection.Close(); }
// Görev durumuna göre görevleri siler. public void DeleteTaskForTaskStatu(int taskStatuID) { List <Task> taskStatusTasks = GetTaskStatusTasks(taskStatuID); foreach (var task in taskStatusTasks) { WorkBLL workBll = new WorkBLL(); workBll.DeleteWork(task.TaskID); } SqlConnection connection = database.OpenConnection(); SqlCommand sqlCommand = database.CreateConnection("DELETE FROM dbo.Task WHERE TaskStatuID=@taskStatuID;"); sqlCommand.Parameters.AddWithValue("@taskStatuID", taskStatuID); sqlCommand.ExecuteNonQuery(); connection.Close(); }
// Görev günceller. public void UpdateTask(int taskID, int projectID, string technicalExpert, DateTime date, int predictTime, int actualTime, string workDetail, string nots, List <Work> works) { SqlConnection connection = database.OpenConnection(); SqlCommand sqlCommand = database.CreateConnection("UPDATE dbo.Task SET TeknikUzman=@technicalExpert, Tarih=@date, " + "TahminiSure=@predictTime, GerceklesenSure=@actualTime, IsAciklamasi=@workDetail, Notlar=@nots WHERE TaskID=@taskID"); sqlCommand.Parameters.AddWithValue("@taskID", taskID); sqlCommand.Parameters.AddWithValue("@technicalExpert", technicalExpert); sqlCommand.Parameters.AddWithValue("@date", date); sqlCommand.Parameters.AddWithValue("@predictTime", predictTime); sqlCommand.Parameters.AddWithValue("@actualTime", actualTime); sqlCommand.Parameters.AddWithValue("@workDetail", workDetail); sqlCommand.Parameters.AddWithValue("@nots", nots); sqlCommand.ExecuteNonQuery(); connection.Close(); WorkBLL workBll = new WorkBLL(); workBll.UpdateWorks(taskID, projectID, works); }