Exemplo n.º 1
0
        public ActionResult Index(OrderQueryModels query, string msg)
        {
            ViewBag.Msg = msg;
            IList <Inpinke_Order> list = DBOrderBLL.GetOrderByQueryModels(PageInfo, query);

            ViewBag.QueryModel = query;
            return(View(list));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查询订单
        /// </summary>
        /// <param name="pInfo"></param>
        /// <param name="qModel"></param>
        /// <returns></returns>
        public static IList <Inpinke_Order> GetOrderByQueryModels(PageInfo pInfo, OrderQueryModels qModel)
        {
            try
            {
                IList <Inpinke_Order> list = new List <Inpinke_Order>();
                string field = " O.* ";
                string table = " Inpinke_Order O left join Inpinke_User U on O.UserID=U.ID ";
                string where = FormatQModel.FormatQueryModel <OrderQueryModels>(qModel);
                string orderby = " O.ID desc";

                string countQ = PagerHelper.GetCountSQL(table, where);
                string qSql   = PagerHelper.GetPager(table, pInfo.Skip, pInfo.PageSize, field, orderby, where);
                pInfo.Total = InpinkeDataContext.Instance.ExecuteQuery <int>(countQ).FirstOrDefault();
                list        = InpinkeDataContext.Instance.ExecuteQuery <Inpinke_Order>(qSql).ToList();

                return(list);
            }
            catch (Exception ex)
            {
                Logger.Error(string.Format("GetOrderByQueryModels Error:{0}", ex.ToString()));
                return(null);
            }
        }