コード例 #1
0
    /// <summary>
    /// 加载
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                this.currentuserid.Value = this.mUser.id.ToString();
                btnAddSel.PostBackUrl    = string.Format("UserPermissionsEdit.aspx?Url=UserPermissionsList.aspx&currentuserid={0}", this.currentuserid.Value.ToString());
                int roleType = mCompany.RoleType;
                List <Bd_Base_Page> iPost = new Bd_Base_PageBLL().GetListByRoleType(roleType);

                ViewState["basePage"] = iPost;

                BindUserPermissions();
            }
        }
        catch (Exception)
        {
        }
    }
コード例 #2
0
ファイル: BasePage.cs プロジェクト: toyslife/PiaoBaoWork3.0
    /// <summary>
    /// 页面权限
    /// </summary>
    private void Limits()
    {
        try
        {
            string Url = Request.AppRelativeCurrentExecutionFilePath != null ? Request.AppRelativeCurrentExecutionFilePath : "";
            Url = Url.Replace("~/", "").ToUpper();

            //判断公共页面
            foreach (string sTempComm in CommonUrl())
            {
                if (Url.Contains(sTempComm.ToUpper()))
                {
                    return;
                }
            }

            Bd_Base_PageBLL bd_Base_PageBLL = new Bd_Base_PageBLL();
            PbProject.Logic.User.User_PermissionsBLL uPermissionsBLL = new PbProject.Logic.User.User_PermissionsBLL();
            IList <Bd_Base_Page> iPostResult = new List <Bd_Base_Page>();

            List <Bd_Base_Page> pageList = bd_Base_PageBLL.GetList();

            User_Permissions userPermissions  = uPermissionsBLL.GetById(mUser.DeptId);
            string           valuePermissions = "," + userPermissions.Permissions + ",";
            string           temp             = "";
            int pageListCount = pageList != null ? pageList.Count : 0;

            //得到权限
            for (int j = 0; j < pageListCount; j++)
            {
                temp = "," + pageList[j].PageIndex.ToString() + ",";
                if (valuePermissions.Contains(temp) && pageList[j].RoleType == mCompany.RoleType)
                {
                    iPostResult.Add(pageList[j]);
                }
            }


            int x = 0;
            for (int i = 0; i < iPostResult.Count; i++)
            {
                if (iPostResult[i].PageURL.ToUpper().Contains(Url.ToUpper()))
                {
                    x++;
                    break;
                }
            }
            if (x == 0)
            {
                string[] str = Url.Split('/');
                if (str.Length > 2)
                {
                    //无权限提示
                    Response.Redirect("../../Power.htm", true);
                }
                if (Url.Contains("/"))
                {
                    //无权限提示
                    Response.Redirect("../Power.htm", true);
                }
                else
                {
                    //无权限提示
                    Response.Redirect("Power.htm", true);
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
コード例 #3
0
    /// <summary>
    /// 绑定页面
    /// </summary>
    private void TreeDataBind()
    {
        try
        {
            int roleType = mCompany.RoleType;
            List <Bd_Base_Page> iPost = new Bd_Base_PageBLL().GetListByRoleType(roleType);

            #region 排序

            iPost = (from e in iPost
                     orderby e.ModuleIndex
                     select new Bd_Base_Page
            {
                id = e.id,
                ModuleIndex = e.ModuleIndex,
                ModuleName = e.ModuleName,
                OneMenuIndex = e.OneMenuIndex,
                OneMenuName = e.OneMenuName,
                TwoMenuIndex = e.TwoMenuIndex,
                TwoMenuName = e.TwoMenuName,
                PageIndex = e.PageIndex,
                PageName = e.PageName,
                PageURL = e.PageURL,
                RoleType = e.RoleType
            }).ToList();

            #endregion

            #region 菜单页面

            for (int i = 0; i < iPost.Count; i++)
            {
                int v = 0;
                int x = 0;
                foreach (TreeNode childnodes in trvPagePower.Nodes)
                {
                    if (childnodes.Value == iPost[i].ModuleIndex.ToString())
                    {
                        v++;
                        foreach (TreeNode childnodes2 in childnodes.ChildNodes)
                        {
                            if (iPost[i].OneMenuIndex.ToString() == childnodes2.Value)
                            {
                                x++;
                                if (iPost[i].TwoMenuIndex != 0)
                                {
                                    //添加第三级菜单
                                    TreeNode childnodey = new TreeNode(iPost[i].TwoMenuName.ToString(), iPost[i].PageIndex.ToString());

                                    childnodey.Expanded = false;
                                    childnodes2.ChildNodes.Add(childnodey);
                                }
                            }
                        }
                        if (x == 0)
                        {
                            if (iPost[i].TwoMenuIndex != 0)
                            {
                                //添加第二级菜单
                                TreeNode childnodex = new TreeNode(iPost[i].OneMenuName, iPost[i].OneMenuIndex.ToString());
                                childnodex.Expanded = false;
                                childnodes.ChildNodes.Add(childnodex);


                                //添加第三级菜单
                                TreeNode childnodey = new TreeNode(iPost[i].TwoMenuName.ToString(), iPost[i].PageIndex.ToString());
                                childnodey.Expanded = false;
                                childnodex.ChildNodes.Add(childnodey);
                            }
                        }
                        x = 0;
                    }
                }
                if (v == 0)
                {
                    if (iPost[i].ModuleName != "测试模块")
                    {
                        iPost[i].ModuleName = iPost[i].ModuleName == "报表管理" ? "机票" : iPost[i].ModuleName;
                        //添加第一级菜单
                        TreeNode regionalnode = new TreeNode(iPost[i].ModuleName.Replace("预订", "").Replace("管理", "").Replace("服务", ""), iPost[i].ModuleIndex.ToString());
                        regionalnode.Expanded = false;
                        //添加第二级菜单
                        TreeNode childnodex = new TreeNode(iPost[i].OneMenuName, iPost[i].OneMenuIndex.ToString());
                        childnodex.Expanded = false;
                        regionalnode.ChildNodes.Add(childnodex);
                        if (iPost[i].TwoMenuIndex != 0)
                        {
                            //添加第三级菜单
                            TreeNode childnodey = new TreeNode(iPost[i].TwoMenuName.ToString(), iPost[i].PageIndex.ToString());
                            childnodey.Expanded = false;
                            childnodex.ChildNodes.Add(childnodey);
                        }

                        trvPagePower.Nodes.Add(regionalnode);
                    }
                }
                v = 0;
            }

            #endregion

            #region 非菜单页面,隐藏页面

            iPost = (from e in iPost
                     where e.TwoMenuIndex == 0
                     orderby e.ModuleIndex
                     select new Bd_Base_Page
            {
                id = e.id,
                ModuleIndex = e.ModuleIndex,
                ModuleName = e.ModuleName,
                OneMenuIndex = e.OneMenuIndex,
                OneMenuName = e.OneMenuName,
                TwoMenuIndex = e.TwoMenuIndex,
                TwoMenuName = e.TwoMenuName,
                PageIndex = e.PageIndex,
                PageName = e.PageName,
                PageURL = e.PageURL,
                RoleType = e.RoleType
            }).ToList();
            ViewState["NullPage"] = iPost;

            #endregion
        }
        catch (Exception ex)
        {
        }
    }
コード例 #4
0
    /// <summary>
    /// 查询
    /// </summary>
    protected void RepBasePageBind()
    {
        try
        {
            int roleType = int.Parse(ddlType.SelectedValue);
            List <Bd_Base_Page> bPaseList    = new Bd_Base_PageBLL().GetListByRoleType(roleType);
            List <Bd_Base_Page> bPaseListNew = new List <Bd_Base_Page>();

            #region 筛选

            Bd_Base_Page[] modelArray = bPaseList.ToArray <Bd_Base_Page>();

            IQueryable <Bd_Base_Page> query = modelArray.AsQueryable();

            if (!string.IsNullOrEmpty(txtModuleIndex.Text))
            {
                query = query.Where(c => c.ModuleIndex == int.Parse(txtModuleIndex.Text));
            }
            if (!string.IsNullOrEmpty(txtModuleName.Text))
            {
                query = query.Where(c => c.ModuleName.Contains(txtModuleName.Text));
            }
            if (!string.IsNullOrEmpty(txtOneMenuIndex.Text))
            {
                query = query.Where(c => c.OneMenuIndex == int.Parse(txtOneMenuIndex.Text));
            }
            if (!string.IsNullOrEmpty(txtOneMenuName.Text))
            {
                query = query.Where(c => c.OneMenuName.Contains(txtOneMenuName.Text));
            }
            if (!string.IsNullOrEmpty(txtTwoMenuIndex.Text))
            {
                query = query.Where(c => c.TwoMenuIndex == int.Parse(txtTwoMenuIndex.Text));
            }
            if (!string.IsNullOrEmpty(txtTwoMenuName.Text))
            {
                query = query.Where(c => c.TwoMenuName.Contains(txtTwoMenuName.Text));
            }
            if (!string.IsNullOrEmpty(txtPageIndex.Text))
            {
                query = query.Where(c => c.PageIndex == int.Parse(txtPageIndex.Text));
            }
            if (!string.IsNullOrEmpty(txtPageName.Text))
            {
                query = query.Where(c => c.PageName.Contains(txtPageName.Text));
            }
            if (!string.IsNullOrEmpty(txtPageURL.Text))
            {
                query = query.Where(c => c.PageURL.Contains(txtPageURL.Text));
            }

            bPaseListNew = query.ToList <Bd_Base_Page>();


            #endregion

            #region 排序
            IEnumerable <Bd_Base_Page> querys = null;
            querys       = from aa in bPaseListNew orderby aa.ModuleIndex, aa.OneMenuIndex, aa.TwoMenuIndex, aa.PageIndex select aa;
            bPaseListNew = querys.ToList <Bd_Base_Page>();

            #endregion

            RepBasePage.DataSource = bPaseListNew;
            RepBasePage.DataBind();
        }
        catch (Exception ex)
        {
            RepBasePage.DataSource = null;
            RepBasePage.DataBind();
        }
    }