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); } }
public override DeliveryOptionCollection GetDeliveryOptions(PackageInfo package) { Database db = DatabaseFactory.CreateDatabase(); using (DbCommand cmd = db.GetStoredProcCommand("CSK_Shipping_GetRates")) { db.AddInParameter(cmd, "@weight", DbType.Decimal, package.Weight); IDataReader rdr = db.ExecuteReader(cmd); DeliveryOptionCollection coll = new DeliveryOptionCollection(); coll.Load(rdr); rdr.Close(); return(coll); } }