/// <summary> /// 修改权限组 /// </summary> /// <param name="handle">当前行</param> private void RightGroupUpdate(int handle) { try { if (handle < 0) { return; } RightEdit rightEdit = new RightEdit(); rightEdit.EditType = 2; DataRow dw = ViewRightGroup.GetDataRow(handle); int ManagerGroupID = int.Parse(dw["ManagerGroupID"].ToString()); UM_ManagerGroup ManagerGroup = ManagerGroupBLL.GetModel(ManagerGroupID); rightEdit.ManagerGroup = ManagerGroup; if (rightEdit.ShowDialog(this) == DialogResult.OK) { LoadRightGroup(); this.ViewRightGroup.FocusedRowHandle = handle; } } catch (Exception ex) { string errCode = "GL-1203"; string errMsg = "修改权限组失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); } }
private void btn_OK_Click(object sender, EventArgs e) { try { if (this.txt_GroupName.Text == string.Empty) { ShowMessageBox.ShowInformation("请输入权限组名称!"); return; } if (EditType == 1) { managergroup = new UM_ManagerGroup(); } managergroup.ManagerGroupName = this.txt_GroupName.Text; if (this.listBoxHasRight.Items.Count < 1) { ShowMessageBox.ShowInformation("请选择权限!"); return; } List <UM_ManagerGroupFunctions> l_ManagerGroupFunctions = new List <UM_ManagerGroupFunctions>(); UM_ManagerGroupFunctions ManagerGroupFunction; foreach (object obj in listBoxHasRight.Items) { UComboItem item = (UComboItem)obj; ManagerGroupFunction = new UM_ManagerGroupFunctions(); ManagerGroupFunction.FunctionID = item.ValueIndex; l_ManagerGroupFunctions.Add(ManagerGroupFunction); } if (EditType == 1) { if (ManagerGroupBLL.Add(managergroup, l_ManagerGroupFunctions)) { ShowMessageBox.ShowInformation("添加权限组成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("添加权限组失败!"); } } else { if (ManagerGroupBLL.Update(managergroup, l_ManagerGroupFunctions)) { ShowMessageBox.ShowInformation("修改权限组成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("修改权限组失败!"); } } } catch (Exception ex) { string errCode = "GL-1221"; string errMsg = "保存权限组事件失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); } }