Ejemplo n.º 1
0
        public ActionResult List()
        {
            var model = new ListViewModel();
            var key   = Request.QueryString["skeys"] ?? "";
            var state = Request.QueryString["state"] ?? "";
            var _sort = Request.QueryString["s_sort"] ?? "0";

            model.CurrentPage = Convert.ToInt32(Request.QueryString["curr"] ?? "1");
            if (model.CurrentPage == 0)
            {
                model.CurrentPage = 1;
            }
            string stype = !string.IsNullOrEmpty(Request["stype"]) ? Request["stype"] : "";

            model.PageSize = Convert.ToInt32(Request.QueryString["psize"] ?? "10");
            int pageCount;
            var sort = Convert.ToInt32(_sort);

            var lstWhere = new List <string>();

            if (!string.IsNullOrEmpty(state))
            {
                lstWhere.Add(string.Format("m_state={0}", state));
            }
            if (!string.IsNullOrEmpty(stype))
            {
                if (!string.IsNullOrEmpty(key))
                {
                    if (stype == "1")
                    {
                        lstWhere.Add(string.Format("m_loginname like '%{0}%'", key));
                    }
                    if (stype == "2")
                    {
                        lstWhere.Add(string.Format("m_realname like '%{0}%'", key));
                    }
                }
            }
            var where = lstWhere.Count > 0 ? string.Format(" WHERE {0}", string.Join(" AND ", lstWhere)) : "";

            var strSql     = string.Format("SELECT * FROM jmp_merchant {0}", where);
            var strOrderBy = string.Format(" ORDER BY m_id {0}", sort == 0 ? "" : "DESC");
            var lst        = new JMP.BLL.BllCommonQuery().GetLists <JMP.MDL.jmp_merchant>(strSql, strOrderBy, model.CurrentPage, model.PageSize, out pageCount);

            model.PageCount = pageCount;
            if (lst != null && lst.Count > 0)
            {
                model.Merchants = lst;
            }
            model.ButtonsTags = GetVoidHtml();
            model.MerchantSearchModel.Sort      = sort;
            model.MerchantSearchModel.State     = state;
            model.MerchantSearchModel.SearchKey = key;
            ViewBag.stype = stype;
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult ChoiceMerchantList()
        {
            var model = new ListUserViewModel();
            var key   = Request.QueryString["skeys"] ?? "";
            var _sort = Request.QueryString["s_sort"] ?? "0";

            model.CurrentPage = Convert.ToInt32(Request.QueryString["curr"] ?? "1");
            model.PageSize    = Convert.ToInt32(Request.QueryString["psize"] ?? "10");
            int    pageCount;
            var    sort  = Convert.ToInt32(_sort);
            string stype = !string.IsNullOrEmpty(Request["stype"]) ? Request["stype"] : "";
            //string dept = System.Configuration.ConfigurationManager.AppSettings["RoleID"];
            var lstWhere = new List <string>();

            lstWhere.Add(string.Format("u_state={0}", 1));
            ///lstWhere.Add(string.Format(" u_role_id ={0}", ""+dept+"" ));
            if (!string.IsNullOrEmpty(stype))
            {
                if (!string.IsNullOrEmpty(key))
                {
                    if (stype == "1")
                    {
                        lstWhere.Add(string.Format("u_loginname like '%{0}%'", key));
                    }
                    if (stype == "2")
                    {
                        lstWhere.Add(string.Format("u_realname like '%{0}%'", key));
                    }
                }
            }
            var where = lstWhere.Count > 0 ? string.Format(" WHERE {0}", string.Join(" AND ", lstWhere)) : "";

            var strSql     = string.Format("SELECT * FROM jmp_locuser {0}", where);
            var strOrderBy = string.Format(" ORDER BY u_id {0}", sort == 0 ? "" : "DESC");
            var lst        = new JMP.BLL.BllCommonQuery().GetLists <JMP.MDL.jmp_locuser>(strSql, strOrderBy, model.CurrentPage, model.PageSize, out pageCount);

            model.PageCount = pageCount;
            if (lst != null && lst.Count > 0)
            {
                model.Users = lst;
            }
            model.ButtonsTags = GetVoidHtml();
            ViewBag.stype     = stype;
            model.MerchantSearchModel.Sort      = sort;
            model.MerchantSearchModel.SearchKey = key;
            return(View(model));
        }