Example #1
0
        public bool HasFreeShipping() {
            try {
                List<int> excludedStates = new State().GetExcludedStates().Select(x => x.stateID).ToList();
                BindAddresses();
                if (excludedStates.Contains(this.Shipping.state)) {
                    return false;
                }

                Settings settings = new Settings();
                decimal freeship = Convert.ToDecimal(settings.Get("FreeShippingAmount"));
                decimal total = 0;
                foreach (CartItem item in this.CartItems) {
                    total += (item.price * item.quantity);
                }
                if (total >= freeship) {
                    return true;
                }
            } catch (Exception) { }
            return false;
        }
 partial void UpdateState(State instance);
 partial void InsertState(State instance);
		private void detach_States(State entity)
		{
			this.SendPropertyChanging();
			entity.Country = null;
		}
		private void attach_States(State entity)
		{
			this.SendPropertyChanging();
			entity.Country = this;
		}
 partial void DeleteState(State instance);