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_CredentialCodeRule_RuleID", rowIdx].Value.ToInt32(); frmCodeRuleEdit frmEdit = new frmCodeRuleEdit(Key); frmEdit.ShowDialog(); }
private void tlbMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { #region 新增 if (e.ClickedItem.Name == "tlbAdd") { frmCodeRuleEdit frmEdit = new frmCodeRuleEdit(-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 _ruleID = this.dgvMain["col_SYS_CredentialCodeRule_RuleID", rowIdx].Value.ToInt32(); SYS_CredentialCodeRuleLogic logic = new SYS_CredentialCodeRuleLogic(this); WCFAddUpdateResult rst = logic.DelInfo(new SYS_CredentialCodeRuleParam() { RuleID = _ruleID }); if (rst.Key > 0) { BindData(this.pagMain.PageIndex); } } #endregion }