Procházet zdrojové kódy

Made JobDocumentSetLink.ID a LookupEditor

frogsoftware před 1 rokem
rodič
revize
6f6a4c2eec

+ 38 - 1
prs.classes/Entities/Job/DocumentSet/JobDocumentSetLink.cs

@@ -1,11 +1,12 @@
 using System;
+using System.Linq;
 using InABox.Core;
 
 namespace Comal.Classes
 {
     public class JobDocumentSetLink : EntityLink<JobDocumentSet>, IJobDocumentSet
     {
-        [NullEditor]
+        [LookupEditor(typeof(JobDocumentSet))]
         public override Guid ID { get; set; }
         
         [NullEditor]
@@ -32,4 +33,40 @@ namespace Comal.Classes
 
         public LightJobDocumentSetMileStoneLink CurrentMileStone { get; set; }
     }
+    
+    public class JobDocumentSetLookups : EntityLookup<JobDocumentSet>, ILookupDefinition<JobDocumentSet,Job>
+    {
+        public override Filter<JobDocumentSet>? DefineFilter()
+        {
+            return null;
+        }
+
+        public override SortOrder<JobDocumentSet> DefineSortOrder()
+        {
+            return new SortOrder<JobDocumentSet>(x=>x.Code);
+        }
+
+        public override Columns<JobDocumentSet> DefineColumns()
+        {
+            return new Columns<JobDocumentSet>(x => x.ID)
+                .Add(x => x.Code)
+                .Add(x => x.Description);
+        }
+
+
+        public Filter<JobDocumentSet>? DefineFilter(Job[] items)
+        {
+            var ids = items.Select(x => x.ID).Distinct().ToArray();
+            return ids.Any()
+                ? new Filter<JobDocumentSet>(x => x.Job.ID).InList(ids)
+                : new Filter<JobDocumentSet>().None();
+        }
+
+        public Columns<Job> DefineFilterColumns()
+        {
+            return new Columns<Job>(x => x.ID)
+                .Add(x => x.JobNumber)
+                .Add(x => x.Name);
+        }
+    }
 }