public void Soeg() { SoegInputType1 input = new SoegInputType1(); //input.SoegVirkning = new SoegVirkningType(); input.AttributListe = new AttributListeType(); input.RelationListe = new RelationListeType(); input.TilstandListe = new TilstandListeType(); soegRequest request = new soegRequest(); request.SoegRequest1 = new SoegRequestType(); request.SoegRequest1.SoegInput = input; request.SoegRequest1.AuthorityContext = new AuthorityContextType(); request.SoegRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); OrganisationPortType channel = StubUtil.CreateChannel <OrganisationPortType>(OrganisationStubHelper.SERVICE, "Soeg", helper.CreatePort()); try { channel.soeg(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 Organisation", ex); } }
public soegResponse Search(SoegInputType1 soegInput) { // construct request soegRequest request = new soegRequest(); request.SoegRequest1 = new SoegRequestType(); request.SoegRequest1.SoegInput = soegInput; request.SoegRequest1.AuthorityContext = new AuthorityContextType(); request.SoegRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); // send request OrganisationFunktionPortType channel = StubUtil.CreateChannel <OrganisationFunktionPortType>(OrganisationFunktionStubHelper.SERVICE, "Soeg", helper.CreatePort()); try { return(channel.soeg(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 Soeg service on OrganisationFunktion", ex); } }
public List <string> Soeg(string antal = null, string offset = null) { OrganisationEnhedPortType channel = StubUtil.CreateChannel <OrganisationEnhedPortType>(OrganisationEnhedStubHelper.SERVICE, "Soeg", helper.CreatePort()); SoegInputType1 soegInput = new SoegInputType1(); soegInput.AttributListe = new AttributListeType(); soegInput.RelationListe = new RelationListeType(); soegInput.TilstandListe = new TilstandListeType(); if (antal != null) { soegInput.MaksimalAntalKvantitet = antal; } if (offset != null) { soegInput.FoersteResultatReference = offset; } // only search for Active units soegInput.TilstandListe.Gyldighed = new GyldighedType[1]; soegInput.TilstandListe.Gyldighed[0] = new GyldighedType(); soegInput.TilstandListe.Gyldighed[0].GyldighedStatusKode = GyldighedStatusKodeType.Aktiv; // TODO: these three lines should be removeable once KMD fixes their end soegInput.TilstandListe.Gyldighed[0].Virkning = new VirkningType(); soegInput.TilstandListe.Gyldighed[0].Virkning.FraTidspunkt = new TidspunktType(); soegInput.TilstandListe.Gyldighed[0].Virkning.FraTidspunkt.Item = DateTime.Now; // only return objects that have a Tilhører relationship top-level Organisation UnikIdType orgReference = StubUtil.GetReference <UnikIdType>(registry.MunicipalityOrganisationUUID[OrganisationRegistryProperties.GetCurrentMunicipality()], ItemChoiceType.UUIDIdentifikator); OrganisationRelationType organisationRelationType = new OrganisationRelationType(); organisationRelationType.ReferenceID = orgReference; soegInput.RelationListe.Tilhoerer = organisationRelationType; // search soegRequest request = new soegRequest(); request.SoegRequest1 = new SoegRequestType(); request.SoegRequest1.SoegInput = soegInput; request.SoegRequest1.AuthorityContext = new AuthorityContextType(); request.SoegRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); try { soegResponse response = channel.soeg(request); int statusCode = Int32.Parse(response.SoegResponse1.SoegOutput.StandardRetur.StatusKode); if (statusCode != 20 && statusCode != 44) // 44 is empty search result { string message = StubUtil.ConstructSoapErrorMessage(statusCode, "Soeg", OrganisationEnhedStubHelper.SERVICE, response.SoegResponse1.SoegOutput.StandardRetur.FejlbeskedTekst); log.Error(message); throw new SoapServiceException(message); } List <string> functions = new List <string>(); if (statusCode == 20) { foreach (string id in response.SoegResponse1.SoegOutput.IdListe) { functions.Add(id); } } return(functions); } 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 Soeg service on OrganisationEnhed", ex); } }
private List <string> Soeg(string functionsTypeUuid, string userUuid, string unitUuid, string itSystemUuid) { OrganisationFunktionPortType channel = StubUtil.CreateChannel <OrganisationFunktionPortType>(OrganisationFunktionStubHelper.SERVICE, "Soeg", helper.CreatePort()); SoegInputType1 soegInput = new SoegInputType1(); soegInput.AttributListe = new AttributListeType(); soegInput.RelationListe = new RelationListeType(); soegInput.TilstandListe = new TilstandListeType(); // only return objects that have a Tilhører relationship top-level Organisation UnikIdType orgReference = StubUtil.GetReference <UnikIdType>(registry.MunicipalityOrganisationUUID[OrganisationRegistryProperties.GetMunicipality()], ItemChoiceType.UUIDIdentifikator); soegInput.RelationListe.TilknyttedeOrganisationer = new OrganisationFlerRelationType[1]; soegInput.RelationListe.TilknyttedeOrganisationer[0] = new OrganisationFlerRelationType(); soegInput.RelationListe.TilknyttedeOrganisationer[0].ReferenceID = orgReference; if (!String.IsNullOrEmpty(functionsTypeUuid)) { UnikIdType reference = new UnikIdType(); reference.Item = functionsTypeUuid; reference.ItemElementName = ItemChoiceType.UUIDIdentifikator; KlasseRelationType funktionsType = new KlasseRelationType(); funktionsType.ReferenceID = reference; soegInput.RelationListe.Funktionstype = funktionsType; } if (!String.IsNullOrEmpty(userUuid)) { UnikIdType reference = new UnikIdType(); reference.Item = userUuid; reference.ItemElementName = ItemChoiceType.UUIDIdentifikator; soegInput.RelationListe.TilknyttedeBrugere = new BrugerFlerRelationType[1]; soegInput.RelationListe.TilknyttedeBrugere[0] = new BrugerFlerRelationType(); soegInput.RelationListe.TilknyttedeBrugere[0].ReferenceID = reference; } if (!String.IsNullOrEmpty(unitUuid)) { UnikIdType reference = new UnikIdType(); reference.Item = unitUuid; reference.ItemElementName = ItemChoiceType.UUIDIdentifikator; soegInput.RelationListe.TilknyttedeEnheder = new OrganisationEnhedFlerRelationType[1]; soegInput.RelationListe.TilknyttedeEnheder[0] = new OrganisationEnhedFlerRelationType(); soegInput.RelationListe.TilknyttedeEnheder[0].ReferenceID = reference; } if (!String.IsNullOrEmpty(itSystemUuid)) { UnikIdType reference = new UnikIdType(); reference.Item = itSystemUuid; reference.ItemElementName = ItemChoiceType.UUIDIdentifikator; soegInput.RelationListe.TilknyttedeItSystemer = new ItSystemFlerRelationType[1]; soegInput.RelationListe.TilknyttedeItSystemer[0] = new ItSystemFlerRelationType(); soegInput.RelationListe.TilknyttedeItSystemer[0].ReferenceID = reference; } // search soegRequest request = new soegRequest(); request.SoegRequest1 = new SoegRequestType(); request.SoegRequest1.SoegInput = soegInput; request.SoegRequest1.AuthorityContext = new AuthorityContextType(); request.SoegRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetMunicipality(); try { soegResponse response = channel.soeg(request); int statusCode = Int32.Parse(response.SoegResponse1.SoegOutput.StandardRetur.StatusKode); if (statusCode != 20 && statusCode != 44) // 44 is empty search result { string message = StubUtil.ConstructSoapErrorMessage(statusCode, "Soeg", OrganisationFunktionStubHelper.SERVICE, response.SoegResponse1.SoegOutput.StandardRetur.FejlbeskedTekst); log.Error(message); throw new SoapServiceException(message); } List <string> functions = new List <string>(); if (statusCode == 20) { foreach (string id in response.SoegResponse1.SoegOutput.IdListe) { functions.Add(id); } } return(functions); } 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 Soeg service on OrganisationFunktion", ex); } }