Example #1
0
 //*
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtName.Text.Length > 0 && txtApel.Text.Length > 0 && txtEdad.Text.Length > 0 &&
         txtTel.Text.Length > 0 && CBEspel.Text.Length > 0 &&
         txtUser.Text.Length > 0 && txtPass.Text.Length > 0 &&
         h.TelFormat(txtTel.Text))
     {
         pasarDatos();
         if (v == -1)
         {
             if (consul.UserExits(txtUser.Text.Trim()) == false)
             {
                 consul.AddUser(user);
                 Limpiar();
             }
             else
             {
                 MessageBox.Show("ERROR\n\nYa existe ese Usuario en la Base de datos");
             }
         }
         else
         {
             if (CBEstado.SelectedIndex == 0 || CBEstado.SelectedIndex == 1)
             {
                 consul.UpdateUser(user);
             }
             else
             {
                 MessageBox.Show("ERROR\n\nEscoga un estado para el Usuario");
             }
         }
     }
     else
     {
         MessageBox.Show("ERROR\n\nLlene todos los campos requeridos correctamente");
     }
 }