//--------------------------------------------FIN 48PAPAS----------------------------------------------------------- //--------------------------------------------INICIO METODOS COMUNES------------------------------------------------ /* * Devuelve id_cosecha, madre, padre, posicion, individuo y destino para las distintas temporadas */ public List <Cosecha> GetTablaCosecha(int año, int id_temporada) { try { DataAccess.DataBase bd = new DataBase(); bd.Connect(); //método conectar List <Cosecha> cosecha6papas = new List <Cosecha>(); string salida = "cosechaTablaObtener"; //comando sql bd.CreateCommandSP(salida); bd.CreateParameter("@ano_cosecha", DbType.Int32, año); bd.CreateParameter("@id_temporada", DbType.Int32, id_temporada); DbDataReader resultado = bd.Query();//disponible resultado while (resultado.Read()) { Cosecha cos = new Cosecha(resultado.GetInt32(0), resultado.GetString(1), resultado.GetString(2), resultado.GetString(3), resultado.GetString(4), resultado.GetDouble(5), resultado.GetString(6), resultado.GetString(7)); cosecha6papas.Add(cos); } resultado.Close(); bd.Close(); return(cosecha6papas); } catch (Exception e) { throw new Exception(e.ToString()); } }
/* * Devuelve el nombre de la enfermedad y resistencia de la variedad en la cosecha seleccionada */ public List <Cosecha> GetCosechaEnfermedades(int id_cosecha) { try { DataAccess.DataBase bd = new DataBase(); bd.Connect(); //método conectar List <Cosecha> enfermedades = new List <Cosecha>(); string salida = "cosechaEnfermedadesObtener"; //comando sql bd.CreateCommandSP(salida); bd.CreateParameter("@id_cosecha", DbType.Int32, id_cosecha); DbDataReader resultado = bd.Query();//disponible resultado while (resultado.Read()) { Cosecha color = new Cosecha(resultado.GetString(0), resultado.GetString(1)); enfermedades.Add(color); } resultado.Close(); bd.Close(); return(enfermedades); } catch (Exception e) { throw new Exception(e.ToString()); } }
/* * Actualizar la variedad en 6 papas, devuelve 1 si actualizó, 0 en caso contrario */ public int UpdateCosecha6papas(Cosecha c) { try { DataAccess.DataBase bd = new DataBase(); bd.Connect(); //método conectar string sql = "cosecha6papasActualizar"; bd.CreateCommandSP(sql); bd.CreateParameter("@id_cosecha", DbType.Int32, c.Id_cosecha); bd.CreateParameter("@cantidad_papas", DbType.Int32, c.Cantidad_papas); bd.CreateParameter("@posicion_cosecha", DbType.Double, c.Posicion_cosecha); bd.CreateParameter("@flor_cosecha", DbType.Boolean, c.Flor_cosecha); bd.CreateParameter("@bayas_cosecha", DbType.Boolean, c.Bayas_cosecha); bd.CreateParameter("@id_fertilidad", DbType.Int32, c.Id_fertilidad); bd.CreateParameter("@id_emergencia40", DbType.Int32, c.Id_emergencia_40_dias); bd.CreateParameter("@id_metribuzina", DbType.Int32, c.Id_metribuzina); bd.CreateParameter("@id_emergencia", DbType.Int32, c.Id_emergencia); bd.CreateParameter("@id_madurez", DbType.Int32, c.Id_madurez); bd.CreateParameter("@id_desarrollo_follaje", DbType.Int32, c.Id_desarrollo_follaje); bd.CreateParameter("@id_tipo_hoja", DbType.Int32, c.Id_tipo_hoja); bd.CreateParameter("@id_brotacion", DbType.Int32, c.Id_brotacion); bd.CreateParameter("@id_tamano", DbType.Int32, c.Id_tamaño); bd.CreateParameter("@id_distribucion", DbType.Int32, c.Id_distribucion_calibre); bd.CreateParameter("@id_forma", DbType.Int32, c.Id_forma); bd.CreateParameter("@id_regularidad", DbType.Int32, c.Id_regularidad); bd.CreateParameter("@id_profundidad", DbType.Int32, c.Id_profundidad); bd.CreateParameter("@id_calidad", DbType.Int32, c.Id_calidad_piel); bd.CreateParameter("@id_verdes", DbType.Int32, c.Id_tuberculos_verdes); bd.CreateParameter("@tizon_follaje", DbType.Int32, c.Id_tizon_tardio_follaje); bd.CreateParameter("@tizon_tuberculo", DbType.Int32, c.Id_tizon_tardio_tuberculo); bd.CreateParameter("@id_numero", DbType.Int32, c.Id_numero_tuberculos); bd.CreateParameter("@id_ciudad", DbType.Int32, c.Id_ciudad); bd.CreateParameter("@total_kg", DbType.Double, c.Total_kg); bd.CreateParameter("@tuberculos_planta", DbType.Double, c.Tuberculos_planta); bd.CreateParameter("@toneladas_hectarea", DbType.Double, c.Toneladas_hectarea); bd.CreateParameter("@porcentaje_relacion", DbType.Int32, c.Porcentaje_relacion_standard); bd.CreateParameter("@consumo", DbType.Int32, c.Consumo); bd.CreateParameter("@semillon", DbType.Int32, c.Semillon); bd.CreateParameter("@semilla", DbType.Int32, c.Semilla); bd.CreateParameter("@semillita", DbType.Int32, c.Semillita); bd.CreateParameter("@bajo_calibre", DbType.Int32, c.Bajo_calibre); bd.CreateParameter("@numero_tallos", DbType.Int32, c.Numero_tallos); bd.CreateParameter("@id_sensibilidad_quimica", DbType.Int32, c.Id_sensibilidad_quimica); bd.CreateParameter("@id_facilidad_muerte", DbType.Int32, c.Id_facilidad_muerte); bd.CreateParameter("@dormancia", DbType.Int32, c.Dormancia); bd.CreateParameter("@tolerancia_sequia", DbType.Int32, c.Tolerancia_sequia); bd.CreateParameter("@tolerancia_calor", DbType.Int32, c.Tolerancia_calor); bd.CreateParameter("@tolerancia_sal", DbType.Int32, c.Tolerancia_sal); bd.CreateParameter("@dano_cosecha", DbType.Int32, c.Daño_cosecha); bd.CreateParameter("@tizon_hoja", DbType.Int32, c.Tizon_hoja); bd.CreateParameter("@putrefaccion_suave", DbType.Int32, c.Putrefaccion_suave); bd.CreateParameter("@putrefaccion_rosa", DbType.Int32, c.Putrefaccion_rosa); bd.CreateParameter("@silver_scurf", DbType.Int32, c.Silver_scurf); bd.CreateParameter("@blackleg", DbType.Int32, c.Blackleg); int actualizo; DbDataReader resultado = bd.Query();//disponible resultado resultado.Read(); actualizo = resultado.GetInt32(0); resultado.Close(); bd.Close(); return(actualizo); } catch (Exception e) { throw new Exception(e.ToString()); } }