| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 | using System;using System.Collections.Generic;using System.Linq.Expressions;using InABox.Core;namespace Comal.Classes{    public class PaymentTotal : CoreAggregate<Payment, BillPayment, double>    {        public override Expression<Func<BillPayment, double>> Aggregate => x => x.Amount;        public Expression<Func<BillPayment, Guid>> Link => x => x.PaymentLink.ID;        public override AggregateCalculation Calculation => AggregateCalculation.Sum;        public override Dictionary<Expression<Func<BillPayment, object>>, Expression<Func<Payment, object>>> Links =>            new Dictionary<Expression<Func<BillPayment, object>>, Expression<Func<Payment, object>>>()            {                { BillPayment => BillPayment.PaymentLink.ID, Payment => Payment.ID }            };    }    [UserTracking(typeof(Bill))]    public class Payment : Entity, IPersistent, IRemotable, ILicense<AccountsPayableLicense>    {        [DateEditor]        public DateTime Date { get; set; }        [EditorSequence(1)]        public SupplierLink SupplierLink { get; set; }        [EntityRelationship(DeleteAction.SetNull)]        public PaymentTypeLink PaymentTypeLink { get; set; }        [MemoEditor]        public string Notes { get; set; }        [CurrencyEditor(Editable = Editable.Hidden)]        [Aggregate(typeof(PaymentTotal))]        public double Total { get; set; }        public override string ToString()        {            return string.Format("{0:dd MMM yy}: {1} (${2:F2})", Date, PaymentTypeLink.Description, Total);        }    }}
 |