private bool IsValidated() { var sMsg = new StringBuilder(); Control cFocus = null; string Code = txtCode.Text.Trim(); if (Code.Length == 0) { sMsg.AppendLine(LabelFacade.sy_msg_prefix + MessageFacade.code_not_empty); cFocus = txtCode; } else if (UnitMeasureFacade.Exists(Code, Id)) { sMsg.AppendLine(LabelFacade.sy_msg_prefix + MessageFacade.code_already_exists); cFocus = txtCode; } if (!Util.IsDecimal(txtFactor.Text)) // Factor { sMsg.AppendLine(LabelFacade.sy_msg_prefix + MessageFacade.location_factor_not_number); cFocus = txtFactor; } if (sMsg.Length > 0) { MessageFacade.Show(this, ref fMsg, sMsg.ToString(), LabelFacade.sy_save); cFocus.Focus(); return(false); } return(true); }
private void txtCode_Leave(object sender, EventArgs e) { // Check if entered code already exists if (txtCode.ReadOnly) { return; } if (UnitMeasureFacade.Exists(txtCode.Text.Trim())) { MessageFacade.Show(this, ref fMsg, LabelFacade.sy_msg_prefix + MessageFacade.code_already_exists, LabelFacade.sy_unit_measure); } }