public async Task <string> OvertimeUtilizationReportExcelExport(OvertimeUtilizationReportInputModel input) { AppSettings.SetSiteLanguage(input.LangId); var parentDirectory = Directory.GetParent(Environment.CurrentDirectory).FullName; var fileName = string.Format("Overtime_Utilization_{0}.xlsx", Guid.NewGuid().ToString()); FileStream fs = new FileStream(Path.Combine(parentDirectory, "Surgicalogic.Web", "static", fileName), FileMode.CreateNew); var excelService = new ExcelDocumentService(); var items = await _overtimeUtilizationStoreService.GetExportAsync(input); await excelService.WriteAsync(fs, "Worksheet", items, typeof(OvertimeUtilizationReportExportModel), System.Globalization.CultureInfo.CurrentCulture); return(fileName); }
public async Task <ResultModel <OvertimeUtilizationReportOutputModel> > GetAsync <TOutputModel>(OvertimeUtilizationReportInputModel input) { var result = await GetOvertimeAndUtilizationAsync(input.OperationStartDate, input.OperationEndDate); if (!string.IsNullOrEmpty(input.SortBy)) { Func <OvertimeUtilizationForOvertimeReportOutputModel, object> orderBy = null; switch (input.SortBy) { case "operatingRoom": orderBy = x => x.OperatingRoom; break; case "overtime": orderBy = x => x.Overtime; break; case "utilization": orderBy = x => x.Utilization; break; default: orderBy = x => x.OperatingRoomId; break; } if (input.Descending == true) { result = result.OrderByDescending(orderBy).ToList(); } else { result = result.OrderBy(orderBy).ToList(); } } int totalCount = result.Count(); if (input.PageSize > 0) { result = result.Skip((input.CurrentPage - 1) * input.PageSize).Take(input.PageSize).ToList(); } return(new ResultModel <OvertimeUtilizationReportOutputModel> { Result = AutoMapper.Mapper.Map <List <OvertimeUtilizationReportOutputModel> >(result), TotalCount = totalCount, Info = new Info { Succeeded = true } }); }
public async Task <ResultModel <OvertimeUtilizationReportOutputModel> > GetOvertimeUtilization(OvertimeUtilizationReportInputModel input) { return(await _overtimeUtilizationStoreService.GetAsync <OvertimeUtilizationReportOutputModel>(input)); }
public async Task <List <OvertimeUtilizationReportExportModel> > GetExportAsync(OvertimeUtilizationReportInputModel input) { var query = await GetOvertimeAndUtilizationAsync(input.OperationStartDate, input.OperationEndDate); return(AutoMapper.Mapper.Map <List <OvertimeUtilizationReportExportModel> >(query)); }