Exemplo n.º 1
0
        public async Task <IEnumerable <AdvancedReportModel> > GetAdvancedReport(int?placeId, int?departmentId, int?shiftId, int?employeeId, DateTime?startDate, DateTime?endDate, int?lateBy, int clientId, int userId)
        {
            if (!await _permissionManager.HasPermission(clientId, userId, Permission.CanViewHRUserReport))
            {
                throw new Exception("User has not permission to perform this operation");
            }

            var data = (await _reportRepository.GetAdvancedReport(clientId, placeId, departmentId, shiftId, employeeId, startDate, endDate, lateBy)).ToList();

            data.ForEach((e) =>
            {
                e.TotalInTime  = e.TotalInTime.HasValue ? (long)new TimeSpan(e.TotalInTime.Value).TotalMinutes : 0;
                e.TotalOutTime = e.TotalOutTime.HasValue ? (long)new TimeSpan(e.TotalOutTime.Value).TotalMinutes : 0;
            });

            return(data);
        }