Esempio n. 1
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         if (dataGridView1.CurrentRow.Cells["Grupo"].Value.ToString().Equals("Sin Grupo"))
         {
             Reportes.CedulaReporte r = new Reportes.CedulaReporte((int)dataGridView1.CurrentRow.Cells["ID Cedula"].Value);
             r.ShowDialog();
         }
         else
         {
             Reportes.CedulaForza r = new Reportes.CedulaForza((int)dataGridView1.CurrentRow.Cells["ID Cedula"].Value);
             r.ShowDialog();
         }
     }
     catch { }
 }
        private void btnSiguiente_Click(object sender, EventArgs e)
        {
            if (segundoPanel.Visible == true)
            {
                DialogResult result = MessageBox.Show("Desea Crear esta cedula de Aplicacion", "Crear Cedula", MessageBoxButtons.YesNoCancel);
                if (result == DialogResult.Yes)
                {
                    try {
                        DAO.CedulaIdentidad.insertarCedula(new Entidades.CedulaIdentidad()
                        {
                            FechaProgramada       = DateTime.Parse(lblFechaProgramada.Text),
                            JustMuestreo          = chkMuestreo.Checked,
                            JustProgramacion      = chkJustificacion.Checked,
                            LtsRequeridos         = Double.Parse(txtAguaRequerida.Text),
                            TotalLtsRequeridos    = Double.Parse(lblTotalLitros.Text),
                            TotalBoonesRequeridos = Double.Parse(lblTotalboones.Text),
                            Cultivo          = cmbCultivo.Text,
                            Chofer           = comboChofer.Text,
                            NumSpray         = comboSpray.Text,
                            NumTractor       = comboTractor.Text,
                            NombreAplicacion = lblAplicacion.Text,
                            Posicion         = int.Parse(lblCiclo.Text),
                            AreaTotal        = Double.Parse(lblAreaTotal.Text),
                            FechaCreacion    = DateTime.Today.Date,
                            Lote             = lblLote.Text,
                            IdAplicacion     = id,
                            CostoTotal       = double.Parse(lblCosto.Text),
                            GrupoForza       = lblGrupo.Text,
                            Etapa            = etapa.Text,
                            PeriodoReingreso = obtenerMayor("P.Reing(H)"),
                            InterCosecha1    = obtenerMayor("InterCosecha"),
                            PeriodoCosecha   = getPeriodoCosecha()
                        });
                        guardarDetalleProductos();
                        guardarDetalleSeccion();
                        guardarDetalleSpray();
                        MessageBox.Show("Cedula Creada Correctamente");
                        if (lblGrupo.Text.Equals("Sin Grupo"))
                        {
                            Reportes.CedulaReporte r = new Reportes.CedulaReporte(DAO.CedulaIdentidad.obtenerUltimoDato());
                            r.ShowDialog();
                        }
                        else
                        {
                            Reportes.CedulaForza r = new Reportes.CedulaForza(DAO.CedulaIdentidad.obtenerUltimoDato());
                            r.ShowDialog();
                        }



                        this.anterior.Dispose();
                        this.Dispose();
                    }


                    catch (Exception ex) {
                    }
                }
            }
            if (primerPanel.Visible == true)
            {
                if (segundoPanel.Visible == true)
                {
                    DAO.CedulaIdentidad.insertarCedula(new Entidades.CedulaIdentidad()
                    {
                        FechaProgramada  = DateTime.Parse(lblFechaProgramada.Text),
                        JustMuestreo     = chkMuestreo.Checked,
                        JustProgramacion = chkJustificacion.Checked,
                        Cultivo          = cmbCultivo.Text,
                        Chofer           = comboChofer.Text,
                        NumSpray         = comboSpray.Text,
                        NumTractor       = comboTractor.Text,
                        NombreAplicacion = lblAplicacion.Text,
                        Posicion         = int.Parse(lblCiclo.Text)
                    });
                    guardarDetalleProductos();
                    guardarDetalleSeccion();
                }
                if (primerPanel.Visible == true)
                {
                    segundoPanel.Visible = true;
                    primerPanel.Visible  = false;
                }
            }
        }