Ejemplo n.º 1
0
        public static void LoadData()
        {
            Framework.DomainModels.Persisters.IPersisterReader <IParcel> parcelReader =
                Global
                .ContainerDaySim.GetInstance <IPersistenceFactory <IParcel> >()
                .Reader;

            IParcelCreator parcelCreator =
                Global
                .ContainerDaySim
                .GetInstance <IWrapperFactory <IParcelCreator> >()
                .Creator;

            Parcels = new Dictionary <int, IParcelWrapper>(parcelReader.Count);

            Framework.DomainModels.Persisters.IPersisterReader <IZone> zoneReader =
                Global
                .ContainerDaySim
                .GetInstance <IPersistenceFactory <IZone> >()
                .Reader;

            //            ZoneTotals = new Dictionary<int, ZoneTotals>(zoneReader.Count);
            ZoneKeys = new Dictionary <int, int>(zoneReader.Count);

            Dictionary <int, IZone> zones = new Dictionary <int, IZone>();

            foreach (IZone zone in zoneReader)
            {
                ZoneKeys.Add(zone.Id, zone.Key);
                zones.Add(zone.Id, zone);
            }

            Dictionary <int, Framework.ShadowPricing.IShadowPriceParcel> shadowPrices = ShadowPriceReader.ReadShadowPrices();

            foreach (IParcel parcel in parcelReader)
            {
                IParcelWrapper parcelWrapper = parcelCreator.CreateWrapper(parcel);

                Parcels.Add(parcel.Id, parcelWrapper);


                if (zones.TryGetValue(parcel.ZoneId, out IZone zone))
                {
                    parcelWrapper.District = zone.External;
                }

                parcelWrapper.SetShadowPricing(zones, shadowPrices);

                //                ZoneTotals zoneTotals;
                //
                //                if (!ZoneTotals.TryGetValue(parcel.ZoneId, out zoneTotals)) {
                //                    zoneTotals = new ZoneTotals();
                //
                //                    ZoneTotals.Add(parcel.ZoneId, zoneTotals);
                //                }
                //
                //                zoneTotals.SumTotals(parcel);
            }

            if (Global.DestinationParkingNodeIsEnabled)
            {
                DestinationParkingNodeDao = new DestinationParkingNodeDao();
            }
            if (Global.ParkAndRideNodeIsEnabled)
            {
                ParkAndRideNodeDao = new ParkAndRideNodeDao();
            }
        }