Пример #1
0
        public static ShiftOutput MapFromShiftDTOToShiftOutput(ShiftDTO shiftDTO)
        {
            ShiftOutput shiftOutput = new ShiftOutput
            {
                Earning             = shiftDTO.ShiftEarning,
                TotalHoursWorked    = shiftDTO.TotalHoursWorked,
                BreakHours          = shiftDTO.BreakHours,
                NormalHoursWorked   = shiftDTO.NormalHoursWorked,
                After6PmHoursWorked = shiftDTO.After6PmHoursWorked,
                OvertimeHoursWorked = shiftDTO.OvertimeHoursWorked
            };

            return(shiftOutput);
        }
Пример #2
0
        private ShiftOutput ProcessShift(Shift shift, List <WageLevel> wageLevels)
        {
            ShiftDTO shiftDTO = new ShiftDTO(shift);

            WageLevel wageLevel = wageLevels.FirstOrDefault(wl => wl.Key == shiftDTO.WageLevel);

            if (wageLevel == null)
            {
                throw new ArgumentNullException($"wageLevel in shift started at: [{shift.StartedAt}] cannot be found.");
            }
            decimal wageBase = wageLevel.Value;

            //init shiftDTO
            shiftDTO.InitWageBaseRate(wageBase).CalculateHoursWorked().CalculateEarning();
            //map to output
            ShiftOutput shiftOutput = PayslipMapper.MapFromShiftDTOToShiftOutput(shiftDTO);

            return(shiftOutput);
        }