Exemple #1
0
            public void Constructor_Comma_OK()
            {
                var names = new string[] { "Smith, John" };
                var ret   = new PersonNameStructureType(names);

                Assert.AreEqual("John", ret.PersonGivenName);
                Assert.AreEqual("Smith", ret.PersonSurnameName);
            }
Exemple #2
0
 public static PersonName FromXmlType(PersonNameStructureType oio)
 {
     if (oio != null)
     {
         return(new PersonName()
         {
             FirstName = oio.PersonGivenName,
             MiddleName = oio.PersonMiddleName,
             LastName = oio.PersonSurnameName
         });
     }
     return(null);
 }
Exemple #3
0
        public NavnStrukturType ToNavnStrukturType(String firstname, String middlename, String lastname)
        {
            // Set the name search criteria
            PersonNameStructureType nameStructure = new PersonNameStructureType();

            nameStructure.PersonGivenName   = firstname;
            nameStructure.PersonMiddleName  = middlename;
            nameStructure.PersonSurnameName = lastname;

            // Playing the matryoshka doll game
            NavnStrukturType navnStrukturType = new NavnStrukturType();

            navnStrukturType.PersonNameStructure = nameStructure;
            return(navnStrukturType);
        }
        /// <summary>
        /// Calls the AN08300 web service
        /// </summary>
        /// <param name="cprNumber"></param>
        /// <returns></returns>
        private WS_AN08300.ReplyPeople[] CallAN08300(PersonNameStructureType name, Schemas.Part.PersonGenderCodeType?gender)
        {
            // TODO: use correct service objects
            //var service = new CprBroker.Providers.KMD.WS_AN08300.WS_AN08300();
            //SetServiceUrl(service, ServiceTypes.AN08300);

            //service.userinfoValue = new userinfo()
            //{
            //    userid = DatabaseObject.UserName,
            //    password = DatabaseObject.Password
            //};

            SearchData searchData = new SearchData();

            if (!name.IsEmpty)
            {
                searchData.FirstName = name.PersonGivenName;
                searchData.LastName  = name.ToMiddleAndLastNameString();
            }
            if (gender.HasValue)
            {
                searchData.Gender = Utilities.FromPartGender(gender).ToString();
            }

            AN08300 param = new AN08300()
            {
                InputRecord = searchData.InnerObject
            };
            // TODO: use correct objects
            var svar = new WS_AN08300.SVAR();

            ValidateReturnCode(svar.RETURKODE.ToString(), svar.RETURTEKST);

            // TODO: use correct object
            var resp = new WS_AN08300.SVARPERSONER[] {};

            return(Array.ConvertAll <WS_AN08300.SVARPERSONER, WS_AN08300.ReplyPeople>(resp, (p) => new WS_AN08300.ReplyPeople(p)));
        }
Exemple #5
0
        public bool FillFrom(SoegListOutputType searchResult)
        {
            var names    = this.Name.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            var fullName = new PersonNameStructureType(names).ToString();

            // If multiple matches are found, choose the first one
            var bestMatch = searchResult.LaesResultat
                            .Select(lr => (lr.Item as FiltreretOejebliksbilledeType).AttributListe)
                            .Where(atr => atr != null)
                            .Select(atr => new { atr, FullName = atr.Egenskab.FirstOrDefault()?.NavnStruktur?.PersonNameStructure?.ToString() })
                            .Where(o => o.FullName?.ToLower() == fullName?.ToLower())
                            .FirstOrDefault();

            if (bestMatch != null)
            {
                this.FillFrom(bestMatch.atr);
                return(true);
            }
            else
            {
                return(false);
            }
        }