public MunicipalityWasImportedFromCrab(
     CrabMunicipalityId crabMunicipalityId,
     NisCode nisCode,
     CrabLanguage?primaryLanguage,
     CrabLanguage?secondaryLanguage,
     NumberOfFlags numberOfFlags,
     CrabLifetime lifetime,
     WkbGeometry wkbGeometry,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     CrabMunicipalityId = crabMunicipalityId;
     NisCode            = nisCode;
     PrimaryLanguage    = primaryLanguage;
     SecondaryLanguage  = secondaryLanguage;
     NumberOfFlags      = numberOfFlags;
     BeginDate          = lifetime.BeginDateTime;
     EndDate            = lifetime.EndDateTime;
     WkbGeometry        = wkbGeometry?.ToString();
     Timestamp          = timestamp;
     Operator           = @operator;
     Modification       = modification;
     Organisation       = organisation;
 }
 public MunicipalityWasAttached(
     PostalCode postalCode,
     NisCode nisCode)
 {
     PostalCode = postalCode;
     NisCode    = nisCode;
 }
Ejemplo n.º 3
0
 public NameMunicipality(
     NisCode nisCode,
     MunicipalityName name)
 {
     NisCode = nisCode;
     Name    = name;
 }
        public static Municipality Register(MunicipalityId municipalityId, NisCode nisCode)
        {
            var municipality = Factory();

            municipality.ApplyChange(new MunicipalityWasImported(municipalityId, nisCode));
            return(municipality);
        }
Ejemplo n.º 5
0
        public PostalInformationWasImportedFromCrab(
            PostalCode postalCode,
            CrabSubCantonId subCantonId,
            CrabSubCantonCode subCantonCode,
            NisCode nisCode,
            CrabMunicipalityName municipalityName,
            CrabLifetime lifetime,
            CrabTimestamp timestamp,
            CrabOperator @operator,
            CrabModification?modification,
            CrabOrganisation?organisation)
        {
            PostalCode    = postalCode;
            SubCantonId   = subCantonId;
            SubCantonCode = subCantonCode;
            NisCode       = nisCode;

            BeginDate = lifetime.BeginDateTime;

            MunicipalityName         = municipalityName.Name;
            MunicipalityNameLanguage = municipalityName.Language;

            Timestamp    = timestamp;
            Operator     = @operator;
            Modification = modification;
            Organisation = organisation;
        }
Ejemplo n.º 6
0
        public void ImportPostalInformationFromCrab(
            PostalCode postalCode,
            CrabSubCantonId subCantonId,
            CrabSubCantonCode subCantonCode,
            NisCode nisCode,
            CrabMunicipalityName municipalityName,
            CrabLifetime lifetime,
            CrabTimestamp timestamp,
            CrabOperator @operator,
            CrabModification?modification,
            CrabOrganisation?organisation)
        {
            ApplyChange(
                new MunicipalityWasAttached(
                    new PostalCode(subCantonCode),
                    nisCode));

            ApplyChange(
                new PostalInformationWasImportedFromCrab(
                    postalCode,
                    subCantonId,
                    subCantonCode,
                    nisCode,
                    municipalityName,
                    lifetime,
                    timestamp,
                    @operator,
                    modification,
                    organisation));
        }
 public MunicipalityWasRegistered(
     MunicipalityId municipalityId,
     NisCode nisCode)
 {
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
 }
 public MunicipalityNisCodeWasDefined(
     MunicipalityId municipalityId,
     NisCode nisCode)
 {
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
 }
Ejemplo n.º 9
0
 public DefineMunicipalitySecondaryLanguage(
     NisCode nisCode,
     Language language)
 {
     NisCode  = nisCode;
     Language = language;
 }
 public MunicipalityWasImported(
     MunicipalityId municipalityId,
     NisCode nisCode)
 {
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
 }
 public ImportStreetNameFromCrab(
     CrabStreetNameId streetNameId,
     CrabMunicipalityId municipalityId,
     NisCode nisCode,
     CrabStreetName primaryStreetName,
     CrabStreetName secondaryStreetName,
     CrabTransStreetName primaryTransStreetName,
     CrabTransStreetName secondaryTransStreetName,
     CrabLanguage?primaryLanguage,
     CrabLanguage?secondaryLanguage,
     CrabLifetime lifeTime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     StreetNameId             = streetNameId;
     MunicipalityId           = municipalityId;
     NisCode                  = nisCode;
     PrimaryStreetName        = primaryStreetName;
     SecondaryStreetName      = secondaryStreetName;
     PrimaryTransStreetName   = primaryTransStreetName;
     SecondaryTransStreetName = secondaryTransStreetName;
     PrimaryLanguage          = primaryLanguage;
     SecondaryLanguage        = secondaryLanguage;
     LifeTime                 = lifeTime;
     Timestamp                = timestamp;
     Operator                 = @operator;
     Modification             = modification;
     Organisation             = organisation;
 }
Ejemplo n.º 12
0
 public static ChangeMunicipalityNisCode WithNisCode(
     this ChangeMunicipalityNisCode command,
     NisCode nisCode)
 {
     return(new ChangeMunicipalityNisCode(new MunicipalityId(command.MunicipalityId), nisCode,
                                          command.Provenance));
 }
 public DrawMunicipality(
     NisCode nisCode,
     WkbGeometry wkbGeometry)
 {
     NisCode     = nisCode;
     WkbGeometry = wkbGeometry;
 }
 public ImportMunicipalityFromCrab(
     NisCode nisCode,
     CrabLanguage?primaryLanguage,
     CrabLanguage?secondaryLanguage,
     CrabLanguage?facilityLanguage,
     WkbGeometry geometry,
     NumberOfFlags numberOfFlags,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation,
     CrabMunicipalityId municipalityId)
 {
     NisCode           = nisCode;
     PrimaryLanguage   = primaryLanguage;
     SecondaryLanguage = secondaryLanguage;
     FacilityLanguage  = facilityLanguage;
     Geometry          = geometry;
     Lifetime          = lifetime;
     Timestamp         = timestamp;
     Operator          = @operator;
     Modification      = modification;
     Organisation      = organisation;
     NumberOfFlags     = numberOfFlags;
     MunicipalityId    = municipalityId;
 }
 public MunicipalityNisCodeWasCorrected(
     MunicipalityId municipalityId,
     NisCode nisCode)
 {
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
 }
Ejemplo n.º 16
0
 public TerminateMunicipality(
     NisCode nisCode,
     TerminationDate date)
 {
     NisCode = nisCode;
     Date    = date;
 }
Ejemplo n.º 17
0
 public static ImportMunicipality WithNisCode(
     this ImportMunicipality command,
     NisCode nisCode)
 {
     return(new ImportMunicipality(
                new MunicipalityId(command.MunicipalityId),
                nisCode,
                command.Provenance));
 }
Ejemplo n.º 18
0
        public void DefineNisCode(NisCode nisCode)
        {
            if (string.IsNullOrWhiteSpace(nisCode))
            {
                throw new NoNisCodeException("Cannot clear NisCode of a municipality.");
            }

            ApplyChange(new MunicipalityNisCodeWasDefined(_municipalityId, nisCode));
        }
 public ChangeMunicipalityNisCode(
     MunicipalityId municipalityId,
     NisCode nisCode,
     Provenance provenance)
 {
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
     Provenance     = provenance;
 }
 public StreetNameWasRegistered(
     StreetNameId streetNameId,
     MunicipalityId municipalityId,
     NisCode nisCode)
 {
     StreetNameId   = streetNameId;
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
 }
 public ImportMunicipality(
     MunicipalityId municipalityId,
     NisCode nisCode,
     Provenance provenance)
 {
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
     Provenance     = provenance;
 }
Ejemplo n.º 22
0
 public RegisterMunicipality(
     MunicipalityId municipalityId,
     NisCode nisCode,
     Language?primaryLanguage,
     Language?secondaryLanguage)
 {
     MunicipalityId    = municipalityId;
     NisCode           = nisCode;
     PrimaryLanguage   = primaryLanguage;
     SecondaryLanguage = secondaryLanguage;
 }
 public StreetNameWasProposedV2(
     MunicipalityId municipalityId,
     NisCode nisCode,
     Names streetNameNames,
     PersistentLocalId persistentLocalId)
 {
     MunicipalityId    = municipalityId;
     NisCode           = nisCode;
     StreetNameNames   = streetNameNames;
     PersistentLocalId = persistentLocalId;
 }
        public void ChangeNisCode(NisCode nisCode)
        {
            if (string.IsNullOrWhiteSpace(nisCode))
            {
                throw new NoNisCodeException("NisCode of a municipality cannot be empty.");
            }

            if (nisCode != _nisCode)
            {
                ApplyChange(new MunicipalityNisCodeWasChanged(_municipalityId, nisCode));
            }
        }
Ejemplo n.º 25
0
        public void ThenNisCodeChangedToNisCodeRonse()
        {
            var nisCode = new NisCode("45041");
            var command = Fixture.Create <ChangeMunicipalityNisCode>()
                          .WithMunicipalityId(_municipalityId)
                          .WithNisCode(nisCode);

            Assert(new Scenario()
                   .Given(_municipalityId,
                          Fixture.Create <MunicipalityWasImported>())
                   .When(command)
                   .Then(new[]
            {
                new Fact(_municipalityId, new MunicipalityNisCodeWasChanged(command.MunicipalityId, nisCode))
            }));
        }
Ejemplo n.º 26
0
        private void CheckChangedNisCode(NisCode nisCode, CrabModification?crabModification)
        {
            if (_nisCode == nisCode)
            {
                return;
            }

            if (nisCode == null)
            {
                throw new NoNisCodeException("Cannot clear NisCode of a municipality.");
            }

            if (crabModification == CrabModification.Correction)
            {
                ApplyChange(new MunicipalityNisCodeWasCorrected(_municipalityId, nisCode));
            }
            else
            {
                DefineNisCode(nisCode);
            }
        }
Ejemplo n.º 27
0
        private static async Task <Optional <StreetName> > GetOrRegisterStreetName(
            IStreetNames streetNames,
            StreetNameId streetNameId,
            MunicipalityId municipalityId,
            NisCode nisCode,
            CancellationToken ct)
        {
            var streetName = await streetNames.GetOptionalAsync(streetNameId, ct);

            if (streetName.HasValue)
            {
                return(streetName);
            }

            streetName = new Optional <StreetName>(
                StreetName.Register(
                    new StreetNameId(streetNameId),
                    new MunicipalityId(municipalityId),
                    nisCode));

            streetNames.Add(streetNameId, streetName.Value);

            return(streetName);
        }
Ejemplo n.º 28
0
        public void ImportFromCrab(
            CrabMunicipalityId crabMunicipalityId,
            NisCode nisCode,
            CrabLanguage?primaryLanguage,
            CrabLanguage?secondaryLanguage,
            CrabLanguage?facilityLanguage,
            NumberOfFlags numberOfFlags,
            CrabLifetime crabLifetime,
            WkbGeometry geometry,
            CrabTimestamp crabTimestamp,
            CrabOperator crabOperator,
            CrabModification?crabModification,
            CrabOrganisation?crabOrganisation)
        {
            var endTime = crabLifetime?.EndDateTime;

            CheckChangedNisCode(nisCode, crabModification);
            CheckChangedOfficialLanguages(new[] { primaryLanguage?.ToLanguage(), secondaryLanguage?.ToLanguage() });
            CheckChangedFacilityLanguages(facilityLanguage?.ToLanguage());
            CheckChangedGeometry(geometry == null ? null : geometry, crabModification);
            CheckChangedStatus(endTime, crabModification);

            // Legacy Event
            ApplyChange(new MunicipalityWasImportedFromCrab(
                            crabMunicipalityId,
                            nisCode,
                            primaryLanguage,
                            secondaryLanguage,
                            numberOfFlags,
                            crabLifetime,
                            geometry,
                            crabTimestamp,
                            crabOperator,
                            crabModification,
                            crabOrganisation));
        }
 private void When(MunicipalityNisCodeWasCorrected @event)
 {
     _nisCode = new NisCode(@event.NisCode);
 }
 private void When(MunicipalityWasRegistered @event)
 {
     _municipalityId = new MunicipalityId(@event.MunicipalityId);
     _nisCode        = new NisCode(@event.NisCode);
 }