Пример #1
0
        private static IEnumerable <TEL> CreateTelecomItems(PersonalInformation info)
        {
            var telecomItems = new List <TEL>();

            if (info.mobile != "tel:")
            {
                telecomItems.Add(new TEL {
                    value = info.mobile, use = new[] { TelecommunicationAddressUse.MC }, nullFlavor = NullFlavor.NI, nullFlavorSpecified = true
                });
            }
            if (info.epostPrivate != "mailto:")
            {
                telecomItems.Add(new TEL {
                    value = info.epostPrivate, use = new[] { TelecommunicationAddressUse.H }
                });
            }
            if (info.epostWork != "mailto:")
            {
                telecomItems.Add(new TEL {
                    value = info.epostWork, use = new[] { TelecommunicationAddressUse.WP }
                });
            }

            return(telecomItems);
        }
Пример #2
0
        private static IEnumerable <ENXP> CreateNameItems(PersonalInformation info)
        {
            var nameItems = new List <ENXP>();

            nameItems.AddRange(info.firstName.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                               .Select(fn => new engiven(fn)));
            nameItems.AddRange(info.middleName.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                               .Select(mn => new enfamily(mn, true)));
            nameItems.AddRange(info.lastName.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                               .Select(ln => new enfamily(ln)));
            return(nameItems);
        }
Пример #3
0
        private static PersonalInformation ReadPersonalInformation(bool askForIdNumber, bool askForGender,
            bool askForTelecom, bool askForPassnr)
        {
            var info = new PersonalInformation();
            if (askForIdNumber)
                info.fhNumber = ReadLineAndTrim("FH-number: ");
            info.firstName = ReadLineAndTrim("Fornavn(er): ");
            info.middleName = ReadLineAndTrim("Mellomnavn(er): ");
            info.lastName = ReadLineAndTrim("Etternavn(er): ");
            info.dateOfBirth = ReadLineAndTrim(string.Format($"Fødselsdato ({DateFormat}): "));
            info.streetAddressLineHome = ReadLineAndTrim("Hjemmeadresse - gate: ");
            info.cityHome = ReadLineAndTrim("Hjemmeadresse - by: ");
            info.zipCodeHome = ReadLineAndTrim("Hjemmeadresse - postkode: ");
            info.landCodeHome = ReadLineAndTrim("Hjemmeadresse - landkode: ");
            info.streetAddressLineTemp = ReadLineAndTrim("Kontaktadresse i Norge - gate: ");
            info.cityTemp = ReadLineAndTrim("Kontaktadresse i Norge - by: ");
            info.countyTemp = ReadLineAndTrim("Konntakadresse i Norge - oppholdskommune: ");
            info.zipCodeTemp = ReadLineAndTrim("Kontaktadresse i Norge - postkode: ");
            if (askForGender)
                info.gender = ReadLineAndTrim("Gender (M/F): ");
            if (askForTelecom)
            {
                info.mobile = "tel:" + ReadLineAndTrim("Mobilnr: ");
                info.epostPrivate = "mailto:" + ReadLineAndTrim("Privat e-post adresse: ");
                info.epostWork = "mailto:" + ReadLineAndTrim("Jobb e-post adresse: ");
            }

            if (askForPassnr)
            {
                info.passNr = ReadLineAndTrim("Pass nummer: ");
                info.passNrIssuerNationality = ReadLineAndTrim("Pass utsteder: ");
            }


            return info;
        }
Пример #4
0
        private static IEnumerable <KeyValuePair <string, IEnumerable <ADXP> > > CreateAddressItems(PersonalInformation info)
        {
            var addressItems = new List <KeyValuePair <string, IEnumerable <ADXP> > >();

            if ((info.streetAddressLineHome != "") || (info.cityHome != "") || (info.landCodeHome != "") ||
                (info.zipCodeHome != ""))
            {
                var addressItemsHome = new List <ADXP>
                {
                    (info.cityHome != "") ? new adxpcity {
                        Text = new[] { info.cityHome }
                    } : null,
                    (info.streetAddressLineHome != "")
                        ? new adxpstreetAddressLine {
                        Text = new[] { info.streetAddressLineHome }
                    }
                        : null,
                    (info.zipCodeHome != "") ? new adxppostalCode {
                        Text = new[] { info.zipCodeHome }
                    } : null,
                    (info.landCodeHome != "") ? new adxpcountry {
                        Text = new[] { info.landCodeHome }
                    } : null
                };
                addressItems.Add(new KeyValuePair <string, IEnumerable <ADXP> >("private", addressItemsHome));
            }

            if ((info.streetAddressLineTemp != "") || (info.cityTemp != "") || (info.countyTemp != "") ||
                (info.zipCodeTemp != ""))
            {
                var addressItemsTemp = new List <ADXP>
                {
                    (info.cityTemp != "") ? new adxpcity {
                        Text = new[] { info.cityTemp }
                    } : null,
                    (info.streetAddressLineTemp != "")
                        ? new adxpstreetAddressLine {
                        Text = new[] { info.streetAddressLineTemp }
                    }
                        : null,
                    (info.countyTemp != "") ? new adxpcounty {
                        Text = new[] { info.countyTemp }
                    } : null,
                    (info.zipCodeTemp != "") ? new adxppostalCode {
                        Text = new[] { info.zipCodeTemp }
                    } : null,
                };
                addressItems.Add(new KeyValuePair <string, IEnumerable <ADXP> >("temp", addressItemsTemp));
            }

            return(addressItems);
        }