Exemplo n.º 1
0
        public void TestLRRes()
        {
            var s = new LandRegistryRes(29, "SK310937");

            s.Execute();
            Assert.IsFalse(String.IsNullOrEmpty(s.Result));
        }
Exemplo n.º 2
0
        public override void Execute()
        {
            var linkedCustomers = new SortedSet <int>();

            DB.ForEachRowSafe(entriesSafeReader => {
                int customerId     = entriesSafeReader["CustomerId"];
                string xml         = entriesSafeReader["Response"];
                string titleNumber = entriesSafeReader["TitleNumber"];
                int landRegistryId = entriesSafeReader["Id"];

                if (linkedCustomers.Contains(customerId))                 // Already found link for this customer
                {
                    return;
                }

                LandRegistryRes res = new LandRegistryRes(customerId, titleNumber);
                res.LinkLandRegistryAndAddress(customerId, xml, landRegistryId);
                linkedCustomers.Add(customerId);
            }, "GetLandRegistryDataForBackfill", CommandSpecies.StoredProcedure);
        }
Exemplo n.º 3
0
        }         // ExecuteStep

        private void QueryLandRegistry()
        {
            var customerAddressesHelper = new CustomerAddressHelper(this.customerID);

            customerAddressesHelper.Execute();

            foreach (CustomerAddressModel address in customerAddressesHelper.OwnedAddresses)
            {
                LandRegistryDataModel model = null;

                if (!string.IsNullOrEmpty(address.HouseName))
                {
                    model = LandRegistryEnquiry.Get(
                        this.customerID,
                        null,
                        address.HouseName,
                        null,
                        null,
                        address.PostCode
                        );
                }
                else if (!string.IsNullOrEmpty(address.HouseNumber))
                {
                    model = LandRegistryEnquiry.Get(
                        this.customerID,
                        address.HouseNumber,
                        null,
                        null,
                        null,
                        address.PostCode
                        );
                }
                else if (
                    !string.IsNullOrEmpty(address.FlatOrApartmentNumber) &&
                    string.IsNullOrEmpty(address.HouseNumber)
                    )
                {
                    model = LandRegistryEnquiry.Get(
                        this.customerID,
                        address.FlatOrApartmentNumber,
                        null,
                        null,
                        null,
                        address.PostCode
                        );
                }                 // if

                bool doLandRegistry =
                    (model != null) &&
                    (model.Enquery != null) &&
                    (model.ResponseType == LandRegistryResponseType.Success) &&
                    (model.Enquery.Titles != null) &&
                    (model.Enquery.Titles.Count == 1);

                if (doLandRegistry)
                {
                    var lrr = new LandRegistryRes(this.customerID, model.Enquery.Titles[0].TitleNumber);
                    lrr.PartialExecute();

                    LandRegistryDB dbLandRegistry = lrr.LandRegistry;

                    LandRegistryDataModel landRegistryDataModel = lrr.RawResult;

                    if (landRegistryDataModel.ResponseType == LandRegistryResponseType.Success)
                    {
                        bool isOwnerAccordingToLandRegistry = LandRegistryRes.IsOwner(
                            this.customerID,
                            this.customerFullName,
                            landRegistryDataModel.Response,
                            landRegistryDataModel.Res.TitleNumber
                            );

                        DB.ExecuteNonQuery(
                            "AttachCustomerAddrToLandRegistryAddr",
                            CommandSpecies.StoredProcedure,
                            new QueryParameter("@LandRegistryAddressID", dbLandRegistry.Id),
                            new QueryParameter("@CustomerAddressID", address.AddressId),
                            new QueryParameter("@IsOwnerAccordingToLandRegistry", isOwnerAccordingToLandRegistry)
                            );
                    }                     // if
                }
                else
                {
                    int num = 0;

                    if (model != null && model.Enquery != null && model.Enquery.Titles != null)
                    {
                        num = model.Enquery.Titles.Count;
                    }

                    Log.Warn(
                        "No land registry retrieved for customer id: {5}," +
                        "house name: {0}, house number: {1}, flat number: {2}, postcode: {3}, # of inquiries {4}",
                        address.HouseName,
                        address.HouseNumber,
                        address.FlatOrApartmentNumber,
                        address.PostCode,
                        num,
                        this.customerID
                        );
                } // if
            }     // for each
        }         // QueryLandRegistry