public List <Reservoir> ReadReservoirs(int scenario) { string table = "EmbalseBasica"; List <Reservoir> reservoirs = new List <Reservoir>(); query = "SELECT nombre, VolMinimo, VolMaximo, VolumenInicial FROM " + table; if (ScenarioExists(table, scenario)) { query += " WHERE Escenario = " + scenario; } else { query += " WHERE Escenario = 1"; } reader = DataBaseManager.ReadData(query); while (reader.Read()) { reservoirs.Add(new Reservoir(reader.GetString(0), Convert.ToDouble(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)), Convert.ToDouble(reader.GetValue(3)))); } DataBaseManager.DbConnection.Close(); return(reservoirs); }
public void CreatePlantsMappingTables() { List <string> tables = new List <string>() { "MapeoRecursosHidro", "MapeoRecursosTermicos" }; foreach (string table in tables) { string query = string.Format("SELECT TOP 1 Planta FROM {0}", table); try { OleDbDataReader reader = DataBaseManager.ReadData(query); } catch { query = string.Format("CREATE TABLE {0} (Planta Text, Recurso Text)", table); DataBaseManager.ExecuteQuery(query); log.Info(MessageUtil.FormatMessage("INFO.TableCreated", table)); } DataBaseManager.DbConnection.Close(); } }
public static List <VariableHydroPlant> GetObjects() { List <VariableHydroPlant> plants = new List <VariableHydroPlant>(); string query = string.Format("SELECT Recurso, Embalse, Segmento, Volumen, FactorConversion, GeneracionMaxima, Escenario, Id " + "FROM {0}", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { plants.Add(new VariableHydroPlant() { Name = reader.GetString(0), Reservoir = reader.GetString(1), Segment = Convert.ToInt32(reader.GetValue(2)), Level = Convert.ToDouble(reader.GetValue(3)), ProductionFactor = Convert.ToDouble(reader.GetValue(4)), Max = Convert.ToDouble(reader.GetValue(5)), Case = Convert.ToInt32(reader.GetValue(6)), Id = Convert.ToInt32(reader.GetValue(7)) }); } DataBaseManager.DbConnection.Close(); return(plants); }
public static List <FuelContract> GetObjects() { List <FuelContract> plants = new List <FuelContract>(); string query = string.Format("SELECT Nombre, Tipo, CapacidadHora, MinimoHora, CostoContrato, EtapaInicial, EtapaFinal, Id " + "FROM {0}", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { plants.Add(new FuelContract() { Name = reader.GetString(0), Type = reader.GetString(1), Capacity = Convert.ToDouble(reader.GetValue(2)), Min = Convert.ToDouble(reader.GetValue(3)), Cost = Convert.ToDouble(reader.GetValue(4)), InitialPeriod = Convert.ToInt32(reader.GetValue(5)), FinalPeriod = Convert.ToInt32(reader.GetValue(6)), Id = Convert.ToInt32(reader.GetValue(7)) }); } DataBaseManager.DbConnection.Close(); return(plants); }
public static List <PFEquation> GetObjects() { List <PFEquation> pfEquations = new List <PFEquation>(); string query = string.Format("SELECT Recurso, Embalse, Intercepto, coeficienteLineal, coeficienteCuadratico, Escenario, Id " + "FROM {0} ORDER BY Recurso, Embalse, Escenario", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { pfEquations.Add(new PFEquation() { Name = reader.GetString(0), Reservoir = reader.GetString(1), Intercept = Convert.ToDouble(reader.GetValue(2)), LinearCoefficient = Convert.ToDouble(reader.GetValue(3)), CuadraticCoefficient = Convert.ToDouble(reader.GetValue(4)), Case = Convert.ToInt32(reader.GetValue(5)), Id = Convert.ToInt32(reader.GetValue(6)) }); } DataBaseManager.DbConnection.Close(); return(pfEquations); }
public static List <Zone> GetZones() { List <Zone> zones = new List <Zone>(); string query = string.Format("SELECT Nombre, Tipo, Valor, Id " + "FROM {0}", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { zones.Add(new Zone(reader.GetString(0), reader.GetString(1), Convert.ToDouble(reader.GetValue(2)), Convert.ToInt32(reader.GetValue(3)))); } DataBaseManager.DbConnection.Close(); foreach (Zone zone in zones) { List <string> plants = new List <string>(); query = "SELECT Recurso " + "FROM zonaRecurso " + "WHERE Nombre = '" + zone.Name + "'"; reader = DataBaseManager.ReadData(query); while (reader.Read()) { plants.Add(reader.GetString(0)); } DataBaseManager.DbConnection.Close(); zone.Plants = plants; } return(zones); }
public static List <Company> GetObjects() { List <Company> companies = new List <Company>(); string query = string.Format("SELECT Nombre, PrecioBolsa, Contrato, ModelaContratos, FactorContrato, FactorPenalizacionContrato, Escenario, Id " + "FROM {0} ORDER BY ModelaContratos DESC, Escenario, Nombre", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { companies.Add(new Company() { Name = reader.GetString(0), StockPrice = Convert.ToDouble(reader.GetValue(1)), Contract = Convert.ToDouble(reader.GetValue(2)), IsContractModeled = Convert.ToInt32(reader.GetValue(3)), ContractFactor = Convert.ToDouble(reader.GetValue(4)), ContractPenalizationFactor = Convert.ToDouble(reader.GetValue(5)), Case = Convert.ToInt32(reader.GetValue(6)), Id = Convert.ToInt32(reader.GetValue(7)) }); } DataBaseManager.DbConnection.Close(); return(companies); }
public static List <HydroElement> GetObjects() { List <HydroElement> hydroElements = new List <HydroElement>(); string query = string.Format("SELECT Nombre, TurMinimo, TurMaximo, Filtracion, FactorRecuperacion, EtapaEntrada, Id " + "FROM {0}", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { hydroElements.Add(new HydroElement() { Name = reader.GetString(0), MinTurbinedOutflow = Convert.ToDouble(reader.GetValue(1)), MaxTurbinedOutflow = Convert.ToDouble(reader.GetValue(2)), Filtration = Convert.ToInt32(reader.GetValue(3)), RecoveryFactor = Convert.ToDouble(reader.GetValue(4)), StartPeriod = Convert.ToInt32(reader.GetValue(5)), Id = Convert.ToInt32(reader.GetValue(6)) }); } DataBaseManager.DbConnection.Close(); return(hydroElements); }
public static List <NonConventionalPlantBlock> GetObjects() { List <NonConventionalPlantBlock> blocks = new List <NonConventionalPlantBlock>(); //string query = string.Format("SELECT nombre, Bloque, FactorReductor, Id " + // "FROM {0} " + // "ORDER BY nombre, Bloque", table); string query = string.Format("SELECT tipo, periodo, bloque, factorReductor,Id " + "FROM {0} " + "ORDER BY tipo,periodo, Bloque", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { try { blocks.Add(new NonConventionalPlantBlock() { Name = reader.GetString(0), Case = Convert.ToInt32(reader.GetValue(1)), Block = Convert.ToInt32(reader.GetValue(2)), ReductionFactor = Convert.ToDouble(reader.GetValue(3)), Id = Convert.ToInt32(reader.GetValue(4)) }); } catch (Exception e) { throw; } } DataBaseManager.DbConnection.Close(); return(blocks); }
public static List <ThermalPlant> GetObjects() { List <ThermalPlant> plants = new List <ThermalPlant>(); string vble = null; string vble1 = null; string query = string.Format("SELECT nombre, Combustible, FactorDisponibilidad, FactorConsumoPromedio, Minimo, Maximo, CostoVariable, FactorConsumoVariable, Obligatorio, empresa, EtapaEntrada, Escenario, Id, Subarea " + "FROM {0}", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { try { vble = null; vble1 = null; if (!reader.IsDBNull(13)) { vble = reader.GetString(13); } else { vble = string.Empty; } if (!reader.IsDBNull(1)) { vble1 = reader.GetString(1); } else { vble1 = string.Empty; } } catch (Exception ex) { MessageBox.Show(ex.Message, "ex."); throw; } plants.Add(new ThermalPlant() { Name = reader.GetString(0), Fuel = vble1, //reader.GetString(1), AvailabilityFactor = Convert.ToDouble(reader.GetValue(2)), ProductionFactor = Convert.ToDouble(reader.GetValue(3)), Min = Convert.ToDouble(reader.GetValue(4)), Max = Convert.ToDouble(reader.GetValue(5)), VariableCost = Convert.ToDouble(reader.GetValue(6)), HasVariableProductionFactor = Convert.ToDouble(reader.GetValue(7)), IsMandatory = Convert.ToInt32(reader.GetValue(8)), Company = reader.GetString(9), StartPeriod = Convert.ToInt32(reader.GetValue(10)), Case = Convert.ToInt32(reader.GetValue(11)), Id = Convert.ToInt32(reader.GetValue(12)), Subarea = vble }); } DataBaseManager.DbConnection.Close(); return(plants); }
public static List <NonConventionalPlant> GetObjects() { List <NonConventionalPlant> plants = new List <NonConventionalPlant>(); string query = string.Format("SELECT nombre, Tipo, FactorPlanta, Maximo, empresa, EtapaEntrada, Escenario, Id, Subarea " + "FROM {0}", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { plants.Add(new NonConventionalPlant() { Name = reader.GetString(0), Type = reader.GetString(1), ProductionFactor = Convert.ToDouble(reader.GetValue(2)), Max = Convert.ToDouble(reader.GetValue(3)), Company = reader.GetString(4), StartPeriod = Convert.ToInt32(reader.GetValue(5)), Case = Convert.ToInt32(reader.GetValue(6)), Id = Convert.ToInt32(reader.GetValue(7)), Subarea = reader.GetString(8) }); } DataBaseManager.DbConnection.Close(); return(plants); }
private static bool EstadoRango(EspecialZone dataobject1, out double IndiceIniantes, out double IndiceFinantes) { bool State = false; IndiceIniantes = 0; IndiceFinantes = 0; string query = string.Format("SELECT nombre,IndiceIni,IndiceFin " + "FROM ZonaEspecial " + "WHERE ((nombre='" + dataobject1.Name + "' and " + dataobject1.IndiceIni + " between IndiceIni and IndiceFin) or (nombre='" + dataobject1.Name + "' and " + dataobject1.IndiceFin + " between IndiceIni and IndiceFin))"); OleDbDataReader reader = DataBaseManager.ReadData(query); if (!reader.Read()) { State = false; } else { State = true; DataBaseManager.DbConnection.Close(); reader = DataBaseManager.ReadData(query); while (reader.Read()) { IndiceIniantes = Convert.ToDouble(reader.GetValue(1)); IndiceFinantes = Convert.ToDouble(reader.GetValue(2)); } } DataBaseManager.DbConnection.Close(); return(State); }
public static List <Fuel> GetObjects() { List <Fuel> plants = new List <Fuel>(); string query = string.Format("SELECT CentroAbastecimiento, Tipo, CapacidadHora, MinimoHora, CostoCombustible, CostoTransporte, Id " + "FROM {0}", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { plants.Add(new Fuel() { Name = reader.GetString(0), Type = reader.GetString(1), Capacity = Convert.ToDouble(reader.GetValue(2)), Min = Convert.ToDouble(reader.GetValue(3)), Cost = Convert.ToDouble(reader.GetValue(4)), TransportCost = Convert.ToDouble(reader.GetValue(5)), Id = Convert.ToInt32(reader.GetValue(6)) }); } DataBaseManager.DbConnection.Close(); return(plants); }
public static List <Period> GetObjects() { List <Period> periods = new List <Period>(); string query = string.Format("SELECT Fecha, nombre, demanda, duracionHoras, ReservaAGC, CostoRacionamiento, CAR, demandaInternacional, tasaDescuento, Escenario, Id " + "FROM {0} ORDER BY Escenario, Nombre", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { periods.Add(new Period() { Date = reader.GetString(0), Name = Convert.ToInt32(reader.GetValue(1)), Load = Convert.ToDouble(reader.GetValue(2)), HourlyDuration = Convert.ToDouble(reader.GetValue(3)), AGCReservoir = Convert.ToDouble(reader.GetValue(4)), RationingCost = Convert.ToDouble(reader.GetValue(5)), CAR = Convert.ToDouble(reader.GetValue(6)), InternationalLoad = Convert.ToDouble(reader.GetValue(7)), DiscountRate = Convert.ToDouble(reader.GetValue(8)), Case = Convert.ToInt32(reader.GetValue(9)), Id = Convert.ToInt32(reader.GetValue(10)) }); } DataBaseManager.DbConnection.Close(); return(periods); }
public List <ConventionalPlant> ReadConventionalPlants(string table, int scenario) { List <ConventionalPlant> ConventionalPlants = new List <ConventionalPlant>(); if (table.Equals("recursoHidroBasica")) { query = "SELECT nombre, Minimo, Maximo, costoVariable, obligatorio, FactorConversionPromedio, FactorDisponibilidad FROM " + table; } else if (table.Equals("recursoTermicoBasica")) { query = "SELECT nombre, Minimo, Maximo, costoVariable, obligatorio, FactorConsumoPromedio, FactorDisponibilidad FROM " + table; } if (ScenarioExists(table, scenario)) { query += " WHERE Escenario = " + scenario; } else { query += " WHERE Escenario = 1"; } reader = DataBaseManager.ReadData(query); while (reader.Read()) { ConventionalPlants.Add(new ConventionalPlant(reader.GetString(0), Convert.ToDouble(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)), Convert.ToDouble(reader.GetValue(3)), Convert.ToInt32(reader.GetValue(4)), Convert.ToDouble(reader.GetValue(5)), Convert.ToDouble(reader.GetValue(6)))); } DataBaseManager.DbConnection.Close(); return(ConventionalPlants); }
public static void UpdateObject(NameMapping dataObject) { string query = string.Format("SELECT Rio " + "FROM {0} " + "WHERE Rio = '{1}'", table, dataObject.DHOGName); OleDbDataReader reader = DataBaseManager.ReadData(query); if (!reader.Read()) { query = string.Format("INSERT INTO {0}(Id, Rio) " + "VALUES(@SDDPNumber, @DHOGName)", table); } //query = string.Format("INSERT INTO {0}(Numero, Rio) " + // "VALUES(@SDDPNumber, @DHOGName)", table); else { query = string.Format("UPDATE {0} SET " + "Id = @SDDPNumber " + "WHERE Rio = @DHOGName", table); } //query = string.Format("UPDATE {0} SET " + // "Numero = @SDDPNumber " + // "WHERE Rio = @DHOGName", table); DataBaseManager.DbConnection.Close(); using (OleDbCommand command = new OleDbCommand(query, DataBaseManager.DbConnection)) { command.Parameters.Add("@SDDPNumber", OleDbType.VarChar); command.Parameters.Add("@DHOGName", OleDbType.VarChar); DataBaseManager.DbConnection.Open(); command.Parameters["@SDDPNumber"].Value = dataObject.SDDPNumber; command.Parameters["@DHOGName"].Value = dataObject.DHOGName; try { int rowsAffected = command.ExecuteNonQuery(); } catch { DataBaseManager.DbConnection.Close(); throw; } DataBaseManager.DbConnection.Close(); } }
public List <FuelContract> ReadFuelContracts() { List <FuelContract> fuelContracts = new List <FuelContract>(); query = "SELECT DISTINCT(Nombre), CapacidadHora, CostoContrato, EtapaInicial, EtapaFinal FROM ContratoCombustibleBasica"; reader = DataBaseManager.ReadData(query); while (reader.Read()) { fuelContracts.Add(new FuelContract(reader.GetString(0), Convert.ToDouble(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)), Convert.ToInt32(reader.GetValue(3)), Convert.ToInt32(reader.GetValue(4)))); } DataBaseManager.DbConnection.Close(); return(fuelContracts); }
public List <Fuel> ReadFuels() { List <Fuel> fuels = new List <Fuel>(); query = "SELECT DISTINCT(CentroAbastecimiento), CapacidadHora, CostoCombustible FROM combustibleBasica"; reader = DataBaseManager.ReadData(query); while (reader.Read()) { fuels.Add(new Fuel(reader.GetString(0), Convert.ToDouble(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)))); } DataBaseManager.DbConnection.Close(); return(fuels); }
public Dictionary <int, string> ReadRiversMapping() { Dictionary <int, string> mappingTable = new Dictionary <int, string>(); query = "SELECT Numero, Rio " + "FROM MapeoRios"; reader = DataBaseManager.ReadData(query); while (reader.Read()) { mappingTable.Add(Convert.ToInt32(reader.GetValue(0)), reader.GetString(1)); } DataBaseManager.DbConnection.Close(); return(mappingTable); }
public static List <Block> GetObjects() { List <Block> blocks = new List <Block>(); string query = string.Format("SELECT nombre, FactorDuracion, FactorDemanda, Id " + "FROM {0} ORDER BY Nombre", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { blocks.Add(new Block(Convert.ToInt32(reader.GetValue(0)), Convert.ToDouble(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)), Convert.ToInt32(reader.GetValue(3)))); } DataBaseManager.DbConnection.Close(); return(blocks); }
public static List <LineaBarra> GetObjects() { List <LineaBarra> LineaBarra = new List <LineaBarra>(); string query = string.Format("SELECT nombre, barraInicial, barraFinal, reactancia, nMenos1, FlujoMaximo, activa " + "FROM {0} ORDER BY nombre", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { LineaBarra.Add(new LineaBarra(Convert.ToString(reader.GetValue(0)), Convert.ToString(reader.GetValue(1)), Convert.ToString(reader.GetValue(2)), Convert.ToDouble(reader.GetValue(3)), Convert.ToDouble(reader.GetValue(4)), Convert.ToInt32(reader.GetValue(5)), Convert.ToInt32(reader.GetValue(6)))); } DataBaseManager.DbConnection.Close(); return(LineaBarra); }
public static List <NameMapping> GetObjects() { List <NameMapping> namesMapping = new List <NameMapping>(); string query = string.Format("SELECT Recurso, Planta " + "FROM {0} " + "ORDER BY Recurso", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { namesMapping.Add(new NameMapping(reader.GetString(0), reader.GetString(1))); } DataBaseManager.DbConnection.Close(); return(namesMapping); }
public static List <PeriodicInflow> GetPeriodicInflows() { List <PeriodicInflow> periodicInflows = new List <PeriodicInflow>(); string query = string.Format("SELECT Nombre, Periodo, Valor, Escenario " + "FROM {0}", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { periodicInflows.Add(new PeriodicInflow(reader.GetString(0), Convert.ToInt32(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)), Convert.ToInt32(reader.GetValue(3)))); } DataBaseManager.DbConnection.Close(); return(periodicInflows); }
public static List <ExcludingPlants> GetObjects() { List <ExcludingPlants> excludingPlants = new List <ExcludingPlants>(); string query = string.Format("SELECT Recurso1, Recurso2 " + "FROM {0} " + "ORDER BY Recurso1", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { excludingPlants.Add(new ExcludingPlants(reader.GetString(0), reader.GetString(1))); } DataBaseManager.DbConnection.Close(); return(excludingPlants); }
public static int UpdateObject(HydroTopology dataObject) { bool isNew = false; string query = string.Format("SELECT Sistema " + "FROM {0} " + "WHERE Id = {1}", table, dataObject.Id); OleDbDataReader reader = DataBaseManager.ReadData(query); if (!reader.Read()) { query = string.Format("INSERT INTO {0}(Sistema, Elemento, Tipo, TipoElemento) " + "VALUES('{1}', '{2}', '{3}', '{4}')", table, dataObject.System, dataObject.Element, dataObject.Type, dataObject.ElementType); isNew = true; } else { query = string.Format("UPDATE {0} SET " + "Sistema = '{1}', " + "Elemento = '{2}', " + "Tipo = '{3}', " + "TipoElemento = '{4}' " + "WHERE Id = {5}", table, dataObject.System, dataObject.Element, dataObject.Type, dataObject.ElementType, dataObject.Id); } DataBaseManager.DbConnection.Close(); DataBaseManager.ExecuteQuery(query); if (isNew) { query = string.Format("SELECT Max(Id) FROM {0}", table); reader = DataBaseManager.ReadData(query); reader.Read(); int id = Convert.ToInt32(reader.GetValue(0)); DataBaseManager.DbConnection.Close(); return(id); } else { return(-1); } }
public static List <CorteLinea> GetCorteLinea() { List <CorteLinea> CorteLinea = new List <CorteLinea>(); string query = String.Format("SELECT Nombre, Linea, Sentido " + "FROM {0} " + "ORDER BY Nombre ASC", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { CorteLinea.Add(new CorteLinea(Convert.ToString(reader.GetValue(0)), Convert.ToString(reader.GetValue(1)), Convert.ToInt16(reader.GetValue(2)))); } DataBaseManager.DbConnection.Close(); return(CorteLinea); }
public static List <PeriodicFuel> GetPeriodicFuels() { List <PeriodicFuel> periodicFuels = new List <PeriodicFuel>(); string query = String.Format("SELECT CentroAbastecimiento, Periodo, CapacidadHora, MinimoHora, CostoCombustible, CostoTransporte, Escenario " + "FROM {0} " + "ORDER BY CentroAbastecimiento, Periodo, Escenario ASC", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { periodicFuels.Add(new PeriodicFuel(reader.GetString(0), Convert.ToInt32(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)), Convert.ToDouble(reader.GetValue(3)), Convert.ToDouble(reader.GetValue(4)), Convert.ToDouble(reader.GetValue(5)), Convert.ToInt32(reader.GetValue(6)))); } DataBaseManager.DbConnection.Close(); return(periodicFuels); }
public static List <PeriodicNonConventionalPlant> GetPeriodicNonConventionalPlants() { List <PeriodicNonConventionalPlant> periodicNonConventionalPlants = new List <PeriodicNonConventionalPlant>(); string query = String.Format("SELECT Nombre, Periodo, Maximo, FactorPlanta, Escenario " + "FROM {0} " + "ORDER BY Nombre, Periodo, Escenario ASC", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { periodicNonConventionalPlants.Add(new PeriodicNonConventionalPlant(reader.GetString(0), Convert.ToInt32(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)), Convert.ToDouble(reader.GetValue(3)), Convert.ToInt32(reader.GetValue(4)))); } DataBaseManager.DbConnection.Close(); return(periodicNonConventionalPlants); }
public static List <PeriodicBlock> GetPeriodicBlocks() { List <PeriodicBlock> periodicBlocks = new List <PeriodicBlock>(); string query = String.Format("SELECT Nombre, Periodo, FactorDuracion, FactorDemanda " + "FROM {0} " + "ORDER BY Periodo, Nombre ASC", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { periodicBlocks.Add(new PeriodicBlock(Convert.ToInt32(reader.GetValue(0)), Convert.ToInt32(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)), Convert.ToDouble(reader.GetValue(3)))); } DataBaseManager.DbConnection.Close(); return(periodicBlocks); }
public static List <PeriodicFuelContract> GetPeriodicFuelContracts() { List <PeriodicFuelContract> periodicFuelContracts = new List <PeriodicFuelContract>(); string query = String.Format("SELECT Nombre, Periodo, CapacidadHora, MinimoHora, CostoContrato, Escenario " + "FROM {0} " + "ORDER BY Nombre, Periodo, Escenario ASC", table); OleDbDataReader reader = DataBaseManager.ReadData(query); while (reader.Read()) { periodicFuelContracts.Add(new PeriodicFuelContract(reader.GetString(0), Convert.ToInt32(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)), Convert.ToDouble(reader.GetValue(3)), Convert.ToDouble(reader.GetValue(4)), Convert.ToInt32(reader.GetValue(5)))); } DataBaseManager.DbConnection.Close(); return(periodicFuelContracts); }