private void txtMachineCode_Leave(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtMachineCode.Text.Trim())) { BaseMasterMachineTable MCode = new BaseMasterMachineTable(); MCode = bMasterMachine.GetModel(this.txtMachineCode.Text.Trim()); if (MCode != null) { txtMachineCode.Focus(); txtMachineCode.Text = ""; MessageBox.Show("编号已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
/// <summary> /// 获得当前选中的数据 /// </summary> private void GetCurrentSelectedTable() { try { string code = dgvData.SelectedRows[0].Cells[0].Value.ToString(); if (code != "") { _currentMasterMachineTable = bMasterMachine.GetModel(code); } } catch (Exception ex) { } if (_currentMasterMachineTable == null || _currentMasterMachineTable.MACHINE_CODE == null || "".Equals(_currentMasterMachineTable.MACHINE_CODE)) { _currentMasterMachineTable = null; } }