public IEnumerable <CoalPlant> GetCoal() { var plant = new List <CoalPlant>(); var connString = "Host=localhost;Username=postgres;Password=admin;Database=postgres"; var connection = new NpgsqlConnection(connString); connection.Open(); var i = 0; using (var cmd = new NpgsqlCommand("SELECT * FROM coal_power_plant", connection)) { using (var reader = cmd.ExecuteReader()) while (reader.Read()) { var t = new CoalPlant() { Position = new LatLng() { Lat = reader.GetDouble(1), Lng = reader.GetDouble(0) }, Name = reader.GetString(2), CO2 = reader.GetDouble(3) }; i++; plant.Add(t); } } return(plant); }
private static void OnWiltRecover(CoalPlant plant, object data = null) { plant.consumer.EnableConsumption(true); }
private static void OnWilt(CoalPlant plant, object data = null) { plant.consumer.EnableConsumption(false); }