private static identification IdentificationDataTranferObjectFromIdentificationByNameAndAddress(RecipientByNameAndAddress recipientByNameAndAddress)
        {
            var identification = new identification
            {
                ItemElementName = ItemChoiceType.nameandaddress,
                Item            = new nameandaddress
                {
                    fullname     = recipientByNameAndAddress.FullName,
                    addressline1 = recipientByNameAndAddress.AddressLine1,
                    addressline2 = recipientByNameAndAddress.AddressLine2,
                    postalcode   = recipientByNameAndAddress.PostalCode,
                    city         = recipientByNameAndAddress.City,
                    emailaddress = recipientByNameAndAddress.Email,
                    phonenumber  = recipientByNameAndAddress.PhoneNumber
                }
            };

            if (recipientByNameAndAddress.BirthDate.HasValue)
            {
                var nameandaddress = (nameandaddress)identification.Item;
                nameandaddress.birthdate          = recipientByNameAndAddress.BirthDate.Value;
                nameandaddress.birthdateSpecified = true;
            }

            return(identification);
        }
Esempio n. 2
0
            public void IdentificationByOrganizationNumber()
            {
                //Arrange
                var source      = new Identification(new RecipientById(IdentificationType.OrganizationNumber, "123456789"));
                var expectedDto = new identification
                {
                    ItemElementName = ItemChoiceType.organisationnumber,
                    Item            = ((RecipientById)source.DigipostRecipient).Id
                };

                //Act
                var actualDto = DataTransferObjectConverter.ToDataTransferObject(source);

                //Assert
                Comparator.AssertEqual(expectedDto, actualDto);
            }
        public static identification ToDataTransferObject(IIdentification identification)
        {
            identification identificationDto = null;

            if (identification.DigipostRecipient is RecipientById)
            {
                identificationDto = IdentificationDataTransferObjectFromIdentificationById((RecipientById)identification.DigipostRecipient);
            }

            if (identification.DigipostRecipient is RecipientByNameAndAddress)
            {
                identificationDto = IdentificationDataTranferObjectFromIdentificationByNameAndAddress((RecipientByNameAndAddress)identification.DigipostRecipient);
            }

            return(identificationDto);
        }
Esempio n. 4
0
            public void IdentificationByNameAndAddress()
            {
                //Arrange
                var source = new Identification(
                    new RecipientByNameAndAddress("Ola Nordmann", "Osloveien 22", "0001", "Oslo")
                {
                    AddressLine2 = "Adresselinje2",
                    BirthDate    = DateTime.Today,
                    PhoneNumber  = "123456789",
                    Email        = "*****@*****.**"
                }
                    );

                var sourceRecipient = (RecipientByNameAndAddress)source.DigipostRecipient;

                var expectedDto = new identification
                {
                    ItemElementName = ItemChoiceType.nameandaddress,
                    Item            = new nameandaddress
                    {
                        fullname           = sourceRecipient.FullName,
                        addressline1       = sourceRecipient.AddressLine1,
                        addressline2       = sourceRecipient.AddressLine2,
                        postalcode         = sourceRecipient.PostalCode,
                        city               = sourceRecipient.City,
                        birthdate          = sourceRecipient.BirthDate.Value,
                        birthdateSpecified = true,
                        phonenumber        = sourceRecipient.PhoneNumber,
                        emailaddress       = sourceRecipient.Email
                    }
                };

                //Act
                var actualDto = DataTransferObjectConverter.ToDataTransferObject(source);

                //Assert
                Comparator.AssertEqual(expectedDto, actualDto);
            }
Esempio n. 5
0
        //public Personne Personne { get; set; }

        public VMIdentification(identification w)
        {
            ConnectUtil = new RelayCommand(Connection);
            NewUserNav  = new RelayCommand(NewUserNavCde);
            iWindow     = w;
        }