Пример #1
0
        public async Task <ProducerBusiness> SetProducerBusiness(producerBusinessType producerBusiness)
        {
            object          item = producerBusiness.Item;
            ProducerContact correspondentForNoticeContact = null;

            if (producerBusiness.correspondentForNotices.contactDetails != null)
            {
                correspondentForNoticeContact =
                    await GetProducerContact(producerBusiness.correspondentForNotices.contactDetails);
            }

            Company     company     = null;
            Partnership partnership = null;

            if (item is companyType)
            {
                companyType     companyitem = (companyType)item;
                ProducerContact contact     = await GetProducerContact(companyitem.registeredOffice.contactDetails);

                company = new Company(companyitem.companyName, companyitem.companyNumber, contact);
            }
            else if (item is partnershipType)
            {
                partnershipType partnershipItem = (partnershipType)item;
                string          partnershipName = partnershipItem.partnershipName;

                List <string>   partnersList = partnershipItem.partnershipList.ToList();
                List <Partner>  partners     = partnersList.Select(name => new Partner(name)).ToList();
                ProducerContact contact      = await GetProducerContact(partnershipItem.principalPlaceOfBusiness.contactDetails);

                partnership = new Partnership(partnershipName, contact, partners);
            }

            return(new ProducerBusiness(company, partnership, correspondentForNoticeContact));
        }
Пример #2
0
        private static producerType SetRegisteredOfficeOrPPoBDetails(bool hasPartnership)
        {
            producerBusinessType producerBusiness = null;

            var contactDetailsInfo = new contactDetailsContainerType()
            {
                contactDetails = new contactDetailsType()
                {
                    address = new addressType()
                    {
                        country = countryType.UKENGLAND
                    }
                }
            };

            if (hasPartnership)
            {
                var producerPartnership = new partnershipType()
                {
                    partnershipName          = "MiddleEarth",
                    principalPlaceOfBusiness = contactDetailsInfo
                };

                producerBusiness = new producerBusinessType()
                {
                    Item = producerPartnership
                };
            }
            else
            {
                var producerCompany = new companyType()
                {
                    companyName      = "Rivendell",
                    registeredOffice = contactDetailsInfo
                };

                producerBusiness = new producerBusinessType()
                {
                    Item = producerCompany
                };
            }

            var producer = new producerType
            {
                producerBusiness = producerBusiness
            };

            return(producer);
        }