BillPayment.cs 941 B

1234567891011121314151617181920212223242526272829303132
  1. using System.ComponentModel;
  2. using InABox.Core;
  3. namespace Comal.Classes
  4. {
  5. [UserTracking(typeof(Bill))]
  6. public class BillPayment : Entity, IPersistent, IRemotable, IManyToMany<Bill, Payment>, ILicense<AccountsPayableLicense>
  7. {
  8. [EntityRelationship(DeleteAction.SetNull)]
  9. public BillLink BillLink { get; set; }
  10. [EntityRelationship(DeleteAction.Cascade)]
  11. public PaymentLink PaymentLink { get; set; }
  12. [CurrencyEditor]
  13. public double Amount { get; set; }
  14. protected override void Init()
  15. {
  16. base.Init();
  17. BillLink = new BillLink();
  18. BillLink.PropertyChanged += BillLinkChanged;
  19. PaymentLink = new PaymentLink();
  20. }
  21. private void BillLinkChanged(object sender, PropertyChangedEventArgs e)
  22. {
  23. if (e.PropertyName.Equals("Balance"))
  24. Amount = BillLink.Balance;
  25. }
  26. }
  27. }