public static DeliveryOptionCollection GetOptions(PackageInfo package, DeliveryRestrictions restrictions) { LoadProviders(); DeliveryOptionCollection options = new DeliveryOptionCollection(); //if there are no restrictions, hit every provider and return the collection foreach (FulfillmentProvider provider in _providers) { options.Combine(provider.GetDeliveryOptions(package, restrictions)); } return(options); }
public override DeliveryOptionCollection GetDeliveryOptions(PackageInfo package, DeliveryRestrictions restrictions) { //TODO: I need to put a little more thought into the restrictions if (restrictions == DeliveryRestrictions.Download) { throw new Exception("Shipping Error: This item is download only."); } _deliveryRestriction = restrictions; HttpRequestHandler http = new HttpRequestHandler(_connectionUrl); string rateXml = http.POST(rateRequest(package)); DeliveryOptionCollection collection = UspsParseRates(rateXml); return(collection); }
public abstract DeliveryOptionCollection GetDeliveryOptions(PackageInfo package, DeliveryRestrictions restrictions);
public override DeliveryOptionCollection GetDeliveryOptions(PackageInfo package, DeliveryRestrictions restrictions) { Database db = DatabaseFactory.CreateDatabase(); string sp = "CSK_Shipping_GetRates"; if (restrictions == DeliveryRestrictions.Air) { sp = "CSK_Shipping_GetRates_Air"; } else if (restrictions == DeliveryRestrictions.Freight || restrictions == DeliveryRestrictions.Ground) { sp = "CSK_Shipping_GetRates_Ground"; } using (DbCommand cmd = db.GetStoredProcCommand(sp)) { db.AddInParameter(cmd, "@weight", DbType.Decimal, package.Weight); IDataReader rdr = db.ExecuteReader(cmd); DeliveryOptionCollection coll = new DeliveryOptionCollection(); coll.Load(rdr); rdr.Close(); return(coll); } }