Пример #1
0
        static void Main(string[] args)
        {
            var stopWatch = Stopwatch.StartNew();

            stopWatch.Start();
            //Get Bank Exchange Rates
            BNCRManager bank          = new BNCRManager();
            var         exchangeRates = bank.GetExchangeRate();

            List <ShippingRate> rates = new List <ShippingRate>();

            FedExManager fedExManager = new FedExManager();

            rates.AddRange(fedExManager.GetRates());

            USPSManager uspsManager = new USPSManager();

            rates.AddRange(uspsManager.GetRates());

            var ratesInColones = rates.Select(c => { c.Price = c.Price * exchangeRates.PurchasePrice; return(c); }).ToList();

            stopWatch.Stop();
            Console.WriteLine($"Sequential Time {stopWatch.ElapsedMilliseconds}");

            Console.WriteLine("Shipping Method          Price (Colones)");
            foreach (var rate in rates)
            {
                Console.WriteLine($"{rate.Method}           {rate.Price}");
            }

            //Console.ReadKey();
        }
Пример #2
0
        public bool ValidateGolfCourseAddress(PrivilegeRequestViewModel privilegeRequestVm)
        {
            var address = new Address
            {
                Address2 = privilegeRequestVm.CourseAddress,
                City     = privilegeRequestVm.City,
                State    = privilegeRequestVm.StateCode,
                Zip      = privilegeRequestVm.Zip,
            };

            var uspsManager = new USPSManager(_uspsUserId);

            try
            {
                var validatedAddress = uspsManager.ValidateAddress(address);
            }
            catch (USPSManagerException uspsManagerException)
            {
                return(false);
            }
            return(true);
        }
Пример #3
0
        private static long CalculateSequential()
        {
            var stopWatch = Stopwatch.StartNew();

            stopWatch.Start();
            //Get Bank Exchange Rates
            BNCRManager bank          = new BNCRManager();
            var         exchangeRates = bank.GetExchangeRate();

            List <ShippingRate> rates = new List <ShippingRate>();

            FedExManager fedExManager = new FedExManager();

            rates.AddRange(fedExManager.GetRates());

            USPSManager uspsManager = new USPSManager();

            rates.AddRange(uspsManager.GetRates());

            var ratesInColones = rates.Select(c => { c.Price = c.Price * exchangeRates.PurchasePrice; return(c); }).ToList();

            stopWatch.Stop();
            return(stopWatch.ElapsedMilliseconds);
        }
Пример #4
0
 public TrackingControl()
 {
     USPS  = new USPSManager();
     UPS   = new UPSManager();
     FedEx = new FedExManager();
 }