Exemple #1
0
        private void txt_Phone_TextChanged(object sender, EventArgs e)
        {
            var result = Utilities.EnsureNumericOnly(txt_Phone.Text);

            if (!result)
            {
                lb_DangerPhone.Show(); toolTip.Show("Phone number is not in the right format", lb_DangerPhone);
                return;
            }
            else
            {
                toolTip.Hide(lb_DangerPhone); lb_DangerPhone.Hide();
            }
            if (txt_Phone.Text.Length < 11)
            {
                lb_DangerPhone.Show(); toolTip.Show("Incorrect phone number", lb_DangerPhone);
                return;
            }
            else
            {
                toolTip.Hide(lb_DangerPhone); lb_DangerPhone.Hide();
            }
            if (txt_Phone.Text != currentPhone)
            {
                if (_CustomerRepo.DoesNumberExists(txt_Phone.Text))
                {
                    lb_DangerPhone.Show(); toolTip.Show("Phone number already exists", lb_DangerPhone); isPhoneNoExisting = true;
                }
                else
                {
                    toolTip.Hide(lb_DangerPhone); lb_DangerPhone.Hide(); isPhoneNoExisting = false;
                }
            }
        }