Ejemplo n.º 1
0
        public void CargarGrilla()
        {
            try
            {
                EventoAnimal_DescSubevento_Negocio eventoAnimalDescNegocio = new EventoAnimal_DescSubevento_Negocio();


                this.dgvEventos.DataSource = eventoAnimalDescNegocio.RecuperarSoloEventosPorTambo(Principal.Tambo.Id_tambo);

                if (this.dgvEventos.Rows.Count != 0 && this.dgvEventos.Rows != null)
                {
                    this.btnExportar.Enabled = true;
                    this.btnEliminar.Enabled = true;
                }
                else
                {
                    this.btnExportar.Enabled = false;
                    this.btnEliminar.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 2
0
 private void txtBuscar_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         EventoAnimal_DescSubevento_Negocio eventoNegocio = new EventoAnimal_DescSubevento_Negocio();
         if (this.cbBuscar.SelectedIndex == -1)
         {
             this.txtBuscar.Enabled = false;
             //MessageBox.Show("Debe seleccionar un parámetro a buscar en el combo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else if (this.cbBuscar.SelectedItem.ToString() == "Nombre animal")
         {
             this.dgvEventos.DataSource = eventoNegocio.FiltrarPorNombreAnimal(this.txtBuscar.Text, idtambo);
         }
         else if (this.cbBuscar.SelectedItem.ToString() == "Evento")
         {
             this.dgvEventos.DataSource = eventoNegocio.FiltrarPorNombreEvento(this.txtBuscar.Text, idtambo);
         }
         else if (this.cbBuscar.SelectedItem.ToString() == "Caravana")
         {
             this.dgvEventos.DataSource = eventoNegocio.FiltrarPorCaravana(this.txtBuscar.Text, idtambo);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
     }
 }
Ejemplo n.º 3
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                EventoAnimal_DescSubevento_Negocio eventoNegocio = new EventoAnimal_DescSubevento_Negocio();
                int id_evento = Convert.ToInt32(this.dgvEventos.CurrentRow.Cells["id_evento"].Value);
                int rp        = Convert.ToInt32(this.dgvEventos.CurrentRow.Cells["rp"].Value);


                DateTime     fecha_desc    = Convert.ToDateTime(this.dgvEventos.CurrentRow.Cells["fecha_desc"].Value);
                bool         estado_evento = false;
                int          id_tambo      = Convert.ToInt32(this.dgvEventos.CurrentRow.Cells["id_tambo"].Value);
                DateTime     fecha         = Convert.ToDateTime(this.dgvEventos.CurrentRow.Cells["fecha_desc"].Value);
                DialogResult result        = MessageBox.Show("¿Está seguro que desea eliminar el evento?", "Verificación", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    eventoNegocio.Eliminar(estado_evento, id_evento, rp, fecha_desc);
                    this.CargarGrilla();
                    MessageBox.Show("El evento fue eliminado", "Eliminación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 4
0
        private void dgvEventos_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //if (e.ColumnIndex == 0)
            //{
            try
            {
                if (this.dgvEventos.Rows.Count != 0 && this.dgvEventos.Rows != null)
                {
                    int      id_tambo  = Principal.Tambo.Id_tambo;
                    int      rp        = Convert.ToInt32(this.dgvEventos.CurrentRow.Cells["rp"].Value);
                    int      id_evento = Convert.ToInt32(this.dgvEventos.CurrentRow.Cells["id_evento"].Value);
                    DateTime fecha     = Convert.ToDateTime(this.dgvEventos.CurrentRow.Cells["fecha_desc"].Value);

                    DetalleEventos detalle = new DetalleEventos();
                    EventoAnimal_DescSubevento_Negocio eventoAnimalDescNegocio = new EventoAnimal_DescSubevento_Negocio();
                    detalle.dgvDetalles.DataSource = eventoAnimalDescNegocio.RecuperarDescripcionesPorEvento(id_tambo, rp, id_evento, fecha);
                    detalle.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
            }
            //}
        }
Ejemplo n.º 5
0
 private void vpEventos_Animal_Load(object sender, EventArgs e)
 {
     try
     {
         if (Animal == null)
         {
             EventoAnimal_DescSubevento_Negocio eventoAnimalDescNegocio = new EventoAnimal_DescSubevento_Negocio();
             rptEvento_Animal reporte = new rptEvento_Animal();
             reporte.SetParameterValue("@id_tambo", Principal.Tambo.Id_tambo);
             reporte.SetDatabaseLogon("abcd", "123456");
             crvEvento_Animal.ReportSource = reporte;
         }
         else
         {
             EventoAnimal_DescSubevento_Negocio eventoAnimalDescNegocio = new EventoAnimal_DescSubevento_Negocio();
             rptEventoXAnimal reporte = new rptEventoXAnimal();
             reporte.SetParameterValue("@id_tambo", Principal.Tambo.Id_tambo);
             reporte.SetParameterValue("@rp", Animal.Rp);
             reporte.SetDatabaseLogon("abcd", "123456");
             crvEvento_Animal.ReportSource = reporte;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
     }
 }
Ejemplo n.º 6
0
 public ReporteReproduccion(int id_tambo)
 {
     InitializeComponent();
     CargarTextBoxTambo(id_tambo);
     eventoNegocio = new EventoAnimal_DescSubevento_Negocio();
     //CargarGrilla(id_tambo);
     //CargarCantidadCrias(id_tambo);
 }
Ejemplo n.º 7
0
 private void tstxtBuscar_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         EventoAnimal_DescSubevento_Negocio eventoNegocio = new EventoAnimal_DescSubevento_Negocio();
         this.dgvEventos.DataSource = eventoNegocio.FiltrarPorNombreEvento(this.tstxtBuscar.Text, idtambo);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
     }
 }
Ejemplo n.º 8
0
        private void vpHistoriaClinica_Load(object sender, EventArgs e)
        {
            try
            {
                EventoAnimal_DescSubevento_Negocio eventoNegocio = new EventoAnimal_DescSubevento_Negocio();
                rptHistoriaClinica reporte = new rptHistoriaClinica();

                reporte.SetDataSource(eventoNegocio.RecuperarDTPorTamboYAnimal(Principal.Tambo.Id_tambo, rp));
                crvHistoriaClinica.ReportSource = reporte;
                crvHistoriaClinica.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 9
0
 private void vpListadoEventos_Load(object sender, EventArgs e)
 {
     try
     {
         EventoAnimal_DescSubevento_Negocio eventoAnimalDescNegocio = new EventoAnimal_DescSubevento_Negocio();
         rptListadoEventos reporte = new rptListadoEventos();
         //GrupoPrueba reporte = new GrupoPrueba();
         reporte.SetDataSource(eventoAnimalDescNegocio.RecuperarDTPorTambo(idtambo));
         crvEventos.ReportSource = reporte;
         crvEventos.Refresh();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
     }
 }
Ejemplo n.º 10
0
 public void CargarGrilla(int id_tambo)
 {
     try
     {
         //EventoAnimal_DescSubevento_Negocio eventoAnimalDescNegocio = new EventoAnimal_DescSubevento_Negocio();
         //this.dgvEventos.DataSource = eventoAnimalDescNegocio.RecuperarPorTambo(id_tambo);
         EventoAnimal_DescSubevento_Negocio eventoAnimalDescNegocio = new EventoAnimal_DescSubevento_Negocio();
         this.dgvEventos.AutoGenerateColumns = false;
         this.dgvEventos.DataSource          = eventoAnimalDescNegocio.RecuperarSoloEventosPorTambo(id_tambo);
         //gvEventos.Columns[0].HeaderText = "TextoAMostrarEnLaCabecera";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
     }
 }
Ejemplo n.º 11
0
        private void vpReproduccion_Load(object sender, EventArgs e)
        {
            try
            {
                EventoAnimal_DescSubevento_Negocio eventoAnimalDescNegocio = new EventoAnimal_DescSubevento_Negocio();
                rptReproduccion reporte = new rptReproduccion();
                dsTamboSoft     ds      = new dsTamboSoft();

                reporte.SetDataSource(eventoAnimalDescNegocio.ReporteReproduccion(idtambo));
                crvReproduccion.ReportSource = reporte;
                crvReproduccion.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 12
0
 private void eventosToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         EventoAnimal_DescSubevento_Negocio eventoNegocio = new EventoAnimal_DescSubevento_Negocio();
         if (eventoNegocio.HayEventos(Principal.Tambo.Id_tambo))
         {
             ListadoEventos listadoEventos = new ListadoEventos(id_tambo);
             listadoEventos.idtambo = id_tambo;
             listadoEventos.ShowDialog();
         }
         else
         {
             MessageBox.Show("El tambo no posee eventos", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
     }
 }
Ejemplo n.º 13
0
        private void dgvAnimales_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == 19)
                {
                    if (this.dgvAnimales.Rows.Count != 0 && this.dgvAnimales.Rows != null)
                    {
                        if (eventoNegocio.TieneEventos(Convert.ToInt32(this.dgvAnimales.CurrentRow.Cells["rp"].Value)))
                        {
                            int id_tambo = Principal.Tambo.Id_tambo;
                            int rp       = Convert.ToInt32(this.dgvAnimales.CurrentRow.Cells["rp"].Value);

                            HistoriaClinica historiaClinica = new HistoriaClinica();
                            EventoAnimal_DescSubevento_Negocio eventoAnimalDescNegocio = new EventoAnimal_DescSubevento_Negocio();

                            historiaClinica.dgvHistorialClinico.DataSource = eventoAnimalDescNegocio.RecuperarPorTamboYAnimal(id_tambo, rp);
                            historiaClinica.Show();
                        }
                        else
                        {
                            MessageBox.Show("El animal no posee historia clínica", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else if (e.ColumnIndex == 20)
                {
                    if (this.dgvAnimales.Rows.Count != 0 && this.dgvAnimales.Rows != null)
                    {
                        if (controlNegocio.TieneControles(Convert.ToInt32(this.dgvAnimales.CurrentRow.Cells["rp"].Value)))
                        {
                            int id_tambo = Principal.Tambo.Id_tambo;
                            int rp       = Convert.ToInt32(this.dgvAnimales.CurrentRow.Cells["rp"].Value);

                            HistorialProduccion    historialProd        = new HistorialProduccion();
                            Control_Animal_Negocio controlAnimalNegocio = new Control_Animal_Negocio();
                            historialProd.dgvHistorialProduccion.DataSource = controlAnimalNegocio.RecuperarPorTamboYAnimal(id_tambo, rp);
                            historialProd.Show();
                        }
                        else
                        {
                            MessageBox.Show("El animal no posee historial de producción", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK);
            }

            //else if (e.ColumnIndex == 1)
            //{
            //    if (this.dgvAnimales.Rows.Count != 0 && this.dgvAnimales.Rows != null)
            //    {
            //        int id_tambo = Principal.Tambo.Id_tambo;
            //        int rp = Convert.ToInt32(this.dgvAnimales.CurrentRow.Cells["rp"].Value);

            //        HistorialProduccion historialProd = new HistorialProduccion();
            //        Control_Animal_Negocio controlAnimalNegocio = new Control_Animal_Negocio();
            //        historialProd.dgvHistorialProduccion.DataSource = controlAnimalNegocio.RecuperarPorTamboYAnimal(id_tambo, rp);
            //        historialProd.Show();
            //    }
            //}
        }