Beispiel #1
0
    protected void btnGrantAccess_Click(object sender, EventArgs e)
    {
        bool result = false;
        List <PermissionMap> permissionList = new List <PermissionMap>();

        foreach (GridViewRow item in grdGlobalPermission.Rows)
        {
            PermissionMap pm = new PermissionMap();
            pm.Permission = ((Label)item.FindControl("lblPermission")).Text;
            pm.Allow      = ((CheckBox)item.FindControl("chkGrantPermission")).Checked;
            pm.Deny       = ((CheckBox)item.FindControl("chkRevokePermission")).Checked;
            permissionList.Add(pm);
        }
        using (ResourceDataAccess dataAccess = new ResourceDataAccess(Utility.CreateContext()))
        {
            result = dataAccess.SetCreatePremissions(permissionList[0], Id.ToString(), userToken);
        }

        if (result)
        {
            Utility.ShowMessage(lblErrorGlobalPermission, Resources.Resources.PermissionGranted, false);
        }
        else
        {
            Utility.ShowMessage(lblErrorGlobalPermission, Resources.Resources.FailToGrantPermission, false);
        }
        lblErrorGlobalPermission.Visible = true;
    }