GetCSV() public method

public GetCSV ( double acKilowatts, double fanKilowatts, double heatBTU, int timeZoneDifference ) : string
acKilowatts double
fanKilowatts double
heatBTU double
timeZoneDifference int
return string
Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DeleteOldData();

        DataTable thermostats = ThermostatMonitorLib.Thermostats.LoadPublicThermostats();

        OutputCSV(ThermostatMonitorLib.Utils.DataTableToCSV(thermostats), "/dump/thermostats.csv");

        foreach (DataRow row in thermostats.Rows)
        {
            int    id           = Convert.ToInt32(row["Id"]);
            int    locationId   = Convert.ToInt32(row["LocationId"]);
            double acKilowatts  = Convert.ToDouble(row["ACKilowatts"]);
            double fanKilowatts = Convert.ToDouble(row["FanKilowatts"]);
            double heatBTU      = 0;
            try
            {
                heatBTU = Convert.ToDouble(row["HeatBtuPerHour"]);
            }
            catch { }

            ThermostatMonitorLib.Cycles cycles = ThermostatMonitorLib.Cycles.LoadRange(id, new DateTime(2000, 1, 1), DateTime.Now);
            OutputCSV(cycles.GetCSV(acKilowatts, fanKilowatts, heatBTU, 0), "/dump/t" + id.ToString() + "_cycles.csv");
            OutputCSV(ThermostatMonitorLib.Temperatures.LoadTemperaturesByThermostatId(id).GetCSV(), "/dump/t" + id.ToString() + "_inside.csv");

            OutputCSV(ThermostatMonitorLib.OutsideConditions.LoadOutsideConditionsByLocationId(locationId).GetCSV(), "/dump/l" + locationId.ToString() + "_outside.csv");
        }

        ZipFiles();
        Response.Redirect("/dump/export.zip");
    }
Exemplo n.º 2
0
 private void OutputCycles(ThermostatMonitorLib.Thermostat thermostat, ThermostatMonitorLib.Location location)
 {
     ThermostatMonitorLib.Cycles cycles = ThermostatMonitorLib.Cycles.LoadRange(thermostat.Id, new DateTime(2000, 1, 1), DateTime.Now);
     OutputCSV(cycles.GetCSV(thermostat.ACKilowatts, thermostat.FanKilowatts, thermostat.HeatBtuPerHour, AppUser.TimezoneDifference(location.Timezone, location.DaylightSavings)), "cycles.csv");
 }