コード例 #1
0
ファイル: GoodsController.cs プロジェクト: lwsadmin/UnionMall
        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));
        }
コード例 #2
0
        public async Task <IActionResult> List(int page        = 1, int pageSize   = 10, string title = "",
                                               string timeFrom = "", string timeTo = "")
        {
            string where = string.Empty;
            if (!string.IsNullOrEmpty(title))
            {
                where += $" and title like '%{title}%'";
            }
            if (!string.IsNullOrEmpty(timeFrom))
            {
                where += $" and SendTime>='{timeFrom} 00:00:00'";
            }
            if (!string.IsNullOrEmpty(timeTo))
            {
                where += $" and SendTime<='{timeTo} 23:59:59'";
            }
            int        total;
            DataSet    ds       = _appService.GetPage(page, pageSize, "id 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));
            }
            var storeDropDown = (await _storeAppService.GetDropDown());

            ViewData.Add("ChainStore", new SelectList(storeDropDown, "Id", "Name"));
            return(View(pageList));
        }
コード例 #3
0
        public async Task <IActionResult> List(int page        = 1, int pageSize  = 10, string Level = "", string Name = "",
                                               string Business = "", string Store = "", string RegTimeFrom = "", string RegTimeTo = "")
        {
            //System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            //stopwatch.Start(); //  开始监视代码运行时间
            //                   //  需要测试的代码 ....

            string where = string.Empty; where += _comAppService.GetWhere();
            if (!string.IsNullOrEmpty(Level))
            {
                where += $" and c.levelId={Level}";
            }
            if (!string.IsNullOrEmpty(Name))
            {
                where += $" and c.WeChatName like'%{Name}%'";
            }
            if (!string.IsNullOrEmpty(Business))
            {
                where += $" and c.BusinessId={Business}";
            }
            if (!string.IsNullOrEmpty(Store))
            {
                where += $" and c.ChainStoreId={Store}";
            }
            if (!string.IsNullOrEmpty(RegTimeFrom))
            {
                where += $" and c.RegTime>='{RegTimeFrom} 00:00:00'";
            }
            if (!string.IsNullOrEmpty(RegTimeTo))
            {
                where += $" and c.RegTime<='{RegTimeTo} 23:59:59'";
            }

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

            //stopwatch.Stop(); //  停止监视
            //TimeSpan timespan = stopwatch.Elapsed; //  获取当前实例测量得出的总时间
            //double milliseconds = timespan.TotalMilliseconds;  //  总毫秒数
            //Logger.Warn("11111111111111111111111111耗时间:"+ milliseconds.ToString());
            if (Request.Headers.ContainsKey("x-requested-with"))
            {
                return(View("_Table", pageList));
            }

            //var businessDropDown = (await _businessAppService.GetDropDown());
            //ViewData.Add("Business", new SelectList(businessDropDown, "Id", "BusinessName"));

            var levelDropDown = (await _levelAppService.GetDropDown());

            ViewData.Add("Level", new SelectList(levelDropDown, "Id", "Title"));

            var storeDropDown = (await _storeAppService.GetDropDown());

            ViewData.Add("ChainStore", new SelectList(storeDropDown, "Id", "Name"));
            return(View(pageList));
        }
コード例 #4
0
        public async Task <IActionResult> Index(long?id)
        {
            //   ViewBag.Page = new PagedList<DataRow>(null, 1, 1);
            if (id != null)
            {
                ViewBag.CarId = (await _AppService.GetEntity((long)id)).CardID;
            }

            var levelDropDown = (await _levelAppService.GetDropDown());

            ViewData.Add("Level", new SelectList(levelDropDown, "Id", "Title"));

            var storeDropDown = (await _storeAppService.GetDropDown());

            ViewData.Add("ChainStore", new SelectList(storeDropDown, "Id", "Name"));

            string where = _comAppService.GetWhere();
            int     total;
            string  sql = $@"select c.id,c.Title from dbo.TCoupon c where c.id>0";
            DataSet ds  = _couponService.GetPage(1, int.MaxValue, "id desc", out total, where, sql);

            ViewBag.CouponTable = ds.Tables[0];
            return(View());
        }
コード例 #5
0
ファイル: UserController.cs プロジェクト: lwsadmin/UnionMall
        public JsonResult DropDrowGetStore(long businessID)
        {
            List <StoreDropDownDto> s = _storeAppService.GetDropDown(businessID).Result;

            return(Json(new { stores = s }));
        }