protected void Registrar_SEGUIMIENTO() { int aux1 = 0; DB_EXT_DesignacionProd estadoprod = new DB_EXT_DesignacionProd(); DB_AP_Registro_Org aux = new DB_AP_Registro_Org(); DB_EXT_Seguimiento insSeg = new DB_EXT_Seguimiento(); EXT_Seguimiento seg = new EXT_Seguimiento(); EXT_SeguimientoParcela segParc = new EXT_SeguimientoParcela(); seg.Id_InscripcionOrg = Convert.ToInt32(LblIdInsOrg.Text); seg.Id_Usuario = LblIdUsuario.Text; seg.Id_Productor = LblIdInsProd.Text; seg.Id_Campanhia = Convert.ToInt32(LblIdCamp.Text); seg.Id_Regional = Convert.ToInt32(LblIdReg.Text); seg.Programa = LblProg.Text; if (DDLFenologia.SelectedItem.Text == "COSECHA Y ACOPIO") /*************HAY QUE TRABAJAR AQUI MAÑANA*********************************/ { LblEtapa.Text = "VERIFICACION_COSECHA"; } seg.Etapa = LblEtapa.Text; if (LblEtapa.Text == "VERIFICACION_PARCELA") { seg.Num_Seg_Cultivo = 0; } else { seg.Num_Seg_Cultivo = 1; } seg.Estado = "ENVIADO"; seg.Fecha_Envio = DateTime.Now; seg.Tipo_Seguimiento = Convert.ToInt32(DDLTipoSeg.SelectedValue); insSeg.DB_Registrar_SEGUIMIENTO(seg); segParc.Id_Seguimiento = Convert.ToInt32(aux.DB_MaxId("EXT_SEGUIMIENTO", "Id_Seguimiento")); if (Convert.ToInt32(DDLTipoSeg.SelectedValue) == 1) { segParc.Boleta_Numero = Convert.ToInt32(aux.DB_MaxId("EXT_SEGUIMIENTO_PARCELA", "Id_Seguimiento_Parcela")) + 1; } else { segParc.Boleta_Numero = Convert.ToInt32(TxtNumBoleta.Text); } segParc.Fecha_Seg = Convert.ToDateTime(TxtFecha.Text); DateTime t = DateTime.Now; segParc.Hora_Seg = t.Hour.ToString() + ":" + t.Minute.ToString(); //segParc.Hora_Seg = DDLHora.SelectedValue + ":" + DDLMinuto.SelectedValue; segParc.Fecha_Sis = DateTime.Now; segParc.Observacion = TxtObser.Text; segParc.Recomendacion = TxtRecomen.Text; insSeg.DB_Registrar_SEGUIMIENTO_PARCELA(segParc); EXT_SeguimientoCoordenadas scor = new EXT_SeguimientoCoordenadas(); EXT_SeguimientoSiembra ss = new EXT_SeguimientoSiembra(); EXT_SeguimientoCultivo sc = new EXT_SeguimientoCultivo(); EXT_AdversidadPresentada ad = new EXT_AdversidadPresentada(); /***********************************************************************/ DataTable dt = Session["datos"] as DataTable; int id = 0; id = Convert.ToInt32(aux.DB_MaxId("EXT_SEGUIMIENTO_PARCELA", "Id_Seguimiento_Parcela")); for (int i = 0; i < dt.Rows.Count; i++) { sc.Id_Seguimiento_Parcela = id; sc.Id_Fenologia = Convert.ToInt32(dt.Rows[i][0].ToString()); sc.Estado = dt.Rows[i][2].ToString(); if (dt.Rows[i][1].ToString() == "FECHA COSECHA PROBABLE") { sc.Porcentaje_FF = 0; sc.Fecha_Cosecha = Convert.ToDateTime(dt.Rows[i][4].ToString()); } else { sc.Porcentaje_FF = Convert.ToInt32(dt.Rows[i][3].ToString()); sc.Fecha_Cosecha = Convert.ToDateTime("01/01/1900"); } insSeg.DB_Registrar_SEGUIMIENTO_CULTIVO(sc); estadoprod.DB_Cambiar_ESTADO(LblIdInsProd.Text, "VERIFICACION_CULTIVO"); } if (LblEtapa.Text == "VERIFICACION_COSECHA") { EXT_SeguimientoCosecha cos = new EXT_SeguimientoCosecha(); cos.Id_Seguimiento_Parcela = id; cos.Rendimiento = Convert.ToDecimal(TxtRedimiento.Text); cos.Sup_Sembrada = Convert.ToDecimal(TxtSupSiem.Text); cos.Peso_Aproximado = Convert.ToDecimal(TxtPesoApro.Text); cos.Fecha_Siembra = Convert.ToDateTime(TxtFechSiem.Text); cos.Placa_Camion = TxtPlacaCam.Text; cos.Nom_Chofer = TxtNomChofer.Text; cos.Centro_Acopio = TxtCentroAco.Text; cos.Region = ""; insSeg.DB_Registrar_DATOS_COSECHA(cos); } if (GVAdversidad.Rows.Count > 0) { foreach (GridViewRow dgi in GVAdversidad.Rows) { ad.Id_Seguimiento_Parcela = id; ad.Adversidad = GVAdversidad.Rows[dgi.RowIndex].Cells[0].Text; ad.Descripcion = GVAdversidad.Rows[dgi.RowIndex].Cells[1].Text; ad.Intencidad = GVAdversidad.Rows[dgi.RowIndex].Cells[2].Text; ad.Porcentage = Convert.ToDecimal(GVAdversidad.Rows[dgi.RowIndex].Cells[3].Text); ad.Tratamiento = GVAdversidad.Rows[dgi.RowIndex].Cells[4].Text; insSeg.DB_Registrar_ADVESIDAD(ad); } } }