Exemple #1
0
        /// <summary>
        /// This will return the quantity of an item multiplied by either the sales price if there is one or the regular
        /// price, this function also makes sure to take into account the buy one get one deal, so it may remove some
        /// quantity to account for this.
        /// </summary>
        public decimal MultCorrectPriceByQuant()
        {
            decimal QuantityTimesItemPrice;
            decimal QuantityInDec = (decimal)Quantity;

            if (ProductInformation.GetTwoForOne() == true)
            {
                var DivideQuantBy2 = Decimal.Floor(QuantityInDec / 2);
                var FindQuant2     = QuantityInDec - (DivideQuantBy2 * 2);
                var AdjustedQuant  = DivideQuantBy2 + FindQuant2;
                QuantityTimesItemPrice = (AdjustedQuant * ProductInformation.GetRegularPrice());
            }

            else if (ProductInformation.GetSalePrice() == 0)
            {
                QuantityTimesItemPrice = (QuantityInDec * ProductInformation.GetRegularPrice());
            }
            else
            {
                QuantityTimesItemPrice = (QuantityInDec * ProductInformation.GetSalePrice());
            }
            return(QuantityTimesItemPrice);
        }