/// <summary> /// 选择角色 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPickRole_Click(object sender, EventArgs e) { var mUserRole = new FrmUserRole(_roleList, _isAdmin); mUserRole.ShowDialog(); _roleList = mUserRole.PickedRoles; RefreshRoles(); }
/// <summary> /// 选择角色 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPickRole_Click(object sender, EventArgs e) { var mUserRole = new FrmUserRole(_roleList, true); mUserRole.ShowDialog(); _roleList = mUserRole.PickedRoles; lstRoles.Items.Clear(); foreach (var role in _roleList) { var lst = new ListViewItem(role.Role); lst.SubItems.Add(role.Db); lstRoles.Items.Add(lst); } }
/// <summary> /// 修改角色 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdModifyRole_Click(object sender, EventArgs e) { if (lstOtherRoles.SelectedItems.Count == 0) { MyMessageBox.ShowMessage("Error", "Please Select A Database"); } else { var dbName = lstOtherRoles.SelectedItems[0].Text; var mUserRole = new FrmUserRole(_otherDbRolesDict[dbName].Value.AsBsonArray); mUserRole.ShowDialog(); var otherRole = new BsonElement(cmbDB.Text, mUserRole.Result); _otherDbRolesDict[dbName] = otherRole; RefreshOtherDbRoles(); } }
/// <summary> /// 增加角色 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdAddRole_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cmbDB.Text)) { MyMessageBox.ShowMessage("Error", "Please Select A Database"); return; } var mUserRole = new FrmUserRole(new BsonArray()); mUserRole.ShowDialog(); var otherRole = new BsonElement(cmbDB.Text, mUserRole.Result); if (_otherDbRolesDict.ContainsKey(cmbDB.Text)) { _otherDbRolesDict[cmbDB.Text] = otherRole; } else { _otherDbRolesDict.Add(cmbDB.Text, otherRole); } RefreshOtherDbRoles(); }