瀏覽代碼

Added filter row to digital form grid

Kenric Nugteren 1 年之前
父節點
當前提交
8aa7650d16
共有 2 個文件被更改,包括 16 次插入3 次删除
  1. 15 2
      InABox.Core/Imports/ImportFactory.cs
  2. 1 1
      inabox.wpf/DigitalForms/DigitalFormGrid.cs

+ 15 - 2
InABox.Core/Imports/ImportFactory.cs

@@ -55,8 +55,21 @@ namespace InABox.Core
         public static IEnumerable<ImportMapping> ExtractMappings(Type type, ImportMappingType Import)
         {
             var results = new List<ImportMapping>();
-            
-            var props = DatabaseSchema.Properties(type).OrderBy(x => CoreUtils.GetPropertySequence(x));
+
+            var props = DatabaseSchema.Properties(type)
+                .OrderBy(x => x.Page, Comparer<string>.Create((x, y) =>
+                {
+                    if(x.IsNullOrWhiteSpace() || x.Equals("General"))
+                    {
+                        return -1;
+                    }
+                    else if(y.IsNullOrWhiteSpace() || y.Equals("General"))
+                    {
+                        return 1;
+                    }
+                    return x.CompareTo(y);
+                }))
+                .ThenBy(x => CoreUtils.GetPropertySequence(x));
             
             //var keys = CoreUtils.PropertyList(type, x => true, true).Keys.ToArray();
             foreach (var prop in props)

+ 1 - 1
inabox.wpf/DigitalForms/DigitalFormGrid.cs

@@ -171,7 +171,7 @@ namespace InABox.DynamicGrid
         {
             base.DoReconfigure(options);
 
-            options.AddRange(DynamicGridOption.ImportData, DynamicGridOption.ExportData);
+            options.AddRange(DynamicGridOption.ImportData, DynamicGridOption.ExportData, DynamicGridOption.FilterRows);
         }
 
         private bool EditGroupsClick(Button arg1, CoreRow[] arg2)