public async Task <IActionResult> PriceCompilance() { var model = new PriceCompilancelistModel(); model.AvailableVendors.Add(new SelectListItem { Text = "Select", Value = "0" }); foreach (var item in (await _selecteItems.GetVendorList((int)_workContext.CurrentCustomer.ClientId))) { model.AvailableVendors.Add(new SelectListItem { Text = item.Vname, Value = item.Vname }); } model.AvailableShip.Add(new SelectListItem { Text = "ALL", Value = "0" }); foreach (var item in (await _costCenterService.SelectCostCenter((int)_workContext.CurrentCustomer.ClientId, (int)_workContext.CurrentCustomer.UserType, _workContext.CurrentCustomer.LogonId))) { model.AvailableShip.Add(new SelectListItem { Text = item.SName, Value = item.SName }); } return(View(model)); }
public async Task <IActionResult> PriceCompilance(DataSourceRequest command, PriceCompilancelistModel model) { var(vendorPricePerfListModel, totalCount) = await _vendorManagementService.PreparePriceCompilanceReportListModel(model, command.Page, command.PageSize); var gridModel = new DataSourceResult { Data = vendorPricePerfListModel, Total = totalCount }; return(Json(gridModel)); }
public async Task <(IEnumerable <VendorPricePerf> vendorPricePerfListModel, int totalCount)> PreparePriceCompilanceReportListModel(PriceCompilancelistModel model, int pageIndex, int pageSize) { try { SqlParameter[] pr = new SqlParameter[] { new SqlParameter("@intClientID", (int)_workcontext.CurrentCustomer.ClientId), new SqlParameter("@DateStart", (string.IsNullOrEmpty(model.DateStart)) ? DBNull.Value.ToString() : model.DateStart), new SqlParameter("@DateEnd", (string.IsNullOrEmpty(model.DateEnd)) ? DBNull.Value.ToString() : model.DateEnd), new SqlParameter("@strVendor", model.strVendor), new SqlParameter("@strShip2", model.strShip2) }; var query = await _dbContext.Set <VendorPricePerf>().FromSqlRaw("exec [dbo].[VendorPricePerf] @intClientID,@strVendor,@strShip2,@DateStart,@DateEnd", pr).ToListAsync(); int totalCount = query.Count; int pageOffSet = (Convert.ToInt32(pageIndex) - 1) * 10; query = query.Skip(pageOffSet).Take(Convert.ToInt32(pageSize)).ToList(); return(query.ToList(), totalCount); } catch (Exception ex) { } return(null, 0); }