Пример #1
0
        public ActionResult ShowOrderListJSON()
        {
            int      pageSize   = 10;
            int      totalCount = 0;
            JQueryDT dt         = new JQueryDT(Request);
            GetFinishTradeService _GetFinishTrade = new GetFinishTradeService();

            List <GetFinishTrade> _List = _GetFinishTrade.ListProducts(dt.iDisplayStart, pageSize, ref totalCount);

            BaseModel _dt = FormatDTByObject <GetFinishTrade>(_List, dt, pageSize, totalCount);

            return(Json(_dt, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult getDTJson()
        {
            int             pageSize   = 10;
            int             totalCount = 0;
            JQueryDT        dt         = new JQueryDT(Request);
            ProductsService _Products  = new ProductsService();

            List <Products> _productsList = _Products.ListProducts(dt.iDisplayStart, pageSize, ref totalCount);

            BaseModel _dt = FormatDTByObject <Products>(_productsList, dt, pageSize, totalCount);

            return(Json(_dt, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public static BaseModel FormatDTByObject <T>(IEnumerable <T> enumeration, JQueryDT dt, int pageSize, int totalRecords)
        {
            BaseModel root = new BaseModel();

            root.sEcho                = dt.sEcho;
            root.iTotalRecords        = totalRecords;
            root.iTotalDisplayRecords = totalRecords;

            if (enumeration != null)
            {
                List <object> adList = new List <object>();
                foreach (T item in enumeration)
                {
                    adList.Add(item);
                }
                root.aaData = adList;
            }
            return(root);
        }