Example #1
0
        private void CheckForPricesBelowZero(UserSpecificPrice price)
        {
            var final = price.PriceWithAdjustments();

            if (final < 0)
            {
                var tweak = -1 * final;
                price.AddAdjustment(tweak, "Price can not be below zero");
            }
        }
Example #2
0
        private void AdjustProductPriceForUser(UserSpecificPrice price, Product p, CustomerAccount currentUser)
        {
            if (currentUser == null)
            {
                return;
            }
            if (currentUser.Bvin == string.Empty)
            {
                return;
            }
            if (currentUser.PricingGroupId == string.Empty)
            {
                return;
            }
            if (p == null)
            {
                return;
            }
            if (price == null)
            {
                return;
            }

            var startingPrice = price.PriceWithAdjustments();

            var pricingGroup = ContactServices.PriceGroups.Find(currentUser.PricingGroupId);

            if (pricingGroup == null)
            {
                return;
            }

            var nonGroupPrice = price.BasePrice;

            var groupPrice = nonGroupPrice;

            //groupPrice = pricingGroup.GetAdjustedPriceForThisGroup(p.SitePrice, p.ListPrice, p.SiteCost);
            groupPrice = pricingGroup.GetAdjustedPriceForThisGroup(startingPrice, p.ListPrice, p.SiteCost);

            var amountOfDiscount = groupPrice - nonGroupPrice;

            price.AddAdjustment(amountOfDiscount, "Price Group");
        }