Kenric Nugteren 1 gadu atpakaļ
vecāks
revīzija
c8da2607ef
1 mainītis faili ar 31 papildinājumiem un 4 dzēšanām
  1. 31 4
      prs.desktop/Panels/Staging/StagingPanel.xaml.cs

+ 31 - 4
prs.desktop/Panels/Staging/StagingPanel.xaml.cs

@@ -647,10 +647,37 @@ public class Module
                 MessageBox.Show("Please select a setout first.");
                 return;
             }
-            Document.Approved = !Document.Approved;
-            new Client<StagingSetoutDocument>().Save(Document, "");
-            refreshing = true;
-            stagingSetoutGrid.Refresh(false, true);
+            if (selectedSetouts.Count > 1)
+            {
+                var msg = Document.Approved
+                    ? "Bulk unapprove?"
+                    : "Bulk approve? (Skip individual setout approval)";
+                if (MessageBox.Show(msg, "Continue?", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
+                {
+                    Progress.Show("Approving Setouts..");
+                    var documents = Client.Query(
+                        new Filter<StagingSetoutDocument>(x => x.EntityLink.ID).InList(selectedSetouts.Select(x => x.ID).ToArray()),
+                        new Columns<StagingSetoutDocument>(x => x.ID, x => x.Approved)
+                    ).ToObjects<StagingSetoutDocument>().ToList();
+                    foreach(var document in documents)
+                    {
+                        document.Approved = !Document.Approved;
+                    }
+                    Client.Save(documents, "Approved by user.");
+
+                    Progress.Close();
+
+                    refreshing = true;
+                    stagingSetoutGrid.Refresh(false, true);
+                }
+            }
+            else
+            {
+                Document.Approved = !Document.Approved;
+                new Client<StagingSetoutDocument>().Save(Document, "");
+                refreshing = true;
+                stagingSetoutGrid.Refresh(false, true);
+            }
         }
 
         private void OnMarkupSelected()