Kenric Nugteren 8 mesi fa
parent
commit
4cf622eacc

+ 8 - 5
prs.desktop/Forms/Issues/IssuesGrid.cs

@@ -34,10 +34,11 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
 
     public Guid CustomerID { get; set; }
 
-    private CustomProperty CustomerProperty = new CustomProperty
+    public static CustomProperty CustomerProperty = new CustomProperty
     {
         Name = "CustomerID",
-        PropertyType = typeof(string)
+        PropertyType = typeof(string),
+        ClassType = typeof(Kanban)
     };
 
     public IssuesGrid() : base()
@@ -48,6 +49,8 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
         foreach (var col in cols)
             HiddenColumns.Add(col);
 
+        HiddenColumns.Add(x => x.Notes);
+
         ActionColumns.Add(new DynamicMenuColumn(BuildMenu) { Position = DynamicActionColumnPosition.End });
     }
 
@@ -84,7 +87,7 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
         var kanban = row.ToObject<Kanban>();
         var text = "";
 
-        if(TextEdit.Execute("Enter note:", ref text))
+        if(TextBoxDialog.Execute("Enter note:", ref text))
         {
             text = string.Format("{0:yyyy-MM-dd HH:mm:ss}: {1}", DateTime.Now, text);
             kanban.Notes = kanban.Notes.Concatenate([text]);
@@ -188,7 +191,7 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
     {
         var pages = new DynamicEditorPages
         {
-            new DynamicDocumentGrid<KanbanDocument, Kanban, KanbanLink>()
+            //new DynamicDocumentGrid<KanbanDocument, Kanban, KanbanLink>()
         };
         return pages;
     }
@@ -214,7 +217,7 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
         Filters<Kanban> criteria, Columns<Kanban> columns, ref SortOrder<Kanban>? sort,
         CancellationToken token, Action<CoreTable?, Exception?> action)
     {
-        criteria.Add(new Filter<Kanban>(x => x.Closed).IsNotEqualTo(Guid.Empty));
+        criteria.Add(new Filter<Kanban>(x => x.Closed).IsEqualTo(Guid.Empty));
         criteria.Add(new Filter<Kanban>(CustomerProperty).IsEqualTo(CustomerID.ToString()));
         if(Options.PageSize > 0)
         {

+ 15 - 0
prs.desktop/Forms/Issues/IssuesWindow.xaml.cs

@@ -61,9 +61,24 @@ public partial class IssuesWindow : Window
             MessageWindow.ShowMessage("Could not connect to PRS digital database.", "Connection error.");
             return;
         }
+
         var issues = new IssuesWindow();
+
+        // Save the old property if it exists.
+        var prop = DatabaseSchema.Property(typeof(Kanban), IssuesGrid.CustomerProperty.Name) as CustomProperty;
+
+        // Load the new property.
+        DatabaseSchema.Load([IssuesGrid.CustomerProperty]);
+
         issues.Grid.CustomerID = customerID;
         issues.ClientFactory = x => (Activator.CreateInstance(typeof(RpcClient<>).MakeGenericType(x), transport) as IClient)!;
         issues.ShowDialog();
+
+        // Return DB schema to what it was.
+        DatabaseSchema.Unload([IssuesGrid.CustomerProperty]);
+        if(prop is not null)
+        {
+            DatabaseSchema.Load([prop]);
+        }
     }
 }