ソースを参照

Hard File Directories

APIIntegration
rpm-mcarman 3年前
コミット
9cc93f997b
100個のファイルの変更453行の追加49行の削除
  1. +30
    -0
      JDISLog.cs
  2. +78
    -0
      JSONMethods.cs
  3. +112
    -48
      Program.cs
  4. +1
    -1
      RESTObjects/RESTResponse.cs
  5. +1
    -0
      RESTObjects/RESTService.cs
  6. +39
    -0
      Settings.json
  7. +114
    -0
      Success/JDIS-20230203-15_58_28.txt
  8. +0
    -0
      bin/Debug/net6.0/Microsoft.Exchange.WebServices.Auth.dll
  9. +0
    -0
      bin/Debug/net6.0/Microsoft.Exchange.WebServices.dll
  10. +0
    -0
      bin/Debug/net6.0/Microsoft.Identity.Client.dll
  11. +0
    -0
      bin/Debug/net6.0/Microsoft.IdentityModel.Abstractions.dll
  12. +0
    -0
      bin/Debug/net6.0/Newtonsoft.Json.Bson.dll
  13. +0
    -0
      bin/Debug/net6.0/Newtonsoft.Json.dll
  14. +0
    -0
      bin/Debug/net6.0/RestSharp.dll
  15. +39
    -0
      bin/Debug/net6.0/Settings.json
  16. +0
    -0
      bin/Debug/net6.0/System.Data.SqlClient.dll
  17. +0
    -0
      bin/Debug/net6.0/System.Net.Http.Formatting.dll
  18. +0
    -0
      bin/Debug/net6.0/jdis_import
  19. バイナリ
      bin/Debug/net6.0/jdis_import.dll
  20. バイナリ
      bin/Debug/net6.0/jdis_import.pdb
  21. +0
    -0
      bin/Debug/net6.0/runtimes/unix/lib/netstandard2.0/System.Data.SqlClient.dll
  22. +0
    -0
      bin/Debug/net6.0/runtimes/win-arm64/native/sni.dll
  23. +0
    -0
      bin/Debug/net6.0/runtimes/win-x64/native/sni.dll
  24. +0
    -0
      bin/Debug/net6.0/runtimes/win-x86/native/sni.dll
  25. +0
    -0
      bin/Debug/net6.0/runtimes/win/lib/netstandard2.0/System.Data.SqlClient.dll
  26. +0
    -0
      bin/release/net6.0/osx.12-x64/Microsoft.CSharp.dll
  27. +0
    -0
      bin/release/net6.0/osx.12-x64/Microsoft.Exchange.WebServices.Auth.dll
  28. +0
    -0
      bin/release/net6.0/osx.12-x64/Microsoft.Exchange.WebServices.dll
  29. +0
    -0
      bin/release/net6.0/osx.12-x64/Microsoft.Identity.Client.dll
  30. +0
    -0
      bin/release/net6.0/osx.12-x64/Microsoft.IdentityModel.Abstractions.dll
  31. +0
    -0
      bin/release/net6.0/osx.12-x64/Microsoft.VisualBasic.Core.dll
  32. +0
    -0
      bin/release/net6.0/osx.12-x64/Microsoft.VisualBasic.dll
  33. +0
    -0
      bin/release/net6.0/osx.12-x64/Microsoft.Win32.Primitives.dll
  34. +0
    -0
      bin/release/net6.0/osx.12-x64/Microsoft.Win32.Registry.dll
  35. +0
    -0
      bin/release/net6.0/osx.12-x64/Newtonsoft.Json.Bson.dll
  36. +0
    -0
      bin/release/net6.0/osx.12-x64/Newtonsoft.Json.dll
  37. +0
    -0
      bin/release/net6.0/osx.12-x64/RestSharp.dll
  38. +39
    -0
      bin/release/net6.0/osx.12-x64/Settings.json
  39. +0
    -0
      bin/release/net6.0/osx.12-x64/System.AppContext.dll
  40. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Buffers.dll
  41. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Collections.Concurrent.dll
  42. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Collections.Immutable.dll
  43. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Collections.NonGeneric.dll
  44. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Collections.Specialized.dll
  45. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Collections.dll
  46. +0
    -0
      bin/release/net6.0/osx.12-x64/System.ComponentModel.Annotations.dll
  47. +0
    -0
      bin/release/net6.0/osx.12-x64/System.ComponentModel.DataAnnotations.dll
  48. +0
    -0
      bin/release/net6.0/osx.12-x64/System.ComponentModel.EventBasedAsync.dll
  49. +0
    -0
      bin/release/net6.0/osx.12-x64/System.ComponentModel.Primitives.dll
  50. +0
    -0
      bin/release/net6.0/osx.12-x64/System.ComponentModel.TypeConverter.dll
  51. +0
    -0
      bin/release/net6.0/osx.12-x64/System.ComponentModel.dll
  52. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Configuration.dll
  53. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Console.dll
  54. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Core.dll
  55. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Data.Common.dll
  56. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Data.DataSetExtensions.dll
  57. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Data.SqlClient.dll
  58. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Data.dll
  59. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Diagnostics.Contracts.dll
  60. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Diagnostics.Debug.dll
  61. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Diagnostics.DiagnosticSource.dll
  62. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Diagnostics.FileVersionInfo.dll
  63. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Diagnostics.Process.dll
  64. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Diagnostics.StackTrace.dll
  65. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Diagnostics.TextWriterTraceListener.dll
  66. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Diagnostics.Tools.dll
  67. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Diagnostics.TraceSource.dll
  68. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Diagnostics.Tracing.dll
  69. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Drawing.Primitives.dll
  70. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Drawing.dll
  71. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Dynamic.Runtime.dll
  72. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Formats.Asn1.dll
  73. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Globalization.Calendars.dll
  74. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Globalization.Extensions.dll
  75. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Globalization.dll
  76. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.Compression.Brotli.dll
  77. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.Compression.FileSystem.dll
  78. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.Compression.Native.dylib
  79. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.Compression.ZipFile.dll
  80. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.Compression.dll
  81. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.FileSystem.AccessControl.dll
  82. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.FileSystem.DriveInfo.dll
  83. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.FileSystem.Primitives.dll
  84. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.FileSystem.Watcher.dll
  85. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.FileSystem.dll
  86. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.IsolatedStorage.dll
  87. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.MemoryMappedFiles.dll
  88. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.Pipes.AccessControl.dll
  89. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.Pipes.dll
  90. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.UnmanagedMemoryStream.dll
  91. +0
    -0
      bin/release/net6.0/osx.12-x64/System.IO.dll
  92. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Linq.Expressions.dll
  93. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Linq.Parallel.dll
  94. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Linq.Queryable.dll
  95. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Linq.dll
  96. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Memory.dll
  97. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Native.a
  98. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Native.dylib
  99. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Net.Http.Formatting.dll
  100. +0
    -0
      bin/release/net6.0/osx.12-x64/System.Net.Http.Json.dll

+ 30
- 0
JDISLog.cs ファイルの表示

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.IO;

namespace jdis_import
{
public class JDISLog
{

public static void WriteToLog(string logFile, string msg)
{
using (StreamWriter sw = File.AppendText(logFile))
{
sw.WriteLine(msg);
}

}
public static void Begin(string logFile)
{
using (StreamWriter sw = File.AppendText(logFile))
{
sw.WriteLine();
sw.WriteLine("###########################################################################");
sw.WriteLine(string.Format("Import Began at {0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString()));
}
}
}
}

+ 78
- 0
JSONMethods.cs ファイルの表示

@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.IO;
using Newtonsoft.Json;

namespace jdis_import
{
public class JSONMethods
{
public static JSONSetting GetSettings()
{
JSONSetting settings = new JSONSetting();
string abPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Settings.json");
Console.WriteLine(abPath);
string text = File.ReadAllText(abPath);
settings = JsonConvert.DeserializeObject<JSONSetting>(text);
return settings;
}

}
[JsonObject(MemberSerialization.OptIn)]
public class JSONSetting
{
private bool _local = true;
[JsonProperty(PropertyName = "Remote")]
public bool Remote { get; set; }
[JsonProperty(PropertyName = "LogFile")]
public string LogFile { get; set; }
[JsonProperty(PropertyName = "OSs")]
public List<OS> OSs { get; set; }
[JsonProperty(PropertyName = "Email")]
public Email Email { get; set; }
public bool Local { get { return _local; } set { _local = value; } }
[JsonProperty(PropertyName = "Prelub")]
public Prelub Prelub { get; set; }
}
[JsonObject(MemberSerialization.OptIn)]
public class OS
{
[JsonProperty(PropertyName = "Name")]
public string Name { get; set; }
[JsonProperty(PropertyName = "Fail")]
public string Fail { get; set; }
[JsonProperty(PropertyName = "Success")]
public string Success { get; set; }
[JsonProperty(PropertyName = "Log")]
public string Log { get; set; }
[JsonProperty(PropertyName = "Temp")]
public string Temp { get; set; }
}
[JsonObject(MemberSerialization.OptIn)]
public class Email
{
[JsonProperty(PropertyName = "Username")]
public string Username { get; set; }
[JsonProperty(PropertyName = "Password")]
public string Password { get; set; }
[JsonProperty(PropertyName = "Mailbox")]
public int Mailbox { get; set; }
[JsonProperty(PropertyName = "Url")]
public string Url { get; set; }
[JsonProperty(PropertyName = "Filter")]
public string Filter { get; set; }
}
[JsonObject(MemberSerialization.OptIn)]
public class Prelub
{
[JsonProperty(PropertyName = "Check")]
public string Check { get; set; }
[JsonProperty(PropertyName = "LocalService")]
public string LocalService { get; set; }
[JsonProperty(PropertyName = "RemoteService")]
public string RemoteService { get; set; }
public string ActiveService { get; set; }
}
}

+ 112
- 48
Program.cs ファイルの表示

@@ -10,6 +10,7 @@ using System.Data.SqlClient;
using System.Reflection;
using jdis_import.RESTObjects;
using System.Linq;
using System.Net;
/*
Secret Value up-8Q~y46~JyQZjJlsAJ-zpXpglpmuPIJ1Gx3a2O
@@ -23,6 +24,8 @@ namespace jdis_import
{
class Program
{
private static JSONSetting _settings;
private static string _os, _logDir, _logFile, _successDir, _failureDir, _downloadDir;
private static bool _runAPI = true;
private static RESTService _rservice;
private static List<User> _users;
@@ -192,9 +195,10 @@ namespace jdis_import
workorder.UpdateDate = DateTime.Now;
workorder.UpdateUserID = -1;
string woJson = Serialize.ToJson<WorkOrder>(workorder);
Console.WriteLine("WorkOrder Object");
Console.WriteLine();
Console.WriteLine(woJson);
//Console.WriteLine("WorkOrder Object");
//Console.WriteLine();
//Console.WriteLine(woJson);
JDISLog.WriteToLog(_logFile, string.Format("Creating Work Order: {0}", workorder.Number));
workorder = _rservice.PostRest<WorkOrder>(woJson, "workorders.svc");
if (template == null || template.ID == 0)
{
@@ -203,6 +207,7 @@ namespace jdis_import
}
else
{
JDISLog.WriteToLog(_logFile, String.Format("Creating Inspections for Workorder {0}", workorder.Number));
Dictionary<string, string> tps = new Dictionary<string, string>();
tps.Add("create", string.Format("{0}/{1}/{2}", template.ID, workorder.ID, -1));
Inspection i = _rservice.RestGet<Inspection>(true, "inspections.svc", tps);
@@ -238,6 +243,7 @@ namespace jdis_import
private static void ListsAndDefaults()
{
_rservice = new RESTService();
_rservice.BaseUrl = _settings.Prelub.ActiveService;
_customers = _rservice.RestGet<Customer>("customers.svc");
_makes = _rservice.RestGet<Make>("makes.svc");
_products = _rservice.RestGet<Product>("products.svc");
@@ -260,13 +266,36 @@ namespace jdis_import
_reason.UpdateDate = new DateTime(2013, 10, 1, 9, 23, 7);
_reason.UpdateUserID = -1;
}
static async System.Threading.Tasks.Task IsLocalNetwork()
{
var client = new System.Net.Http.HttpClient();
try
{
var result = await client.GetAsync(_settings.Prelub.Check);
_settings.Prelub.ActiveService = _settings.Prelub.LocalService;
}
catch
{
_settings.Prelub.ActiveService = _settings.Prelub.RemoteService;
}
}
static async System.Threading.Tasks.Task Main(string[] args)
{
_settings = JSONMethods.GetSettings();
await IsLocalNetwork();
if (IsWindows()) _os = "Windows";
else if (IsMacOS()) _os = "Mac";
else if (IsLinux()) _os = "Linux";
SetupDirectories();
JDISLog.Begin(_logFile);
ListsAndDefaults();
Console.WriteLine("Web APIs have loaded.");
//Console.WriteLine("Web APIs have loaded.");
JDISLog.WriteToLog(_logFile, string.Format("Default data loaded..... {0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString()));
_exeDir = Environment.CurrentDirectory;
SetupDirectories();
List<ToDo> list = new List<ToDo>();
var cca = ConfidentialClientApplicationBuilder
.Create(_keys["AppID"])
@@ -277,7 +306,8 @@ namespace jdis_import
var ewsScopes = new string[] { "https://outlook.office365.com/.default" };
try
{
Console.WriteLine("Connecting To Exchange.");
//Console.WriteLine("Connecting To Exchange.");
JDISLog.WriteToLog(_logFile, string.Format("Connectiong to Exchange Server....{0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString()));
var authResult = await cca.AcquireTokenForClient(ewsScopes)
.ExecuteAsync();
@@ -299,8 +329,17 @@ namespace jdis_import
view.PropertySet = new PropertySet(BasePropertySet.IdOnly, ItemSchema.Subject, ItemSchema.DateTimeReceived);
view.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);
view.Traversal = ItemTraversal.Shallow;
Console.WriteLine("Line 90: Finding emails.");
//Console.WriteLine("Line 90: Finding emails.");
FindItemsResults<Item> findResults = ewsClient.FindItems(fid, searchFilter, view);
List<EmailMessage> messages = new List<EmailMessage>();
foreach (EmailMessage message in findResults.Items)
{
message.Load();
if (!message.IsRead)
messages.Add(message);
}
JDISLog.WriteToLog(_logFile, string.Format("Found {0} emails", messages.Count));
foreach (EmailMessage msg in findResults.Items)
{
msg.Load();
@@ -315,12 +354,13 @@ namespace jdis_import
{
ToDo todo = new ToDo();
todo.Sender = msg.Sender.Address;
todo.SenderName = msg.Sender.Name;
todo.FileName = attachment.Name;
list.Add(todo);
//Download File
FileAttachment fAttachment = attachment as FileAttachment;
string fileAttachmentPath = Path.Combine(_exeDir, fAttachment.Name);
string fileAttachmentPath = Path.Combine(_downloadDir, fAttachment.Name);
File.WriteAllBytes(fileAttachmentPath, fAttachment.Content);
msg.IsRead = true;
msg.Update(ConflictResolutionMode.AlwaysOverwrite);
@@ -329,7 +369,8 @@ namespace jdis_import
}
}
}
Console.WriteLine("Beginning Import.");
//Console.WriteLine("Beginning Import.");
JDISLog.WriteToLog(_logFile, string.Format("Importing JDIS files....{0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToLongDateString()));
foreach (ToDo import in list)
{
@@ -340,6 +381,7 @@ namespace jdis_import
foreach (ToDo sendMsg in list)
{
EmailMessage msgToSend = new EmailMessage(ewsClient);
JDISLog.WriteToLog(_logFile, string.Format("Sending Message to: {0}\r\nFor Work Order: {1}\r\nJDIS File: {2}", sendMsg.Sender, sendMsg.WorkOrderNumber, sendMsg.FileName.Substring(sendMsg.FileName.LastIndexOf("/") + 1).Trim()));
string body = "JDIS File: {0} Work Order:{1} {2}";
if (sendMsg.Success)
{
@@ -348,7 +390,7 @@ namespace jdis_import
else
{
body = string.Format(body, sendMsg.FileName.Substring(sendMsg.FileName.LastIndexOf("/") + 1).Trim(), sendMsg.WorkOrderNumber, string.Format("Had Errors while importing: {0}", sendMsg.Validation));
msgToSend.Attachments.AddFileAttachment(Path.Combine(_exeDir, sendMsg.FileName));
msgToSend.Attachments.AddFileAttachment(Path.Combine(_downloadDir, sendMsg.FileName));
}
string fileNameOnly = sendMsg.FileName.Substring(sendMsg.FileName.LastIndexOf("/") + 1);
@@ -357,18 +399,20 @@ namespace jdis_import
msgToSend.CcRecipients.Add(new EmailAddress("mcarman@rpmindustries.com"));
msgToSend.Body = body;
msgToSend.SendAndSaveCopy();
string pathToFile = Path.Combine(_exeDir, sendMsg.FileName);
if (sendMsg.Success) File.Move(pathToFile, Path.Combine(_exeDir, "Success", fileNameOnly));
else File.Move(sendMsg.FileName, Path.Combine(_exeDir, "Fail", fileNameOnly));
string pathToFile = Path.Combine(_downloadDir, sendMsg.FileName);
if (sendMsg.Success) File.Move(pathToFile, Path.Combine(_successDir, fileNameOnly));
else File.Move(sendMsg.FileName, Path.Combine(_failureDir, fileNameOnly));
}
}
catch (MsalException ex)
{
Console.WriteLine($"Error acquiring access token: {ex}");
//Console.WriteLine($"Error acquiring access token: {ex}");
JDISLog.WriteToLog(_logFile, $"Error acquiring access token: {ex}");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex}");
//Console.WriteLine($"Error: {ex}");
JDISLog.WriteToLog(_logFile, $"Error: {ex}");
}
if (System.Diagnostics.Debugger.IsAttached)
@@ -387,15 +431,48 @@ namespace jdis_import
}
private static void SetupDirectories()
{
string path = Path.Combine(_exeDir, "Success");
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
path = Path.Combine(_exeDir, "Fail");
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
path = Path.Combine(_exeDir, "Log");
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
OS os = new OS();
switch (_os)
{
case "Windows":
os = _settings.OSs.Find(x => x.Name == "WINDOWS");
_logDir = os.Log.Replace("/", "\\");
_logFile = Path.Combine(os.Log.Replace("/", "\\"), "jdis.log");
_successDir = os.Success.Replace("/", "\\");
_failureDir = os.Fail.Replace("/", "\\");
_downloadDir = os.Temp.Replace("/", "\\");
break;
case "Mac":
os = _settings.OSs.Find(x => x.Name == "OSX");
_logDir = os.Log;
_logFile = Path.Combine(os.Log, "jdis.log");
_successDir = os.Success;
_failureDir = os.Fail;
_downloadDir = os.Temp;
break;
case "Linux":
os = _settings.OSs.Find(x => x.Name == "LINUX");
_logDir = os.Log;
_logFile = Path.Combine(os.Log, "jdis.log");
_successDir = os.Success;
_failureDir = os.Fail;
_downloadDir = os.Temp;
break;
default:
break;
}
if (!Directory.Exists(_logDir)) Directory.CreateDirectory(_logDir);
if (!Directory.Exists(_failureDir)) Directory.CreateDirectory(_failureDir);
if (!Directory.Exists(_successDir)) Directory.CreateDirectory(_successDir);
//string path = Path.Combine(_exeDir, "Success");
//if (!Directory.Exists(path))
// Directory.CreateDirectory(path);
//path = Path.Combine(_exeDir, "Fail");
//if (!Directory.Exists(path))
// Directory.CreateDirectory(path);
//path = Path.Combine(_exeDir, "Log");
//if (!Directory.Exists(path))
// Directory.CreateDirectory(path);
}
public static void GetInspectionTypes()
{
@@ -407,27 +484,6 @@ namespace jdis_import
InspectionType.Add(t.Name, t.ID);
}
/*
SqlConnection con = new SqlConnection("Data Source=192.168.0.7;Initial Catalog=Connexion_Brandt;User ID=mobilepmuser;Password=data4techs;Encrypt=No;TrustServerCertificate=true;Persist Security Info=True;");
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandTimeout = 0;
cmd.Connection = con;
cmd.CommandText = "Select ID, [Name] From InspectionType";
cmd.CommandType = CommandType.Text;
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
foreach (DataRow row in ds.Tables[0].Rows)
{
InspectionType.Add(row["Name"].ToString(), Convert.ToInt32(row["ID"]));
}
ds.Dispose();
cmd.Dispose();
con.Close();
con.Dispose();
*/
}
private static string frmtString
{
@@ -696,15 +752,15 @@ namespace jdis_import
}
private static void ReadFile(ToDo todo)
{
string file = Path.Combine(_exeDir, todo.FileName);// todo.FileName;
string file = Path.Combine(_downloadDir, todo.FileName);// todo.FileName;
todo.FileName = file;
CustomerImport c = new CustomerImport();
WorkOrderImport wo = new WorkOrderImport();
EquipmentImport eq = new EquipmentImport();
List<PartImport> parts = new List<PartImport>();
Console.WriteLine("Line 306: " + file);
Console.WriteLine("Line 307: " + file);
//Console.WriteLine("Line 306: " + file);
//Console.WriteLine("Line 307: " + file);
string filemove = string.Empty;
string filetxt = string.Empty;
string inspectionLevel = string.Empty;
@@ -1124,6 +1180,14 @@ namespace jdis_import
}
public static bool IsWindows() =>
System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
public static bool IsMacOS() =>
System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX);
public static bool IsLinux() =>
System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux);
}
public class ToDo


+ 1
- 1
RESTObjects/RESTResponse.cs ファイルの表示

@@ -42,7 +42,7 @@ namespace jdis_import.RESTObjects
{
public static T FromJson<T>(string json)
{
Console.WriteLine(json);
//Console.WriteLine(json);
return JsonConvert.DeserializeObject<T>(json, Converter.Settings);

}


+ 1
- 0
RESTObjects/RESTService.cs ファイルの表示

@@ -12,6 +12,7 @@ namespace jdis_import.RESTObjects
{
private string _baseUrl = @"http://servicesbrandt.rpmindustries.com:8081";
private HttpClient _httpClient;
public string BaseUrl { get { return _baseUrl; } set { _baseUrl = value; } }

public RESTService()
{


+ 39
- 0
Settings.json ファイルの表示

@@ -0,0 +1,39 @@
{
"OSs": [
{
"Name": "Linux",
"Fail": "/var/log/failures/",
"Success": "/var/log/successes/",
"Log": "/var/log/",
"Temp": "/var/tmp/"
},
{
"Name": "Windows",
"Fail": "C:/log/failures",
"Success": "C:/log/successes/",
"Log": "C:/log/",
"Temp": "C:/tmp/"
},
{
"Name": "OSX",
"Fail": "/var/log/failures/",
"Success": "/var/log/successes/",
"Log": "/var/log/",
"Temp": "/var/tmp/"
}
],
"Email": {
"Username": "mcarman@prelub.com",
"Password": "Gr@nt@cc3$$",
"Mailbox": 4,
"Url": "https://outlook.office365.com/ews/Exchange.asmx",
"Filter": "United Rentals, Inc:"
},
"Remote": false,
"Log File": "jdis_import.log",
"Prelub": {
"Check": "http://brandt.rpmindustries.com:8080",
"LocalService": "http://servicesbrandt.rpmindustries.com:8081",
"RemoteService": "https://servicesbrandt.rpmindustries.com"
}
}

+ 114
- 0
Success/JDIS-20230203-15_58_28.txt ファイルの表示

@@ -0,0 +1,114 @@



Date 03FEB2023 15:58:26 ** WORK ORDER PREVIEW ** Page 1

Location 48 Work Order 3376918 Seg. 01 Opn Dt 03FEB2023
Auth by JULIA STECKHAHN Phone 403-514-4000 Inv Cls Dt
CHARGE Slprn 48
S FORTIS ALBERTA INC Cust No. 62963901 S
O PO BOX 2570 Pur-Ord. H ACCOUNTSPAYABLE@FORTISCOR
L STATION M P-% 0.0 L-% 0.0 I COM
D CALGARY, AB T2P 5H4 P
G/L # Stock# Multi-use#
Make Model PIN Number Equipment Meter MC SFR
JD 744K 1DW744KXCED662037 .0 S
Prt Cls-PC Lbr Cls-ICL Price Cd-L Prt Tx-N001 Lbr Tx-N001

Item Hrs/Ord Bk-Ord Ship Description/Comments RATE EXTENSION
-------------------------------------------------------------------------------

2000 HR SERVICE
PM INTERVAL: 2000 HR T
EMPID: EDMPM1 T
PROMISE DATE: 10FEB2023 T
SPECIAL INSTRUCTIONS: 10916 HWY 60 ACHESON AB T
LOADER IS NEXT DOOR AT THE MAIN WAREHOUSE IN THE QUONSET T
CONTACT: JULIA STECKHAHN 780-203-4925 T
EMAIL: JULIA.STECKHAHN@FORTISALBERTA.COM T
1 1 DZ118283 FILTER KXY 55.96 .00
1 1 RE525523 FILTER EXY 179.52 .00
1 1 AT365869 FILTER EXY 103.19 .00
1 1 AT223493 FUEL FILXY 21.83 .00
1 1 AM39653 OIL FILTXY 19.39 .00
1 1 T225008 BREATHERXY 46.38 .00
1 1 T158495 VALVE XY 40.29 .00
2 2 AH128449 HYDRAULIXY 141.58 .00
2 2 AT468647 OIL FILTXY 104.65 .00
1 1 AT223226 FILTER EXY 186.14 .00
1 1 AT175224 FILTER EXY 105.15 .00
1 1 AT191102 AIR FILTXY 30.89 .00
1 1 AT307501 AIR FILTXY 25.41 .00
5 5 AT346594 FLUID KIXY 52.14 .00
SEG # 01 TOTAL = .00 P .00 LH .00 L .00 M .00 T
Quoted TOTAL = .00 P .00 LH .00 L .00 M .00 T

PM SERVICE CALL

SEG # 02 TOTAL = .00 P .00 LH .00 L .00 M .00 T
Quoted TOTAL = .00 P .00 LH .00 L .00 M .00 T

MISC ITEMS NOT COVERED BY PM INTERVAL

SEG # 03 TOTAL = .00 P .00 LH .00 L .00 M .00 T
Quoted TOTAL = .00 P .00 LH .00 L .00 M .00 T


Date 03FEB2023 15:58:26 ** WORK ORDER PREVIEW ** Page 2

Location 48 Work Order 3376918 Seg. 03 Opn Dt 03FEB2023
Auth by JULIA STECKHAHN Phone 403-514-4000 Inv Cls Dt
CHARGE Slprn 48
S FORTIS ALBERTA INC Cust No. 62963901 S
O PO BOX 2570 Pur-Ord. H ACCOUNTSPAYABLE@FORTISCOR
L STATION M P-% 0.0 L-% 0.0 I COM
D CALGARY, AB T2P 5H4 P
G/L # Stock# Multi-use#
Make Model PIN Number Equipment Meter MC SFR
JD 744K 1DW744KXCED662037 .0 S
Prt Cls-PC Lbr Cls-ICL Price Cd-L Prt Tx-N001 Lbr Tx-N001

Item Hrs/Ord Bk-Ord Ship Description/Comments RATE EXTENSION
-------------------------------------------------------------------------------






























****************************************
* Taxable Parts .00 *
* *
* Backordered Parts 1,567.31 *
* Total Labor .00 *
* *
* Misc Charges .00 *
* *
* Sales Tax .00 *
* *
* TOTAL DUE > .00 *
****************************************

+ 0
- 0
bin/Debug/net6.0/Microsoft.Exchange.WebServices.Auth.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/Microsoft.Exchange.WebServices.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/Microsoft.Identity.Client.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/Microsoft.IdentityModel.Abstractions.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/Newtonsoft.Json.Bson.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/Newtonsoft.Json.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/RestSharp.dll ファイルの表示


+ 39
- 0
bin/Debug/net6.0/Settings.json ファイルの表示

@@ -0,0 +1,39 @@
{
"OSs": [
{
"Name": "Linux",
"Fail": "/var/log/failures/",
"Success": "/var/log/successes/",
"Log": "/var/log/",
"Temp": "/var/tmp/"
},
{
"Name": "Windows",
"Fail": "C:/log/failures",
"Success": "C:/log/successes/",
"Log": "C:/log/",
"Temp": "C:/tmp/"
},
{
"Name": "OSX",
"Fail": "/var/log/failures/",
"Success": "/var/log/successes/",
"Log": "/var/log/",
"Temp": "/var/tmp/"
}
],
"Email": {
"Username": "mcarman@prelub.com",
"Password": "Gr@nt@cc3$$",
"Mailbox": 4,
"Url": "https://outlook.office365.com/ews/Exchange.asmx",
"Filter": "United Rentals, Inc:"
},
"Remote": false,
"Log File": "jdis_import.log",
"Prelub": {
"Check": "http://brandt.rpmindustries.com:8080",
"LocalService": "http://servicesbrandt.rpmindustries.com:8081",
"RemoteService": "https://servicesbrandt.rpmindustries.com"
}
}

+ 0
- 0
bin/Debug/net6.0/System.Data.SqlClient.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/System.Net.Http.Formatting.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/jdis_import ファイルの表示


バイナリ
bin/Debug/net6.0/jdis_import.dll ファイルの表示


バイナリ
bin/Debug/net6.0/jdis_import.pdb ファイルの表示


+ 0
- 0
bin/Debug/net6.0/runtimes/unix/lib/netstandard2.0/System.Data.SqlClient.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/runtimes/win-arm64/native/sni.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/runtimes/win-x64/native/sni.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/runtimes/win-x86/native/sni.dll ファイルの表示


+ 0
- 0
bin/Debug/net6.0/runtimes/win/lib/netstandard2.0/System.Data.SqlClient.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/Microsoft.CSharp.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/Microsoft.Exchange.WebServices.Auth.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/Microsoft.Exchange.WebServices.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/Microsoft.Identity.Client.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/Microsoft.IdentityModel.Abstractions.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/Microsoft.VisualBasic.Core.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/Microsoft.VisualBasic.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/Microsoft.Win32.Primitives.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/Microsoft.Win32.Registry.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/Newtonsoft.Json.Bson.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/Newtonsoft.Json.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/RestSharp.dll ファイルの表示


+ 39
- 0
bin/release/net6.0/osx.12-x64/Settings.json ファイルの表示

@@ -0,0 +1,39 @@
{
"OSs": [
{
"Name": "Linux",
"Fail": "/var/log/failures/",
"Success": "/var/log/successes/",
"Log": "/var/log/",
"Temp": "/var/tmp/"
},
{
"Name": "Windows",
"Fail": "C:/log/failures",
"Success": "C:/log/successes/",
"Log": "C:/log/",
"Temp": "C:/tmp/"
},
{
"Name": "OSX",
"Fail": "/var/log/failures/",
"Success": "/var/log/successes/",
"Log": "/var/log/",
"Temp": "/var/tmp/"
}
],
"Email": {
"Username": "mcarman@prelub.com",
"Password": "Gr@nt@cc3$$",
"Mailbox": 4,
"Url": "https://outlook.office365.com/ews/Exchange.asmx",
"Filter": "United Rentals, Inc:"
},
"Remote": false,
"Log File": "jdis_import.log",
"Prelub": {
"Check": "http://brandt.rpmindustries.com:8080",
"LocalService": "http://servicesbrandt.rpmindustries.com:8081",
"RemoteService": "https://servicesbrandt.rpmindustries.com"
}
}

+ 0
- 0
bin/release/net6.0/osx.12-x64/System.AppContext.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Buffers.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Collections.Concurrent.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Collections.Immutable.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Collections.NonGeneric.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Collections.Specialized.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Collections.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.ComponentModel.Annotations.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.ComponentModel.DataAnnotations.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.ComponentModel.EventBasedAsync.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.ComponentModel.Primitives.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.ComponentModel.TypeConverter.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.ComponentModel.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Configuration.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Console.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Core.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Data.Common.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Data.DataSetExtensions.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Data.SqlClient.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Data.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Diagnostics.Contracts.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Diagnostics.Debug.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Diagnostics.DiagnosticSource.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Diagnostics.FileVersionInfo.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Diagnostics.Process.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Diagnostics.StackTrace.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Diagnostics.TextWriterTraceListener.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Diagnostics.Tools.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Diagnostics.TraceSource.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Diagnostics.Tracing.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Drawing.Primitives.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Drawing.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Dynamic.Runtime.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Formats.Asn1.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Globalization.Calendars.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Globalization.Extensions.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Globalization.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.Compression.Brotli.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.Compression.FileSystem.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.Compression.Native.dylib ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.Compression.ZipFile.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.Compression.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.FileSystem.AccessControl.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.FileSystem.DriveInfo.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.FileSystem.Primitives.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.FileSystem.Watcher.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.FileSystem.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.IsolatedStorage.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.MemoryMappedFiles.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.Pipes.AccessControl.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.Pipes.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.UnmanagedMemoryStream.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.IO.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Linq.Expressions.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Linq.Parallel.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Linq.Queryable.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Linq.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Memory.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Native.a ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Native.dylib ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Net.Http.Formatting.dll ファイルの表示


+ 0
- 0
bin/release/net6.0/osx.12-x64/System.Net.Http.Json.dll ファイルの表示


変更されたファイルが多すぎるため、一部のファイルは表示されません

読み込み中…
キャンセル
保存