示例#1
0
        static void Main(string[] args)
        {
            //var s = Util.GetItems("Grand   canyon   ave");
            //var s1 = Util.GetItems("Grandcanyonave");
            //var s2 = Util.GetItems("");

            var userInput = new Address()
            {
                FirstName   = "NewBegin",
                LastName    = "Chandrakasan",
                AddressName = "3467 west wilson avn",
                City        = "Glendale",
                State       = "CA",
                Zip         = "91203"
            };
            var            dataFromDb = new DataFromDb();
            var            pa         = new ProcessAddress(dataFromDb, new AddressMatchingRating());
            List <Address> addreslist = pa.DoValidate(userInput);

            Console.WriteLine("Input");
            PrintValue(userInput);
            Console.WriteLine("Dups");
            foreach (Address adr in addreslist)
            {
                PrintValue(adr);
            }
        }
示例#2
0
        public void ProcessAddressTestTest_ShouldSortResultsBasedOnStreetName()
        {
            //---------------Set up test pack-------------------

            ProcessAddress processAddress = new ProcessAddress();

            processAddress.AddressBooks = _readExcel.GetDataRows();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            processAddress.SortAddress();
            //---------------Test Result -----------------------
            StringAssert.AreEqualIgnoringCase("AgriSETA House 529 Belvedere Road Arcadia 0083", processAddress.Address[0]);
            StringAssert.AreEqualIgnoringCase("12th Floor Durban Bay House 333 Smith Street Durban", processAddress.Address[1]);
        }
示例#3
0
        public ActionResult ProximityFilter(int id)
        {
            //Get all users coordinates from the database
            ProcessAddress procCoords = new ProcessAddress();

            List <User> Users = db.Users.ToList <User>();

            //Preserves each users coordinates so as to calculate each distance from one user to another
            Dictionary <User, Dictionary <decimal, decimal> > toAddress = new Dictionary <User, Dictionary <decimal, decimal> >();
            Dictionary <decimal, decimal> fromUserAdd = procCoords.latlong(db.Users.Where(o => o.Id == id).Single().Address);

            foreach (User user in Users)
            {
                toAddress.Add(user, procCoords.latlong(user.Address));
            }

            Dictionary <User, double>   fromToUserDistance = new Dictionary <User, double>();
            List <ProximityFilterModel> proxyModelFilterIteratorFrontEnd = new List <ProximityFilterModel>();
            int countTest = toAddress.Count;

            for (int i = 0; i < toAddress.Count; i++)
            {
                double toUserLat = (double)toAddress.ElementAt(i).Value.ElementAt(0).Key;
                double toUserLon = (double)toAddress.ElementAt(i).Value.ElementAt(0).Value;

                double fromUserLat = (double)fromUserAdd.ElementAt(0).Key;
                double fromUserLon = (double)fromUserAdd.ElementAt(0).Value;

                fromToUserDistance.Add(toAddress.ElementAt(i).Key, procCoords.calcualteDistanceCord(fromUserLat, fromUserLon, toUserLat, toUserLon, 'K'));
                proxyModelFilterIteratorFrontEnd.Add(new ProximityFilterModel
                {
                    fromUser = toAddress.ElementAt(i).Key,
                    distance = procCoords.calcualteDistanceCord(fromUserLat, fromUserLon, toUserLat, toUserLon, 'K')
                });
            }

            return(View("Proximity", proxyModelFilterIteratorFrontEnd));
        }