private void BindData() { ShippingByTotalCollection shippingByTotalCollection = ShippingByTotalManager.GetAll(); gvShippingByTotals.DataSource = shippingByTotalCollection; gvShippingByTotals.DataBind(); }
/// <summary> /// Gets all ShippingByTotals /// </summary> /// <returns>ShippingByTotal collection</returns> public static ShippingByTotalCollection GetAll() { DBShippingByTotalCollection dbCollection = DBProviderManager <DBShippingByTotalProvider> .Provider.GetAll(); ShippingByTotalCollection collection = DBMapping(dbCollection); return(collection); }
/// <summary> /// Gets all ShippingByTotals by shipping method identifier /// </summary> /// <param name="ShippingMethodID">The shipping method identifier</param> /// <returns>ShippingByTotal collection</returns> public static ShippingByTotalCollection GetAllByShippingMethodID(int ShippingMethodID) { DBShippingByTotalCollection dbCollection = DBProviderManager <DBShippingByTotalProvider> .Provider.GetAllByShippingMethodID(ShippingMethodID); ShippingByTotalCollection collection = DBMapping(dbCollection); return(collection); }
private static ShippingByTotalCollection DBMapping(DBShippingByTotalCollection dbCollection) { if (dbCollection == null) { return(null); } var collection = new ShippingByTotalCollection(); foreach (var dbItem in dbCollection) { var item = DBMapping(dbItem); collection.Add(item); } return(collection); }
/// <summary> /// Gets a shipping rate /// </summary> /// <param name="subTotal">Subtotal</param> /// <param name="ShippingMethodID">Shipping method identifier</param> /// <returns>Shipping rate</returns> protected decimal GetRate(decimal subTotal, int ShippingMethodID) { decimal shippingTotal = decimal.Zero; ShippingByTotal shippingByTotal = null; ShippingByTotalCollection shippingByTotalCollection = ShippingByTotalManager.GetAllByShippingMethodID(ShippingMethodID); foreach (ShippingByTotal shippingByTotal2 in shippingByTotalCollection) { if ((subTotal >= shippingByTotal2.From) && (subTotal <= shippingByTotal2.To)) { shippingByTotal = shippingByTotal2; break; } } if (shippingByTotal == null) { return(decimal.Zero); } if (shippingByTotal.UsePercentage && shippingByTotal.ShippingChargePercentage <= decimal.Zero) { return(decimal.Zero); } if (!shippingByTotal.UsePercentage && shippingByTotal.ShippingChargeAmount <= decimal.Zero) { return(decimal.Zero); } if (shippingByTotal.UsePercentage) { shippingTotal = Math.Round((decimal)((((float)subTotal) * ((float)shippingByTotal.ShippingChargePercentage)) / 100f), 2); } else { shippingTotal = shippingByTotal.ShippingChargeAmount; } if (shippingTotal < decimal.Zero) { shippingTotal = decimal.Zero; } return(shippingTotal); }