|
@@ -0,0 +1,57 @@
|
|
|
+using Comal.Classes;
|
|
|
+using InABox.Clients;
|
|
|
+using InABox.Core;
|
|
|
+using InABox.DynamicGrid;
|
|
|
+using javax.print.attribute.standard;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.IO;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+
|
|
|
+namespace PRSDesktop
|
|
|
+{
|
|
|
+ public class StagingSetoutGrid : DynamicDataGrid<StagingSetout>
|
|
|
+ {
|
|
|
+ public StagingSetoutGrid()
|
|
|
+ {
|
|
|
+ CoreTable table = new Client<StagingSetout>().Query(new Filter<StagingSetout>(x => x.Setout.ID).IsEqualTo(Guid.Empty));
|
|
|
+
|
|
|
+ string folder = @"U:\" + "9999" + " " + "Test Job" + @"\COM-AL SETOUTS";
|
|
|
+ var dir = new DirectoryInfo(folder);
|
|
|
+ var files = dir.EnumerateFiles();
|
|
|
+ foreach ( var file in files)
|
|
|
+ {
|
|
|
+ if (!file.FullName.EndsWith(".pdf"))
|
|
|
+ continue;
|
|
|
+
|
|
|
+ if (CheckStagingExists(file))
|
|
|
+ continue;
|
|
|
+
|
|
|
+ Stream stream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
|
|
|
+ byte[] pdfData = new byte[stream.Length];
|
|
|
+ stream.Read(pdfData, 0, System.Convert.ToInt32(pdfData.Length));
|
|
|
+
|
|
|
+ Document doc = new Document();
|
|
|
+ doc.FileName = file.Name;
|
|
|
+ doc.Data = pdfData;
|
|
|
+
|
|
|
+ new Client<Document>().Save(doc, "Created from sync setout function");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool CheckStagingExists(FileInfo file)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void Reload(Filters<StagingSetout> criteria, Columns<StagingSetout> columns, ref SortOrder<StagingSetout>? sort, Action<CoreTable?, Exception?> action)
|
|
|
+ {
|
|
|
+ base.Reload(criteria, columns, ref sort, action);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|