Exemplo n.º 1
0
        public static void LoadData()
        {
            var parcelReader =
                Global
                .Kernel
                .Get <IPersistenceFactory <IParcel> >()
                .Reader;

            var parcelCreator =
                Global
                .Kernel
                .Get <IWrapperFactory <IParcelCreator> >()
                .Creator;

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

            var zoneReader =
                Global
                .Kernel
                .Get <IPersistenceFactory <IZone> >()
                .Reader;

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

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

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

            var shadowPrices = ShadowPriceReader.ReadShadowPrices();

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

                Parcels.Add(parcel.Id, parcelWrapper);

                IZone zone;

                if (zones.TryGetValue(parcel.ZoneId, out 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.ParkAndRideNodeIsEnabled)
            {
                ParkAndRideNodeDao = new ParkAndRideNodeDao();
            }
        }
Exemplo n.º 2
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();
            }
        }