示例#1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(opciones.Text))
     {
         string sex;
         long   a;
         if (men.Checked == true)
         {
             sex = "Masculino";
         }
         else
         {
             sex = "Femenino";
         }
         if (!string.IsNullOrEmpty(nombre.Text) && !string.IsNullOrEmpty(aparterno.Text) && !string.IsNullOrEmpty(amaterno.Text) && !string.IsNullOrEmpty(telefono.Text) && !string.IsNullOrEmpty(direccion.Text))
         {
             if (telefono.Text.Length == 10 && long.TryParse(telefono.Text, out a))
             {
                 dt = Consultas.buscarDato("IDDUENIO", "duenio", opciones.Text, "COMPLETO");
                 string completo = nombre.Text + " " + aparterno.Text + " " + amaterno.Text + " :" + dt.Rows[0][0];
                 if (long.TryParse(nombre.Text, out a) && long.TryParse(aparterno.Text, out a) && long.TryParse(amaterno.Text, out a))
                 {
                     MessageBox.Show("No se permiten numeros en algunos campos");
                 }
                 else
                 {
                     Consultas.actualizar_duenio(nombre.Text, aparterno.Text, amaterno.Text, sex, direccion.Text, telefono.Text, nacimineto.Value.ToString("dd/MM/yyyy"), completo, opciones.Text, ciudad.Text);
                 }
             }
             else
             {
                 MessageBox.Show("El telefono debe contener 10 digitos");
             }
         }
         else
         {
             MessageBox.Show("Llene todo los campos");
         }
     }
 }