/// <summary> /// 品牌列表 /// </summary> /// <param name="brandName">品牌名称</param> /// <param name="sortColumn">排序列</param> /// <param name="sortDirection">排序方向</param> /// <param name="pageSize">每页数</param> /// <param name="pageNumber">当前页数</param> /// <returns></returns> public ActionResult List(string brandName, string sortColumn, string sortDirection, int pageSize = 15, int pageNumber = 1) { string condition = AdminBrands.AdminGetBrandListCondition(brandName); string sort = AdminBrands.AdminGetBrandListSort(sortColumn, sortDirection); PageModel pageModel = new PageModel(pageSize, pageNumber, AdminBrands.AdminGetBrandCount(condition)); BrandListModel model = new BrandListModel() { BrandList = AdminBrands.AdminGetBrandList(pageModel.PageSize, pageModel.PageNumber, condition, sort), PageModel = pageModel, SortColumn = sortColumn, SortDirection = sortDirection, BrandName = brandName }; ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&brandName={5}", Url.Action("list"), pageModel.PageNumber, pageModel.PageSize, sortColumn, sortDirection, brandName)); return(View(model)); }
public virtual ActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageBrands)) { return(AccessDeniedView()); } var model = new BrandListModel(); return(View(model)); }
async Task LoadBrands(BrandListQueryModel queryModel = null) { loading = true; try { brands = await Client.GetBrands(queryModel); } finally { StateHasChanged(); loading = false; } }
/// <summary> /// 品牌列表 /// </summary> /// <returns></returns> public ActionResult List() { string brandName = WebHelper.GetQueryString("brandName"); int page = WebHelper.GetQueryInt("page"); PageModel pageModel = new PageModel(10, page, Brands.GetBrandCount(brandName)); BrandListModel model = new BrandListModel() { PageModel = pageModel, BrandName = brandName, BrandList = Brands.GetBrandList(pageModel.PageSize, pageModel.PageNumber, brandName) }; return(View(model)); }
public BrandListControl(BrandListModel model) { InitializeComponent(); _presenter = new BrandListPresenter(this, model); gvBrand.PopupMenuShowing += gvBrand_PopupMenuShowing; gvBrand.FocusedRowChanged += gvBrand_FocusedRowChanged; // init editor control accessibility btnNewBrand.Enabled = AllowInsert; cmsEditData.Enabled = AllowEdit; cmsDeleteData.Enabled = AllowDelete; this.Load += BrandListControl_Load; }
public ActionResult Delete(int index, int id) { var model = new BrandListModel(); model.GridIndex = index; try { var modelError = ProductService.DeleteBrand(id); if (modelError.IsError) { model.Error.SetError(modelError.Message); } } catch (Exception e1) { model.Error.SetError(e1); } return(Json(model, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> List() { var storeId = _workContext.CurrentCustomer.StaffStoreId; var model = new BrandListModel(); model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" }); foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId))) { model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() }); } return(View(model)); }
public async Task <IActionResult> List(DataSourceRequest command, BrandListModel model) { if (await _groupService.IsStaff(_workContext.CurrentCustomer)) { model.SearchStoreId = _workContext.CurrentCustomer.StaffStoreId; } var brands = await _brandService.GetAllBrands(model.SearchBrandName, model.SearchStoreId, command.Page - 1, command.PageSize, true); var gridModel = new DataSourceResult { Data = brands.Select(x => x.ToModel()), Total = brands.TotalCount }; return(Json(gridModel)); }
public virtual ActionResult List(DataSourceRequest command, BrandListModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageBrands)) { return(AccessDeniedKendoGridJson()); } var brands = _brandService.GetAllBrands(model.SearchBrandName, command.Page - 1, command.PageSize, true); var gridModel = new DataSourceResult { Data = brands.Select(x => x.ToModel()), Total = brands.TotalCount }; return(Json(gridModel)); }
public BrandListModel FindBrandListModel(int index, int pageNo, int pageSize, string search, bool bShowHidden = true) { var model = new BrandListModel(); // Do a case-insensitive search model.GridIndex = index; var allItems = db.FindBrands(bShowHidden) .Where(b => string.IsNullOrEmpty(search) || (b.BrandName != null && b.BrandName.ToLower().Contains(search.ToLower()))); model.TotalRecords = allItems.Count(); foreach (var item in allItems.Skip((pageNo - 1) * pageSize) .Take(pageSize)) { model.Items.Add(MapToModel(item)); } return(model); }
public BrandListModel GetBrands(BrandListQueryModel queryModel) { if (queryModel is null) { queryModel = new BrandListQueryModel(); } var brandsQuery = Database.Brands; if (queryModel.ActiveOnly) { brandsQuery = brandsQuery.Active(); } if (!string.IsNullOrWhiteSpace(queryModel.Query)) { brandsQuery = brandsQuery.Where(b => b.Name.Contains(queryModel.Query) || b.Description.Contains(queryModel.Query)); } int skip = (queryModel.Page - 1) * queryModel.Size; int total = brandsQuery.Count(); var items = brandsQuery .OrderBy(b => b.Name) .Select(b => new BrandListModel.ListItem { Id = b.Id, Description = b.Description, Name = b.Name, Url = b.Url, Deleted = b.Deleted }).Skip(skip).Take(queryModel.Size).ToArray(); double pages = total / queryModel.Page; var model = new BrandListModel { Total = total, CurrentPage = pages == 0 ? 0 : queryModel.Page, TotalPages = Convert.ToInt32(Math.Ceiling(pages)), Items = items }; return(model); }
public ActionResult List(DataSourceRequest command, BrandListModel model) { var brands = _brandService.GetAllBrands(keywords: model.Keywords, pageIndex: command.Page - 1, pageSize: command.PageSize); var jsonData = new DataSourceResult { Data = brands.Items.Select(b => new { Id = b.Id, Name = b.Name, DisplayOrder = b.DisplayOrder, CreationTime = b.CreationTime }), }; return(AbpJson(jsonData)); }
/// <summary> /// 品牌列表 /// </summary> /// <param name="brandName">品牌名称</param> /// <param name="pageSize">每页数</param> /// <param name="pageNumber">当前页数</param> /// <returns></returns> public ActionResult List(string brandName, int pageSize = 15, int pageNumber = 1) { string condition = AdminBrands.AdminGetBrandListCondition(brandName); PageModel pageModel = new PageModel(pageSize, pageNumber, AdminBrands.AdminGetBrandCount(condition)); BrandListModel model = new BrandListModel() { PageModel = pageModel, BrandList = AdminBrands.AdminGetBrandList(pageModel.PageSize, pageModel.PageNumber, condition), BrandName = brandName }; MallUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&brandName={3}", Url.Action("list"), pageModel.PageNumber, pageModel.PageSize, brandName)); return(View(model)); }
/// <summary> /// 品牌列表 /// </summary> /// <returns></returns> public ActionResult List() { string brandName = WebHelper.GetQueryString("brandName"); int page = WebHelper.GetQueryInt("page"); if (!SecureHelper.IsSafeSqlString(brandName)) { return(PromptView(WorkContext.UrlReferrer, "您搜索的品牌不存在")); } PageModel pageModel = new PageModel(10, page, Brands.GetBrandCount(brandName)); BrandListModel model = new BrandListModel() { PageModel = pageModel, BrandName = brandName, BrandList = Brands.GetBrandList(pageModel.PageSize, pageModel.PageNumber, brandName) }; return(View(model)); }
public ActionResult List() { var model = new BrandListModel(); return(View(model)); }