Example #1
0
        public void CreateTask(string Description, string Username, int ToolID, DateTime Date)
        {
            Transaction trans = new Transaction();
            ToolRDG toolrdg = new ToolRDG(ToolID);
            NormalUser woerkerdg = new NormalUser(Username);

            TaskRDG TRDG = new TaskRDG(toolrdg,woerkerdg,Description, Date, trans);

            trans.BeginTransaction();
            try
            {
                TRDG.CreateTaskDB();
            }
            catch (Exception e)
            {
                trans.Rollback();
                throw e;
            }
            trans.Commit();
        }
Example #2
0
 public void UpdateTaskStatus(int ID, string Feedback)
 {
     Transaction trans = new Transaction();
     TaskRDG TRDG = new TaskRDG(ID, Feedback, trans);
     trans.BeginTransaction();
     try
     {
         TRDG.UpdateTaskStatus();
     }
     catch (Exception e)
     {
         trans.Rollback();
         throw e;
     }
     trans.Commit();
 }
Example #3
0
 public void ReassignTask(int TaskID, string WorkerUsername)
 {
     Transaction trans = new Transaction();
     WorkerRDG worker = new WorkerRDG(WorkerUsername);
     TaskRDG task = new TaskRDG(TaskID, worker, trans);
     trans.BeginTransaction();
     try
     {
         task.ReassignTask();
     }
     catch (Exception e)
     {
         trans.Rollback();
         throw e;
     }
     trans.Commit();
 }
Example #4
0
 public List<TaskDTO> GetNotifications(DateTime date, string Username = "")
 {
     Transaction trans = new Transaction();
     List<TaskDTO> tasklist;
     TaskRDG task = new TaskRDG(trans);
     trans.BeginTransaction();
     try
     {
         tasklist = task.GetNotified(date, Username);
     }
     catch (Exception e)
     {
         trans.Rollback();
         throw e;
     }
     trans.Commit();
     return tasklist;
 }
Example #5
0
 public List<TaskDTO> GetAllTasksFromWorker(string Username)
 {
     Transaction trans = new Transaction();
     WorkerRDG WRDG = new WorkerRDG(Username);
     TaskRDG TRDG = new TaskRDG(WRDG, trans);
     List<TaskDTO> ListOfTasks = new List<TaskDTO>();
     trans.BeginTransaction();
     try
     {
         ListOfTasks = TRDG.GetAllTasksFromWorker(TRDG);
     }
     catch (Exception e)
     {
         trans.Rollback();
         throw e;
     }
     trans.Commit();
     return ListOfTasks;
 }
Example #6
0
 public List<TaskDTO> GetAllTasks()
 {
     Transaction trans = new Transaction();
     TaskRDG TRDG = new TaskRDG(trans);
     List<TaskDTO> ListOfAllTasks = new List<TaskDTO>();
     trans.BeginTransaction();
     try
     {
         ListOfAllTasks = TRDG.GetAllTasks();
     }
     catch (Exception e)
     {
         trans.Rollback();
         throw e;
     }
     return ListOfAllTasks;
 }
Example #7
0
 public List<TaskDTO> GetAllTaskForATool(int ToolId)
 {
     Transaction trans = new Transaction();
     ToolRDG tool = new ToolRDG(ToolId);
     TaskRDG task = new TaskRDG(tool, trans);
     List<TaskDTO> tasks = new List<TaskDTO>();
     trans.BeginTransaction();
     try
     {
         tasks = task.GetAllTasksFromTool(task);
     }
     catch (Exception e)
     {
         trans.Rollback();
         throw e;
     }
     trans.Commit();
     return tasks;
 }
Example #8
0
        public List<TaskDTO> GetAllTasksFromWorker(TaskRDG worker)
        {
            List<TaskDTO> tasks = new List<TaskDTO>();
            TaskDTO taskDTO;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "SP_GetAllTasksFromWorker";
            cmd.Parameters.Clear();

            SqlParameter par = new SqlParameter("@Username", SqlDbType.NVarChar);
            par.Value = worker.Worker.UserName;
            cmd.Parameters.Add(par);

            cmd.Transaction = trans.GetTransaction();
            cmd.Connection = trans.GetTransaction().Connection;
            SqlDataReader datareader = cmd.ExecuteReader();
            while (datareader.Read() && datareader.HasRows)
            {
                taskDTO = new TaskDTO();
                taskDTO.TaskID = (int)datareader["TaskID"];
                taskDTO.Description = (string)datareader["Description"];
                taskDTO.IsDone = (bool)datareader["IsDone"];
                taskDTO.Feedback = (string)datareader["Feedback"];
                taskDTO.ToolID = (int)datareader["FK_ToolID"];
                taskDTO.Date = (DateTime)datareader["Date"];
                tasks.Add(taskDTO);
            }
            datareader.Close();
            cmd.ExecuteNonQuery();
            return tasks;
        }