Prechádzať zdrojové kódy

Merge commit 'ce7b97844173e321c8c855826de40f3a23f3a98e' into kenric

Kenric Nugteren 2 rokov pred
rodič
commit
298a50ee1e

+ 22 - 9
prs.desktop/Panels/Jobs/DocumentSets/JobDocumentSetTree.xaml.cs

@@ -1,7 +1,5 @@
 using System;
 using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel;
 using System.Diagnostics;
 using System.IO;
 using System.Linq;
@@ -11,21 +9,17 @@ using System.Windows.Documents;
 using System.Windows.Forms;
 using System.Windows.Input;
 using System.Windows.Media;
-using com.sun.tools.javac.file;
 using Comal.Classes;
 using InABox.Clients;
 using InABox.Configuration;
 using InABox.Core;
 using InABox.DynamicGrid;
 using InABox.WPF;
-using net.sf.mpxj.phoenix.schema.phoenix5;
-using org.omg.CORBA;
 using Syncfusion.Compression.Zip;
 using Syncfusion.Data.Extensions;
 using Syncfusion.UI.Xaml.Grid;
 using Syncfusion.UI.Xaml.TreeGrid;
 using Syncfusion.UI.Xaml.TreeGrid.Helpers;
-using Syncfusion.Windows.Controls.Grid;
 using Syncfusion.XlsIO;
 using Color = System.Drawing.Color;
 using Environment = System.Environment;
@@ -1008,11 +1002,17 @@ namespace PRSDesktop
                 }
 
                 var milestoneids = rows.Select(r => r.Get<JobDocumentSetMileStone, Guid>(c => c.ID)).ToArray();
-                var currentfiles = new Client<JobDocumentSetMileStoneFile>().Query(
+                var table = new Client<JobDocumentSetMileStoneFile>().Query(
                     new Filter<JobDocumentSetMileStoneFile>(x => x.EntityLink.ID).InList(milestoneids),
-                    new Columns<JobDocumentSetMileStoneFile>(x => x.DocumentLink.ID)
+                    new Columns<JobDocumentSetMileStoneFile>(x => x.ID, x => x.DocumentLink.ID)
                         .Add(x => x.DocumentLink.FileName)
-                ).ToDictionary<JobDocumentSetMileStoneFile, String, Guid>(x => x.DocumentLink.FileName, x => x.DocumentLink.ID);
+                );
+                List<JobDocumentSetMileStoneFile> jobdocsetfiles = new List<JobDocumentSetMileStoneFile>();
+                foreach (var row in table.Rows)
+                { 
+                    jobdocsetfiles.Add(row.ToObject<JobDocumentSetMileStoneFile>());
+                }
+                var currentfiles = table.ToDictionary<JobDocumentSetMileStoneFile, String, Guid>(x => x.DocumentLink.FileName, x => x.DocumentLink.ID);
                 var matched = filenames.Where(filename => currentfiles.Keys.Any(key => Path.GetFileName(filename).ToLower().StartsWith(key.ToLower())));
                 bool replace = false;
                 if (matched.Any())
@@ -1030,6 +1030,7 @@ namespace PRSDesktop
                 Progress.ShowModal("Uploading Files", (progress) =>
                 {
                     List<Document> documents = new List<Document>();
+                    List<JobDocumentSetMileStoneFile> linked = new List<JobDocumentSetMileStoneFile>();
                     foreach (var file in filenames)
                     {
                         if (!matched.Contains(file) || replace)
@@ -1044,11 +1045,23 @@ namespace PRSDesktop
                             doc.CRC = CoreUtils.CalculateCRC(doc.Data);
                             doc.TimeStamp = new FileInfo(file).LastWriteTime;
                             documents.Add(doc);
+
+                            if (doc.ID != Guid.Empty)
+                            {
+                                var linkedfile = jobdocsetfiles.FirstOrDefault(x => x.DocumentLink.ID == doc.ID);
+                                linkedfile.DocumentLink.ID = Guid.Empty;
+                                linkedfile.CommitChanges();
+                                linkedfile.DocumentLink.ID = doc.ID;
+                                linked.Add(linkedfile);
+                            }                           
                         }
                     }
                     if (documents.Any())
                         new Client<Document>().Save(documents.ToArray(), "Uploaded by User");
 
+                    if (linked.Any())
+                        new Client<JobDocumentSetMileStoneFile>().Save(linked, "Uploaded by User");
+
                     progress.Report("Updating Links");
                     List<JobDocumentSetMileStoneFile> links = new List<JobDocumentSetMileStoneFile>();
                     foreach (var document in documents)

+ 15 - 1
prs.mobile/ConnectionTestApp/ConnectionTest.sln

@@ -33,7 +33,9 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "InABox.Remote.Shared", "..\
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InABox.WebSocket.Shared", "..\..\..\inabox\inabox.websocket.shared\InABox.WebSocket.Shared.csproj", "{4057A462-4A28-46D6-BF75-12E1D494F3ED}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PRSClasses", "..\..\prs.classes\PRSClasses.csproj", "{21814563-A9B8-483D-A635-FE9EC7BB1ACB}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PRSClasses", "..\..\prs.classes\PRSClasses.csproj", "{21814563-A9B8-483D-A635-FE9EC7BB1ACB}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InABox.Client.Rest", "..\..\..\inabox\inabox.client.rest\InABox.Client.Rest\InABox.Client.Rest.csproj", "{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -167,6 +169,18 @@ Global
 		{21814563-A9B8-483D-A635-FE9EC7BB1ACB}.Release|iPhone.Build.0 = Release|Any CPU
 		{21814563-A9B8-483D-A635-FE9EC7BB1ACB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
 		{21814563-A9B8-483D-A635-FE9EC7BB1ACB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Debug|iPhone.Build.0 = Debug|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Release|Any CPU.Build.0 = Release|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Release|iPhone.ActiveCfg = Release|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Release|iPhone.Build.0 = Release|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+		{86D2D6F5-06F1-43D5-B766-A02A9C4D3907}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 0 - 1
prs.mobile/ConnectionTestApp/ConnectionTest/ConnectionTest.Android/Resources/Resource.designer.cs

@@ -2,7 +2,6 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.

+ 1 - 0
prs.mobile/ConnectionTestApp/ConnectionTest/ConnectionTest/ConnectionTest.csproj

@@ -17,6 +17,7 @@
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\..\..\..\inabox\InABox.Client.Remote.Json\InABox.Client.Remote.Json.csproj" />
+    <ProjectReference Include="..\..\..\..\..\inabox\inabox.client.rest\InABox.Client.Rest\InABox.Client.Rest.csproj" />
     <ProjectReference Include="..\..\..\..\..\inabox\inabox.client.websocket\InABox.Client.WebSocket.csproj" />
     <ProjectReference Include="..\..\..\..\..\inabox\InABox.Configuration\InABox.Configuration.csproj" />
     <ProjectReference Include="..\..\..\..\..\inabox\InABox.Core\InABox.Core.csproj" />

+ 7 - 4
prs.mobile/ConnectionTestApp/ConnectionTest/ConnectionTest/ConnectionTestUnit.xaml.cs

@@ -23,7 +23,7 @@ namespace ConnectionTest
         string URL = "";
         string log = "";
         double interval = 1000;
-        static JsonClient<User> client;
+        static RestClient<User> client;
         public ConnectionTestUnit(string url)
         {
             InitializeComponent();
@@ -112,10 +112,13 @@ namespace ConnectionTest
                     Thread.Sleep((int)interval);
 
                     if(client == null)
-                        client = new JsonClient<User>(URL, false, true, BinarySerializationSettings.Latest);
+                        client = new RestClient<User>(URL, false, true, BinarySerializationSettings.Latest);
 
                     if(ClientFactory.ClientType == null)
-                        ClientFactory.SetClientType(typeof(JsonClient<>), "Test connection App", "1.0", URL, true);
+                        ClientFactory.SetClientType(typeof(RestClient<>), InABox.Core.Platform.TimeBench, "Connection Test app 2.0 - rest client",  URL, true);
+
+
+
                     var result = ClientFactory.Validate("TAN", "nictan");
 
                     //var request = WebRequest.Create("http://" + URL);
@@ -135,7 +138,7 @@ namespace ConnectionTest
                         attemptNoLbl.Text = "Attempt: " + count;                       
                     });
 
-                    CoreTable table = new Client<Product>().Query();
+                    //CoreTable table = new Client<Product>().Query();
 
                     Device.BeginInvokeOnMainThread(() =>
                     {

+ 2 - 2
prs.mobile/ConnectionTestApp/ConnectionTest/ConnectionTest/MainPage.xaml.cs

@@ -17,11 +17,11 @@ namespace ConnectionTest
     {
         List<string> urls = new List<string>
         { 
-            //"remote.com-al.com.au:8000",
+            "remote.com-al.com.au:8000",
             //"remote2.com-al.com.au:8000",
             //"remote.prsdigital.com.au:8005",
             //"remote2.prsdigital.com.au:8005",
-            "remote.com-al.com.au:8020",
+            //"remote.com-al.com.au:8020",
         };
         public MainPage()
         {