Exemple #1
0
        public ActionResult Index(UserQueryModels q)
        {
            ViewBag.QueryModel = q;
            IList <Inpinke_User> list = DBUserBLL.GetUserByQueryModel(PageInfo, q);

            return(View(list));
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pInfo"></param>
        /// <param name="q"></param>
        /// <returns></returns>
        public static IList <Inpinke_User> GetUserByQueryModel(PageInfo pInfo, UserQueryModels query)
        {
            try
            {
                IList <Inpinke_User> list = new List <Inpinke_User>();
                string field = " U.* ";
                string table = " Inpinke_User U ";
                string where = FormatQModel.FormatQueryModel <UserQueryModels>(query);
                string orderby = " U.ID ";

                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_User>(qSql).ToList();

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