Exemple #1
0
        public static VestigingModel Parse(OptionParseVestigingModels option)
        {
            var vestiging = new VestigingModel
            {
                Id                    = option.vestigingEntity.Id,
                Adres                 = option.incAdres ? AdresModel.Parse(option.vestigingEntity.Adre, option.currentLocation) : null,
                Destination           = BestemmingModel.Parse(option.vestigingEntity.Destination, option.currentLocation),
                Latitude              = option.vestigingEntity.Latitude,
                Longtitude            = option.vestigingEntity.Longtitude,
                Naam                  = option.vestigingEntity.Naam,
                Pakkets               = option.incPakketten ? PakketModel.Parse(option.vestigingEntity.Pakkets) : null,
                ZoomLevel             = option.vestigingEntity.ZoomLevel,
                Korting               = option.vestigingEntity.Korting,
                Tax                   = option.vestigingEntity.Tax,
                Status                = option.vestigingEntity.Status,
                Valuta                = ValutaModel.Parse(option.vestigingEntity.Valuta),
                Leverancier           = option.incLeverancier ? LeverancierModel.Parse(option.vestigingEntity.Leverancier, option.currentLocation, false) : null,
                ExternalId            = option.vestigingEntity.ExternalId,
                VestigingOpeningHours = option.incVestigingOpeningHour ? VestigingOpeningHourModel.Parse(option.vestigingEntity.VestigingOpeningHours) : null,
                UrlNameParent         = option.destinations.FirstOrDefault(l => l.Id == option.vestigingEntity.Destination.ParentId) != null
                                ? option.destinations.FirstOrDefault(l => l.Id == option.vestigingEntity.Destination.ParentId).DisplayName
                                : string.Empty,
                UrlName = option.destinations.FirstOrDefault(l => l.Cities.Any(c => c.Id == option.vestigingEntity.Destination.Id)) != null
                                ? option.destinations.FirstOrDefault(l => l.Cities.Any(c => c.Id == option.vestigingEntity.Destination.Id)).Cities.First(x => x.Id == option.vestigingEntity.Destination.Id).DisplayName
                                : string.Empty,
            };

            if (option.useLocalCurrency)
            {
                UpdateLocalPackagesUsingLocalCurrency(vestiging);
            }

            return(vestiging);
        }
        public static VestigingOpeningHourModel Parse(VestigingOpeningHour vestigingOpeningHourEntity)
        {
            var vestigingOpeningHour = new VestigingOpeningHourModel
            {
                Id          = vestigingOpeningHourEntity.Id,
                VestigingId = vestigingOpeningHourEntity.VestigingId,
                Weekday     = vestigingOpeningHourEntity.Weekday,
                WeekdayName = vestigingOpeningHourEntity.WeekdayName,
                FromHour    = vestigingOpeningHourEntity.FromHour.Value.ToString("00.00").Replace('.', ':'),
                ToHour      = vestigingOpeningHourEntity.ToHour.Value.ToString("00.00").Replace('.', ':')
            };

            return(vestigingOpeningHour);
        }