Exemple #1
0
 private void txtCode_Leave(object sender, EventArgs e)
 {
     // Check if entered code already exists
     if (txtCode.ReadOnly)
     {
         return;
     }
     if (AccountFacade.Exists(txtCode.Text.Trim()))
     {
         MessageFacade.Show(this, ref fMsg, LabelFacade.sy_msg_prefix + MessageFacade.code_already_exists, LabelFacade.sy_location);
     }
 }
Exemple #2
0
        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 (AccountFacade.Exists(Code, Id))
            {
                sMsg.AppendLine(LabelFacade.sy_msg_prefix + MessageFacade.code_already_exists);
                cFocus = txtCode;
            }
            if (cboNormalBalance.SelectedIndex == -1)
            {
                sMsg.AppendLine(LabelFacade.sy_msg_prefix + MessageFacade.location_type_not_empty);
                if (cFocus == null)
                {
                    cFocus = cboNormalBalance;
                }
            }
            if (txtEmail.Text.Length > 0 && !Util.IsEmailValid(txtEmail.Text))
            {
                sMsg.AppendLine(LabelFacade.sy_msg_prefix + MessageFacade.email_not_valid);
                if (cFocus == null)
                {
                    cFocus = txtEmail;
                }
            }
            if (sMsg.Length > 0)
            {
                MessageFacade.Show(this, ref fMsg, sMsg.ToString(), LabelFacade.sy_save);
                //fMsg.Show(sMsg.ToString(), LabelFacade.sy_save, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                cFocus.Focus();
                return(false);
            }
            return(true);
        }