| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | 
							- using System;
 
- using System.Linq.Expressions;
 
- using InABox.Core;
 
- namespace Comal.Classes
 
- {
 
-     public class ProductPriceComponentNettCostFormula : IFormula<ProductPriceComponent, double>
 
-     {
 
-         public Expression<Func<ProductPriceComponent, double>> Value => x => x.Quantity;
 
-         public Expression<Func<ProductPriceComponent, double>>[] Modifiers =>
 
-             new Expression<Func<ProductPriceComponent, double>>[] { x => x.Component.NettCost };
 
-         public FormulaOperator Operator => FormulaOperator.Multiply;
 
-         
 
-         public FormulaType Type => FormulaType.Virtual;
 
-     }
 
-     [UserTracking(typeof(Product))]
 
-     public class ProductPriceComponent : Entity, IPersistent, IRemotable, ILicense<ProductManagementLicense>
 
-     {
 
-         [EditorSequence(1)]
 
-         public ProductLink Product { get; set; }
 
-         [EditorSequence(2)]
 
-         public ProductLink Component { get; set; }
 
-         [DoubleEditor(4)]
 
-         [EditorSequence(3)]
 
-         public double Quantity { get; set; }
 
-         [DoubleEditor(Editable = Editable.Disabled, Summary = Summary.Sum)]
 
-         [Formula(typeof(ProductPriceComponentNettCostFormula))]
 
-         [EditorSequence(4)]
 
-         public double NettCost { get; set; }
 
-         protected override void Init()
 
-         {
 
-             base.Init();
 
-             Product = new ProductLink(() => this);
 
-             Component = new ProductLink(() => this);
 
-         }
 
-         protected override void DoPropertyChanged(string name, object before, object after)
 
-         {
 
-             base.DoPropertyChanged(name, before, after);
 
-             if (name.Equals("Quantity")) NettCost = (double)after * Component.NettCost;
 
-         }
 
-     }
 
- }
 
 
  |