/// <summary>
 /// Starts a new shift of the given logged in in the given role.
 /// </summary>
 /// <param name="sessionID">The sessionID of the current session</param>
 /// <param name="role">The role.</param>
 public void StampShiftStart(string sessionID, string role)
 {
     WorkerShiftsTableAdapter wta = new WorkerShiftsTableAdapter();
     wta.Insert(DateTime.Now, null, role, Auth.getEmployeeID(sessionID));
     EmployeeStatusTableAdapter est = new EmployeeStatusTableAdapter();
     est.UpdateStatus(true, role, Auth.getEmployeeID(sessionID));
 }
 /// <summary>
 /// Gets all employees on duty.
 /// </summary>
 /// <param name="sessionID">The sessionID of the current session</param>
 /// <returns></returns>
 public List<BasicEmployee> GetAllEmployeesOnDuty(string sessionID)
 {
     List<BasicEmployee> re = new List<BasicEmployee>();
     EmployeeStatusTableAdapter esa = new EmployeeStatusTableAdapter();
     var rows = esa.GetAllWorkersOnDuty();
     foreach (var row in rows)
     {
         BasicEmployee be = new BasicEmployee();
         be.id = row.UserID;
         be.name = row.Name;
         be.role = row.Role;
         be.username = Auth.getEmployeeUsername(row.UserID);
         re.Add(be);
     }
     return re;
 }
        /// <summary>
        /// Ends the shift of the given user if they are in a shift.
        /// </summary>
        /// <param name="sessionID">The sessionID of the current session</param>
        /// <returns>
        /// Returns true if the user's shift could be ended, else returns false
        /// </returns>
        public bool StampShiftEnd(string sessionID)
        {
            WorkerShiftsTableAdapter wta = new WorkerShiftsTableAdapter();
            var lastStartTime = wta.GetDataByEmployeeID(Auth.getEmployeeID(sessionID), DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0))).FirstOrDefault();
            EmployeeStatusTableAdapter est = new EmployeeStatusTableAdapter();
            est.UpdateStatus(false, "", Auth.getEmployeeID(sessionID));

            if (lastStartTime == null || !lastStartTime.IsEndTimeNull())
            {
                return false;
            }
            else
            {
                lastStartTime.EndTime = DateTime.Now;
                wta.Update(lastStartTime);
                return true;
            }
        }