Example #1
0
        public string CheckInOrOutByPin(int pin)
        {
            string          message  = "";
            Employee        employee = employeeRepo.GetEmployeeByPin(pin);
            ShiftRepository sr       = new ShiftRepository();
            int             shiftID  = -1;

            if (employee != null)
            {
                if (employee.OpenShift == -1)
                {
                    shiftID = sr.AddShift(employee.EmployeeId);
                    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);
        }
Example #2
0
        public string CheckShiftByPin(int pin, DateTime start, DateTime end)
        {
            string          message  = "";
            Employee        employee = employeeRepo.GetEmployeeByPin(pin);
            ShiftRepository sr       = new ShiftRepository();
            int             shiftID  = -1;

            if (employee != null)
            {
                shiftID = sr.AddShift(employee.EmployeeId, start);
                message = employee.FullName + " blev tjekket ind.";

                sr.EndShift(employee.OpenShift, end);
                message = employee.FullName + " er tjekket ud.";

                employee.OpenShift = shiftID;
            }

            return(message);
        }