Example #1
0
        private void acept_Click(object sender, EventArgs e)
        {
            string sex, tipo;
            int    a;

            if (men.Checked == true)
            {
                sex = "Macho";
            }
            else
            {
                sex = "Hembra";
            }
            if (dog.Checked == true)
            {
                tipo = "Perro";
            }
            else
            {
                tipo = "Gato";
            }
            if (!string.IsNullOrEmpty(nombre.Text) && !string.IsNullOrEmpty(edad.Text) && !string.IsNullOrEmpty(razgos.Text) && !string.IsNullOrEmpty(tiempo.Text))
            {
                if (int.TryParse(edad.Text, out a))
                {
                    string completo = id.Text + " : " + nombre.Text + " | " + dueño.Text;
                    if (int.TryParse(nombre.Text, out a))
                    {
                        MessageBox.Show("No se permiten numeros el nombre");
                    }
                    else
                    {
                        dt  = Consultas.buscarFila("duenio", "COMPLETO", dueño.Text);
                        idd = dt.Rows[0][0].ToString();
                        string vida = (edad.Text + " " + tiempo.Text);
                        Consultas.crearMascota(id.Text, tipo, nombre.Text, sex, vida, fecha.Text, razgos.Text, dueño.Text, completo, raza.Text, "Mascota");
                        Consultas.crearRelacion(idd, id.Text);
                        if (tipo == "Perro")
                        {
                            Consultas.crearVacuna(id.Text, "detalle_vacuna_perros", "IDPERRO", nombre.Text);
                        }
                        else
                        {
                            Consultas.crearVacuna(id.Text, "detalle_vacuna_gatos", "IDGATO", nombre.Text);
                        }

                        this.Hide();
                    }
                }
                else
                {
                    MessageBox.Show("Solo numeros en la edad");
                }
            }
            else
            {
                MessageBox.Show("Llene todo los campos");
            }
        }