コード例 #1
0
ファイル: Z30CustomerController.cs プロジェクト: yan2oo7/EAP
        public ActionResult Index(int?pageindex, int?pagesize, string qTitle, string qEmail, long?qCateID, int?qSiteStatus, int?qSuccessRatio, int?orderCol)
        {
            if ((_crud & Zippy.SaaS.Entity.CRUD.Read) != Zippy.SaaS.Entity.CRUD.Read)
            {
                return(RedirectToAction("NoPermission", "Error"));
            }

            System.Text.StringBuilder sbMenu = new System.Text.StringBuilder();
            if ((_crud & Zippy.SaaS.Entity.CRUD.Create) == Zippy.SaaS.Entity.CRUD.Create)
            {
                sbMenu.AppendLine("<a href='/Z01Customer/Edit?ReturnUrl=" + System.Web.HttpUtility.UrlEncode("/" + _ContollerName + "/?pagesize=" + pagesize) + "' class='btn img'><i class='icon i_create'></i>添加<b></b></a>");
            }
            if ((_crud & Zippy.SaaS.Entity.CRUD.Read) == Zippy.SaaS.Entity.CRUD.Read)
            {
                sbMenu.AppendLine("<a href='javascript:;' class='btn list img' id='search'><i class='icon i_search'></i>查询<b></b></a>");
            }
            if ((_crud & Zippy.SaaS.Entity.CRUD.Delete) == Zippy.SaaS.Entity.CRUD.Delete)
            {
                sbMenu.AppendLine("<a href='javascript:;' class='btn img' id='bDelete'><i class='icon i_delete'></i>删除<b></b></a>");
            }
            sbMenu.AppendLine("<a href='javascript:;' class='btn img' id='bReload'><i class='icon i_refresh'></i>刷新<b></b></a>");
            ViewBag.TopMenu  = sbMenu.ToString();
            ViewBag.db       = db;
            ViewBag.PageSize = pagesize ?? 10;
            int currentPageSize  = pagesize ?? 10;
            int currentPageIndex = pageindex ?? 1;


            Hashtable hs = new Hashtable();

            hs.Add("qTitle", qTitle);
            hs.Add("qEmail", qEmail);
            hs.Add("qCateID", qCateID);
            hs.Add("qSiteStatus", qSiteStatus);
            hs.Add("qSuccessRatio", qSuccessRatio);
            hs.Add("qPrincipal", _user.UserID);

            PaginatedList <Z01Customer> result = Z01CustomerHelper.Query(db, _tenant.TenantID.Value, currentPageSize, currentPageIndex, hs, orderCol);

            result.QueryParameters = hs;

            PaginatedList <Z01CustomerCategory> cateRes = Z01CustomerCategoryHelper.Query(db, _tenant.TenantID.Value, 2000, 1, null, null);

            ViewBag.xcate   = cateRes;
            ViewBag.xcateid = qCateID;

            return(View(result));
        }
コード例 #2
0
        public ActionResult Index(int?PageIndex, int?PageSize, string qTitle, string qEmail, long?qCateID, int?qCustomerType, int?orderCol)
        {
            if ((_crud & Zippy.SaaS.Entity.CRUD.Read) != Zippy.SaaS.Entity.CRUD.Read)
            {
                return(RedirectToAction("NoPermission", "Error"));
            }

            System.Text.StringBuilder sbMenu = new System.Text.StringBuilder();
            if ((_crud & Zippy.SaaS.Entity.CRUD.Create) == Zippy.SaaS.Entity.CRUD.Create)
            {
                sbMenu.AppendLine("<a href='/" + _ContollerName + "/Edit?ReturnUrl=" + System.Web.HttpUtility.UrlEncode("/" + _ContollerName + "/?PageSize=" + PageSize) + "' class='btn img'><i class='icon i_create'></i>添加<b></b></a>");
            }
            if ((_crud & Zippy.SaaS.Entity.CRUD.Read) == Zippy.SaaS.Entity.CRUD.Read)
            {
                sbMenu.AppendLine("<a href='javascript:;' class='btn list img' id='search'><i class='icon i_search'></i>查询<b></b></a>");
            }
            sbMenu.AppendLine("<a href='javascript:;' class='btn img' id='bReload'><i class='icon i_refresh'></i>刷新<b></b></a>");
            ViewData["TopMenu"] = sbMenu.ToString();

            qCustomerType = qCustomerType ?? 0;
            ViewData.Add("db", db);
            ViewBag.PageSize = PageSize ?? 10;
            int currentPageSize  = PageSize ?? 10;
            int currentPageIndex = PageIndex ?? 1;

            Hashtable hs = new Hashtable();

            hs.Add("qTitle", qTitle);
            hs.Add("qEmail", qEmail);
            hs.Add("qCateID", qCateID);
            hs.Add("qCustomerType", qCustomerType);

            PaginatedList <Z01Customer> result = Z01CustomerHelper.Query(db, _tenant.TenantID.Value, currentPageSize, currentPageIndex, hs, orderCol);

            result.QueryParameters = hs;

            PaginatedList <Z01CustomerCategory> cateRes = Z01CustomerCategoryHelper.Query(db, _tenant.TenantID.Value, 2000, 1, null, null);

            ViewData.Add("xcate", cateRes);
            ViewData.Add("xcateid", qCateID);

            //角色为销售的用户
            var salesTable = db.ExecuteDataSet("select * from [V_UserRole] where [Title]=@Title", db.CreateParameter("Title", "销售")).Tables[0];

            ViewBag.Sales = salesTable;

            return(View(result));
        }