public async Task <IActionResult> ExportDevDtrFgtResultReport(SDevDtrFgtResultReport sDevDtrFgtResultReport) { _logger.LogInformation(String.Format(@"****** DTRController ExportDevDtrFgtResultReport fired!! ******")); if (String.IsNullOrEmpty(sDevDtrFgtResultReport.cwaDateS)) { sDevDtrFgtResultReport.cwaDateS = _config.GetSection("LogicSettings:MinDate").Value; } if (String.IsNullOrEmpty(sDevDtrFgtResultReport.cwaDateE)) { sDevDtrFgtResultReport.cwaDateE = _config.GetSection("LogicSettings:MaxDate").Value; } sDevDtrFgtResultReport.cwaDateS = sDevDtrFgtResultReport.cwaDateS.Replace("-", "/"); sDevDtrFgtResultReport.cwaDateE = sDevDtrFgtResultReport.cwaDateE.Replace("-", "/"); var data = await _dKSDAO.GetDevDtrFgtResultReportDto(sDevDtrFgtResultReport); byte[] result = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; if (sDevDtrFgtResultReport.reportType == "Dev") { //DEV result = _excelService.CommonExportReport(data, "TempDevDtrFgtResultReport_Dev.xlsx"); } else if (sDevDtrFgtResultReport.reportType == "Buy Plan") { result = _excelService.CommonExportReport(data, "TempDevDtrFgtResultReport_BuyPlan.xlsx"); } return(File(result, "application/xlsx")); }
public async Task <List <DevDtrFgtResultDto> > GetDevDtrFgtResultReportDto(SDevDtrFgtResultReport sDevDtrFgtResultReport) { List <SqlParameter> pc = new List <SqlParameter> { new SqlParameter("@Article", String.IsNullOrEmpty(sDevDtrFgtResultReport.article) ? (object)DBNull.Value : sDevDtrFgtResultReport.article.Trim().ToUpper()), new SqlParameter("@ModelNo", String.IsNullOrEmpty(sDevDtrFgtResultReport.modelNo) ? (object)DBNull.Value : sDevDtrFgtResultReport.modelNo.Trim().ToUpper()), new SqlParameter("@ModelName", String.IsNullOrEmpty(sDevDtrFgtResultReport.modelName) ? (object)DBNull.Value : sDevDtrFgtResultReport.modelName.Trim().ToUpper()), new SqlParameter("@CwaDateS", String.IsNullOrEmpty(sDevDtrFgtResultReport.cwaDateS) ? (object)DBNull.Value : sDevDtrFgtResultReport.cwaDateS), new SqlParameter("@CwaDateE", String.IsNullOrEmpty(sDevDtrFgtResultReport.cwaDateE) ? (object)DBNull.Value : sDevDtrFgtResultReport.cwaDateE), }; var data = new List <DevDtrFgtResultDto>(); if (sDevDtrFgtResultReport.reportType == "Dev") //DEV { pc.Add(new SqlParameter("@Season", String.IsNullOrEmpty(sDevDtrFgtResultReport.devSeason) ? (object)DBNull.Value : sDevDtrFgtResultReport.devSeason.Trim().ToUpper())); pc.Add(new SqlParameter("@Factory", sDevDtrFgtResultReport.factory.Trim().ToUpper())); data = await _context.GetDevDtrFgtResultDto .FromSqlRaw("EXECUTE dbo.GetDTR_FGT_Result_Report_DEV @Article,@ModelNo,@ModelName,@CwaDateS,@CwaDateE,@Season,@Factory", pc.ToArray()) .ToListAsync(); } else if (sDevDtrFgtResultReport.reportType == "Buy Plan") { pc.Add(new SqlParameter("@Season", sDevDtrFgtResultReport.buyPlanSeason.Trim().ToUpper())); pc.Add(new SqlParameter("@Factory", sDevDtrFgtResultReport.factory.Trim().ToUpper())); pc.Add(new SqlParameter("@VerNo", (object)DBNull.Value)); //because sp will find the biggest version of buy plan data = await _context.GetDevDtrFgtResultDto .FromSqlRaw("EXECUTE dbo.GetDTR_FGT_Result_Report_BuyPlan @Article,@ModelNo,@ModelName,@CwaDateS,@CwaDateE,@Season,@Factory,@VerNo", pc.ToArray()) .ToListAsync(); } return(data); }
public async Task <IActionResult> GetDevDtrFgtResultReport([FromQuery] SDevDtrFgtResultReport sDevDtrFgtResultReport) { _logger.LogInformation(String.Format(@"****** DTRController GetDevDtrFgtResultReport fired!! ******")); if (String.IsNullOrEmpty(sDevDtrFgtResultReport.cwaDateS)) { sDevDtrFgtResultReport.cwaDateS = _config.GetSection("LogicSettings:MinDate").Value; } if (String.IsNullOrEmpty(sDevDtrFgtResultReport.cwaDateE)) { sDevDtrFgtResultReport.cwaDateE = _config.GetSection("LogicSettings:MaxDate").Value; } sDevDtrFgtResultReport.cwaDateS = sDevDtrFgtResultReport.cwaDateS.Replace("-", "/"); sDevDtrFgtResultReport.cwaDateE = sDevDtrFgtResultReport.cwaDateE.Replace("-", "/"); var data = await _dKSDAO.GetDevDtrFgtResultReportDto(sDevDtrFgtResultReport); PagedList <DevDtrFgtResultDto> result = PagedList <DevDtrFgtResultDto> .Create(data, sDevDtrFgtResultReport.PageNumber, sDevDtrFgtResultReport.PageSize, sDevDtrFgtResultReport.IsPaging); Response.AddPagination(result.CurrentPage, result.PageSize, result.TotalCount, result.TotalPages); return(Ok(result)); }