private void txtHsCode_Leave(object sender, EventArgs e) { //判断编号是否已存在 if (!string.IsNullOrEmpty(this.txtHsCode.Text.Trim())) { BaseHsCodeTable HsCode = new BaseHsCodeTable(); HsCode = bHsCode.GetModel(txtHsCode.Text); if (HsCode != null) { txtHsCode.Focus(); txtHsCode.Text = ""; MessageBox.Show("编号已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
/// <summary> /// 获得当前选中的数据 /// </summary> private void GetCurrentSelectedTable() { try { string code = dgvData.SelectedRows[0].Cells["HS_CODE"].Value.ToString(); if (code != "") { _currentHsCodeTable = bHsCode.GetModel(code); } } catch (Exception ex) { } if (_currentHsCodeTable == null || _currentHsCodeTable.HS_CODE == null || "".Equals(_currentHsCodeTable.HS_CODE)) { _currentHsCodeTable = null; } }
private void txtHsCode_Leave(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtHsCode.Text.Trim())) { BaseHsCodeTable HsCode = new BaseHsCodeTable(); BHsCode bHsCode = new BHsCode(); HsCode = bHsCode.GetModel(this.txtHsCode.Text); if (HsCode == null || "".Equals(HsCode)) { txtHsCode.Focus(); txtHsCode.Text = ""; txtHsName.Text = ""; MessageBox.Show("海关编号不存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { txtHsName.Text = HsCode.HS_NAME; } } }