protected override void fillDBWithMeters() { CustomerData tempCustomer = new CustomerData(); int customerId = tempCustomer.FillEmptyCustomer(); myDatabase.InsertCustomerData(tempCustomer); MeterManufactorData tempMeterManufactor = new MeterManufactorData(); int meterManufactorId = tempMeterManufactor.FillEmptyMeterManufactor(); myDatabase.InsertMeterManufactorData(tempMeterManufactor); MeterProtocolData tempMeterProtocol = new MeterProtocolData(); int meterProtocolId = tempMeterProtocol.FillEmptyMeterProtocol(); myDatabase.InsertMeterProtocolData(tempMeterProtocol); MeterTypeData tempMeterType = new MeterTypeData(); int meterTypeId = tempMeterType.FillEmptyMeterType(); myDatabase.InsertMeterTypeData(tempMeterType); REDDMeter.SetCustomerId(customerId); REDDMeter.SetManufactorId(meterManufactorId); REDDMeter.SetProtolId(meterProtocolId); REDDMeter.SetTypeId(meterTypeId); REDDMeter.SetKey("not availiable"); REDDMeter.SetPeriod(1); REDDMeter.SetPort("not availiable"); REDDMeter.SetSerial("not availiable"); REDDMeter.SetActive(true); myDatabase.InsertMeterManagementData(REDDMeter); }
protected override void fillDBWithMeters() { CustomerData tempCustomer = new CustomerData(); int customerId = tempCustomer.FillEmptyCustomer(); myDatabase.InsertCustomerData(tempCustomer); MeterManufactorData tempMeterManufactor = new MeterManufactorData(); int meterManufactorId = tempMeterManufactor.FillEmptyMeterManufactor(); myDatabase.InsertMeterManufactorData(tempMeterManufactor); MeterProtocolData tempMeterProtocol = new MeterProtocolData(); int meterProtocolId = tempMeterProtocol.FillEmptyMeterProtocol(); myDatabase.InsertMeterProtocolData(tempMeterProtocol); MeterTypeData tempMeterType = new MeterTypeData(); int meterTypeId = tempMeterType.FillEmptyMeterType(); myDatabase.InsertMeterTypeData(tempMeterType); for (int i = 0; i < 81; i++) { int HomeNbr = i / 9; int ApplicationNbr = i % 9; MeterManagementData GREENDMeter = new MeterManagementData(); GREENDMeter.SetCustomerId(customerId); GREENDMeter.SetManufactorId(meterManufactorId); GREENDMeter.SetProtolId(meterProtocolId); GREENDMeter.SetTypeId(meterTypeId); GREENDMeter.SetDescribtion("GREEND-" + HomeNbr + "-" + ApplicationNbr); GREENDMeter.SetKey("not availiable"); GREENDMeter.SetPeriod(1); GREENDMeter.SetPort("not availiable"); GREENDMeter.SetSerial("not availiable"); GREENDMeter.SetActive(true); myDatabase.InsertMeterManagementData(GREENDMeter); Tuple <int, ApplicationEnum> temp = new Tuple <int, ApplicationEnum>(GREENDMeter.GetMeterId(), this.getEnumFromGREENDEnumId((HomeNbr * 9) + ApplicationNbr)); this.meterList.Add(temp); } }
protected override void fillDBWithMeters() { CustomerData tempCustomer = new CustomerData(); int customerId = tempCustomer.FillEmptyCustomer(); myDatabase.InsertCustomerData(tempCustomer); MeterManufactorData tempMeterManufactor = new MeterManufactorData(); int meterManufactorId = tempMeterManufactor.FillEmptyMeterManufactor(); myDatabase.InsertMeterManufactorData(tempMeterManufactor); MeterProtocolData tempMeterProtocol = new MeterProtocolData(); int meterProtocolId = tempMeterProtocol.FillEmptyMeterProtocol(); myDatabase.InsertMeterProtocolData(tempMeterProtocol); MeterTypeData tempMeterType = new MeterTypeData(); int meterTypeId = tempMeterType.FillEmptyMeterType(); myDatabase.InsertMeterTypeData(tempMeterType); ///Create whole houses meter for (int i = 0; i < 4; i++) { MeterManagementData UKDALEMeter = new MeterManagementData(); UKDALEMeter.SetCustomerId(customerId); UKDALEMeter.SetManufactorId(meterManufactorId); UKDALEMeter.SetProtolId(meterProtocolId); UKDALEMeter.SetTypeId(meterTypeId); UKDALEMeter.SetDescribtion("UKDALE-" + i + "-ALL"); UKDALEMeter.SetKey("not availiable"); UKDALEMeter.SetPeriod(1); UKDALEMeter.SetPort("not availiable"); UKDALEMeter.SetSerial("not availiable"); UKDALEMeter.SetActive(true); myDatabase.InsertMeterManagementData(UKDALEMeter); int tempMeterId = UKDALEMeter.GetMeterId(); Tuple <int, ApplicationEnum> temp; switch (i) { case 0: { temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.UKDALEwholeHouse1); break; } case 1: { temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.UKDALEwholeHouse2); break; } case 2: { temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.UKDALEwholeHouse3); break; } case 3: { temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.UKDALEwholeHouse4); break; } case 4: { temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.UKDALEwholeHouse5); break; } default: { temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.None); break; } } this.housesList.Add(temp); } String pathToUKDALEAplliances = "UKDaleAppliances\\"; for (int i = 1; i <= 5; i++) { Console.WriteLine("working File: " + i); using (StreamReader file = new StreamReader(pathToUKDALEAplliances + "UKDALEdat_" + i + ".txt")) { if (file != null) { String line = ""; while ((line = file.ReadLine()) != null) { MeterManagementData UKDALEMeter = new MeterManagementData(); UKDALEMeter.SetCustomerId(customerId); UKDALEMeter.SetManufactorId(meterManufactorId); UKDALEMeter.SetProtolId(meterProtocolId); UKDALEMeter.SetTypeId(meterTypeId); String[] applicationParts = line.Split(' '); int applicationNumber = Int32.Parse(applicationParts[0]); ApplicationEnum foundApplicationEnum = this.FindApplicationEnumByString(applicationParts[1]); UKDALEMeter.SetDescribtion("UKDALE-" + (i - 1) + "-" + applicationNumber); UKDALEMeter.SetKey("not availiable"); UKDALEMeter.SetPeriod(1); UKDALEMeter.SetPort("not availiable"); UKDALEMeter.SetSerial("not availiable"); UKDALEMeter.SetActive(true); myDatabase.InsertMeterManagementData(UKDALEMeter); int tempMeterId = UKDALEMeter.GetMeterId(); int[] tempTupel = new int[2]; tempTupel[0] = tempMeterId; tempTupel[1] = applicationNumber; Tuple <int[], ApplicationEnum> temp = new Tuple <int[], ApplicationEnum>(tempTupel, foundApplicationEnum); switch (i) { case 1: { this.house1ApplicationList.Add(temp); break; } case 2: { this.house2ApplicationList.Add(temp); break; } case 3: { this.house3ApplicationList.Add(temp); break; } case 4: { this.house4ApplicationList.Add(temp); break; } case 5: { this.house5ApplicationList.Add(temp); break; } } } } } } }