private decimal GetLiveRate(string shipperCode, string tableType, string tableClassCode, string destZip, string orgZip, double weightInOz)
        {
            decimal returnRate = 0;
            switch (shipperCode)
            {
                case "USPS":
                    {
                        try
                        {
                            if (_reply == null)
                            {

                                USPSManager m = new USPSManager("065TOTAL8347", false);

                                Package pack = new Package();

                                pack.ServiceType = ServiceType.All;
                                pack.PackageSize = PackageSize.Regular;
                                pack.FromAddress.Zip = orgZip;
                                pack.ToAddress.Zip = destZip;
                                pack.WeightInOunces = Convert.ToInt32(weightInOz);
                                pack.Machinable = true;
                                _reply = new RateResponse();
                                _reply = m.GetRate(pack);

                            }

                            foreach (MAX.USPS.Postage postage in _reply.Postage)
                            {

                                if (postage.Class.ToString() == tableClassCode)
                                {
                                    decimal postageAmount = 0;
                                    postageAmount = postage.Amount;
                                    return postageAmount;
                                }

                            }
                        }
                        catch (Exception)
                        {
                            return 0;
                        }
                    }
                    break;
                case "FEDEX":
                    {
                        try
                        {
                            FedExRates.RateService.ServiceType myService = FedExRates.RateService.ServiceType.FEDEX_GROUND;

                            switch (tableType)
                            {
                                case "FEDEX_GROUND":
                                    {
                                        myService = FedExRates.RateService.ServiceType.FEDEX_GROUND;
                                        break;
                                    }
                                case "EUROPE_FIRST_INTERNATIONAL_PRIORITY":
                                    {
                                        myService = FedExRates.RateService.ServiceType.EUROPE_FIRST_INTERNATIONAL_PRIORITY;
                                        break;
                                    }
                                case "FEDEX_1_DAY_FREIGHT":
                                    {
                                        myService = FedExRates.RateService.ServiceType.FEDEX_1_DAY_FREIGHT;
                                        break;
                                    }
                                case "FEDEX_2_DAY":
                                    {
                                        myService = FedExRates.RateService.ServiceType.FEDEX_2_DAY;
                                        break;
                                    }
                                case "FEDEX_2_DAY_FREIGHT":
                                    {
                                        myService = FedExRates.RateService.ServiceType.FEDEX_2_DAY_FREIGHT;
                                        break;
                                    }
                                case "FEDEX_3_DAY_FREIGHT":
                                    {
                                        myService = FedExRates.RateService.ServiceType.FEDEX_3_DAY_FREIGHT;
                                        break;
                                    }
                                case "FEDEX_EXPRESS_SAVER":
                                    {
                                        myService = FedExRates.RateService.ServiceType.FEDEX_EXPRESS_SAVER;
                                        break;
                                    }
                                case "FIRST_OVERNIGHT":
                                    {
                                        myService = FedExRates.RateService.ServiceType.FIRST_OVERNIGHT;
                                        break;
                                    }
                                case "GROUND_HOME_DELIVERY":
                                    {
                                        myService = FedExRates.RateService.ServiceType.GROUND_HOME_DELIVERY;
                                        break;
                                    }
                                case "INTERNATIONAL_ECONOMY":
                                    {
                                        myService = FedExRates.RateService.ServiceType.INTERNATIONAL_ECONOMY;
                                        break;
                                    }
                                case "INTERNATIONAL_ECONOMY_FREIGHT":
                                    {
                                        myService = FedExRates.RateService.ServiceType.INTERNATIONAL_ECONOMY_FREIGHT;
                                        break;
                                    }
                                case "INTERNATIONAL_FIRST":
                                    {
                                        myService = FedExRates.RateService.ServiceType.INTERNATIONAL_FIRST;
                                        break;
                                    }
                                case "INTERNATIONAL_PRIORITY":
                                    {
                                        myService = FedExRates.RateService.ServiceType.INTERNATIONAL_PRIORITY;
                                        break;

                                    }
                                case "INTERNATIONAL_PRIORITY_FREIGHT":
                                    {
                                        myService = FedExRates.RateService.ServiceType.INTERNATIONAL_PRIORITY_FREIGHT;
                                        break;
                                    }
                                case "PRIORITY_OVERNIGHT":
                                    {
                                        myService = FedExRates.RateService.ServiceType.PRIORITY_OVERNIGHT;
                                        break;
                                    }
                                case "STANDARD_OVERNIGHT":
                                    {
                                        myService = FedExRates.RateService.ServiceType.STANDARD_OVERNIGHT;
                                        break;
                                    }
                                default:
                                    break;

                            }
                            IWEB.FedEx.Rate myRate = new IWEB.FedEx.Rate();
                            myRate.ServiceType = myService;
                            myRate.DestinationCountryCode = "US";
                            myRate.DestinationZip = destZip;
                            myRate.OriginCountryCode = "US";
                            myRate.OriginZip = orgZip;
                            decimal dweightInOz = Convert.ToDecimal(weightInOz);
                            myRate.PackageWeightInOunces = dweightInOz;

                            decimal rate = myRate.GetRate();
                            if (rate != 0)
                            {
                                return rate;
                            }
                            else
                            {
                                return 0;
                            }
                        }
                        catch (Exception)
                        {
                            return 0;
                        }
                    }
                    break;
                case "UPS":
                    {

                    }
                    break;
                case "DHL":
                    {

                    }
                    break;
                default:
                    //there wasent something we know about, return null values
                    break;
            }

            return returnRate;
        }
 public TrackingControl()
 {
     USPS = new USPSManager();
     UPS = new UPSManager();
     FedEx = new FedExManager();
 }