public StandortAnalysis([ItemNotNull][NotNull] List <Localnet> localNetEntries, [NotNull] Logger logger, [NotNull] string standort, [NotNull] string geschäftspartner, [NotNull] Database dbHouse, [ItemNotNull][NotNull] List <BusinessName> businesses, [ItemNotNull][NotNull] List <string> alreadyRegisteredPotentialBusinesses) { Standort = standort; var isns = localNetEntries.Select(x => x.StandortID).Distinct().ToList(); isns.Remove(-2146826246); if (isns.Count > 1) { throw new FlaException("More than one isn on a single standort"); } if (isns.Count == 1) { IsnID = isns[0]; } else { IsnID = null; } LocalNetEntries = localNetEntries; BusinessPartnerName = geschäftspartner; RechnungsArtList = localNetEntries.Select(x => x.Rechnungsart).Distinct().ToList(); Rechnungsart = RechnungsArtList[0]; if (RechnungsArtList.Count != 1) { var rechnungsarten = MergeStringList(RechnungsArtList); logger.AddMessage(new LogMessage(MessageType.Warning, "More than one rechnungsart for a single standort: " + rechnungsarten, "A1Hhouseholds", Stage.Houses, null)); } LowVoltageElectricityDuringDayList = localNetEntries.Where(x => x.Verrechnungstyp == "Netz Tagesstrom (HT)" && x.Tarif != "MS").ToList(); LowVoltageElectricityEntries = new List <Localnet>(); LowVoltageElectricityEntries.AddRange(LowVoltageElectricityDuringDayList); // ReSharper disable once PossibleInvalidOperationException LowVoltageElectricityUseDaytime = (double)LowVoltageElectricityDuringDayList.Select(x => x.BasisVerbrauch).Sum(); LowVoltageElectricityDuringNightList = localNetEntries.Where(x => x.Verrechnungstyp == "Netz Nachtstrom (NT)" && x.Tarif != "MS").ToList(); LowVoltageElectricityEntries.AddRange(LowVoltageElectricityDuringNightList); // ReSharper disable once PossibleInvalidOperationException LowVoltageElectricityUseNighttime = (double)LowVoltageElectricityDuringNightList.Select(x => x.BasisVerbrauch).Sum(); LowVoltageTotalElectricity = LowVoltageElectricityUseDaytime + LowVoltageElectricityUseNighttime; HighVoltageElectricityDuringDayList = localNetEntries.Where(x => x.Verrechnungstyp == "Netz Tagesstrom (HT)" && x.Tarif == "MS").ToList(); HighVoltageElectricityEntries = new List <Localnet>(); HighVoltageElectricityEntries.AddRange(HighVoltageElectricityDuringDayList); // ReSharper disable once PossibleInvalidOperationException HighVoltageElectricityUseDaytime = (double)HighVoltageElectricityDuringDayList.Select(x => x.BasisVerbrauch).Sum(); HighVoltageElectricityDuringNightList = localNetEntries.Where(x => x.Verrechnungstyp == "Netz Nachtstrom (NT)" && x.Tarif == "MS").ToList(); HighVoltageElectricityEntries.AddRange(HighVoltageElectricityDuringNightList); // ReSharper disable once PossibleInvalidOperationException HighVoltageElectricityUseNighttime = (double)HighVoltageElectricityDuringNightList.Select(x => x.BasisVerbrauch).Sum(); HighVoltageTotalElectricity = HighVoltageElectricityUseDaytime + HighVoltageElectricityUseNighttime; //electricity tarif var tarif1 = LowVoltageElectricityDuringDayList.Select(x => x.Tarif).Distinct().ToList(); tarif1.AddRange(LowVoltageElectricityDuringDayList.Select(x => x.Tarif).Distinct()); ElectricityTarif = MergeStringList(tarif1.Distinct().ToList()); GasUseList = localNetEntries.Where(x => x.Verrechnungstyp == "Erdgasverbrauch").ToList(); // ReSharper disable once PossibleInvalidOperationException GasUse = (double)GasUseList.Select(x => x.BasisVerbrauch).Sum(); FernWärmeList = localNetEntries.Where(x => x.Verrechnungstyp == "Arbeitspreis").ToList(); // ReSharper disable once PossibleInvalidOperationException FernWärme = (double)FernWärmeList.Select(x => x.BasisVerbrauch).Sum(); BusinessCategory = GetGeschäftspartnerCategory(businesses, geschäftspartner, dbHouse, alreadyRegisteredPotentialBusinesses, LowVoltageTotalElectricity + HighVoltageTotalElectricity, GasUse, FernWärme); //todo: figure out sumemr base gas use and summer base electricity use }
public StandortAnalysis([ItemNotNull][NotNull] List <Localnet> localNetEntries, [NotNull] ILogger logger, [NotNull] string standort, [NotNull] string geschäftspartner, [NotNull] MyDb dbHouse, [ItemNotNull][NotNull] List <BusinessName> businesses, [ItemNotNull][NotNull] List <string> alreadyRegisteredPotentialBusinesses, Stage stage) : base(logger, stage, nameof(StandortAnalysis)) { Standort = standort; var standortids = localNetEntries.Select(x => x.StandortID).Distinct().ToList(); standortids.Remove(-2146826246); standortids.Remove(null); if (standortids.Count > 1) { throw new FlaException("More than one isn on a single standort: " + string.Join(",", standortids)); } OriginalISNs = localNetEntries.Select(x => x.ObjektIDGebäude ?? -1).Distinct().ToList(); LocalNetEntries = localNetEntries; BusinessPartnerName = geschäftspartner; RechnungsArtList = localNetEntries.Select(x => x.Rechnungsart).Distinct().ToList(); Rechnungsart = RechnungsArtList[0]; if (RechnungsArtList.Count != 1) { var rechnungsarten = MergeStringList(RechnungsArtList); Debug("More than one rechnungsart for a single standort: " + rechnungsarten); } LowVoltageElectricityDuringDayList = localNetEntries.Where(x => (x.Verrechnungstyp == "Netz Tagesstrom (HT)" || x.Verrechnungstyp == "EVG Tagesstrom (HT)") && x.Tarif != "MS").ToList(); LowVoltageElectricityEntries = new List <Localnet>(); LowVoltageElectricityEntries.AddRange(LowVoltageElectricityDuringDayList); // ReSharper disable once PossibleInvalidOperationException LowVoltageElectricityUseDaytime = (double)LowVoltageElectricityDuringDayList.Select(x => x.BasisVerbrauch).Sum(); LowVoltageElectricityDuringNightList = localNetEntries.Where(x => (x.Verrechnungstyp == "Netz Nachtstrom (NT)" || x.Verrechnungstyp == "EVG Nachtstrom (NT)") && x.Tarif != "MS").ToList(); LowVoltageElectricityEntries.AddRange(LowVoltageElectricityDuringNightList); // ReSharper disable once PossibleInvalidOperationException LowVoltageElectricityUseNighttime = (double)LowVoltageElectricityDuringNightList.Select(x => x.BasisVerbrauch).Sum(); LowVoltageTotalElectricity = LowVoltageElectricityUseDaytime + LowVoltageElectricityUseNighttime; HighVoltageElectricityDuringDayList = localNetEntries.Where(x => x.Verrechnungstyp == "Netz Tagesstrom (HT)" && x.Tarif == "MS").ToList(); HighVoltageElectricityEntries = new List <Localnet>(); HighVoltageElectricityEntries.AddRange(HighVoltageElectricityDuringDayList); // ReSharper disable once PossibleInvalidOperationException HighVoltageElectricityUseDaytime = (double)HighVoltageElectricityDuringDayList.Select(x => x.BasisVerbrauch).Sum(); HighVoltageElectricityDuringNightList = localNetEntries.Where(x => x.Verrechnungstyp == "Netz Nachtstrom (NT)" && x.Tarif == "MS").ToList(); HighVoltageElectricityEntries.AddRange(HighVoltageElectricityDuringNightList); // ReSharper disable once PossibleInvalidOperationException HighVoltageElectricityUseNighttime = (double)HighVoltageElectricityDuringNightList.Select(x => x.BasisVerbrauch).Sum(); HighVoltageTotalElectricity = HighVoltageElectricityUseDaytime + HighVoltageElectricityUseNighttime; //electricity tarif var tarif1 = LowVoltageElectricityDuringDayList.Select(x => x.Tarif).Distinct().ToList(); tarif1.AddRange(LowVoltageElectricityDuringDayList.Select(x => x.Tarif).Distinct()); ElectricityTarif = MergeStringList(tarif1.Distinct().ToList()); GasUseList = localNetEntries.Where(x => x.Verrechnungstyp == "Erdgasverbrauch").ToList(); // ReSharper disable once PossibleInvalidOperationException GasUse = (double)GasUseList.Select(x => x.BasisVerbrauch).Sum(); FernWärmeList = localNetEntries.Where(x => x.Verrechnungstyp == "Arbeitspreis").ToList(); // ReSharper disable once PossibleInvalidOperationException FernWärme = (double)FernWärmeList.Select(x => x.BasisVerbrauch).Sum(); BusinessCategory = GetGeschäftspartnerCategory(businesses, geschäftspartner, dbHouse, alreadyRegisteredPotentialBusinesses, LowVoltageTotalElectricity + HighVoltageTotalElectricity, GasUse, FernWärme, Standort); }