Exemplo n.º 1
0
        public async Task <IActionResult> List(int pageIndex = 1, int pageSize = 10, string categoryId = "", string title = "")
        {
            string where  = _comService.GetWhere();
            ViewBag.Title = title;
            ViewBag.Cat   = categoryId;
            if (!string.IsNullOrEmpty(title))
            {
                where += $" and g.name like '%{title}%' ";
            }
            if (!string.IsNullOrEmpty(categoryId))
            {
                where += $" and g.categoryId ={categoryId} ";
            }
            int        total;
            DataSet    ds       = _AppService.GetPage(pageIndex, pageSize, "g.sort desc,g.id desc", out total, where);
            IPagedList pageList = new PagedList <DataRow>(ds.Tables[0].Select(), pageIndex, pageSize, total);

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

            return(View(pageList));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> List(string timeFrom, string timeTo, string orderNumber, string cardId,
                                               string name, string status, int page = 1, int pageSize = 10)
        {
            string where = _comService.GetWhere();
            if (!string.IsNullOrEmpty(name))
            {
                where += $" and name like '%{name}%' ";
            }
            if (!string.IsNullOrEmpty(status))
            {
                where += $" and o.Status={status} ";
            }
            if (!string.IsNullOrEmpty(orderNumber))
            {
                where += $" and billNumber = '{orderNumber}' ";
            }
            if (!string.IsNullOrEmpty(cardId))
            {
                where += $" and cardId like '%{cardId}%' ";
            }
            if (!string.IsNullOrEmpty(timeFrom))
            {
                where += $" and o.CreationTime>='{timeFrom} 00:00:00'";
            }
            if (!string.IsNullOrEmpty(timeTo))
            {
                where += $" and o.CreationTime<='{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));
            }
            ViewBag.Category = await _catAppService.GetCategoryDropDownList(0, 1);

            return(View(pageList));
        }