Esempio n. 1
0
        public async Task <IActionResult> List(string goodsName, string storeId, string categoryId,
                                               string brandId, string type, string status, int page = 1, int pageSize = 10)
        {
            string where = _comService.GetWhere();
            if (!string.IsNullOrEmpty(goodsName))
            {
                where = $" and g.Name like '%{goodsName}%'";
            }
            if (!string.IsNullOrEmpty(categoryId))
            {
                where += $" and g.categoryId = {categoryId}";
            }
            if (!string.IsNullOrEmpty(brandId))
            {
                where += $" and g.brandId = {brandId}";
            }
            if (!string.IsNullOrEmpty(storeId))
            {
                where += $" and g.ChinStoreId = {storeId}";
            }
            if (!string.IsNullOrEmpty(type))
            {
                where += $" and g.type = {type}";
            }
            if (!string.IsNullOrEmpty(status))
            {
                where += $" and g.status = {status}";
            }

            int        total;
            DataSet    ds       = _AppService.GetPage(page, pageSize, "g.sort desc", out total, where);
            IPagedList pageList = new PagedList <DataRow>(ds.Tables[0].Select(), page, pageSize, total);

            ViewBag.PageSize = pageSize;
            if (Request.Headers.ContainsKey("x-requested-with"))
            {
                return(View("_Table", pageList));
            }

            ViewBag.Category = _catAppService.GetCategoryDropDownList(AbpSession.TenantId, 0);
            ViewBag.Brand    = _brandAppService.GetMultiSelect();
            ViewBag.Store    = (await _storeAppService.GetDropDown());

            IList <SelectListItem> listItem = new List <SelectListItem>();
            Array values = System.Enum.GetValues(typeof(Entity.GoodsState));

            foreach (int item in values)
            {
                listItem.Add(new SelectListItem
                {
                    Value = item.ToString(),
                    Text  = L(System.Enum.GetName(typeof(Entity.GoodsState), item))
                });
            }
            ViewData.Add("GoodsType", new SelectList(listItem, "Value", "Text"));

            return(View(pageList));
        }
Esempio n. 2
0
        public IActionResult List(int page = 1)
        {
            int    pageSize = 10;
            string table    = $"select g.Id,g.Title,g.ParentId,g.Sort,g.Note from TGoodsCategory g where g.ParentId=0";

            if (_AbpSession.TenantId != null)
            {
                table += $" and g.TenantId={_AbpSession.TenantId}";
            }

            int        total;
            DataSet    ds       = _AppService.GetPage(page, pageSize, table, "sort desc, id desc", out total);
            IPagedList pageList = new PagedList <DataRow>(ds.Tables[0].Select(), page, pageSize, total);

            List <DropDownDto> dtoList = _AppService.GetCategoryDropDownList(AbpSession.TenantId, 0);

            ViewData.Add("cat", new Microsoft.AspNetCore.Mvc.Rendering.SelectList(dtoList, "Id", "Title"));

            List <BrandSelectDto> t = _brandAppService.GetMultiSelect();

            ViewData.Add("brand", t);

            return(View(pageList));
        }
Esempio n. 3
0
 public ActionResult Index()
 {
     _AppService.GetMultiSelect();
     return(View());
 }