Example #1
0
        private IEnumerable <AbsenceInfo> GetAbsencesInfoData(IAbsencesStatisticsCsvRequest absencesInfoRequest)
        {
            IDictionary <string, string> translationList = translationService.Get(new List <string> {
                OtherReasonKey
            }, LanguageKey.Default);
            IEnumerable <IEmployeeAbsenceInfoModel> absencesList         = absenceInfoService.GetlByIds(absencesInfoRequest.AbsencesIdList);
            IEnumerable <IAbsenceDataModel>         absencesListWithTime = GetAbsencesListWithTime(absencesList, absencesInfoRequest.StartDate, absencesInfoRequest.EndDate);
            IEnumerable <AbsenceInfo> absenceInfoList = absencesListWithTime
                                                        .GroupBy(x => x.ReasonId)
                                                        .Select(y => new AbsenceInfo
            {
                AbsenceReason = y.Key == null ? translationList[OtherReasonKey] : y.First().Reason,
                Hours         = y.Sum(x => x.SpentTime)
            })
                                                        .ToList();

            return(absenceInfoList.OrderBy(x => x.AbsenceReason == translationList[OtherReasonKey]));
        }