using System.ComponentModel; using InABox.Core; namespace Comal.Classes { [UserTracking(typeof(Invoice))] public class InvoiceReceipt : Entity, IPersistent, IRemotable, IManyToMany, IManyToMany, ILicense { [EntityRelationship(DeleteAction.SetNull)] public InvoiceLink InvoiceLink { get; set; } [EntityRelationship(DeleteAction.Cascade)] public ReceiptLink ReceiptLink { get; set; } [TextBoxEditor] public string Notes { get; set; } [CurrencyEditor(Summary = Summary.Sum)] public double Amount { get; set; } protected override void Init() { base.Init(); InvoiceLink.PropertyChanged += InvoiceLinkChanged; } private void InvoiceLinkChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName.Equals("Balance")) Amount = InvoiceLink.Balance; } } }