Example #1
0
        private void Ver_Perfil(int num_perfil)
        {
            this.Hide();
            //Editar_Mascota e = new Editar_Mascota(this.id_usuario, num_perfil);
            //e.txtnombre.Text = nombre;
            //e.txtraza.Text = raza;
            //e.txtedad.Text = edad;
            //e.txtcategoria.Text = tipo;
            //e.txtubicacion.Text = ubicacion;
            //e.txthistoria.Text = historia;
            //e.pictureBox4.Image = Base64ToImage(img);
            //e.pictureBox5.Image = Base64ToImage(img);
            //e.Show();
            Perfil_Mascota p         = new Perfil_Mascota(this.id_usuario, num_perfil);
            string         nombre    = bd.selectstring("select nombre from animales where id_animales = " + num_perfil + "");
            string         raza      = bd.selectstring("select raza from animales where id_animales = " + num_perfil + "");
            string         edad      = bd.selectstring("select edad from animales where id_animales = " + num_perfil + "");
            string         tipo      = bd.selectstring("select tipo from animales where id_animales = " + num_perfil + "");
            string         ubicacion = bd.selectstring("select ubicacion from animales where id_animales = " + num_perfil + "");
            string         historia  = bd.selectstring("select informacion from animales where id_animales = " + num_perfil + "");
            string         img       = bd.selectstring("select img from animales where id_animales = " + num_perfil + "");

            p.Text = "        " + nombre;
            p.lblcategoria.Text = tipo;
            p.lbledad.Text      = edad;
            p.lblnombre.Text    = nombre;
            p.lblraza.Text      = raza;
            p.lblubicacion.Text = ubicacion;
            p.lblhistoria.Text  = historia;
            p.pictureBox4.Image = Base64ToImage(img);
            p.pictureBox5.Image = Base64ToImage(img);

            p.Show();
        }
Example #2
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            string modificar = "update animales set nombre ='" + txtnombre.Text + "', img ='" + image64 + "', raza='" + txtraza.Text + "',edad=" + txtedad.Text + ",tipo='" + txtcategoria.Text + "',informacion='" + txthistoria.Text + "',ubicacion='" + txtubicacion.Text + "' where id = " + id_animal + "";

            if (bd.executecommand(modificar))
            {
                MessageBox.Show("modificado");
                Perfil_Mascota p = new Perfil_Mascota(this.id_usuario, this.id_animal);
                p.lblnombre.Text    = txtnombre.Text;
                p.lblraza.Text      = txtraza.Text;
                p.lbledad.Text      = txtedad.Text;
                p.lblcategoria.Text = txtcategoria.Text;
                p.lblubicacion.Text = txtubicacion.Text;
                p.pictureBox4.Image = Image.FromFile(imagen);
                p.pictureBox5.Image = Image.FromFile(imagen);

                p.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("error");
            }
        }
Example #3
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            RadioButton btn = sender as RadioButton;

            if (btn != null && btn.Checked)
            {
                switch (btn.Name)
                {
                case "materialRadioButton1": categoria = 1;
                    break;

                case "materialRadioButton2": categoria = 2;
                    break;

                case "materialRadioButton3": categoria = 3;
                    break;

                case "materialRadioButton4": categoria = 4;
                    break;
                }
            }
            //Acá insertas al sql todo
            if (string.IsNullOrEmpty(txtnombre.Text))
            {
                MessageBox.Show("Debe completar el nombre");
                return;
            }
            if (string.IsNullOrEmpty(txtraza.Text))
            {
                MessageBox.Show("Debe completar el raza");
                return;
            }
            if (string.IsNullOrEmpty(txtedad.Text))
            {
                MessageBox.Show("Debe completar la edad");
                return;
            }
            if (string.IsNullOrEmpty(txthistoria.Text))
            {
                MessageBox.Show("Debe completar la historia");
                return;
            }
            if (string.IsNullOrEmpty(txtubicacion.Text))
            {
                MessageBox.Show("Debe completar la ubicacion");
                return;
            }
            else
            {
                string agregar = "insert into animales (id_cliente,nombre,raza,edad,tipo,informacion,ubicacion,img) values ('" + this.id_usuario + "','" + txtnombre.Text + "','" + txtraza.Text + "'," + txtedad.Text + ",'" + categoria + "','" + txthistoria.Text + "','" + txtubicacion.Text + "', '" + image64 + "')";
                if (am.executecommand(agregar))
                {
                    int id_animales = Int32.Parse(am.selectstring("select id_animales from animales where id_cliente = '" + this.id_usuario + "' and nombre = '" + txtnombre.Text + "' and raza = '" + txtraza.Text + "' and edad = " + txtedad.Text + " and tipo = '" + categoria + "' and informacion = '" + txthistoria.Text + "' and ubicacion = '" + txtubicacion.Text + "' and img = '" + image64 + "'"));
                    MessageBox.Show("El animal se ha puesto en adopción.");
                    Perfil_Mascota p = new Perfil_Mascota(this.id_usuario, id_animales);
                    p.lblnombre.Text    = txtnombre.Text;
                    p.lblraza.Text      = txtraza.Text;
                    p.lbledad.Text      = txtedad.Text;
                    p.lblcategoria.Text = Convert.ToString(categoria);
                    p.lblubicacion.Text = txtubicacion.Text;
                    p.pictureBox4.Image = Image.FromFile(imagen);
                    p.pictureBox5.Image = Image.FromFile(imagen);
                    p.Show();
                }
                else
                {
                    MessageBox.Show("No se pudo agregar correctamente el animal.");
                }
                this.Hide();
            }
        }