public ActionResult List(DataSourceRequest command, SearchSupplierModel model) { if (!_permissionService.Authorize(PermissionProvider.SupplierManagement)) { return(AccessDeniedView()); } var supppliers = _supplierService.GetAllSupplierAsync(searchBySupplierName: model.SupplierName, searchVendorCode: model.VendorCode, pageIndex: command.Page - 1, pageSize: command.PageSize).Result; var gridModel = new DataSourceResult { Data = supppliers.Select(s => new SupplierModel { Id = s.Id, Name = s.Name, Note = s.Note, VendorCode = s.VendorCode, VendorPrefixCode = s.VendorPrefixCode, DisplayOrder = s.DisplayOrder, VendorContact = s.VendorContact, LocationType = new LocationTypeModel(s.LocationTypeId) }), Total = supppliers.TotalCount }; // Return the result as JSON return(Json(gridModel)); }
public ActionResult Pager(SearchSupplierModel model) { try { if (model.SearchString == null) { model.SearchString = ""; } SearchSupplierModel data = new SearchSupplierModel(); List <CLayer.B2B> SupplierList = new List <CLayer.B2B>(); string name = model.SearchString; data.SearchString = model.SearchString; data.CurrentPage = model.CurrentPage; int totr = 0; SupplierList = BLayer.B2B.GetSearchAllSupplier(name, ((model.CurrentPage - 1) * PAGELIMIT), PAGELIMIT, out totr); data.TotalRows = totr; data.SearchList = SupplierList; return(View("Details", data)); } catch (Exception ex) { Common.LogHandler.HandleError(ex); return(Redirect("~/ErrorPage")); } }
public ActionResult GetSupplierList(SearchSupplierModel model) { try { if (model.Name == null) { model.Name = ""; } SearchSupplierModel data = new SearchSupplierModel(); List <CLayer.B2B> SupplierList = new List <CLayer.B2B>(); string name = model.Name; data.SearchString = model.Name; data.CurrentPage = 1; int totr = 0; data.B2BId = model.B2BId; SupplierList = BLayer.B2B.GetSearchAllSupplier(name, 0, PAGELIMIT, out totr); data.SearchList = SupplierList; data.TotalRows = totr; return(View("Index", data)); } catch (Exception ex) { Common.LogHandler.HandleError(ex); return(Redirect("~/ErrorPage")); } }