コード例 #1
0
 public static ParcelSnapshot WithActiveHouseNumberIdsByTerrainObjectHouseNr
     (this ParcelSnapshot snapshot, Dictionary <CrabTerrainObjectHouseNumberId, CrabHouseNumberId> activeHouseNumberIdsByTerrainObjectHouseNr)
 {
     return(new ParcelSnapshot(new ParcelId(snapshot.ParcelId),
                               string.IsNullOrEmpty(snapshot.ParcelStatus) ? null : ParcelStatus.Parse(snapshot.ParcelStatus),
                               snapshot.IsRemoved,
                               snapshot.LastModificationBasedOnCrab,
                               activeHouseNumberIdsByTerrainObjectHouseNr,
                               snapshot.ImportedSubaddressFromCrab,
                               snapshot.AddressIds.Select(x => new AddressId(x))));
 }
コード例 #2
0
 public static SnapshotContainer Build(
     this ParcelSnapshot snapshot,
     long position,
     JsonSerializerSettings serializerSettings)
 {
     return(new SnapshotContainer
     {
         Info = new SnapshotInfo {
             Position = position, Type = nameof(ParcelSnapshot)
         },
         Data = JsonConvert.SerializeObject(snapshot, serializerSettings)
     });
 }
コード例 #3
0
 public static ParcelSnapshot WithAddressIds(this ParcelSnapshot snapshot, IEnumerable <AddressId> addressIds)
 {
     return(new ParcelSnapshot(new ParcelId(snapshot.ParcelId),
                               string.IsNullOrEmpty(snapshot.ParcelStatus) ? null : ParcelStatus.Parse(snapshot.ParcelStatus),
                               snapshot.IsRemoved,
                               snapshot.LastModificationBasedOnCrab,
                               snapshot.ActiveHouseNumberIdsByTerrainObjectHouseNr
                               .ToDictionary(
                                   x => new CrabTerrainObjectHouseNumberId(x.Key),
                                   y => new CrabHouseNumberId(y.Value)),
                               snapshot.ImportedSubaddressFromCrab,
                               addressIds));
 }
コード例 #4
0
 public static ParcelSnapshot WithParcelStatus(this ParcelSnapshot snapshot, ParcelStatus?parcelStatus)
 {
     return(new ParcelSnapshot(new ParcelId(snapshot.ParcelId),
                               parcelStatus,
                               snapshot.IsRemoved,
                               snapshot.LastModificationBasedOnCrab,
                               snapshot.ActiveHouseNumberIdsByTerrainObjectHouseNr
                               .ToDictionary(
                                   x => new CrabTerrainObjectHouseNumberId(x.Key),
                                   y => new CrabHouseNumberId(y.Value)),
                               snapshot.ImportedSubaddressFromCrab,
                               snapshot.AddressIds.Select(x => new AddressId(x))));
 }
コード例 #5
0
        private void When(ParcelSnapshot snapshot)
        {
            _parcelId = new ParcelId(snapshot.ParcelId);
            if (!string.IsNullOrEmpty(snapshot.ParcelStatus))
            {
                var status = ParcelStatus.Parse(snapshot.ParcelStatus);
                if (status == ParcelStatus.Realized)
                {
                    IsRealized = true;
                }
                if (status == ParcelStatus.Retired)
                {
                    IsRetired = true;
                }
            }

            IsRemoved = snapshot.IsRemoved;
            LastModificationBasedOnCrab = snapshot.LastModificationBasedOnCrab;

            foreach (var activeHouseNumberByTerrainObject in snapshot.ActiveHouseNumberIdsByTerrainObjectHouseNr)
            {
                _activeHouseNumberIdsByTerreinObjectHouseNr.Add(
                    new CrabTerrainObjectHouseNumberId(activeHouseNumberByTerrainObject.Key),
                    new CrabHouseNumberId(activeHouseNumberByTerrainObject.Value));
            }

            foreach (var addressId in snapshot.AddressIds)
            {
                _addressCollection.Add(new AddressId(addressId));
            }

            foreach (var subaddressWasImportedFromCrab in snapshot.ImportedSubaddressFromCrab)
            {
                _addressCollection.Add(subaddressWasImportedFromCrab);
            }
        }