Beispiel #1
0
        public static double FedExEstimatedRate(Person shipto, ProductCollection cart)
        {
            double temp = 0.0;                                                //return 0.0 if something is wrong

            RateRequest request = FedEx.FedExCreateRateRequest(shipto, cart); //TODO:  better to use shoppingcartV2 if it was available
            RateService service = new RateService();                          // Initialize the service

            try
            {
                // Call the web service passing in a RateRequest and returning a RateReply
                RateReply reply = service.getRates(request);
                if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING) // check if the call was successful
                {
                    //ShowRateReply(reply);
                    for (int i = 0; i < reply.RateReplyDetails[0].RatedShipmentDetails.Count(); i++)
                    {
                        ShipmentRateDetail rateDetail = reply.RateReplyDetails[0].RatedShipmentDetails[i].ShipmentRateDetail;
                        if ((double)rateDetail.TotalNetCharge.Amount > temp)
                        {
                            temp = (double)rateDetail.TotalNetCharge.Amount;
                        }
                    }
                }
                FedEx.FedExShowNotifications(reply);
            }
            catch (Exception ex)
            {
                temp = 0.0;
            }
            return(temp);
        }
Beispiel #2
0
 string ShipMethod(string vendor, string method)//**EAC unused for now
 {
     if (vendor == "FEDEX")
     {
         return(FedEx.ShipMethod(method));
     }
     else
     {
         return("TODO:ups.shipmethod");
     }
 }
Beispiel #3
0
        double EstimatedRate(Person shipto, ProductCollection cart)
        {
            if (cart.ShipMethod[0] == 'F')
            {
                return(FedEx.FedExEstimatedRate(shipto, cart));
            }

            else if (cart.ShipMethod[0] == 'U')
            {
                return(UPS.UPSEstimatedRate(shipto, cart));
            }

            else
            {
                throw new ArgumentException("Ship method is incorrect");
            }
        }
Beispiel #4
0
        double EstimatedRate(Person shipto, ProductCollection cart)
        {
            try
            {
                if (cart.ShipMethod[0] == 'F')
                {
                    return(FedEx.FedExEstimatedRate(shipto, cart));
                }

                else if (cart.ShipMethod[0] == 'U')
                {
                    return(UPS.UPSEstimatedRate(shipto, cart));
                }
            }
            catch (Exception ex)
            {
                return(0.0);
            }
            return(0.0);
        }