Ejemplo n.º 1
0
        private static Tuple<decimal, decimal> GetBasketPriceAndTax(tbl_Basket table, bool onlyProductsPrice = false)
        {
            if (table == null || table.tbl_BasketContent.Count == 0)
                return new Tuple<decimal, decimal>(0, 0);

            decimal totalPrice = 0, totalTaxAmount = 0;
            foreach (var content in table.tbl_BasketContent)
            {
                Tuple<decimal, decimal> priceAndTax = PriceManager.GetPriceAndTaxAmounts(content.tbl_ProductPrice, content.BC_Quantity);
                totalPrice += priceAndTax.Item1;
                totalTaxAmount += priceAndTax.Item2;
            }

            if (onlyProductsPrice)
                return new Tuple<decimal, decimal>(totalPrice, totalTaxAmount);

            if (table.tbl_Discount != null)
            {
                Tuple<decimal, decimal> priceAndTax = PriceManager.AddDiscountToPrice(table.tbl_Discount, totalPrice, totalTaxAmount, table.B_DomainID);
                totalPrice = priceAndTax.Item1;
                totalTaxAmount = priceAndTax.Item2;
            }

            if (table.tbl_Postage != null)
            {
                decimal maxTax = table.tbl_BasketContent.Max(bc => bc.GetTaxValue());
                Tuple<decimal, decimal> postagePriceAndTax = PriceManager.GetPostagePriceAndTax(table.tbl_Postage, maxTax, table.B_DomainID);
                totalPrice += postagePriceAndTax.Item1;
                totalTaxAmount += postagePriceAndTax.Item2;
            }

            return new Tuple<decimal, decimal>(totalPrice, totalTaxAmount);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new tbl_Basket object.
 /// </summary>
 /// <param name="basketID">Initial value of the BasketID property.</param>
 /// <param name="b_Type">Initial value of the B_Type property.</param>
 /// <param name="b_LastAccessed">Initial value of the B_LastAccessed property.</param>
 /// <param name="b_TermsConfirmed">Initial value of the B_TermsConfirmed property.</param>
 /// <param name="b_BillingEqDelivery">Initial value of the B_BillingEqDelivery property.</param>
 /// <param name="b_DomainID">Initial value of the B_DomainID property.</param>
 /// <param name="b_Subscription">Initial value of the B_Subscription property.</param>
 /// <param name="b_DetailsFor3rdParties">Initial value of the B_DetailsFor3rdParties property.</param>
 public static tbl_Basket Createtbl_Basket(global::System.Int32 basketID, global::System.Byte b_Type, global::System.DateTime b_LastAccessed, global::System.Boolean b_TermsConfirmed, global::System.Boolean b_BillingEqDelivery, global::System.Int32 b_DomainID, global::System.Boolean b_Subscription, global::System.Boolean b_DetailsFor3rdParties)
 {
     tbl_Basket tbl_Basket = new tbl_Basket();
     tbl_Basket.BasketID = basketID;
     tbl_Basket.B_Type = b_Type;
     tbl_Basket.B_LastAccessed = b_LastAccessed;
     tbl_Basket.B_TermsConfirmed = b_TermsConfirmed;
     tbl_Basket.B_BillingEqDelivery = b_BillingEqDelivery;
     tbl_Basket.B_DomainID = b_DomainID;
     tbl_Basket.B_Subscription = b_Subscription;
     tbl_Basket.B_DetailsFor3rdParties = b_DetailsFor3rdParties;
     return tbl_Basket;
 }
Ejemplo n.º 3
0
        public void CopyValuesFromBasket(tbl_Basket basket)
        {
            if (basket != null)
            {
                this.Basket = basket;
                this.BasketID = basket.BasketID;
                this.IsDeliverable = basket.IsDeliverable;

                Email = basket.B_CustomerEMail;
                BillingAddressTheSame = basket.B_BillingEqDelivery;
                Instructions = basket.B_DeliveryNotes;

                DeliveryTitle = basket.B_DeliveryTitle;
                DeliveryFirstName = basket.B_DeliveryFirstnames;
                DeliverySurname = basket.B_DeliverySurname;
                DeliveryPhone = basket.B_DeliveryPhone;
                DeliveryAddress1 = basket.B_DeliveryAddress1;
                DeliveryAddress2 = basket.B_DeliveryAddress2;
                DeliveryAddress3 = basket.B_DeliveryAddress3;
                DeliveryCity = basket.B_DeliveryCity;
                DeliveryPostcode = basket.B_DeliveryPostCode;
                DeliveryState = basket.B_DeliveryState;
                DeliveryCountry = basket.B_DeliveryCountry;
                DeliveryCountryID = basket.B_DeliveryCountryID.GetValueOrDefault(0);

                BillingTitle = basket.B_BillingTitle;
                BillingFirstName = basket.B_BillingFirstnames;
                BillingSurname = basket.B_BillingSurname;
                BillingPhone = basket.B_BillingPhone;
                BillingAddress1 = basket.B_BillingAddress1;
                BillingAddress2 = basket.B_BillingAddress2;
                BillingAddress3 = basket.B_BillingAddress3;
                BillingCity = basket.B_BillingCity;
                BillingPostcode = basket.B_BillingPostCode;
                BillingState = basket.B_BillingState;
                BillingCountry = basket.B_BillingCountry;
                BillingCountryID = basket.B_BillingCountryID;
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tbl_Basket EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotbl_Basket(tbl_Basket tbl_Basket)
 {
     base.AddObject("tbl_Basket", tbl_Basket);
 }
Ejemplo n.º 5
0
 public CheckoutModel(tbl_Basket basket)
 {
     this.IsCheckoutStep = true;
     this.CopyValuesFromBasket(basket);
 }