using InABox.Core; namespace Comal.Classes { public class JobScopeCostCentre : Entity, IRemotable, IPersistent, IOneToMany, IOneToMany, ILicense { [NullEditor] [EntityRelationship(DeleteAction.Cascade)] public JobLink Job { get; set; } [NullEditor] [EntityRelationship(DeleteAction.Cascade)] public JobScopeLink Scope { get; set; } [EditorSequence(1)] [EntityRelationship(DeleteAction.SetNull)] public CostCentreLink CostCentre { get; set; } [EditorSequence(2)] [CurrencyEditor(Summary = Summary.Sum)] public double Cost { get; set; } [EditorSequence(3)] public double Markup { get; set; } [EditorSequence(4)] [CurrencyEditor(Summary = Summary.Sum, Editable = Editable.Disabled)] public double Sell { get; set; } protected override void DoPropertyChanged(string name, object? before, object? after) { base.DoPropertyChanged(name, before, after); if (name.Equals(nameof(Cost))) Sell = ((double?)after ?? 0.0F) * ((100.0F + Markup) / 100.0F); else if (name.Equals(nameof(Markup))) Sell = Cost * ((100.0F + ((double?)after ?? 0.0F)) / 100.0F); } } }