Ejemplo n.º 1
0
 public bool createToolWithHours(string type, DateTime servicedate, int servicehours, int actualhours, int hoursperday)
 {
     Transaction trans = new Transaction();
     ToolRDG TOOLRDG = new ToolRDG(type, trans);
     trans.BeginTransaction();
     try
     {
       TOOLRDG.CreateToolHours(servicedate,servicehours,actualhours,hoursperday);
     }
     catch (Exception e)
     {
         trans.Rollback();
         throw e;
     }
     trans.Commit();
     return true;
 }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
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();
 }
Ejemplo n.º 5
0
 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();
 }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
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();
 }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
0
        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;
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 12
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;
 }