Example #1
0
        public override void ProcessPerson(string cprNumberOrUuid)
        {
            var partService = new BatchClient.Part.Part();

            partService.Url = this.PartServiceUrl;
            partService.ApplicationHeaderValue = new BatchClient.Part.ApplicationHeader()
            {
                ApplicationToken = this.ApplicationToken, UserToken = this.UserToken
            };
            partService.Credentials = System.Net.CredentialCache.DefaultCredentials;

            string uuid;

            if (CprBroker.Utilities.Strings.IsGuid(cprNumberOrUuid))
            {
                uuid = cprNumberOrUuid;
            }
            else
            {
                var getUuidResult = partService.GetUuid(cprNumberOrUuid);
                ValidateResult(cprNumberOrUuid, "GetUuid", getUuidResult.StandardRetur);
                uuid = getUuidResult.UUID;
            }
            var request = new BatchClient.Part.LaesInputType()
            {
                UUID = uuid
            };
            var readResult = partService.Read(request);

            ValidateResult(cprNumberOrUuid, "Read", readResult.StandardRetur);
            Console.WriteLine(partService.QualityHeaderValue.QualityLevel);
        }
Example #2
0
        public override void ProcessPerson(string joinedPnrBatch)
        {
            var partService = new BatchClient.Part.Part();

            partService.Url = this.PartServiceUrl;
            partService.ApplicationHeaderValue = new BatchClient.Part.ApplicationHeader()
            {
                ApplicationToken = this.ApplicationToken, UserToken = this.UserToken
            };
            partService.Credentials = System.Net.CredentialCache.DefaultCredentials;

            string[] pnrs  = joinedPnrBatch.Split(',');
            var      uuids = new List <string>();

            foreach (var pnr in pnrs)
            {
                var getUuidResult = partService.GetUuid(pnr);
                ValidateResult(pnr, "GetUuid", getUuidResult.StandardRetur);
                uuids.Add(getUuidResult.UUID);
            }

            var request = new BatchClient.Part.ListInputType()
            {
                UUID = uuids.ToArray()
            };
            var listResult = partService.List(request);

            ValidateResult(joinedPnrBatch, "List", listResult.StandardRetur);

            Succeeded += listResult.LaesResultat.Where(res => res != null).Count();
            Failed    += listResult.LaesResultat.Where(res => res == null).Count();
            Console.WriteLine(string.Format("Batch finished: Size={0}, Succeeded So far={1}; Failed So far={2}", pnrs.Length, Succeeded, Failed));
        }
Example #3
0
        public override void ProcessPerson(string cprNumber)
        {
            var partService = new BatchClient.Part.Part();

            partService.Url = this.PartServiceUrl;
            partService.ApplicationHeaderValue = new BatchClient.Part.ApplicationHeader()
            {
                ApplicationToken = this.ApplicationToken, UserToken = this.UserToken
            };
            partService.Credentials = System.Net.CredentialCache.DefaultCredentials;
            var getUuidResult = partService.GetUuid(cprNumber);

            ValidateResult(cprNumber, "GetUuid", getUuidResult.StandardRetur);
        }
Example #4
0
        public override void ProcessPerson(string pnr)
        {
            using (var dataContext = new DataContext(BrokerConnectionString))
            {
                var partService = new BatchClient.Part.Part();
                partService.Url = this.PartServiceUrl;
                partService.ApplicationHeaderValue = new BatchClient.Part.ApplicationHeader()
                {
                    ApplicationToken = this.ApplicationToken, UserToken = this.UserToken
                };
                partService.Credentials = System.Net.CredentialCache.DefaultCredentials;

                var name = dataContext.ExecuteQuery <string>("SELECT PersonGivenName FROM PersonSearchCache WHERE UUID={0}", pnr).Single();

                var ret = partService.Search(new Part.SoegInputType1()
                {
                    SoegObjekt = new Part.SoegObjektType()
                    {
                        SoegAttributListe = new Part.SoegAttributListeType()
                        {
                            SoegEgenskab = new Part.SoegEgenskabType[]
                            {
                                new Part.SoegEgenskabType()
                                {
                                    NavnStruktur = new Part.NavnStrukturType()
                                    {
                                        PersonNameStructure = new Part.PersonNameStructureType()
                                        {
                                            PersonGivenName = name
                                        }
                                    }
                                }
                            }
                        }
                    }
                });
                ValidateResult(pnr, "Search", ret.StandardRetur);

                if (ret.Idliste.Length != 1)
                {
                    throw new Exception(string.Format("Unexpected length for result, expected <{0}>, found <{1}>", 1, ret.Idliste.Length));
                }
                if (new Guid(ret.Idliste[0]) != new Guid(pnr))
                {
                    throw new Exception(string.Format("Unexpected UUID in result, expected <{0}>, found <{1}>", pnr, ret.Idliste[0]));
                }
            }
        }