Ejemplo n.º 1
0
        private ProprietorshipPartyModel GetProprietorship(Q1PartyType proprietorship, ItemsChoiceType type)
        {
            var lrProprietorship = new ProprietorshipPartyModel();

            if (type == ItemsChoiceType.CautionerParty)
            {
                lrProprietorship.ProprietorshipType = "Cautioner Party";
            }
            else if (type == ItemsChoiceType.RegisteredProprietorParty)
            {
                lrProprietorship.ProprietorshipType = "Registered Proprietorship Party";
            }
            if (proprietorship.Item.GetType() == typeof(Q1PrivateIndividualType))
            {
                lrProprietorship.ProprietorshipPartyType   = "Private Individual";
                lrProprietorship.PrivateIndividualForename =
                    ((Q1PrivateIndividualType)proprietorship.Item).Name.ForenamesName != null ? ((Q1PrivateIndividualType)proprietorship.Item).Name.ForenamesName.Value : string.Empty;
                lrProprietorship.PrivateIndividualSurname =
                    ((Q1PrivateIndividualType)proprietorship.Item).Name.SurnameName != null ? ((Q1PrivateIndividualType)proprietorship.Item).Name.SurnameName.Value : string.Empty;
            }
            else if (proprietorship.Item.GetType() == typeof(Q1OrganizationType))
            {
                lrProprietorship.ProprietorshipPartyType   = "Organization";
                lrProprietorship.CompanyRegistrationNumber =
                    ((Q1OrganizationType)proprietorship.Item).CompanyRegistrationNumber != null
                                                ? ((Q1OrganizationType)proprietorship.Item).CompanyRegistrationNumber.Value : string.Empty;
                lrProprietorship.CompanyName = ((Q1OrganizationType)proprietorship.Item).Name != null ? ((Q1OrganizationType)proprietorship.Item).Name.Value : string.Empty;
            }
            lrProprietorship.ProprietorshipAddresses = GetAddresses(proprietorship.Address);
            return(lrProprietorship);
        }
Ejemplo n.º 2
0
        private LandRegistryChargeModel GetCharge(Q1ChargeDetailsType charge)
        {
            var lrCharge = new LandRegistryChargeModel {
                ChargeDate = charge.ChargeDate != null?DateTime.SpecifyKind(charge.ChargeDate.Value, DateTimeKind.Utc) : new DateTime(1900, 1, 1),
                                 Description = charge.RegisteredCharge.EntryDetails.EntryText != null ? charge.RegisteredCharge.EntryDetails.EntryText.Value : string.Empty
            };
            var lrProprietorship = new LandRegistryProprietorshipModel {
                ProprietorshipParties = new List <ProprietorshipPartyModel>()
            };

            foreach (var proprietorship in charge.ChargeProprietor.ChargeeParty)
            {
                var lrProprietor = new ProprietorshipPartyModel();
                if (proprietorship.Item.GetType() == typeof(Q1PrivateIndividualType))
                {
                    lrProprietor.ProprietorshipPartyType   = "Private Individual";
                    lrProprietor.PrivateIndividualForename =
                        ((Q1PrivateIndividualType)proprietorship.Item).Name.ForenamesName != null ? ((Q1PrivateIndividualType)proprietorship.Item).Name.ForenamesName.Value : string.Empty;
                    lrProprietor.PrivateIndividualSurname =
                        ((Q1PrivateIndividualType)proprietorship.Item).Name.SurnameName != null ? ((Q1PrivateIndividualType)proprietorship.Item).Name.SurnameName.Value : string.Empty;
                }
                else if (proprietorship.Item.GetType() == typeof(Q1OrganizationType))
                {
                    lrProprietor.ProprietorshipPartyType = "Organization";
                    lrProprietor.CompanyName             = ((Q1OrganizationType)proprietorship.Item).Name != null ? ((Q1OrganizationType)proprietorship.Item).Name.Value : string.Empty;
                }
                lrProprietor.ProprietorshipAddresses = GetAddresses(proprietorship.Address);
                lrProprietorship.ProprietorshipParties.Add(lrProprietor);
            }
            lrCharge.Proprietorship = lrProprietorship;
            return(lrCharge);
        }