Ejemplo n.º 1
0
        public void ImportSubaddressPositionFromCrab(
            CrabAddressPositionId addressPositionId,
            CrabSubaddressId subaddressId,
            WkbGeometry addressPosition,
            CrabAddressPositionOrigin addressPositionOrigin,
            CrabAddressNature addressNature,
            CrabLifetime lifetime,
            CrabTimestamp timestamp,
            CrabOperator @operator,
            CrabModification?modification,
            CrabOrganisation?organisation)
        {
            if (IsRemoved && modification != CrabModification.Delete)
            {
                return;
            }

            var legacyEvent = new AddressSubaddressPositionWasImportedFromCrab(
                addressPositionId,
                subaddressId,
                addressPosition,
                addressPositionOrigin,
                addressNature,
                lifetime,
                timestamp,
                @operator,
                modification,
                organisation);

            ApplyPositionChangeFor <AddressSubaddressPositionWasImportedFromCrab, int>(_crabSubaddressPositionEvents, legacyEvent);

            ApplyAddressCompletion();

            ApplyChange(legacyEvent);
        }
Ejemplo n.º 2
0
        public void ImportSubaddressStatusFromCrab(
            CrabSubaddressStatusId subaddressStatusId,
            CrabSubaddressId subaddressId,
            CrabAddressStatus addressStatus,
            CrabLifetime lifetime,
            CrabTimestamp timestamp,
            CrabOperator @operator,
            CrabModification?modification,
            CrabOrganisation?organisation)
        {
            if (IsRemoved && modification != CrabModification.Delete)
            {
                return;
            }

            var legacyEvent = new AddressSubaddressStatusWasImportedFromCrab(
                subaddressStatusId,
                subaddressId,
                addressStatus,
                lifetime,
                timestamp,
                @operator,
                modification,
                organisation);

            ApplyStatusChangesFor(_subAddressStatusChronicle, legacyEvent);

            ApplyAddressCompletion();

            ApplyChange(legacyEvent);
        }
Ejemplo n.º 3
0
 public AssignPersistentLocalIdForCrabSubaddressId(
     CrabSubaddressId subaddressId,
     PersistentLocalId persistentLocalId,
     PersistentLocalIdAssignmentDate assignmentDate)
 {
     SubaddressId      = subaddressId;
     PersistentLocalId = persistentLocalId;
     AssignmentDate    = assignmentDate;
 }
Ejemplo n.º 4
0
 public ImportSubaddressStatusFromCrab(
     CrabSubaddressStatusId subaddressStatusId,
     CrabSubaddressId subaddressId,
     CrabAddressStatus addressStatus,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     SubaddressStatusId = subaddressStatusId;
     SubaddressId       = subaddressId;
     AddressStatus      = addressStatus;
     Lifetime           = lifetime;
     Timestamp          = timestamp;
     Operator           = @operator;
     Modification       = modification;
     Organisation       = organisation;
 }
Ejemplo n.º 5
0
 public AddressSubaddressStatusWasImportedFromCrab(
     CrabSubaddressStatusId subaddressStatusId,
     CrabSubaddressId subaddressId,
     CrabAddressStatus addressStatus,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     SubaddressStatusId = subaddressStatusId;
     SubaddressId       = subaddressId;
     AddressStatus      = addressStatus;
     BeginDateTime      = lifetime.BeginDateTime;
     EndDateTime        = lifetime.EndDateTime;
     Timestamp          = timestamp;
     Operator           = @operator;
     Modification       = modification;
     Organisation       = organisation;
 }
Ejemplo n.º 6
0
 public ImportSubaddressFromCrab(
     CrabSubaddressId subaddressId,
     CrabHouseNumberId houseNumberId,
     BoxNumber boxNumber,
     CrabBoxNumberType boxNumberType,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     SubaddressId  = subaddressId;
     HouseNumberId = houseNumberId;
     BoxNumber     = boxNumber;
     Lifetime      = lifetime;
     Timestamp     = timestamp;
     Operator      = @operator;
     Modification  = modification;
     Organisation  = organisation;
     BoxNumberType = boxNumberType;
 }
Ejemplo n.º 7
0
 public AddressSubaddressWasImportedFromCrab(
     CrabSubaddressId subaddressId,
     CrabHouseNumberId houseNumberId,
     BoxNumber boxNumber,
     CrabBoxNumberType boxNumberType,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     SubaddressId  = subaddressId;
     HouseNumberId = houseNumberId;
     BoxNumber     = boxNumber;
     BoxNumberType = boxNumberType;
     BeginDateTime = lifetime.BeginDateTime;
     EndDateTime   = lifetime.EndDateTime;
     Timestamp     = timestamp;
     Operator      = @operator;
     Modification  = modification;
     Organisation  = organisation;
 }
Ejemplo n.º 8
0
        public void ImportSubaddressFromCrab(
            CrabSubaddressId subaddressId,
            CrabHouseNumberId houseNumberId,
            BoxNumber boxNumber,
            CrabBoxNumberType boxNumberType,
            CrabLifetime lifetime,
            CrabTimestamp timestamp,
            CrabOperator @operator,
            CrabModification?modification,
            CrabOrganisation?organisation)
        {
            GuardRemoved(modification);

            var addressId = AddressId.CreateFor(subaddressId);

            if (_addressCollection.Contains(AddressId.CreateFor(houseNumberId)) &&
                !_addressCollection.Contains(addressId) &&
                modification != CrabModification.Delete &&
                !lifetime.EndDateTime.HasValue)
            {
                ApplyChange(new ParcelAddressWasAttached(_parcelId, addressId));
            }
            else if (_addressCollection.Contains(addressId) &&
                     (modification == CrabModification.Delete || lifetime.EndDateTime.HasValue))
            {
                ApplyChange(new ParcelAddressWasDetached(_parcelId, addressId));
            }

            ApplyChange(new AddressSubaddressWasImportedFromCrab(
                            subaddressId,
                            houseNumberId,
                            boxNumber,
                            boxNumberType,
                            lifetime,
                            timestamp,
                            @operator,
                            modification,
                            organisation));
        }
 public ImportSubaddressMailCantonFromCrab(
     CrabHouseNumberMailCantonId houseNumberMailCantonId,
     CrabHouseNumberId houseNumberId,
     CrabSubaddressId subaddressId,
     CrabMailCantonId mailCantonId,
     CrabMailCantonCode mailCantonCode,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     HouseNumberMailCantonId = houseNumberMailCantonId;
     HouseNumberId           = houseNumberId;
     SubaddressId            = subaddressId;
     MailCantonId            = mailCantonId;
     Lifetime       = lifetime;
     Timestamp      = timestamp;
     Operator       = @operator;
     Modification   = modification;
     Organisation   = organisation;
     MailCantonCode = mailCantonCode;
 }
Ejemplo n.º 10
0
 public ImportSubaddressPositionFromCrab(
     CrabAddressPositionId addressPositionId,
     CrabSubaddressId subaddressId,
     WkbGeometry addressPosition,
     CrabAddressNature addressNature,
     CrabAddressPositionOrigin addressPositionOrigin,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     AddressPositionId     = addressPositionId;
     SubaddressId          = subaddressId;
     AddressPosition       = addressPosition;
     AddressNature         = addressNature;
     AddressPositionOrigin = addressPositionOrigin;
     Lifetime     = lifetime;
     Timestamp    = timestamp;
     Operator     = @operator;
     Modification = modification;
     Organisation = organisation;
 }
Ejemplo n.º 11
0
 public ImportHouseNumberSubaddressFromCrab(
     CrabHouseNumberId houseNumberId,
     CrabSubaddressId subaddressId,
     CrabStreetNameId streetNameId,
     HouseNumber houseNumber,
     GrbNotation grbNotation,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     HouseNumberId = houseNumberId;
     SubaddressId  = subaddressId;
     StreetNameId  = streetNameId;
     HouseNumber   = houseNumber;
     GrbNotation   = grbNotation;
     Lifetime      = lifetime;
     Timestamp     = timestamp;
     Operator      = @operator;
     Modification  = modification;
     Organisation  = organisation;
 }
Ejemplo n.º 12
0
        public void ImportSubaddressFromCrab(
            CrabSubaddressId subaddressId,
            CrabHouseNumberId houseNumberId,
            BoxNumber boxNumber,
            CrabBoxNumberType boxNumberType,
            CrabLifetime lifetime,
            CrabTimestamp timestamp,
            CrabOperator @operator,
            CrabModification?modification,
            CrabOrganisation?organisation)
        {
            GuardRemoved(modification);

            if (modification == CrabModification.Delete)
            {
                if (!IsRemoved)
                {
                    ApplyChange(new AddressWasRemoved(_addressId));
                }
            }
            else
            {
                if (_boxNumber != boxNumber)
                {
                    if (string.IsNullOrEmpty(boxNumber) && _boxNumber != null)
                    {
                        ApplyChange(new AddressBoxNumberWasRemoved(_addressId));
                    }
                    else if (modification != CrabModification.Correction)
                    {
                        ApplyChange(new AddressBoxNumberWasChanged(_addressId, boxNumber));
                    }
                    else
                    {
                        ApplyChange(new AddressBoxNumberWasCorrected(_addressId, boxNumber));
                    }
                }

                EvaluateRetirement(lifetime, modification);
            }

            if (_coupledHouseNumberId != null && _coupledHouseNumberId != houseNumberId && !IsRemoved)
            {
                var lastEvent = _lastHouseNumberEventsForSubaddress[houseNumberId];

                ApplyHouseNumberChange(new CrabStreetNameId(lastEvent.StreetNameId), new HouseNumber(lastEvent.HouseNumber), modification);

                ApplyPostalCodeChangeFor(
                    _lastHouseNumberMailCantonEventsForSubaddress.ContainsKey(houseNumberId)
                        ? _lastHouseNumberMailCantonEventsForSubaddress[houseNumberId]
                        : null,
                    modification);
            }

            ApplyChange(new AddressSubaddressWasImportedFromCrab(
                            subaddressId,
                            houseNumberId,
                            boxNumber,
                            boxNumberType,
                            lifetime,
                            timestamp,
                            @operator,
                            modification,
                            organisation));
        }
Ejemplo n.º 13
0
 public static AddressId CreateFor(CrabSubaddressId crabSubaddressId)
 => new AddressId(crabSubaddressId.CreateDeterministicId());
 public RequestPersistentLocalIdForCrabSubaddressId(
     CrabSubaddressId subaddressId)
 {
     SubaddressId = subaddressId;
 }
Ejemplo n.º 15
0
 public static ImportSubaddressFromCrab WithSubaddressId(this ImportSubaddressFromCrab command, CrabSubaddressId subaddressId)
 {
     return(new ImportSubaddressFromCrab(
                command.CaPaKey,
                subaddressId,
                command.HouseNumberId,
                command.BoxNumber,
                command.BoxNumberType,
                command.Lifetime,
                command.Timestamp,
                command.Operator,
                command.Modification,
                command.Organisation));
 }