Ejemplo n.º 1
0
        static private void getPermissions(string url)
        {
            List <SecRoleModuleManager.secRoleModuleGet> rolePermissions = null;

            SecRoleModuleManager.secRoleModuleGet rolePermission = null;

            //string str = HttpContext.Current.Request.Url.AbsolutePath.ToLower();
            string str      = url.ToLower();
            string pagename = str.Substring(str.LastIndexOf("/") + 1);

            if (HttpContext.Current.Session["rolePermission"] != null)
            {
                rolePermissions = (List <SecRoleModuleManager.secRoleModuleGet>)HttpContext.Current.Session["rolePermission"];

                rolePermission = rolePermissions.Where(x => x.Url.ToLower() == pagename).FirstOrDefault();

                if (rolePermission != null)
                {
                    AddPermssion     = rolePermission.AddPermssion ?? false;
                    EditPermission   = rolePermission.EditPermission ?? false;
                    DeletePermission = rolePermission.DeletePermission ?? false;
                    ViewPermssion    = rolePermission.ViewPermssion ?? false;
                }
            }
        }
Ejemplo n.º 2
0
        protected void gvModules_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            int      roleID             = Convert.ToInt32(ViewState["RoleID"]);
            GridView gvModulePermission = null;

            SecRoleModuleManager.secRoleModuleGet parentModule = null;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                parentModule = e.Row.DataItem as SecRoleModuleManager.secRoleModuleGet;

                List <SecRoleModuleManager.secRoleModuleGet> childrenModules = roleModules.Where(x => (x.ParentId == parentModule.ModuleId)).ToList();

                gvModulePermission = e.Row.FindControl("gvModulePermission") as GridView;

                gvModulePermission.DataSource = childrenModules;
                gvModulePermission.DataBind();
            }
        }