public void btnSavePageAccessRole_Clicked(object sender, EventArgs e)
    {
        MonkData db = new MonkData();
        Guid roleId = new Guid(hidRoleId.Value);
        var pagesUnderRole = db.aspnet_PageUnderRoles.Where(p=>p.RoleId == roleId && p.FilePath == dlPages.SelectedValue);
        if(pagesUnderRole.Count() > 0)
        {
            // Role was already found that was defined for this page.
            return;
        }

        Monks.aspnet_PageUnderRole pageUnderRole = new Monks.aspnet_PageUnderRole();
        pageUnderRole.FilePath = dlPages.SelectedValue.Trim();
        pageUnderRole.PageId = Guid.NewGuid();
        pageUnderRole.RoleId = roleId;

        db.aspnet_PageUnderRoles.InsertOnSubmit(pageUnderRole);
        db.SubmitChanges();

        var pagePermissions = db.aspnet_PageUnderRoles.Where(p=>p.RoleId == roleId);
        rpPagePermissions.DataSource = pagePermissions;
        rpPagePermissions.DataBind();

        var tablePermissions = db.aspnet_TableUnderRoles.Where(p=>p.RoleId == roleId);
        rpTablePermissions.DataSource = tablePermissions;
        rpTablePermissions.DataBind();
    }
Exemple #2
0
		private void detach_aspnet_PageUnderRoles(aspnet_PageUnderRole entity)
		{
			this.SendPropertyChanging();
			entity.aspnet_Role = null;
		}