Beispiel #1
0
        public static bool ValidateUserPemiss(string currentPath)
        {
            BLL.Sys_RoleMenuMappingBLL bll_ur = new BLL.Sys_RoleMenuMappingBLL();
            int     roleId = int.Parse(HttpContext.Current.Session["RoleId"].ToString());
            DataSet ds     = bll_ur.GetPagePath(roleId);
            int     count  = ds.Tables[0].Select(" MenuUrl='" + currentPath + "'").Length;

            if (count > 0)
            {
                return(true);
            }
            else
            {
                //HttpContext.Current.Response.Redirect("../Login/Login.aspx");
                HttpContext.Current.Response.Write("<script>alert('你没有访问的权限!');</script>");
                HttpContext.Current.Response.End();
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 初始该角色的小类菜单
        /// </summary>
        private void DataBindRole()
        {
            if (Request.QueryString["RoleID"].ToString() == null || !Common.PositiveInt.IsPositiveInt(Request.QueryString["RoleID"].ToString()))
            {
                return;
            }
            int roleID = int.Parse(Request.QueryString["RoleID"]);

            Model.Sys_RoleInfo model_ri = new Model.Sys_RoleInfo();
            model_ri = bll_ri.GetModel(roleID);
            if (model_ri == null)
            {
                return;
            }

            this.txtRoleName.Text = model_ri.RoleName;
            int    rid      = -1;
            string strWhere = " RoleID=" + roleID + "";

            BLL.Sys_RoleMenuMappingBLL bll_rmm = new BLL.Sys_RoleMenuMappingBLL();
            DataSet ds = bll_rmm.GetRoleList(strWhere, rid);

            if (ds.Tables[0].Rows.Count > 0)
            {
                //初始化CheckBoxList选中项
                foreach (RepeaterItem DataItem in rpt_RoleList.Items)
                {
                    foreach (ListItem item in ((CheckBoxList)DataItem.FindControl("cbList")).Items)
                    {
                        DataRow[] dr = ds.Tables[0].Select("MenuID=" + item.Value + "");
                        if (dr.Length > 0)
                        {
                            item.Selected = true;
                        }
                    }
                }
            }
        }