Example #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is OrderReturnLineItem other &&
                   ((Uid == null && other.Uid == null) || (Uid?.Equals(other.Uid) == true)) &&
                   ((SourceLineItemUid == null && other.SourceLineItemUid == null) || (SourceLineItemUid?.Equals(other.SourceLineItemUid) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Quantity == null && other.Quantity == null) || (Quantity?.Equals(other.Quantity) == true)) &&
                   ((QuantityUnit == null && other.QuantityUnit == null) || (QuantityUnit?.Equals(other.QuantityUnit) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((CatalogObjectId == null && other.CatalogObjectId == null) || (CatalogObjectId?.Equals(other.CatalogObjectId) == true)) &&
                   ((VariationName == null && other.VariationName == null) || (VariationName?.Equals(other.VariationName) == true)) &&
                   ((ReturnModifiers == null && other.ReturnModifiers == null) || (ReturnModifiers?.Equals(other.ReturnModifiers) == true)) &&
                   ((AppliedTaxes == null && other.AppliedTaxes == null) || (AppliedTaxes?.Equals(other.AppliedTaxes) == true)) &&
                   ((AppliedDiscounts == null && other.AppliedDiscounts == null) || (AppliedDiscounts?.Equals(other.AppliedDiscounts) == true)) &&
                   ((BasePriceMoney == null && other.BasePriceMoney == null) || (BasePriceMoney?.Equals(other.BasePriceMoney) == true)) &&
                   ((VariationTotalPriceMoney == null && other.VariationTotalPriceMoney == null) || (VariationTotalPriceMoney?.Equals(other.VariationTotalPriceMoney) == true)) &&
                   ((GrossReturnMoney == null && other.GrossReturnMoney == null) || (GrossReturnMoney?.Equals(other.GrossReturnMoney) == true)) &&
                   ((TotalTaxMoney == null && other.TotalTaxMoney == null) || (TotalTaxMoney?.Equals(other.TotalTaxMoney) == true)) &&
                   ((TotalDiscountMoney == null && other.TotalDiscountMoney == null) || (TotalDiscountMoney?.Equals(other.TotalDiscountMoney) == true)) &&
                   ((TotalMoney == null && other.TotalMoney == null) || (TotalMoney?.Equals(other.TotalMoney) == true)));
        }
Example #2
0
 public void Collect(IEnumerable <int> productIds)
 {
     Attributes.Collect(productIds);
     AttributeCombinations.Collect(productIds);
     TierPrices.Collect(productIds);
     ProductCategories.Collect(productIds);
     AppliedDiscounts.Collect(productIds);
     ProductBundleItems.Collect(productIds);
 }
Example #3
0
        public override void CalculatePrice()
        {
            Item milkItem = Items.FirstOrDefault(x => x.Product.Code == "Milk");

            if (milkItem?.Quantity > 3)
            {
                int    discountQoef = milkItem.Quantity / 4;
                double discount     = discountQoef * milkItem.Product.Price;

                milkItem.ProductTotal = Math.Round(milkItem.ProductTotal - discount, 2);
                AppliedDiscounts.Add(Discounts.MilkDiscount);
            }
        }
        public override void CalculatePrice()
        {
            Item butterItem = Items.FirstOrDefault(x => x.Product.Code == "Butter");
            Item breadItem  = Items.FirstOrDefault(x => x.Product.Code == "Bread");

            if (butterItem?.Quantity >= 2 && breadItem != null)
            {
                int discountQoef = butterItem.Quantity / 2 > breadItem.Quantity ? breadItem.Quantity : butterItem.Quantity / 2;

                breadItem.ProductTotal = Math.Round(breadItem.ProductTotal - (discountQoef * breadItem.Product.Price * 0.5), 2);

                AppliedDiscounts.Add(Discounts.ButterDiscount);
            }
        }
Example #5
0
        public override int GetHashCode()
        {
            int hashCode = 1299728447;

            if (Uid != null)
            {
                hashCode += Uid.GetHashCode();
            }

            if (SourceLineItemUid != null)
            {
                hashCode += SourceLineItemUid.GetHashCode();
            }

            if (Name != null)
            {
                hashCode += Name.GetHashCode();
            }

            if (Quantity != null)
            {
                hashCode += Quantity.GetHashCode();
            }

            if (QuantityUnit != null)
            {
                hashCode += QuantityUnit.GetHashCode();
            }

            if (Note != null)
            {
                hashCode += Note.GetHashCode();
            }

            if (CatalogObjectId != null)
            {
                hashCode += CatalogObjectId.GetHashCode();
            }

            if (VariationName != null)
            {
                hashCode += VariationName.GetHashCode();
            }

            if (ReturnModifiers != null)
            {
                hashCode += ReturnModifiers.GetHashCode();
            }

            if (AppliedTaxes != null)
            {
                hashCode += AppliedTaxes.GetHashCode();
            }

            if (AppliedDiscounts != null)
            {
                hashCode += AppliedDiscounts.GetHashCode();
            }

            if (BasePriceMoney != null)
            {
                hashCode += BasePriceMoney.GetHashCode();
            }

            if (VariationTotalPriceMoney != null)
            {
                hashCode += VariationTotalPriceMoney.GetHashCode();
            }

            if (GrossReturnMoney != null)
            {
                hashCode += GrossReturnMoney.GetHashCode();
            }

            if (TotalTaxMoney != null)
            {
                hashCode += TotalTaxMoney.GetHashCode();
            }

            if (TotalDiscountMoney != null)
            {
                hashCode += TotalDiscountMoney.GetHashCode();
            }

            if (TotalMoney != null)
            {
                hashCode += TotalMoney.GetHashCode();
            }

            return(hashCode);
        }
Example #6
0
 public virtual List <string> GetAppliedDiscounts()
 {
     return(AppliedDiscounts.Select(x => x.ToString()).ToList());
 }
        public override int GetHashCode()
        {
            int hashCode = 441365892;

            if (Uid != null)
            {
                hashCode += Uid.GetHashCode();
            }

            if (Name != null)
            {
                hashCode += Name.GetHashCode();
            }

            if (Quantity != null)
            {
                hashCode += Quantity.GetHashCode();
            }

            if (QuantityUnit != null)
            {
                hashCode += QuantityUnit.GetHashCode();
            }

            if (Note != null)
            {
                hashCode += Note.GetHashCode();
            }

            if (CatalogObjectId != null)
            {
                hashCode += CatalogObjectId.GetHashCode();
            }

            if (VariationName != null)
            {
                hashCode += VariationName.GetHashCode();
            }

            if (Metadata != null)
            {
                hashCode += Metadata.GetHashCode();
            }

            if (Modifiers != null)
            {
                hashCode += Modifiers.GetHashCode();
            }

            if (AppliedTaxes != null)
            {
                hashCode += AppliedTaxes.GetHashCode();
            }

            if (AppliedDiscounts != null)
            {
                hashCode += AppliedDiscounts.GetHashCode();
            }

            if (BasePriceMoney != null)
            {
                hashCode += BasePriceMoney.GetHashCode();
            }

            if (VariationTotalPriceMoney != null)
            {
                hashCode += VariationTotalPriceMoney.GetHashCode();
            }

            if (GrossSalesMoney != null)
            {
                hashCode += GrossSalesMoney.GetHashCode();
            }

            if (TotalTaxMoney != null)
            {
                hashCode += TotalTaxMoney.GetHashCode();
            }

            if (TotalDiscountMoney != null)
            {
                hashCode += TotalDiscountMoney.GetHashCode();
            }

            if (TotalMoney != null)
            {
                hashCode += TotalMoney.GetHashCode();
            }

            if (PricingBlocklists != null)
            {
                hashCode += PricingBlocklists.GetHashCode();
            }

            return(hashCode);
        }