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(raza.Text) && !string.IsNullOrEmpty(edad.Text) && !string.IsNullOrEmpty(razgos.Text) && !string.IsNullOrEmpty(condicion.Text) && !string.IsNullOrEmpty(lugar.Text) && !string.IsNullOrEmpty(nombre.Text))
            {
                if (int.TryParse(nombre.Text, out a))
                {
                    MessageBox.Show("No numeros en nombre");
                }
                else
                {
                    if (int.TryParse(edad.Text, out a))
                    {
                        string ede      = Consultas.contar("mascotas", "ID").ToString();
                        string completo = id.Text + " : " + nombre.Text;
                        string vida     = (edad.Text + " " + tiempo.Text);
                        Consultas.crearRescate(tipo, raza.Text, sex, razgos.Text, condicion.Text, lugar.Text, fecha.Text, vida);
                        Consultas.crearMascota(null, tipo, nombre.Text, sex, vida, fecha.Text, razgos.Text, null, completo, raza.Text, "Rescatado");
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Solo numeros en la edad");
                    }
                }
            }
            else
            {
                MessageBox.Show("Llene todo los campos");
            }
        }