public bool createToolWithMileage(string type, DateTime servicedate, int servicemileage, int actualmileage, int milesperday)
 {
     Transaction trans = new Transaction();
     ToolRDG TOOLRDG = new ToolRDG(type, trans);
     trans.BeginTransaction();
     try
     {
      TOOLRDG.CreateToolMileage(servicedate, servicemileage, actualmileage, milesperday);
     }
     catch (Exception e)
     {
         trans.Rollback();
         throw e;
     }
     trans.Commit();
     return true;
 }
        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();
        }
        public void DeleteTool(int toolID)
        {
            Transaction trans = new Transaction();

            ToolRDG TOOLRDG = new ToolRDG(toolID, trans);

            trans.BeginTransaction();
            try
            {
                TOOLRDG.DeleteTool();
            }
            catch (Exception e)
            {
                trans.Rollback();
                throw e;
            }
            trans.Commit();
        }
 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();
 }
 public void UpdateActualMileage(int ToolID, int ActualMileage)
 {
     Transaction trans = new Transaction();
     ToolRDG tool = new ToolRDG(ToolID, ActualMileage, trans);
     trans.BeginTransaction();
     try
     {
         tool.UpdateActualMileage();
     }
     catch (Exception e)
     {
         trans.Rollback();
         throw e;
     }
     trans.Commit();
 }
        public void RegisterWorker(string Username, string Password, string Name, string Address, string PhoneNr)
        {
            Transaction trans = new Transaction();
            NormalUser NRDG = new NormalUser(Username, Password, PhoneNr, Name, Address, trans);

            trans.BeginTransaction();
            try
            {
                NRDG.RegisterNormalUserDB();
            }
            catch (Exception e)
            {
                trans.Rollback();
                throw e;
            }
            trans.Commit();
        }
 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();
 }
 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;
 }
        public List<WorkerDTO> GetAllWorkers()
        {
            Transaction trans = new Transaction();
            List<WorkerDTO> LowDTO;
            WorkerRDG wRDG = new WorkerRDG(trans);

            trans.BeginTransaction();
            try
            {
                LowDTO = wRDG.GetAllWorkers();
            }
            catch (Exception e)
            {
                trans.Rollback();
                throw e;
            }
            trans.Commit();

            return LowDTO;
        }
Exemple #10
0
 public List<ToolDTO> GetAllTools()
 {
     Transaction trans = new Transaction();
     List<ToolDTO> tools;
     ToolRDG toolRDG = new ToolRDG(trans);
     trans.BeginTransaction();
     try
     {
         tools = toolRDG.GetAllTools();
     }
     catch(Exception e)
     {
         trans.Rollback();
         throw e;
     }
     trans.Commit();
     return tools;
 }
Exemple #11
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;
 }
Exemple #12
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;
 }
Exemple #13
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;
 }