| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 | 
							- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using Comal.Classes;
 
- using InABox.Clients;
 
- using InABox.Core;
 
- using InABox.DynamicGrid;
 
- namespace PRSDesktop
 
- {
 
-     public class AssignmentGrid : DynamicDataGrid<Assignment>
 
-     {
 
-         public AssignmentGrid()
 
-         {
 
-             HiddenColumns.Add(x => x.JobLink.Deleted);
 
-         }
 
-         protected override Dictionary<string, object?> EditorValueChanged(IDynamicEditorForm editor, Assignment[] items, string name, object value)
 
-         {
 
-             var result = base.EditorValueChanged(editor, items, name, value);
 
-             if (name.Equals("EmployeeLink.ID"))
 
-             {
 
-                 if (editor.FindEditor("ActivityLink.ID") is ILookupEditorControl activity)
 
-                     DefineLookups(activity, items);
 
-             }
 
-             else if (name.Equals("JobLink.ID"))
 
-             {
 
-                 var itp = editor.FindEditor("ITP.ID") as ILookupEditorControl;
 
-                 if (itp != null)
 
-                     DefineLookups(itp, items);
 
-                 
 
-                 // false here because a job has a defaultscope
 
-                 // and we need to load the lookups before we set the default value
 
-                 var scope = editor.FindEditor("JobScope.ID") as ILookupEditorControl;
 
-                 if (scope != null)
 
-                     DefineLookups(scope,items,false); 
 
-             }
 
-             else if (name.Equals("Task.ID"))
 
-             {
 
-                 var jobid = new Client<Kanban>().Query(
 
-                     new Filter<Kanban>(x => x.ID).IsEqualTo(value),
 
-                     new Columns<Kanban>(x => x.JobLink.ID)
 
-                 ).Rows.FirstOrDefault()?.Get<Kanban, Guid>(x => x.JobLink.ID);
 
-                 DynamicGridUtils.UpdateEditorValue(items, "JobLink.ID", jobid.HasValue ? jobid.Value : Guid.Empty);
 
-                 DynamicGridUtils.UpdateEditorValue(items, "ITP.ID", Guid.Empty);
 
-                 var itp = editor.FindEditor("ITP.ID") as ILookupEditorControl;
 
-                 if (itp != null)
 
-                     DefineLookups(itp, items);
 
-             }
 
-             return result;
 
-         }
 
-         protected override void AfterLoad(IDynamicEditorForm editor, Assignment[] items)
 
-         {
 
-             base.AfterLoad(editor, items);
 
-             var first = items.FirstOrDefault();
 
-             if (first?.ID == Guid.Empty)
 
-                 ReloadForms<Assignment, AssignmentForm, ActivityForm>(editor, first, x => x.Activity.ID, first.ActivityLink.ID);
 
-         }
 
-     }
 
- }
 
 
  |