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 laesResponse Read(string uuid) { // construct request LaesInputType laesInput = new LaesInputType(); laesInput.UUIDIdentifikator = uuid; laesRequest request = new laesRequest(); request.LaesRequest1 = new LaesRequestType(); request.LaesRequest1.LaesInput = laesInput; request.LaesRequest1.AuthorityContext = new AuthorityContextType(); request.LaesRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); // send request OrganisationFunktionPortType channel = StubUtil.CreateChannel <OrganisationFunktionPortType>(OrganisationFunktionStubHelper.SERVICE, "List", helper.CreatePort()); try { return(channel.laes(request)); } 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 Laes service on OrganisationFunktion", ex); } }
public bool IsAlive() { LaesInputType laesInput = new LaesInputType(); laesInput.UUIDIdentifikator = Guid.NewGuid().ToString().ToLower(); laesRequest request = new laesRequest(); request.LaesRequest1 = new LaesRequestType(); request.LaesRequest1.LaesInput = laesInput; request.LaesRequest1.AuthorityContext = new AuthorityContextType(); request.LaesRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); BrugerPortType channel = StubUtil.CreateChannel <BrugerPortType>(BrugerStubHelper.SERVICE, "Laes", helper.CreatePort()); try { laesResponse response = channel.laes(request); int statusCode = Int32.Parse(response.LaesResponse1.LaesOutput.StandardRetur.StatusKode); if (statusCode == 20 || statusCode == 44) { return(true); } } catch (Exception) { ; // ignore } return(false); }
public ReadSubMethodInfo(LaesInputType input, SourceUsageOrder localAction) : this() { this.Input = input; LocalDataProviderOption = localAction; UpdateMethod = (personRegistration) => Local.UpdateDatabase.UpdatePersonRegistration(PersonIdentifier, personRegistration); }
public static LaesOutputType Read(string userToken, string appToken, LaesInputType input, SourceUsageOrder localAction, out QualityLevel?qualityLevel) { ReadFacadeMethodInfo facadeMethod = new ReadFacadeMethodInfo(input, localAction, appToken, userToken); var ret = GetMethodOutput <LaesOutputType, LaesResultatType>(facadeMethod); qualityLevel = facadeMethod.QualityLevel; return(ret); }
public RegistreringType1 Read(CprBroker.Schemas.PersonIdentifier uuid, LaesInputType input, Func <string, Guid> cpr2uuidFunc, out CprBroker.Schemas.QualityLevel?ql) { ql = CprBroker.Schemas.QualityLevel.DataProvider; if (knownCprNumbers.Contains(uuid.CprNumber)) { return(new RegistreringType1()); } return(null); }
public override void Initialize() { SubMethodInfos = Array.ConvertAll <string, SubMethodInfo> ( input.UUID.ToArray(), (pUUID) => new ReadSubMethodInfo( LaesInputType.Create(pUUID, input), sourceUsageOrder) ); }
static void Main(string[] args) { try { string inputCprNo = args[0]; string inputAppToken = args[1]; string endpointAddress = args[2]; PartSoap12Client client = new PartSoap12Client( Program.GetCustomHttpsBinding(), new EndpointAddress(endpointAddress) ); // Conf. SOAP header ApplicationHeader appHeader = new ApplicationHeader(); appHeader.ApplicationToken = inputAppToken; appHeader.UserToken = Environment.UserName; // Call Part.GetUuid var uuidResult = client.GetUuidAsync(appHeader, inputCprNo); string uuid = uuidResult.Result.GetUuidOutput.UUID; Console.WriteLine(string.Format("Part.GetUuid output: {0}", uuid)); // Additional configuration of SOAP Envelope header for Part.Read SourceUsageOrderHeader suoh = new SourceUsageOrderHeader(); suoh.SourceUsageOrder = SourceUsageOrder.LocalThenExternal; LaesInputType lit = new LaesInputType(); lit.UUID = uuid; // Call Part.Read var readResult = client.ReadAsync(appHeader, suoh, lit); // Serializing response, and extracting name element...? var regType1 = readResult.Result.LaesOutput.LaesResultat.Item as RegistreringType1; var personNameStructure = regType1.AttributListe.Egenskab[0].NavnStruktur.PersonNameStructure; string person = string.Format("Part.Read output: {0} {1}", personNameStructure.PersonGivenName, //personNameStructure.PersonMiddleName, personNameStructure.PersonSurnameName ); Console.WriteLine(person); } catch (Exception ex) { Console.WriteLine(string.Format("\n{0}\n", ex.ToString())); } }
public RegistreringType1 Read(CprBroker.Schemas.PersonIdentifier uuid, LaesInputType input, Func <string, Guid> cpr2uuidFunc, out QualityLevel?ql) { ql = QualityLevel.Cpr; IndividualResponseType response = null; response = ExtractManager.GetPerson(uuid.CprNumber); if (response != null) { UuidCache cache = new UuidCache(); cache.FillCache(response.RelatedPnrs); return(response.ToRegistreringType1(cache.GetUuid)); } return(null); }
public static laesRequest CreateStsBrugerLaesRequest(string municipalityCvr, Guid uuid) { var laesInputType = new LaesInputType { UUIDIdentifikator = uuid.ToString() }; var laesRequest = new laesRequest { LaesRequest1 = new LaesRequestType { LaesInput = laesInputType, AuthorityContext = new AuthorityContextType { MunicipalityCVR = municipalityCvr } } }; return(laesRequest); }
public static laesRequest CreateStsAdresseLaesRequest(string municipalityCvr, string uuid) { var laesInputType = new LaesInputType { UUIDIdentifikator = uuid }; var laesRequest = new laesRequest { LaesRequest1 = new LaesRequestType { LaesInput = laesInputType, AuthorityContext = new AuthorityContextType() { MunicipalityCVR = municipalityCvr } } }; return(laesRequest); }
public RegistreringType1 Read(CprBroker.Schemas.PersonIdentifier uuid, LaesInputType input, Func <string, Guid> cpr2uuidFunc, out QualityLevel?ql) { ql = QualityLevel.Cpr; if (IPartPerCallDataProviderHelper.CanCallOnline(uuid.CprNumber)) { IndividualRequestType request = new IndividualRequestType(true, DataType.DefinedByTask, decimal.Parse(uuid.CprNumber)); IndividualResponseType response = this.GetResponse(request); UuidCache cache = new UuidCache(); cache.FillCache(response.RelatedPnrs); return(response.ToRegistreringType1(cpr2uuidFunc)); } else { return(null); } }
public RegistreringType1 Read(PersonIdentifier uuid, LaesInputType input, Func <string, Guid> cpr2uuidFunc, out QualityLevel?ql) { CprBroker.Schemas.Part.RegistreringType1 ret = null; if (IPartPerCallDataProviderHelper.CanCallOnline(uuid.CprNumber)) { EnsurePersonDataExists(uuid.CprNumber); } using (var dataContext = new DPRDataContext(this.ConnectionString)) { var db = PersonInfo.GetPersonInfo(dataContext, decimal.Parse(uuid.CprNumber)); if (db != null) { UuidCache cache = new UuidCache(); cache.FillCache(db.RelatedPnrs); ret = db.ToRegisteringType1(cache.GetUuid, dataContext); } } ql = QualityLevel.DataProvider; return(ret); }
public RegistreringType1 Read(PersonIdentifier uuid, LaesInputType input, Func <string, Guid> cpr2uuidFunc, out CprBroker.Schemas.QualityLevel?ql) { DateTime effectDate = DateTime.Now; ql = QualityLevel.DataProvider; using (var dataContext = new E_MDataContext(ConnectionString)) { dataContext.SetCitizenLoadOptions(); var dbCitizen = dataContext.Citizens .Where(cit => cit.PNR == decimal.Parse(uuid.CprNumber)) .FirstOrDefault(); if (dbCitizen != null) { var cache = new UuidCache(); cache.FillCache(dbCitizen.RelatedPnrs); return(dbCitizen.ToRegistreringType1(effectDate, cache.GetUuid)); } } return(null); }
public LaesOutputType RefreshRead(LaesInputType input) { return(PartManager.Read(applicationHeader.UserToken, applicationHeader.ApplicationToken, input, SourceUsageOrder.ExternalOnly, out qualityHeader.QualityLevel)); }
public LaesOutputType Read(LaesInputType input) { var localAction = SourceUsageOrderHeader.GetLocalDataProviderUsageOption(this.sourceUsageOrderHeader); return(PartManager.Read(applicationHeader.UserToken, applicationHeader.ApplicationToken, input, localAction, out qualityHeader.QualityLevel)); }
public RegistreringType1 Read(CprBroker.Schemas.PersonIdentifier uuid, LaesInputType input, Func <string, Guid> cpr2uuidFunc, out CprBroker.Schemas.QualityLevel?ql) { ql = QualityLevel.DataProvider; return(_Read); }
public RegistreringType1 GetLatestRegistration(string uuid) { LaesInputType laesInput = new LaesInputType(); laesInput.UUIDIdentifikator = uuid; laesRequest request = new laesRequest(); request.LaesRequest1 = new LaesRequestType(); request.LaesRequest1.LaesInput = laesInput; request.LaesRequest1.AuthorityContext = new AuthorityContextType(); request.LaesRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); OrganisationEnhedPortType channel = StubUtil.CreateChannel <OrganisationEnhedPortType>(OrganisationEnhedStubHelper.SERVICE, "Laes", helper.CreatePort()); try { laesResponse response = channel.laes(request); int statusCode = Int32.Parse(response.LaesResponse1.LaesOutput.StandardRetur.StatusKode); if (statusCode != 20) { // note that statusCode 44 means that the object does not exists, so that is a valid response log.Debug("Lookup on OrgUnit with uuid '" + uuid + "' failed with statuscode " + statusCode); return(null); } RegistreringType1[] resultSet = response.LaesResponse1.LaesOutput.FiltreretOejebliksbillede.Registrering; if (resultSet.Length == 0) { log.Warn("OrgUnit with uuid '" + uuid + "' exists, but has no registration"); return(null); } RegistreringType1 result = null; if (resultSet.Length > 1) { log.Warn("OrgUnit with uuid " + uuid + " has more than one registration when reading latest registration, this should never happen"); DateTime winner = DateTime.MinValue; foreach (RegistreringType1 res in resultSet) { // first time through will always result in a True evaluation here if (DateTime.Compare(winner, res.Tidspunkt) < 0) { result = res; winner = res.Tidspunkt; } } } else { result = resultSet[0]; } // we cannot perform any kind of updates on Slettet/Passiveret, så it makes sense to filter them out on lookup, // so the rest of the code will default to Import op top of this if (result.LivscyklusKode.Equals(LivscyklusKodeType.Slettet) || result.LivscyklusKode.Equals(LivscyklusKodeType.Passiveret)) { return(null); } return(result); } 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 Laes service on OrganisationEnhed", ex); } }
public ReadFacadeMethodInfo(LaesInputType input, SourceUsageOrder localAction, string appToken, string userToken) : base(appToken, userToken) { this.Input = input; this.LocalAction = localAction; }