Esempio n. 1
0
 private void GuardarButton_Click(object sender, EventArgs e)
 {
     if (!OrganizacionTextBox.Text.Equals("Ejemplo: SuperMarket Pa' Comer"))
     {
         if (!RepresentanteTextBox.Text.Equals("Ejemplo: Juan Pérez"))
         {
             if (!DireccionTextBox.Text.Equals("Ejemplo: Los Ríos #30, Sto. Dgo."))
             {
                 if (TelefonoMaskedTextBox.MaskFull)
                 {
                     var    telf = TelefonoMaskedTextBox.Text.Split('(', ')', ' ', '-');
                     string Tel  = telf[0].ToString() + telf[1].ToString() + telf[2].ToString();
                     BLL.ClientesBLL.Insertar(new Clientes()
                     {
                         ClienteId     = Convert.ToInt32(ClienteIdTextBox.Text),
                         Organización  = OrganizacionTextBox.Text,
                         Representante = RepresentanteTextBox.Text,
                         Dirección     = DireccionTextBox.Text,
                         Teléfono      = Convert.ToInt64(Tel)
                     });
                     Reiniciar();
                 }
                 else
                 {
                     TelefonoMaskedTextBox.Clear();
                     TelefonoMaskedTextBox.Focus();
                 }
             }
             else
             {
                 DireccionTextBox.Focus();
             }
         }
         else
         {
             RepresentanteTextBox.Focus();
         }
     }
     else
     {
         OrganizacionTextBox.Focus();
     }
 }
Esempio n. 2
0
 private void TelefonoMaskedTextBox_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         OrganizacionTextBox.Focus();
     }
     else
     if (Char.IsDigit(e.KeyChar) || e.KeyChar == (char)Keys.Back)
     {
         if (!TelefonoMaskedTextBox.MaskFull || TelefonoMaskedTextBox.ForeColor == Color.Silver)
         {
             //TelefonoMaskedTextBox.Clear();
             TelefonoMaskedTextBox.ForeColor = Color.Black;
         }
     }
     else
     {
         e.Handled = true;
     }
 }