Exemplo n.º 1
0
        public string UpdateCheckInStatus(int pin)
        {
            string          message  = "";
            Employee        employee = employeeRepo.GetEmployeeByPin(pin);
            ShiftRepository sr       = ShiftRepository.GetInstance();
            int             shiftID  = -1;

            if (employee != null)
            {
                if (employee.OpenShift == -1)
                {
                    shiftID = sr.AddShift(employee);
                    message = employee.FullName + " blev tjekket ind.";
                }
                else
                {
                    sr.EndShift(employee.OpenShift);
                    message = employee.FullName + " er tjekket ud.";
                }
                employee.OpenShift = shiftID;
            }
            else
            {
                message = "PIN-koden er forkert";
            }
            return(message);
        }
Exemplo n.º 2
0
        public int CalculateWorkHours(int employeeId, DateTime endDate)
        {
            int             totalAmountOfMinutes = 0;
            ShiftRepository sr = ShiftRepository.GetInstance();
            List <Shift>    shiftsSelectedMonth = sr.GetShifts(employeeId, endDate);

            foreach (Shift shift in shiftsSelectedMonth)
            {
                totalAmountOfMinutes += shift.TotalNumberOfMinutes;
            }
            return(totalAmountOfMinutes);
        }