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;
 }
コード例 #2
0
 public MunicipalityWasAttached(
     PostalCode postalCode,
     NisCode nisCode)
 {
     PostalCode = postalCode;
     NisCode    = nisCode;
 }
コード例 #3
0
 public NameMunicipality(
     NisCode nisCode,
     MunicipalityName name)
 {
     NisCode = nisCode;
     Name    = name;
 }
コード例 #4
0
        public static Municipality Register(MunicipalityId municipalityId, NisCode nisCode)
        {
            var municipality = Factory();

            municipality.ApplyChange(new MunicipalityWasImported(municipalityId, nisCode));
            return(municipality);
        }
コード例 #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;
        }
コード例 #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));
        }
コード例 #7
0
 public MunicipalityWasRegistered(
     MunicipalityId municipalityId,
     NisCode nisCode)
 {
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
 }
コード例 #8
0
 public MunicipalityNisCodeWasDefined(
     MunicipalityId municipalityId,
     NisCode nisCode)
 {
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
 }
コード例 #9
0
 public DefineMunicipalitySecondaryLanguage(
     NisCode nisCode,
     Language language)
 {
     NisCode  = nisCode;
     Language = language;
 }
 public MunicipalityWasImported(
     MunicipalityId municipalityId,
     NisCode nisCode)
 {
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
 }
コード例 #11
0
 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;
 }
コード例 #12
0
 public static ChangeMunicipalityNisCode WithNisCode(
     this ChangeMunicipalityNisCode command,
     NisCode nisCode)
 {
     return(new ChangeMunicipalityNisCode(new MunicipalityId(command.MunicipalityId), nisCode,
                                          command.Provenance));
 }
コード例 #13
0
 public DrawMunicipality(
     NisCode nisCode,
     WkbGeometry wkbGeometry)
 {
     NisCode     = nisCode;
     WkbGeometry = wkbGeometry;
 }
コード例 #14
0
 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;
 }
コード例 #15
0
 public MunicipalityNisCodeWasCorrected(
     MunicipalityId municipalityId,
     NisCode nisCode)
 {
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
 }
コード例 #16
0
 public TerminateMunicipality(
     NisCode nisCode,
     TerminationDate date)
 {
     NisCode = nisCode;
     Date    = date;
 }
コード例 #17
0
 public static ImportMunicipality WithNisCode(
     this ImportMunicipality command,
     NisCode nisCode)
 {
     return(new ImportMunicipality(
                new MunicipalityId(command.MunicipalityId),
                nisCode,
                command.Provenance));
 }
コード例 #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;
 }
コード例 #20
0
 public StreetNameWasRegistered(
     StreetNameId streetNameId,
     MunicipalityId municipalityId,
     NisCode nisCode)
 {
     StreetNameId   = streetNameId;
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
 }
コード例 #21
0
 public ImportMunicipality(
     MunicipalityId municipalityId,
     NisCode nisCode,
     Provenance provenance)
 {
     MunicipalityId = municipalityId;
     NisCode        = nisCode;
     Provenance     = provenance;
 }
コード例 #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;
 }
コード例 #24
0
        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));
            }
        }
コード例 #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))
            }));
        }
コード例 #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);
            }
        }
コード例 #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);
        }
コード例 #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));
        }
コード例 #29
0
 private void When(MunicipalityNisCodeWasCorrected @event)
 {
     _nisCode = new NisCode(@event.NisCode);
 }
コード例 #30
0
 private void When(MunicipalityWasRegistered @event)
 {
     _municipalityId = new MunicipalityId(@event.MunicipalityId);
     _nisCode        = new NisCode(@event.NisCode);
 }