public string CheckHsCode(string hsCode, string title) { if (hsCode == null || "".Equals(hsCode)) { return(title + ERROR_NULL); } BHsCode bHsCode = new BHsCode(); if (bHsCode.Exists(hsCode)) { return(""); } return(title + ERROR_EXIST); }
private void btnSave_Click(object sender, EventArgs e) { if (CheckInput()) { if (_currentHsCodeTable == null) { _currentHsCodeTable = new BaseHsCodeTable(); } _currentHsCodeTable.HS_CODE = txtHsCode.Text; _currentHsCodeTable.HS_NAME = txtHsName.Text; _currentHsCodeTable.TAX_RATE = Convert.ToDecimal(txtTaxRate.Text); _currentHsCodeTable.LAST_UPDATE_USER = _userInfo.CODE; try { if (bHsCode.Exists(txtHsCode.Text.Trim())) { bHsCode.Update(_currentHsCodeTable); } else { _currentHsCodeTable.CREATE_USER = _userInfo.CODE; bHsCode.Add(_currentHsCodeTable); } } catch (Exception ex) { //log.error MessageBox.Show(""); return; } result = DialogResult.OK; this.Close(); } }