Example #1
0
        public async Task UpdateDayForChildrenLeaves(GetHolidayDto holidayDto)
        {
            var employee = await _repositoryEmployees.GetById(holidayDto.EmployeeId);

            var leaveTime   = _timeService.GetWorkDays(holidayDto.FromInclusive, holidayDto.ToInclusive);
            var currentTime = _timeService.GetCurrentTime();

            if (holidayDto.FromInclusive.Month != holidayDto.ToInclusive.Month)
            {
                var leaveTimeCurrentMonth = _timeService.GetRemainingMonthWorkDays(holidayDto.FromInclusive);
                var leaveTimeNextMonth    = leaveTime - leaveTimeCurrentMonth;
                employee.CurrentAvailableLeaves   -= leaveTimeCurrentMonth;
                employee.NextMonthAvailableLeaves -= leaveTimeNextMonth;
            }
            else if (holidayDto.FromInclusive.Month == currentTime.Month)
            {
                employee.CurrentAvailableLeaves -= leaveTime;
            }
            else
            {
                employee.NextMonthAvailableLeaves -= leaveTime;
            }

            await _repositoryEmployees.Update(employee);
        }
Example #2
0
        public async Task UpdateEmployeesOvertime(GetHolidayDto holidayDto)
        {
            var employee = await _repositoryEmployees.GetById(holidayDto.EmployeeId);

            var requestedOvertimeHours = _overtimeUtility.ConvertOvertimeDaysToHours(holidayDto.OvertimeDays);

            employee.OvertimeHours -= requestedOvertimeHours;
            await _repositoryEmployees.Update(employee);
        }
Example #3
0
        public async Task UpdateEmployeesWorkdays(GetHolidayDto holidayDto)
        {
            var workdays = _timeService.GetWorkDays(holidayDto.FromInclusive, holidayDto.ToInclusive);

            workdays -= holidayDto.OvertimeDays;
            var employee = await _repositoryEmployees.GetById(holidayDto.EmployeeId);

            employee.FreeWorkDays -= workdays;
            await _repositoryEmployees.Update(employee);
        }
Example #4
0
        public async Task <string> GetConfirmerFullName(GetHolidayDto holidayDto)
        {
            var confirmerFullName = string.Empty;

            if (holidayDto.ConfirmerAdminId > 0)
            {
                confirmerFullName = await GetEmployeeFullName(holidayDto.ConfirmerAdminId);
            }
            else if (holidayDto.ConfirmerClientId > 0)
            {
                confirmerFullName = await GetClientFullName(holidayDto.ConfirmerClientId);
            }

            return(confirmerFullName);
        }
Example #5
0
 private GetHolidayDto AddOvertimeDetails(GetHolidayDto holiday)
 {
     return(_overtimeUtility.AddOvertimeDetailsToHoliday(holiday));
 }
Example #6
0
        public GetHolidayDto AddOvertimeDetailsToHoliday(GetHolidayDto holiday)
        {
            holiday.OvertimeHours = Math.Round(ConvertOvertimeDaysToHours(holiday.OvertimeDays), 2);

            return(holiday);
        }