| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 | using System;using System.Collections.Generic;using System.Linq;using System.Linq.Expressions;using InABox.Core;namespace Comal.Classes{    public class QuoteContractExTax : CoreAggregate<QuoteContract, QuoteContractProposal, double>    {        public override Expression<Func<QuoteContractProposal, double>> Aggregate => x => x.Proposal.ProposalExTax;        public override AggregateCalculation Calculation => AggregateCalculation.Sum;        public override Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>> Links =>            new Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>>()            {                { QuoteContractProposal => QuoteContractProposal.Contract.ID, QuoteContract => QuoteContract.ID }            };    }    public class QuoteContractTax : CoreAggregate<QuoteContract, QuoteContractProposal, double>    {        public override Expression<Func<QuoteContractProposal, double>> Aggregate => x => x.Proposal.ProposalTax;        public override AggregateCalculation Calculation => AggregateCalculation.Sum;        public override Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>> Links =>            new Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>>()            {                { QuoteContractProposal => QuoteContractProposal.Contract.ID, QuoteContract => QuoteContract.ID }            };    }    public class QuoteContractIncTax : CoreAggregate<QuoteContract, QuoteContractProposal, double>    {        public override Expression<Func<QuoteContractProposal, double>> Aggregate => x => x.Proposal.ProposalIncTax;        public override AggregateCalculation Calculation => AggregateCalculation.Sum;        public override Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>> Links =>            new Dictionary<Expression<Func<QuoteContractProposal, object>>, Expression<Func<QuoteContract, object>>>()            {                { QuoteContractProposal => QuoteContractProposal.Contract.ID, QuoteContract => QuoteContract.ID }            };    }    [UserTracking(typeof(Quote))]    public class QuoteContract : Entity, IRemotable, IPersistent, IQuoteContract, ILicense<QuotesManagementLicense>, IOneToMany<Quote>    {        [NullEditor]        [EntityRelationship(DeleteAction.Cascade)]        public QuoteLink Quote { get; set; }        [TextBoxEditor]        [EditorSequence(1)]        public string Description { get; set; }        [CurrencyEditor(Editable = Editable.Hidden, Summary = Summary.Sum)]        [Aggregate(typeof(QuoteContractExTax))]        public double ExTax { get; set; }        [CurrencyEditor(Editable = Editable.Hidden, Summary = Summary.Sum)]        [Aggregate(typeof(QuoteContractTax))]        public double Tax { get; set; }        [CurrencyEditor(Visible = Visible.Default, Editable = Editable.Hidden, Summary = Summary.Sum)]        [Aggregate(typeof(QuoteContractIncTax))]        public double IncTax { get; set; }                [DateTimeEditor]        [EditorSequence(2)]        public DateTime Confirmed { get; set; }                        private class QuoteContractJobScopeLookup : LookupDefinitionGenerator<JobScope, QuoteContract>        {            public override Filter<JobScope> DefineFilter(QuoteContract[] items)            {                if (items?.Any() != true)                    return LookupFactory.DefineFilter<JobScope>();                return new Filter<JobScope>(x => x.Job.ID).IsEqualTo(items.First().Quote.Job.ID);            }            public override Columns<QuoteContract> DefineFilterColumns()                => new Columns<QuoteContract>(ColumnTypeFlags.Required);        }        [LookupDefinition(typeof(QuoteContractJobScopeLookup))]        [EditorSequence(3)]        public JobScopeLink JobScope { get; set; }    }}
 |