Selaa lähdekoodia

Improved Column Handling for JobProductMapping and JobStyle grids
Fixed CurrentMilestone Link for JobDocumentSet

frogsoftware 1 vuosi sitten
vanhempi
commit
fc2f343510

+ 1 - 1
prs.classes/Entities/Job/DocumentSet/JobDocumentSet.cs

@@ -83,7 +83,7 @@ namespace Comal.Classes
         public Filter<JobDocumentSetMileStone>? Filter { get; set; } = null;
 
         public SortOrder<JobDocumentSetMileStone>? Sort { get; set; }
-            = new SortOrder<JobDocumentSetMileStone>(x => x.Type.Sequence, SortDirection.Descending).ThenBy(x => x.Created);
+            = new SortOrder<JobDocumentSetMileStone>(x => x.Type.Sequence, SortDirection.Descending).ThenBy(x => x.Created, SortDirection.Descending);
 
         public Expression<Func<JobDocumentSetMileStone, Guid>> Parent => x => x.DocumentSet.ID;
     }

+ 4 - 0
prs.classes/Entities/Job/DocumentSet/JobDocumentSetLink.cs

@@ -21,9 +21,13 @@ namespace Comal.Classes
         [TextBoxEditor(Editable = Editable.Hidden)]
         [EditorSequence(2)]
         public string Description { get; set; }
+        
         public JobDocumentSetDisciplineLink Discipline { get; set; }
+        
         public JobDocumentSetTypeLink Type { get; set; }
+        
         public JobDocumentSetCategoryLink Category { get; set; }
+        
         public JobITPLink Area { get; set; }
 
         public LightJobDocumentSetMileStoneLink CurrentMileStone { get; set; }

+ 1 - 0
prs.classes/Entities/Job/ITP/JobITPLink.cs

@@ -14,6 +14,7 @@ namespace Comal.Classes
         [TextBoxEditor(Editable = Editable.Hidden)]
         public string Description { get; set; }
         
+        [NullEditor]
         public JobLink Job { get; set; }
     }
 }

+ 10 - 4
prs.classes/Entities/Job/JobProductMapping.cs

@@ -8,19 +8,25 @@ namespace Comal.Classes
 {
     public class JobProductMapping : Entity, IRemotable, IPersistent, ILicense<ProjectManagementLicense>
     {
+        
+        [EntityRelationship(DeleteAction.Cascade)]
+        [NullEditor]
+        public JobLink Job { get; set; }
+        
         [CodeEditor(Editable = Editable.Enabled, Visible = Visible.Default)]
+        [EditorSequence(1)]
         public string Code { get; set; } = "";
 
         [MemoEditor(Visible = Visible.Default)]
+        [EditorSequence(2)]
         public string Description { get; set; } = "";
-
-        [EntityRelationship(DeleteAction.Cascade)]
-        public JobLink Job { get; set; }
-
+        
         [EntityRelationship(DeleteAction.SetNull)]
+        [EditorSequence(3)]
         public ProductLink Product { get; set; }
 
         [EntityRelationship(DeleteAction.SetNull)]
+        [EditorSequence(3)]
         public JobDocumentSetLink JobDocumentSet { get; set; }
     }
 }

+ 1 - 1
prs.classes/Entities/Job/JobStyle.cs

@@ -5,7 +5,7 @@ namespace Comal.Classes
     public class JobStyle : Entity, IRemotable, IPersistent, ILicense<ProjectManagementLicense>
     {
         [EntityRelationship(DeleteAction.Cascade)]
-        [EditorSequence(1)]
+        [Editable(Editable.Hidden)]
         public JobLink Job { get; set; }
 
         [EntityRelationship(DeleteAction.SetNull)]

+ 15 - 2
prs.desktop/Panels/Jobs/JobProductMappingsGrid.cs

@@ -35,6 +35,19 @@ public class JobProductMappingsGrid : DynamicDataGrid<JobProductMapping>, IJobCo
         options.Add(DynamicGridOption.SelectColumns);
     }
 
+    public override DynamicGridColumns GenerateColumns()
+    {
+        var columns = new DynamicGridColumns();
+        columns.Add<JobProductMapping, string>(x => x.Code, 150, "", "", Alignment.MiddleCenter);
+        columns.Add<JobProductMapping, string>(x => x.Description, 0, "", "", Alignment.MiddleLeft);
+        columns.Add<JobProductMapping, string>(x => x.Product.Code, 200, "Product Code", "", Alignment.MiddleCenter);
+        columns.Add<JobProductMapping, string>(x => x.JobDocumentSet.Description, 0, "Approval Document", "", Alignment.MiddleLeft);
+        columns.Add<JobProductMapping, string>(x => x.JobDocumentSet.CurrentMileStone.Type.Code, 100, "Stage", "", Alignment.MiddleCenter);
+        columns.Add<JobProductMapping, string>(x => x.JobDocumentSet.CurrentMileStone.Revision, 50, "Rev", "", Alignment.MiddleCenter);
+        columns.Add<JobProductMapping, JobDocumentSetMileStoneStatus>(x => x.JobDocumentSet.CurrentMileStone.Status, 100, "Status", "", Alignment.MiddleCenter);
+        return columns;
+    }
+
     private void BuildMenu(DynamicMenuColumn column, CoreRow? row)
     {
         if (row is not null)
@@ -98,7 +111,7 @@ public class JobProductMappingsGrid : DynamicDataGrid<JobProductMapping>, IJobCo
         var docSet = new JobDocumentSet
         {
             Code = code,
-            Description = row.Get<JobProductMapping, string>(x => x.Description) + $"\nAttached to JobProductMapping '{code}'"
+            Description = $"{code} Approval".Trim()
         };
         docSet.Job.ID = Job.ID;
         docSet.Folder.ID = dialog.SelectedFolder;
@@ -141,7 +154,7 @@ public class JobProductMappingsGrid : DynamicDataGrid<JobProductMapping>, IJobCo
         var ids = ExtractValues(x => x.ID, selection).ToArray();
         return new BaseDataModel<JobProductMapping>(new Filter<JobProductMapping>(x => x.ID).InList(ids));
     }
-
+    
     #endregion
 
 }

+ 13 - 1
prs.desktop/Panels/Jobs/JobProductStylesGrid.cs

@@ -31,6 +31,18 @@ public class JobProductStylesGrid : DynamicDataGrid<JobStyle>, IJobControl, IDat
         base.DoReconfigure(options);
         options.Add(DynamicGridOption.SelectColumns);
     }
+    
+    public override DynamicGridColumns GenerateColumns()
+    {
+        var columns = new DynamicGridColumns();
+        columns.Add<JobStyle, string>(x => x.Style.Code, 150, "", "", Alignment.MiddleCenter);
+        columns.Add<JobStyle, string>(x => x.Style.Description, 0, "", "", Alignment.MiddleLeft);
+        columns.Add<JobStyle, string>(x => x.JobDocumentSet.Description, 0, "Approval Document", "", Alignment.MiddleLeft);
+        columns.Add<JobStyle, string>(x => x.JobDocumentSet.CurrentMileStone.Type.Code, 100, "Stage", "", Alignment.MiddleCenter);
+        columns.Add<JobStyle, string>(x => x.JobDocumentSet.CurrentMileStone.Revision, 50, "Rev", "", Alignment.MiddleCenter);
+        columns.Add<JobStyle, JobDocumentSetMileStoneStatus>(x => x.JobDocumentSet.CurrentMileStone.Status, 100, "Status", "", Alignment.MiddleCenter);
+        return columns;
+    }
 
     private void BuildMenu(DynamicMenuColumn column, CoreRow? row)
     {
@@ -95,7 +107,7 @@ public class JobProductStylesGrid : DynamicDataGrid<JobStyle>, IJobControl, IDat
         var docSet = new JobDocumentSet
         {
             Code = code,
-            Description = row.Get<JobStyle, string>(x => x.Style.Description) + $"\nAttached to Product Style '{code}'"
+            Description = $"{code} Approval".Trim()
         };
         docSet.Job.ID = Job.ID;
         docSet.Folder.ID = dialog.SelectedFolder;