public static RegistreringType1 CreateFakePerson(bool addSourceObject) { var ret = new RegistreringType1() { AttributListe = new AttributListeType() { Egenskab = new EgenskabType[] { }, LokalUdvidelse = null, RegisterOplysning = new RegisterOplysningType[] { }, SundhedOplysning = null, }, RelationListe = new RelationListeType(), TilstandListe = new TilstandListeType(), AktoerRef = UnikIdType.Create(Guid.NewGuid()), LivscyklusKode = LivscyklusKodeType.Rettet, CommentText = "", Virkning = new VirkningType[] { }, SourceObjectsXml = null, Tidspunkt = TidspunktType.Create(DateTime.Today) }; if (addSourceObject) { var o = new object[] { Guid.NewGuid(), Guid.NewGuid() }; ret.SourceObjectsXml = CprBroker.Utilities.Strings.SerializeObject(o); } return(ret); }
public static void ApplyIfNeeded(LaesResultatType result) { if (Config.Properties.Settings.Default.ReturnCityNameInDistrictName) { if (result != null) { RegistreringType1 oioReg = result.Item as RegistreringType1; if (oioReg != null && oioReg.AttributListe != null && oioReg.AttributListe.RegisterOplysning != null && oioReg.AttributListe.RegisterOplysning.Length > 0) { foreach (var opl in oioReg.AttributListe.RegisterOplysning) { var cpr = opl.Item as CprBorgerType; if (cpr != null && cpr.FolkeregisterAdresse != null && cpr.FolkeregisterAdresse.Item is DanskAdresseType) { var dansk = cpr.FolkeregisterAdresse.Item as DanskAdresseType; if (dansk.AddressComplete != null && dansk.AddressComplete.AddressPostal != null) { var postal = dansk.AddressComplete.AddressPostal; if (string.IsNullOrEmpty(postal.DistrictSubdivisionIdentifier) && string.Equals(postal.DistrictName, dansk.PostDistriktTekst)) { postal.DistrictName = postal.DistrictSubdivisionIdentifier; postal.DistrictSubdivisionIdentifier = null; } } } } } } } }
public void Importer(UserData user) { // create ShortKey if not supplied EnsureKeys(user); log.Debug("Attempting Import on Bruger with uuid " + user.Uuid); // create timestamp object to be used on all registrations, properties and relations VirkningType virkning = helper.GetVirkning(user.Timestamp); // setup registration RegistreringType1 registration = helper.CreateRegistration(user.Timestamp, LivscyklusKodeType.Importeret); // add properties helper.AddProperties(user.ShortKey, user.UserId, virkning, registration); // setup relations helper.AddAddressReferences(user.Addresses, virkning, registration); helper.AddPersonRelationship(user.PersonUuid, virkning, registration); helper.AddOrganisationRelation(StubUtil.GetMunicipalityOrganisationUUID(), virkning, registration); // set Tilstand to Active helper.SetTilstandToActive(virkning, registration, user.Timestamp); // wire everything together BrugerType brugerType = helper.GetBrugerType(user.Uuid, registration); ImportInputType importInput = new ImportInputType(); importInput.Bruger = brugerType; // construct request importerRequest request = new importerRequest(); request.ImporterRequest1 = new ImporterRequestType(); request.ImporterRequest1.ImportInput = importInput; request.ImporterRequest1.AuthorityContext = new AuthorityContextType(); request.ImporterRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetMunicipality(); // send request BrugerPortType channel = StubUtil.CreateChannel <BrugerPortType>(BrugerStubHelper.SERVICE, "Importer", helper.CreatePort()); try { importerResponse response = channel.importer(request); int statusCode = Int32.Parse(response.ImporterResponse1.ImportOutput.StandardRetur.StatusKode); if (statusCode != 20) { string message = StubUtil.ConstructSoapErrorMessage(statusCode, "Import", BrugerStubHelper.SERVICE, response.ImporterResponse1.ImportOutput.StandardRetur.FejlbeskedTekst); log.Error(message); throw new SoapServiceException(message); } log.Debug("Import on Bruger with uuid " + user.Uuid + " succeeded"); } catch (Exception ex) when(ex is CommunicationException || ex is IOException || ex is TimeoutException || ex is WebException) { throw new ServiceNotFoundException("Failed to establish connection to the Importer service on Bruger", ex); } }
public void Importer(OrgUnitData unit) { log.Debug("Attempting Importer on OrganisationEnhed with uuid " + unit.Uuid); // create ShortKey if not supplied EnsureKeys(unit); // create timestamp object to be used on all registrations, properties and relations VirkningType virkning = helper.GetVirkning(unit.Timestamp); // setup registration RegistreringType1 registration = helper.CreateRegistration(unit, LivscyklusKodeType.Importeret); // add properties helper.AddProperties(unit.ShortKey, unit.Name, virkning, registration); // add relationships helper.AddAddressReferences(unit.Addresses, virkning, registration); helper.AddOrganisationRelation(StubUtil.GetMunicipalityOrganisationUUID(), virkning, registration); helper.AddOverordnetEnhed(unit.ParentOrgUnitUuid, virkning, registration); helper.AddTilknyttedeFunktioner(unit.OrgFunctionUuids, virkning, registration); // set Tilstand to Active helper.SetTilstandToActive(virkning, registration, unit.Timestamp); // wire everything together OrganisationEnhedType organisationEnhedType = helper.GetOrganisationEnhedType(unit.Uuid, registration); ImportInputType importInput = new ImportInputType(); importInput.OrganisationEnhed = organisationEnhedType; // construct request importerRequest request = new importerRequest(); request.ImporterRequest1 = new ImporterRequestType(); request.ImporterRequest1.ImportInput = importInput; request.ImporterRequest1.AuthorityContext = new AuthorityContextType(); request.ImporterRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetMunicipality(); // send request OrganisationEnhedPortType channel = StubUtil.CreateChannel <OrganisationEnhedPortType>(OrganisationEnhedStubHelper.SERVICE, "Importer", helper.CreatePort()); try { importerResponse result = channel.importer(request); int statusCode = Int32.Parse(result.ImporterResponse1.ImportOutput.StandardRetur.StatusKode); if (statusCode != 20) { string message = StubUtil.ConstructSoapErrorMessage(statusCode, "Import", OrganisationEnhedStubHelper.SERVICE, result.ImporterResponse1.ImportOutput.StandardRetur.FejlbeskedTekst); log.Error(message); throw new SoapServiceException(message); } log.Debug("Importer successful on OrganisationEnhed with uuid " + unit.Uuid); } catch (Exception ex) when(ex is CommunicationException || ex is IOException || ex is TimeoutException || ex is WebException) { throw new ServiceNotFoundException("Failed to establish connection to the Importer service on OrganisationEnhed", ex); } }
public RegistreringType1 Read(CprBroker.Schemas.PersonIdentifier uuid, LaesInputType input, Func <string, Guid> cpr2uuidFunc, out CprBroker.Schemas.QualityLevel?ql) { RegistreringType1 ret = null; if (IPartPerCallDataProviderHelper.CanCallOnline(uuid.CprNumber)) { // TODO: Shall we remove this explicit logging after integration of budget control? Admin.AddNewLog(System.Diagnostics.TraceEventType.Information, "KMD.Read", string.Format("Calling AS78207 with PNR <{0}>", uuid.CprNumber), null, null); var detailsResponse = new EnglishAS78207Response(CallAS78207(uuid.CprNumber)); Admin.AddNewLog(System.Diagnostics.TraceEventType.Information, "KMD.Read", string.Format("Calling AS78205 with PNR <{0}>", uuid.CprNumber), null, null); var addressResponse = CallAS78205(uuid.CprNumber); Admin.AddNewLog(System.Diagnostics.TraceEventType.Information, "KMD.Read", string.Format("Converting PNR <{0}>", uuid.CprNumber), null, null); var kmdResponse = new KmdResponse() { AS78205Response = addressResponse.InnerResponse, AS78207Response = detailsResponse.InnerResponse }; UuidCache cache = new UuidCache(); cache.FillCache(kmdResponse.RelatedPnrs); ret = kmdResponse.ToRegistreringType1(cache.GetUuid); } ql = CprBroker.Schemas.QualityLevel.Cpr; return(ret); }
public static bool ApplyRules(PersonRegistration dbReg, RegistreringType1 newReg, IEnumerable <MatchRule> matchRules) { var existingReg = PersonRegistration.ToXmlType(dbReg); var appliedRules = new List <MatchRule>(); // Attempt rule application to OIO objects foreach (var rule in matchRules) { if (rule.UpdateXmlTypeIfPossible(existingReg, newReg)) { appliedRules.Add(rule); } } if (appliedRules.Count > 0) { var existingXml = Strings.SerializeObject(existingReg); var newXml = Strings.SerializeObject(newReg); if (string.Equals(existingXml, newXml)) { dbReg.BrokerUpdateDate = DateTime.Now; dbReg.SetContents(newReg); return(true); } } return(false); }
public override NavnStrukturType GetObject(RegistreringType1 oio) { if (oio != null && oio.AttributListe != null && oio.AttributListe.Egenskab != null && oio.AttributListe.Egenskab.Length > 0 && oio.AttributListe.Egenskab[0] != null) { return(oio.AttributListe.Egenskab[0].NavnStruktur); } return(null); }
public void Importer(AddressData address) { // create ShortKey and Uuid if not supplied EnsureKeys(address); log.Debug("Attempting Import on Address with uuid " + address.Uuid); // create timestamp object to be used on all registrations, properties and relations VirkningType virkning = helper.GetVirkning(address.Timestamp); // setup registration RegistreringType1 registration = helper.CreateRegistration(address.Timestamp, LivscyklusKodeType.Importeret); // add properties helper.AddProperties(address.AddressText, address.ShortKey, virkning, registration); // wire everything together AdresseType addresseType = helper.GetAdresseType(address.Uuid, registration); ImportInputType inportInput = new ImportInputType(); inportInput.Adresse = addresseType; // construct request importerRequest request = new importerRequest(); request.ImporterRequest1 = new ImporterRequestType(); request.ImporterRequest1.ImportInput = inportInput; request.ImporterRequest1.AuthorityContext = new AuthorityContextType(); request.ImporterRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetMunicipality(); // send request AdressePortType channel = StubUtil.CreateChannel <AdressePortType>(AdresseStubHelper.SERVICE, "Importer", helper.CreatePort()); try { importerResponse response = channel.importer(request); int statusCode = Int32.Parse(response.ImporterResponse1.ImportOutput.StandardRetur.StatusKode); if (statusCode != 20) { if (statusCode == 49) // object already exists is the most likely scenario here { // TODO: a better approach would be to try the read-then-update-if-exists-else-create approach we use elsewhere log.Info("Skipping import on Address " + address.Uuid + " as Organisation returned status 49. The most likely cause is that the object already exists"); return; } string message = StubUtil.ConstructSoapErrorMessage(statusCode, "Import", AdresseStubHelper.SERVICE, response.ImporterResponse1.ImportOutput.StandardRetur.FejlbeskedTekst); log.Error(message); throw new SoapServiceException(message); } log.Debug("Import successful on Address with uuid " + address.Uuid); } catch (Exception ex) when(ex is CommunicationException || ex is IOException || ex is TimeoutException || ex is WebException) { throw new ServiceNotFoundException("Failed to establish connection to the Importer service on Adresse", ex); } }
public override void ProcessPerson(string pnr) { /* Sample person in run "2013 05 27 14_12" * - First Egenskab has null start and end dates - shall the first start at birthdate? * - Married with unknown spouse PNR */ using (var dataContext = new ExtractDataContext()) { var extractItems = dataContext.ExtractItems.Where(ei => ei.PNR == pnr); var grouped = extractItems.GroupBy(ei => ei.Extract); var myOutDir = OutDir + pnr + "\\"; Directory.CreateDirectory(myOutDir); var registrations = new List <RegistreringType1>(); foreach (var extract in grouped.OrderBy(ex => ex.Key.ExtractDate)) { var resp = Extract.GetPersonFromLatestExtract(pnr, extract.AsQueryable(), CprBroker.Providers.CPRDirect.Constants.DataObjectMap); var reg = resp.ToRegistreringType1(GetUuid); registrations.Add(reg); File.WriteAllText( string.Format("{0}{1}.{2}.xml", myOutDir, pnr, reg.Tidspunkt.ToDateTime().Value.ToString("yyyyMMdd HHmm")), CprBroker.Utilities.Strings.SerializeObject(reg) ); } var merged1 = RegistreringType1.Merge(new CprBroker.Schemas.PersonIdentifier() { UUID = GetUuid(pnr), CprNumber = pnr }, VirkningType.Create(DateTime.MinValue, DateTime.MaxValue), registrations.ToArray()); File.WriteAllText( string.Format("{0}{1}.All.1.xml", myOutDir, pnr), CprBroker.Utilities.Strings.SerializeObject(merged1) ); var merged2 = new CPRDirectExtractDataProvider().ReadPeriod(DateTime.MinValue, DateTime.MaxValue, new CprBroker.Schemas.PersonIdentifier() { CprNumber = pnr, UUID = GetUuid(pnr) }, GetUuid); File.WriteAllText( string.Format("{0}{1}.All.2.xml", myOutDir, pnr), CprBroker.Utilities.Strings.SerializeObject(merged2) ); var effectDate = new DateTime(2013, 5, 1); var merged3 = new CPRDirectExtractDataProvider().ReadPeriod(effectDate, effectDate, new CprBroker.Schemas.PersonIdentifier() { CprNumber = pnr, UUID = GetUuid(pnr) }, GetUuid); File.WriteAllText( string.Format("{0}{1}.All.3.xml", myOutDir, pnr), CprBroker.Utilities.Strings.SerializeObject(merged3) ); } }
public void ApplyRules_Empty_False() { var dbReg = new PersonRegistration(); var oioReg = new RegistreringType1(); dbReg.SetContents(oioReg); var ret = MatchRule.ApplyRules(dbReg, oioReg, new MatchRule[0]); Assert.False(ret); }
// Deactivates the user by setting the Gyldighed attribute to Inactive public void Deactivate(string uuid, DateTime timestamp) { log.Debug("Attempting Deactivate on Bruger with uuid " + uuid); RegistreringType1 registration = GetLatestRegistration(uuid); if (registration == null) { log.Debug("Cannot Deactivate Bruger with uuid " + uuid + " because it does not exist in Organisation"); return; } BrugerPortType channel = StubUtil.CreateChannel <BrugerPortType>(BrugerStubHelper.SERVICE, "Ret", helper.CreatePort()); try { RetInputType1 input = new RetInputType1(); input.UUIDIdentifikator = uuid; input.AttributListe = registration.AttributListe; input.TilstandListe = registration.TilstandListe; input.RelationListe = registration.RelationListe; VirkningType virkning = helper.GetVirkning(timestamp); helper.SetTilstandToInactive(virkning, registration, timestamp); retRequest request = new retRequest(); request.RetRequest1 = new RetRequestType(); request.RetRequest1.RetInput = input; request.RetRequest1.AuthorityContext = new AuthorityContextType(); request.RetRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); retResponse response = channel.ret(request); int statusCode = Int32.Parse(response.RetResponse1.RetOutput.StandardRetur.StatusKode); if (statusCode != 20) { if (statusCode == 49) { log.Warn("Deactive failed on Bruger " + uuid + " as Organisation returned status 49. The most likely cause is that the object has been Passiveret"); return; } string message = StubUtil.ConstructSoapErrorMessage(statusCode, "Ret", BrugerStubHelper.SERVICE, response.RetResponse1.RetOutput.StandardRetur.FejlbeskedTekst); log.Error(message); throw new SoapServiceException(message); } log.Debug("Deactivate on Bruger with uuid " + uuid + " succeeded"); } catch (Exception ex) when(ex is CommunicationException || ex is IOException || ex is TimeoutException || ex is WebException) { throw new ServiceNotFoundException("Failed to establish connection to the Ret service on Bruger", ex); } }
public override T GetObject(RegistreringType1 oio) { if (_GetObjectM != null) { return(_GetObjectM(oio)); } else { return(_GetObject); } }
public void CompareContents(RegistreringType1 oioReg, string oldContentsXml, string newContentsXml) { if ((oioReg.AttributListe.RegisterOplysning[0].Item as CprBorgerType).FolkeregisterAdresse != null && (oioReg.AttributListe.RegisterOplysning[0].Item as CprBorgerType).FolkeregisterAdresse.Item is DanskAdresseType) { NUnit.Framework.Assert.AreNotEqual(oldContentsXml, newContentsXml); } else { NUnit.Framework.Assert.AreEqual(oldContentsXml, newContentsXml); } }
internal OrganisationFunktionType GetOrganisationFunktionType(string uuid, RegistreringType1 registration) { OrganisationFunktionType organisationType = new OrganisationFunktionType(); organisationType.UUIDIdentifikator = uuid; RegistreringType1[] registreringTypes = new RegistreringType1[1]; registreringTypes[0] = registration; organisationType.Registrering = registreringTypes; return(organisationType); }
public void CalculateVirkning_TilstandeVirkning_CorrectValues() { DateTime date = DateTime.Today; var registration = new RegistreringType1() { TilstandListe = CreateTilstandListeType(date) }; registration.CalculateVirkning(); Assert.AreEqual(date, registration.Virkning[0].FraTidspunkt.ToDateTime().Value); }
public void CalculateVirkning_TilstandeVirkning_CorrectLength() { DateTime date = DateTime.Today; var registration = new RegistreringType1() { TilstandListe = CreateTilstandListeType(date) }; registration.CalculateVirkning(); Assert.AreEqual(2, registration.Virkning.Length); }
public void ApplyRules_IrrelevantRules_SameObject() { var dbReg = new PersonRegistration(); var oioReg = new RegistreringType1(); dbReg.SetContents(oioReg); var xml1 = Strings.SerializeObject(dbReg); var ret = MatchRule.ApplyRules(dbReg, oioReg); var xml2 = Strings.SerializeObject(dbReg); Assert.AreEqual(xml1, xml2); }
internal bool SetTilstandToInactive(VirkningType virkning, RegistreringType1 registration, DateTime timestamp) { if (TerminateValidityOnGyldighedIfNotMatches(GyldighedStatusKodeType.Inaktiv, registration, timestamp)) { GyldighedType gyldighed = GetGyldighedType(GyldighedStatusKodeType.Inaktiv, virkning); SetTilstand(gyldighed, registration); return(true); } return(false); }
public bool Equals(RegistreringType1 oio) { var xml = Strings.SerializeObject(oio); // Repeat serialization to avoid empty text oio = Strings.Deserialize <RegistreringType1>(xml); xml = Strings.SerializeObject(oio); var thisOio = ToXmlType(this); var thisXml = Strings.SerializeObject(thisOio); return(string.Equals(xml, thisXml)); }
public void UpdateXmlTypeIfPossible_Candidates_True() { var oioReg = new RegistreringType1(); var rule = new DummyRule <RegistreringType1> { _AreCandidates = true, _GetObject = oioReg, _UpdateOioFromXmlType = (r1, r2) => r1.AttributListe = new AttributListeType() { } }; var ret = rule.UpdateXmlTypeIfPossible(oioReg, oioReg); Assert.True(ret); }
public void Importer(PersonData person) { // create ShortKey and Uuid if not supplied EnsureKeys(person); log.Debug("Attempting Import on Person with uuid " + person.Uuid); // create timestamp object to be used on all registrations, properties and relations VirkningType virkning = helper.GetVirkning(person.Timestamp); // setup registration RegistreringType1 registration = helper.CreateRegistration(person.Timestamp, LivscyklusKodeType.Importeret); // add properties helper.AddProperties(person.Name, person.ShortKey, person.Cpr, virkning, registration); // wire everything together PersonType personType = helper.GetPersonType(person.Uuid, registration); ImportInputType importInput = new ImportInputType(); importInput.Person = personType; // construct request importerRequest request = new importerRequest(); request.ImporterRequest1 = new ImporterRequestType(); request.ImporterRequest1.ImportInput = importInput; request.ImporterRequest1.AuthorityContext = new AuthorityContextType(); request.ImporterRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); // send request PersonPortType channel = StubUtil.CreateChannel <PersonPortType>(PersonStubHelper.SERVICE, "Import", helper.CreatePort()); try { importerResponse response = channel.importer(request); int statusCode = Int32.Parse(response.ImporterResponse1.ImportOutput.StandardRetur.StatusKode); if (statusCode != 20) { string message = StubUtil.ConstructSoapErrorMessage(statusCode, "Import", PersonStubHelper.SERVICE, response.ImporterResponse1.ImportOutput.StandardRetur.FejlbeskedTekst); log.Error(message); throw new SoapServiceException(message); } log.Debug("Import successful on Person with uuid " + person.Uuid); } catch (Exception ex) when(ex is CommunicationException || ex is IOException || ex is TimeoutException || ex is WebException) { throw new ServiceNotFoundException("Failed to establish connection to the Importer service on Person", ex); } }
public void UpdateXmlTypeIfPossible_NoCandidates_False() { var oioReg0 = new RegistreringType1(); var oioReg1 = new RegistreringType1(); var rule = new DummyRule <RegistreringType1> { _AreCandidates = false, _GetObject = null, _UpdateOioFromXmlType = (r1, r2) => r1.AttributListe = new AttributListeType() { } }; var ret = rule.UpdateXmlTypeIfPossible(oioReg0, oioReg1); Assert.False(ret); }
public void UpdateXmlTypeIfPossible_Candidates_MethodCall() { var oioReg = new RegistreringType1(); var dbReg = new PersonRegistration(); dbReg.SetContents(oioReg); bool ff = false; var rule = new DummyRule <object> { _AreCandidates = true, _GetObject = "", _UpdateOioFromXmlType = (r1, r2) => ff = true }; var ret = rule.UpdateXmlTypeIfPossible(oioReg, oioReg); Assert.True(ff); }
public void UpdateXmlTypeIfPossible_CandidatesWithOneNullObject_False([Values(0, 1)] int callNumber) { var oioReg = new RegistreringType1(); var oioReg2 = new RegistreringType1(); var oioRegs = new RegistreringType1[] { oioReg, oioReg2 }; var rule = new DummyRule <RegistreringType1> { _AreCandidates = true, _GetObjectM = (o) => o == oioRegs[callNumber] ? null : o, _UpdateOioFromXmlType = (r1, r2) => r1.AttributListe = new AttributListeType() { } }; var ret = rule.UpdateXmlTypeIfPossible(oioReg, oioReg2); Assert.False(ret); }
public override sealed bool UpdateXmlTypeIfPossible(RegistreringType1 existingReg, RegistreringType1 newReg) { var existingObj = GetObject(existingReg); var newObj = GetObject(newReg); if (existingObj != null && newObj != null) { if (AreCandidates(existingObj, newObj)) { UpdateOioFromXmlType(existingObj, newObj); return(true); } } return(false); }
public void UpdateXmlTypeIfPossible_CandidatesWithNullObjects_False() { var oioReg = new RegistreringType1(); var dbReg = new PersonRegistration(); dbReg.SetContents(oioReg); var rule = new DummyRule <RegistreringType1> { _AreCandidates = true, _GetObject = null, _UpdateOioFromXmlType = (r1, r2) => r1.AttributListe = new AttributListeType() { } }; var ret = rule.UpdateXmlTypeIfPossible(oioReg, oioReg); Assert.False(ret); }
public override DanskAdresseType GetObject(RegistreringType1 oio) { if ( oio != null && oio.AttributListe != null && oio.AttributListe.RegisterOplysning != null && oio.AttributListe.RegisterOplysning.Length > 0 && oio.AttributListe.RegisterOplysning[0] != null && oio.AttributListe.RegisterOplysning[0].Item is CprBorgerType && (oio.AttributListe.RegisterOplysning[0].Item as CprBorgerType).FolkeregisterAdresse != null ) { return((oio.AttributListe.RegisterOplysning[0].Item as CprBorgerType).FolkeregisterAdresse.Item as DanskAdresseType); } return(null); }
public void UpdateXmlTypeIfPossible_CandidatesWithNullObjects_SameData() { var oioReg0 = new RegistreringType1(); var oioReg1 = new RegistreringType1(); var xml1 = Strings.SerializeObject(oioReg0); var rule = new DummyRule <RegistreringType1> { _AreCandidates = true, _GetObject = null, _UpdateOioFromXmlType = (r1, r2) => r1.AttributListe = new AttributListeType() { } }; var ret = rule.UpdateXmlTypeIfPossible(oioReg0, oioReg1); var xml2 = Strings.SerializeObject(oioReg0); Assert.AreEqual(xml1, xml2); }
public FiltreretOejebliksbilledeType ReadPeriod(DateTime fromDate, DateTime toDate, PersonIdentifier pId, Func <string, Guid> cpr2uuidFunc) { var targetVirkning = VirkningType.Create(fromDate, toDate); using (var dataContext = new PartDataContext()) { var oioRegs = dataContext .PersonRegistrations // TODO: Shall we also filter by ActorRef.Value to only include CPR Direct? .Where(pr => pr.UUID == pId.UUID) .OrderBy(pr => pr.RegistrationDate) .Select(pr => PersonRegistration.ToXmlType(pr)) .ToArray(); return(RegistreringType1.Merge(pId, targetVirkning, oioRegs)); } }
internal RegistreringType1 CreateRegistration(DateTime timestamp, LivscyklusKodeType registrationType) { UnikIdType systemReference = GetOrganisationReference(); RegistreringType1 registration = new RegistreringType1(); registration.Tidspunkt = timestamp; registration.TidspunktSpecified = true; registration.LivscyklusKode = registrationType; registration.LivscyklusKodeSpecified = true; registration.BrugerRef = systemReference; registration.AttributListe = new AttributListeType(); registration.RelationListe = new RelationListeType(); registration.TilstandListe = new TilstandListeType(); return(registration); }