private void btnAdd_Click(object sender, EventArgs e) { if (tvCustomerClass.SelectedNode == null || tvCustomerClass.SelectedNode.Tag == null) { MessageBoxHelper.ShowWarningMsg("请选择一个分类后再进行添加!"); return; } FrmCustomerEdit frmCustomerEdit = new FrmCustomerEdit(((DataRow)this.tvCustomerClass.SelectedNode.Tag)[CustomerTable.FieldId].ToString().ToString()) { DbLinks = this.DbLinks }; if (frmCustomerEdit.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { this.GetCustomerList(); } }
private void btnEdit_Click(object sender, EventArgs e) { if (dgvCustomer.CurrentCell == null) { return; } string classId = dgvCustomer[CustomerTable.FieldCustomerClassID, dgvCustomer.CurrentCell.RowIndex].Value.ToString(); string customerId = dgvCustomer[CustomerTable.FieldId, dgvCustomer.CurrentCell.RowIndex].Value.ToString(); string shortName = dgvCustomer["colShortName", dgvCustomer.CurrentCell.RowIndex].Value.ToString(); FrmCustomerEdit frmCustomerEdit = new FrmCustomerEdit(classId, customerId, shortName) { DbLinks = this.DbLinks }; if (frmCustomerEdit.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { this.GetCustomerList(); } }