void editData() { int rowIdx = this.dgvMain.CurrentCell == null ? -1 : this.dgvMain.CurrentCell.RowIndex; if (rowIdx < 0) { this.ShowMessage("请指定要修改记录!"); return; } int Key = this.dgvMain["col_Sys_FormRight_FormRightID", rowIdx].Value.ToInt32(); frmSysFormRightEdit frmEdit = new frmSysFormRightEdit(Key); frmEdit.ShowDialog(); }
private void tlbMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { #region 新增 if (e.ClickedItem.Name == "tlbAdd") { frmSysFormRightEdit frmEdit = new frmSysFormRightEdit(-1); frmEdit.ShowDialog(); } #endregion #region 修改 else if (e.ClickedItem.Name == "tlbEdit") { editData(); } #endregion #region 除 if (e.ClickedItem.Name == "tlbDel") { int rowIdx = this.dgvMain.CurrentCell == null ? -1 : this.dgvMain.CurrentCell.RowIndex; if (rowIdx < 0) { this.ShowMessage("请指定要删除记录!"); return; } int _formrightid = this.dgvMain["col_Sys_FormRight_FormRightID", rowIdx].Value.ToInt32(); Sys_FormRightLogic logic = new Sys_FormRightLogic(this); WCFAddUpdateResult rst = logic.DelInfo(new Sys_FormRightParam() { FormRightID = _formrightid }); if (rst.Key > 0) { BindData(1); BindMenuTree(); } } #endregion }