public ITextFileResultModel GetAbsencesDataCsv(IAbsencesStatisticsCsvRequest absencesInfoRequest) { IEnumerable <AbsenceInfo> absenceInfo = GetAbsencesInfoData(absencesInfoRequest); string fileName = GetChartCsvFileName(Constants.ChartName.AbsencesData, absencesInfoRequest.RangeDateString); ITextFileResultModel result = GetCsvTextFileResult(absenceInfo, new AbsencesDataChartCsvProfile(translationService), fileName); return(result); }
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])); }
public ITextFileResultModel GetAbsencesDataCsv(IAbsencesStatisticsCsvRequest absencesInfoRequest) { ITextFileResultModel absencesCsvData = taskStatisticService.GetAbsencesDataCsv(absencesInfoRequest); return(absencesCsvData); }