| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 | using System;using System.Collections.Generic;using System.Linq.Expressions;using InABox.Core;namespace Comal.Classes{        public class JobDocumentSetMileStoneFileCount : CoreAggregate<JobDocumentSetMileStone, JobDocumentSetMileStoneFile, Guid>    {        public override Expression<Func<JobDocumentSetMileStoneFile, Guid>> Aggregate => x => x.ID;        public override AggregateCalculation Calculation => AggregateCalculation.Count;        public override Dictionary<Expression<Func<JobDocumentSetMileStoneFile, object>>, Expression<Func<JobDocumentSetMileStone, object>>> Links =>            new Dictionary<Expression<Func<JobDocumentSetMileStoneFile, object>>, Expression<Func<JobDocumentSetMileStone, object>>>()            {                { JobDocumentSetMileStoneFile => JobDocumentSetMileStoneFile.EntityLink.ID, JobDocumentSetMileStone => JobDocumentSetMileStone.ID }            };    }        [Caption("Milestones")]    public class JobDocumentSetMileStone : Entity, IRemotable, IPersistent, IOneToMany<JobDocumentSet>, IJobDocumentSetMileStone, ILicense<ProjectManagementLicense>    {        [EntityRelationship(DeleteAction.Cascade)]        [NullEditor]        public JobDocumentSetLink DocumentSet { get; set; }                [EntityRelationship(DeleteAction.Cascade)]        [NullEditor]        [EditorSequence(1)]        public JobDocumentSetMileStoneTypelink Type { get; set; }        [CodeEditor(Visible = Visible.Default, Editable = Editable.Enabled)]        [EditorSequence(2)]        public String Revision { get; set; }                [EditorSequence(3)]        public EmployeeLink Employee { get; set; }                [EnumLookupEditor(typeof(JobDocumentSetMileStoneStatus))]        [EditorSequence(4)]        public JobDocumentSetMileStoneStatus Status { get; set; }                [NotesEditor]        [EditorSequence(5)]        public String[] Notes { get; set; }                [TextBoxEditor]        [EditorSequence(6)]        public String Watermark { get; set; }                [DateTimeEditor(Editable = Editable.Enabled)]        [EditorSequence(6)]        public DateTime Due { get; set; }                [Obsolete("Replaced with Submitted", true)]        public DateTime Issued { get; set; }                [DateTimeEditor(Editable = Editable.Disabled)]        [EditorSequence(7)]        public DateTime Submitted { get; set; }                [DateTimeEditor(Editable = Editable.Enabled)]        [EditorSequence(8)]        public DateTime Expected { get; set; }                [DateTimeEditor(Editable = Editable.Disabled)]        [EditorSequence(9)]        public DateTime Closed { get; set; }                [NullEditor]        [Aggregate(typeof(JobDocumentSetMileStoneFileCount))]        public int Attachments { get; set; }                protected override void Init()        {            base.Init();            Status = JobDocumentSetMileStoneStatus.NotStarted;            DocumentSet = new JobDocumentSetLink();            Type = new JobDocumentSetMileStoneTypelink();            Employee = new EmployeeLink();        }        protected override void DoPropertyChanged(string name, object before, object after)        {            base.DoPropertyChanged(name, before, after);            if (String.Equals(name, "Status"))            {                JobDocumentSetMileStoneStatus status = (JobDocumentSetMileStoneStatus)after;                switch (status)                {                    case JobDocumentSetMileStoneStatus.InProgress:                    case JobDocumentSetMileStoneStatus.OnHold:                    case JobDocumentSetMileStoneStatus.InfoRequired:                        Submitted = DateTime.MinValue;                        Closed = DateTime.MinValue;                        break;                    case JobDocumentSetMileStoneStatus.Submitted:                        Submitted = Submitted.IsEmpty() ? DateTime.Now : Submitted;                        Closed = DateTime.MinValue;                        break;                    case JobDocumentSetMileStoneStatus.Approved:                    case JobDocumentSetMileStoneStatus.Rejected:                    case JobDocumentSetMileStoneStatus.Cancelled:                        Submitted = Submitted.IsEmpty() ? DateTime.Now : Submitted;                        Closed = Closed.IsEmpty() ? DateTime.Now : Closed;                        break;                }            }        }    }}
 |