Bläddra i källkod

Fix to DF Dashboard for JobITP forms; fix to assignment panel creating assignment when week view is selected; fix to being able to add items to "All Items";
fix to date range in stock movements; you can no longer actually delete and create users from security group editor.

Kenric Nugteren 2 år sedan
förälder
incheckning
eeba6b7f98

+ 1 - 1
prs.desktop/Dashboards/Common/DigitalFormsDashboard.xaml.cs

@@ -1092,7 +1092,7 @@ namespace PRSDesktop
                         new SortOrder<DigitalFormVariable>(x => x.Sequence)),
                     formQuery
                 };
-            if (ParentType == typeof(JobITPForm))
+            if (ParentType == typeof(JobITP))
             {
                 queries.Add(new KeyedQueryDef<JobITP>(
                     new Filter<JobITP>(x => x.ID).InQuery((formQuery.Filter as Filter<JobITPForm>)!, x => x.Parent.ID),

+ 4 - 1
prs.desktop/Panels/Assignments/AssignmentPanel.xaml.cs

@@ -649,7 +649,10 @@ namespace PRSDesktop
 
         private void CreateAssignment_Click(object sender, RoutedEventArgs e)
         {
-            var resource = GetCurrentResource();
+            if (sender is not MenuItem menu) return;
+            if (menu.DataContext is not SchedulerContextMenuInfo info) return;
+
+            var resource = info.Resource;//GetCurrentResource();
             var tag = new Tuple<DateTime, string>(Bookings.SelectedDate.Value,
                 resource.Id.ToString()); // CreateAssignment.Tag as Tuple<DateTime, String>;
             if (tag != null)

+ 5 - 0
prs.desktop/Panels/Jobs/DocumentSets/JobDocumentSetTree.xaml.cs

@@ -1229,6 +1229,11 @@ namespace PRSDesktop
                 MessageBox.Show("Please choose a Folder first!");
                 return;
             }
+            else if(FolderID == CoreUtils.FullGuid)
+            {
+                MessageBox.Show("Cannot add items to this folder.");
+                return;
+            }
 
             ContextMenu menu = new ContextMenu();
             var onetoone = new MenuItem() { Header = "Add Individual Files" };

+ 7 - 4
prs.desktop/Panels/Products/Movements/StockMovementPanel.xaml.cs

@@ -44,13 +44,16 @@ public partial class StockMovementPanel : UserControl, IPanel<StockMovement>
 
     public void Refresh()
     {
-        Batches.StartDate = _settings.StartDate;
-        Batches.EndDate = _settings.EndDate;
+        var start = StartPicker.SelectedDate?? DateTime.Now;
+        var end = EndPicker.SelectedDate?? DateTime.Now;
+
+        Batches.StartDate = start;
+        Batches.EndDate = end;
         if (ShowBatches.IsChecked == true)
             Batches.Refresh(false, true);
 
-        Movements.StartDate = _settings.StartDate;
-        Movements.EndDate = _settings.EndDate;
+        Movements.StartDate = start;
+        Movements.EndDate = end;
         Movements.Refresh(false, true);
     }
 

+ 50 - 0
prs.desktop/Panels/Security/Groups/SecurityGroupUserGrid.cs

@@ -0,0 +1,50 @@
+using com.sun.org.apache.xpath.@internal.axes;
+using com.sun.security.ntlm;
+using com.sun.xml.@internal.bind.annotation;
+using Comal.Classes;
+using InABox.Clients;
+using InABox.Core;
+using InABox.DynamicGrid;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PRSDesktop
+{
+    public class SecurityGroupUserGrid : DynamicOneToManyGrid<SecurityGroup, User>
+    {
+        public SecurityGroupUserGrid()
+        {
+            Options.BeginUpdate()
+                .Clear()
+                .AddRange(DynamicGridOption.AddRows)
+                .AddRange(DynamicGridOption.DeleteRows)
+                .AddRange(DynamicGridOption.MultiSelect)
+                .EndUpdate();
+        }
+
+        protected override void DoAdd()
+        {
+            var IDs = Items.Select(x => x.ID).ToArray();
+
+            var filters = new Filters<User>();
+            filters.Add(LookupFactory.DefineFilter<User>());
+            filters.Add(new Filter<User>(x => x.ID).NotInList(IDs));
+
+            var dlg = new MultiSelectDialog<User>(filters.Combine(), null, true);
+            if (dlg.ShowDialog())
+            {
+                SaveItems(dlg.Items());
+                Refresh(false, true);
+            }
+        }
+
+        protected override void OnDeleteItem(User item)
+        {
+            item.SecurityGroup.ID = Guid.Empty;
+            new Client<User>().Save(item, "Cleared security group");
+        }
+    }
+}