Пример #1
0
        public Animal MapearAAnimal()
        {
            Raza_Negocio  razaNegocio  = new Raza_Negocio();
            Tambo_Negocio tamboNegocio = new Tambo_Negocio();
            Raza          raza         = razaNegocio.RecuperarUno(Convert.ToInt32(cbRaza.SelectedValue));
            Tambo         tambo        = tamboNegocio.RecuperarPorNombre(txtTambo.Text);
            Animal        animal       = new Animal();

            animal.Rp = Convert.ToInt32(txtRP.Text);
            animal.Fecha_nacimiento = dtpFechaNacimiento.Value.Date;

            //animal.Foto = txtFoto.Text;
            animal.Nombre_animal = txtNombre.Text;
            animal.Estado_animal = cbEstado.SelectedItem.ToString();
            animal.Hba           = Convert.ToInt32(txtHBA.Text);
            animal.Id_Categoria  = ((Categoria)cbCategoria.SelectedItem).Id_Categoria;
            //animal.Sexo = cbSexo.SelectedItem.ToString();
            animal.Rp_madre   = Convert.ToInt32(txtRPMadre.Text);
            animal.Rp_padre   = Convert.ToInt32(txtRPPadre.Text);
            animal.Hba_madre  = Convert.ToInt32(txtHBAMadre.Text);
            animal.Hba_padre  = Convert.ToInt32(txtHBAPadre.Text);
            animal.Id_tambo   = tambo.Id_tambo;
            animal.Id_raza    = raza.Id_raza;
            animal.Habilitado = true;
            animal.Caravana   = txtCaravana.Text;

            return(animal);
        }
Пример #2
0
 private void btnNuevo_Click(object sender, EventArgs e)
 {
     try
     {
         Tambo         tambo        = new Tambo();
         Tambo_Negocio tamboNegocio = new Tambo_Negocio();
         tambo = tamboNegocio.RecuperarPorNombre(this.txtTambo.Text);
         AltaPersonal altaPersonal = new AltaPersonal(tambo.Id_tambo);
         altaPersonal.ShowDialog();
         CargarGrilla(idtambo);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
     }
 }
Пример #3
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         Tambo_Negocio tamboNegocio = new Tambo_Negocio();
         Tambo         tambo        = tamboNegocio.RecuperarPorNombre(this.txtNombreTambo.Text);
         DialogResult  result       = MessageBox.Show("ATENCIÓN!! Al eliminar el tambo " + tambo.Nombre_tambo + ", eliminará todo su personal, animales, controles y eventos asociados. ¿Desea continuar?", "Verificación", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (result == DialogResult.Yes)
         {
             tamboNegocio.Eliminar(tambo.Id_tambo);
             MessageBox.Show("El tambo " + tambo.Nombre_tambo + " fue eliminado", "Eliminación", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Application.Exit();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
     }
 }
Пример #4
0
        private void cbFiltro_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                Animal_Negocio animalNegocio = new Animal_Negocio();
                Tambo_Negocio  tamboNegocio  = new Tambo_Negocio();
                Tambo          tambo         = new Tambo();

                tambo = tamboNegocio.RecuperarPorNombre(this.txtTambo.Text);
                if (this.cbFiltro.SelectedIndex == -1)
                {
                    this.dgvEventos.DataSource = animalNegocio.RecuperarPorTambo(Principal.Tambo.Id_tambo);
                    if (this.dgvEventos.Rows.Count != 0 && this.dgvEventos.Rows != null)
                    {
                        this.btnExportar.Enabled = true;
                    }
                    else
                    {
                        this.btnExportar.Enabled = false;
                    }
                }
                else if (this.cbFiltro.SelectedItem.ToString() == "Vacas en celo")
                {
                    this.dgvEventos.DataSource = animalNegocio.RecuperarVacasEnCeloPorTambo(tambo.Id_tambo);
                    if (this.dgvEventos.Rows.Count != 0 && this.dgvEventos.Rows != null)
                    {
                        this.btnExportar.Enabled = true;
                    }
                    else
                    {
                        this.btnExportar.Enabled = false;
                    }
                }
                else if (this.cbFiltro.SelectedItem.ToString() == "Animales enfermos")
                {
                    this.dgvEventos.DataSource = animalNegocio.RecuperarAnimalesEnfermosPorTambo(tambo.Id_tambo);
                    if (this.dgvEventos.Rows.Count != 0 && this.dgvEventos.Rows != null)
                    {
                        this.btnExportar.Enabled = true;
                    }
                    else
                    {
                        this.btnExportar.Enabled = false;
                    }
                }
                else if (this.cbFiltro.SelectedItem.ToString() == "Vacas con parto en los últimos 21 días")
                {
                    this.dgvEventos.DataSource = animalNegocio.RecuperarVacasConPartoPorTambo(tambo.Id_tambo);
                    if (this.dgvEventos.Rows.Count != 0 && this.dgvEventos.Rows != null)
                    {
                        this.btnExportar.Enabled = true;
                    }
                    else
                    {
                        this.btnExportar.Enabled = false;
                    }
                }
                else if (this.cbFiltro.SelectedItem.ToString() == "Vacas servidas en los últimos 21 días")
                {
                    this.dgvEventos.DataSource = animalNegocio.RecuperarVacasServidasPorTambo(tambo.Id_tambo);
                    if (this.dgvEventos.Rows.Count != 0 && this.dgvEventos.Rows != null)
                    {
                        this.btnExportar.Enabled = true;
                    }
                    else
                    {
                        this.btnExportar.Enabled = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
            }
        }