예제 #1
0
        private void cuitWaterMarkTextBox_Validating(object sender, CancelEventArgs e)
        {
            string error = null;

            if (!Validacion.esNumeroCUIT(cuitWaterMarkTextBox))
            {
                cuitWaterMarkTextBox.BackColor = Color.White;
                error    = "Ingrese el numero de CUIL/CUIT, solo 11 numeros";
                e.Cancel = true;
                errorProvider1.SetError((Control)sender, error);
            }
            else if (DatosCliente.existeClienteC(id, cuitWaterMarkTextBox.Text))
            {
                cuitWaterMarkTextBox.BackColor = colorOk;
                errorProvider1.SetError(cuitWaterMarkTextBox, String.Empty);
            }
            else if (DatosCliente.existeC(cuitWaterMarkTextBox.Text))
            {
                cuitWaterMarkTextBox.BackColor = Color.White;
                error    = "El numero de CUIL/CUIT ya existe";
                e.Cancel = true;
                errorProvider1.SetError((Control)sender, error);
            }
            else
            {
                cuitWaterMarkTextBox.BackColor = colorOk;
                errorProvider1.SetError((Control)sender, String.Empty);
            }
        }