public RoleEditForm(AerospikeClient client, EditType editType, RoleRow row)
        {
            this.client   = client;
            this.editType = editType;
            InitializeComponent();

            grid.AutoGenerateColumns             = false;
            PrivilegeCodeColumn.DataPropertyName = "Code";
            PrivilegeCodeColumn.ValueMember      = "PrivilegeCode";
            PrivilegeCodeColumn.DisplayMember    = "Label";
            PrivilegeCodeColumn.DataSource       = GetPrivilegeTypeBinding();
            NamespaceColumn.DataPropertyName     = "Namespace";
            SetNameColumn.DataPropertyName       = "SetName";

            BindingSource bindingSource = new BindingSource();

            switch (editType)
            {
            case EditType.CREATE:
                bindingSource.DataSource = new BindingList <Privilege>();
                break;

            case EditType.EDIT:
                this.Text                = "Edit Role";
                nameBox.Enabled          = false;
                nameBox.Text             = row.name;
                bindingSource.DataSource = LoadPrivileges(row.privileges);
                oldPrivileges            = row.privileges;
                break;
            }
            grid.DataSource = bindingSource;
        }
        public RoleEditForm(AerospikeClient client, EditType editType, RoleRow row)
        {
            this.client = client;
            this.editType = editType;
            InitializeComponent();

            grid.AutoGenerateColumns = false;
            PrivilegeCodeColumn.DataPropertyName = "Code";
            PrivilegeCodeColumn.ValueMember = "PrivilegeCode";
            PrivilegeCodeColumn.DisplayMember = "Label";
            PrivilegeCodeColumn.DataSource = GetPrivilegeTypeBinding();
            NamespaceColumn.DataPropertyName = "Namespace";
            SetNameColumn.DataPropertyName = "SetName";

            BindingSource bindingSource = new BindingSource();

            switch (editType)
            {
                case EditType.CREATE:
                    bindingSource.DataSource = new BindingList<Privilege>();
                    break;

                case EditType.EDIT:
                    this.Text = "Edit Role";
                    nameBox.Enabled = false;
                    nameBox.Text = row.name;
                    bindingSource.DataSource = LoadPrivileges(row.privileges);
                    oldPrivileges = row.privileges;
                    break;
            }
            grid.DataSource = bindingSource;
        }
 private void SetRoleFields(RoleRow row)
 {
     if (bindingSourcePrivs.DataSource != row.privilegeRows)
     {
         bindingSourcePrivs.DataSource = row.privilegeRows;
     }
     whitelistBox.Text = RoleEditForm.GetWhitelistString(row.whitelist);
 }
        private void RoleRowEnter(object sender, DataGridViewCellEventArgs e)
        {
            RoleRow role = roles[e.RowIndex];

            if (bindingSourcePrivs.DataSource != role.privilegeRows)
            {
                bindingSourcePrivs.DataSource = role.privilegeRows;
            }
        }
        private void RoleRowEnter(object sender, DataGridViewCellEventArgs e)
        {
            RoleRow role = roles[e.RowIndex];

            SetRoleFields(role);
        }