diff --git a/BodyshopUploader/EmsBase/EMS.ENV b/BodyshopUploader/EmsBase/EMS.ENV
new file mode 100644
index 0000000..6c1c9ef
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMS.ENV differ
diff --git a/BodyshopUploader/EmsBase/EMS.LIN b/BodyshopUploader/EmsBase/EMS.LIN
new file mode 100644
index 0000000..42124e3
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMS.LIN differ
diff --git a/BodyshopUploader/EmsBase/EMS.PFH b/BodyshopUploader/EmsBase/EMS.PFH
new file mode 100644
index 0000000..80222b7
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMS.PFH differ
diff --git a/BodyshopUploader/EmsBase/EMS.PFL b/BodyshopUploader/EmsBase/EMS.PFL
new file mode 100644
index 0000000..39d67f2
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMS.PFL differ
diff --git a/BodyshopUploader/EmsBase/EMS.PFM b/BodyshopUploader/EmsBase/EMS.PFM
new file mode 100644
index 0000000..0167f0c
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMS.PFM differ
diff --git a/BodyshopUploader/EmsBase/EMS.PFO b/BodyshopUploader/EmsBase/EMS.PFO
new file mode 100644
index 0000000..5ce9025
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMS.PFO differ
diff --git a/BodyshopUploader/EmsBase/EMS.PFP b/BodyshopUploader/EmsBase/EMS.PFP
new file mode 100644
index 0000000..22f94eb
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMS.PFP differ
diff --git a/BodyshopUploader/EmsBase/EMS.PFT b/BodyshopUploader/EmsBase/EMS.PFT
new file mode 100644
index 0000000..e5318a2
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMS.PFT differ
diff --git a/BodyshopUploader/EmsBase/EMS.STL b/BodyshopUploader/EmsBase/EMS.STL
new file mode 100644
index 0000000..1ce7e54
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMS.STL differ
diff --git a/BodyshopUploader/EmsBase/EMS.TTL b/BodyshopUploader/EmsBase/EMS.TTL
new file mode 100644
index 0000000..deb0b70
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMS.TTL differ
diff --git a/BodyshopUploader/EmsBase/EMSA.AD1 b/BodyshopUploader/EmsBase/EMSA.AD1
new file mode 100644
index 0000000..d80de5b
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMSA.AD1 differ
diff --git a/BodyshopUploader/EmsBase/EMSA.dbt b/BodyshopUploader/EmsBase/EMSA.dbt
new file mode 100644
index 0000000..92b99fc
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMSA.dbt differ
diff --git a/BodyshopUploader/EmsBase/EMSB.AD2 b/BodyshopUploader/EmsBase/EMSB.AD2
new file mode 100644
index 0000000..0577d32
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMSB.AD2 differ
diff --git a/BodyshopUploader/EmsBase/EMSB.dbt b/BodyshopUploader/EmsBase/EMSB.dbt
new file mode 100644
index 0000000..e14e329
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMSB.dbt differ
diff --git a/BodyshopUploader/EmsBase/EMSV.VEH b/BodyshopUploader/EmsBase/EMSV.VEH
new file mode 100644
index 0000000..24bbf16
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMSV.VEH differ
diff --git a/BodyshopUploader/EmsBase/EMSV.dbt b/BodyshopUploader/EmsBase/EMSV.dbt
new file mode 100644
index 0000000..84b106a
Binary files /dev/null and b/BodyshopUploader/EmsBase/EMSV.dbt differ
diff --git a/BodyshopUploader/ImEXOnlinePartner.csproj b/BodyshopUploader/ImEXOnlinePartner.csproj
index 957ab28..c2d8475 100644
--- a/BodyshopUploader/ImEXOnlinePartner.csproj
+++ b/BodyshopUploader/ImEXOnlinePartner.csproj
@@ -187,6 +187,7 @@
+
@@ -257,6 +258,54 @@
PreserveNewest
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
SettingsSingleFileGenerator
Settings.Designer.cs
@@ -294,19 +343,19 @@
6.0.0.3
- 3.7.1
+ 3.7.2
- 3.2.3
+ 4.0.1
- 3.2.3
+ 4.0.1
1.1.0
- 4.1.0
+ 4.2.1
4.7.0
diff --git a/BodyshopUploader/Utils/Decoder/EstimateDecoder.cs b/BodyshopUploader/Utils/Decoder/EstimateDecoder.cs
index 2aab1e0..50102ee 100644
--- a/BodyshopUploader/Utils/Decoder/EstimateDecoder.cs
+++ b/BodyshopUploader/Utils/Decoder/EstimateDecoder.cs
@@ -105,7 +105,7 @@ namespace BodyshopPartner.Utils.Decoder
var reader = new DBFReader(fis);
var type = reader.GetType();
-
+ logger.Trace(reader.Fields.ToString());
reader.SetSelectFields(new string[] { "INS_CO_ID","INS_CO_NM","INS_ADDR1","INS_ADDR2","INS_CITY","INS_ST","INS_ZIP","INS_CTRY",
"INS_EA","POLICY_NO","DED_AMT","DED_STATUS","ASGN_NO","ASGN_DATE","ASGN_TYPE","CLM_NO","CLM_OFC_ID","CLM_OFC_NM","CLM_ADDR1",
diff --git a/BodyshopUploader/Utils/HTTPServer.cs b/BodyshopUploader/Utils/HTTPServer.cs
index 2ad980d..2b92a7e 100644
--- a/BodyshopUploader/Utils/HTTPServer.cs
+++ b/BodyshopUploader/Utils/HTTPServer.cs
@@ -69,6 +69,16 @@ namespace BodyshopPartner.Utils
(req, res, props) => { HandleImport(req, res); }
, "POST");
+ Route.Add("/oec/", (req, res, props) =>
+ {
+ hlog("Received an OEC from ImEX.online");
+ res.WithCORS();
+ res.Close();
+ }, "OPTIONS");
+ Route.Add("/oec/",
+ (req, res, props) => { HandleOec(req, res); }
+ , "POST");
+
logger.Trace("Starting HTTP server...");
hlog = HttpLogger;
@@ -92,6 +102,29 @@ namespace BodyshopPartner.Utils
}
}
+ private static void HandleOec(System.Net.HttpListenerRequest req, System.Net.HttpListenerResponse res)
+ {
+ logger.Trace("/oec/ - POST");
+ //Input will be an array of objects containing XMLs.
+
+ var requestBody = ParseBody(req);
+ JObject HttpResponse = new JObject();
+ try
+ {
+ Utils.OEConnection.SendToOEConnection(requestBody);
+ HttpResponse.Add("success", true);
+ }
+ catch (Exception Ex)
+ {
+ logger.Error(Ex, "Error encountered while handling import requests.");
+ hlog("Error encountered while handling import requests.");
+ HttpResponse.Add("success", false);
+ HttpResponse.Add("error", Ex.ToString());
+ }
+ res.WithCORS().AsText(JsonConvert.SerializeObject(HttpResponse));
+ }
+
+
private static void HandleQbPost(System.Net.HttpListenerRequest req, System.Net.HttpListenerResponse res)
{
logger.Trace("/qb/ - POST");
diff --git a/BodyshopUploader/Utils/OEConnection.cs b/BodyshopUploader/Utils/OEConnection.cs
new file mode 100644
index 0000000..40ff37c
--- /dev/null
+++ b/BodyshopUploader/Utils/OEConnection.cs
@@ -0,0 +1,196 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using DotNetDBF;
+using Newtonsoft.Json.Linq;
+
+namespace BodyshopPartner.Utils
+{
+ public static class OEConnection
+ {
+ private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
+ private static string workingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
+
+ private static string emsBasePath = workingDirectory + @"\EmsBase";
+ private static string TempEmsDir = @"C:\VPS\TEMPEMS";
+
+ private static Encoding DbfFileCharEncoding = Encoding.GetEncoding("UTF-8");
+ private static byte DbfFileSignature = DBFSignature.DBase3;
+ private static byte DbfFileLanguageDriver = 0x37;
+ public static void SendToOEConnection(dynamic PartsOrder)
+ {
+ GenerateAd1File(PartsOrder.job);
+ }
+
+ public static DBFField[] ReadDbfFields(string dbfFilePath)
+ {
+ using (var blankEmsFileStream = File.Open(dbfFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ {
+ using (var reader = new DBFReader(blankEmsFileStream))
+ {
+ return reader.Fields;
+ }
+ }
+ }
+
+ public static string GenerateFileName(dynamic Job)
+ {
+ if (string.IsNullOrEmpty(Job.clm_no?.Value)) { return Job.ro_number?.Value; }
+ return Job.clm_no;
+ }
+
+ public static void GenerateAd1File(dynamic Job)
+ {
+ try
+ {
+ DBFField[] Ad1Fields = ReadDbfFields(emsBasePath + @"\EMSA.AD1");
+
+ using (var fileStream = File.Create(TempEmsDir + $@"\{GenerateFileName(Job)}A.ad1"))
+ {
+ using (var writer = new DBFWriter())
+ {
+ writer.CharEncoding = DbfFileCharEncoding;
+ writer.Signature = DbfFileSignature;
+ writer.LanguageDriver = DbfFileLanguageDriver;
+
+ writer.Fields = Ad1Fields;
+
+ writer.AddRecord(
+ Job.ins_co_id?.Value,
+ Job.ins_co_nm?.Value,
+ Job.ins_addr1?.Value,
+ Job.ins_addr2?.Value,
+ Job.ins_city?.Value,
+ Job.ins_st?.Value,
+ Job.ins_zip?.Value,
+ Job.ins_ctry?.Value,
+ Job.ins_ph1?.Value,
+ Job.ins_ph1x?.Value,
+ Job.ins_ph2?.Value,
+ Job.ins_ph2x?.Value,
+ Job.ins_fax?.Value,
+ Job.ins_faxx?.Value,
+ Job.ins_ct_ln?.Value,
+ Job.ins_ct_fn?.Value,
+ Job.ins_title?.Value,
+ Job.ins_ct_ph?.Value,
+ Job.ins_ct_phx?.Value,
+ Job.ins_ea?.Value,
+ Job.ins_memo?.Value,
+ Job.policy_no?.Value,
+ Job.ded_amt?.Value,
+ Job.ded_status?.Value,
+ Job.asgn_no?.Value,
+ string.IsNullOrEmpty(Job.asgn_date?.Value) ? null : DateTime.Parse(Job.asgn_date?.Value),
+ Job.asgn_type?.Value,
+ Job.clm_no?.Value,
+ Job.clm_ofc_id?.Value,
+ Job.clm_ofc_nm?.Value,
+ Job.clm_addr1?.Value,
+ Job.clm_addr2?.Value,
+ Job.clm_city?.Value,
+ Job.clm_st?.Value,
+ Job.clm_zip?.Value,
+ Job.clm_ctry?.Value,
+ Job.clm_ph1?.Value,
+ Job.clm_ph1x?.Value,
+ Job.clm_ph2?.Value,
+ Job.clm_ph2x?.Value,
+ Job.clm_fax?.Value,
+ Job.clm_faxx?.Value,
+ Job.clm_ct_ln?.Value,
+ Job.clm_ct_fn?.Value,
+ Job.clm_title?.Value,
+ Job.clm_ct_ph?.Value,
+ Job.clm_ct_phx?.Value,
+ Job.clm_ea?.Value,
+ Job.payee_nms?.Value,
+ Job.pay_type?.Value,
+ Job.pay_date?.Value,
+ Job.pay_chknm?.Value,
+ Job.pay_amt?.Value,
+ Job.pay_memo?.Value,
+ Job.agt_co_id?.Value,
+ Job.agt_co_nm?.Value,
+ Job.agt_addr1?.Value,
+ Job.agt_addr2?.Value,
+ Job.agt_city?.Value,
+ Job.agt_st?.Value,
+ Job.agt_zip?.Value,
+ Job.agt_ctry?.Value,
+ Job.agt_ph1?.Value,
+ Job.agt_ph1x?.Value,
+ Job.agt_ph2?.Value,
+ Job.agt_ph2x?.Value,
+ Job.agt_fax?.Value,
+ Job.agt_faxx?.Value,
+ Job.agt_ct_ln?.Value,
+ Job.agt_ct_fn?.Value,
+ Job.agt_ct_ph?.Value,
+ Job.agt_ct_phx?.Value,
+ Job.agt_ea?.Value,
+ Job.agt_lic_no?.Value,
+ string.IsNullOrEmpty(Job.loss_date?.Value) ? null : DateTime.Parse(Job.loss_date?.Value),
+ Job.loss_cat?.Value,
+ Job.loss_type?.Value,
+ Job.loss_desc?.Value,
+ Job.theft_ind?.Value,
+ Job.cat_no?.Value,
+ Job.tlos_ind?.Value,
+ Job.loss_memo?.Value,
+ Job.cust_pr?.Value,
+ Job.insd_ln?.Value,
+ Job.insd_fn?.Value,
+ Job.insd_title?.Value,
+ Job.insd_co_nm?.Value,
+ Job.insd_addr1?.Value,
+ Job.insd_addr2?.Value,
+ Job.insd_city?.Value,
+ Job.insd_st?.Value,
+ Job.insd_zip?.Value,
+ Job.insd_ctry?.Value,
+ Job.insd_ph1?.Value,
+ Job.insd_ph1x?.Value,
+ Job.insd_ph2?.Value,
+ Job.insd_ph2x?.Value,
+ Job.insd_fax?.Value,
+ Job.insd_faxx?.Value,
+ Job.insd_ea?.Value,
+ Job.ownr_ln?.Value,
+ Job.ownr_fn?.Value,
+ Job.ownr_title?.Value,
+ Job.ownr_co_nm?.Value,
+ Job.ownr_addr1?.Value,
+ Job.ownr_addr2?.Value,
+ Job.ownr_city?.Value,
+ Job.ownr_st?.Value,
+ Job.ownr_zip?.Value,
+ Job.ownr_ctry?.Value,
+ Job.ownr_ph1?.Value,
+ Job.ownr_ph1x?.Value,
+ Job.ownr_ph2?.Value,
+ Job.ownr_ph2x?.Value,
+ Job.ownr_fax?.Value,
+ Job.ownr_faxx?.Value,
+ Job.ownr_ea.Value
+ ); ;
+
+ writer.Write(fileStream);
+
+ }
+ }
+
+ }
+ catch (Exception ex)
+ {
+ logger.Error(ex,"Error when creating AD1 file.");
+ }
+
+ }
+
+ }
+}
diff --git a/BodyshopUploader/ViewModels/MainViewModel.commands.cs b/BodyshopUploader/ViewModels/MainViewModel.commands.cs
index 48ce442..aef4ab6 100644
--- a/BodyshopUploader/ViewModels/MainViewModel.commands.cs
+++ b/BodyshopUploader/ViewModels/MainViewModel.commands.cs
@@ -17,6 +17,8 @@ namespace BodyshopPartner.ViewModels
p => true,
async p =>
{
+
+ // Utils.OEConnection.SendToOEConnection();
await TestGql();
});
}
diff --git a/BodyshopUploader/ViewModels/MainViewModel.cs b/BodyshopUploader/ViewModels/MainViewModel.cs
index b25f3b8..cd3fb0e 100644
--- a/BodyshopUploader/ViewModels/MainViewModel.cs
+++ b/BodyshopUploader/ViewModels/MainViewModel.cs
@@ -144,6 +144,10 @@ namespace BodyshopPartner.ViewModels
private async void _updateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
await updateCheck();
+ if (UpdateAvailable)
+ {
+ await InstallUpdates();
+ }
}
private void MonitoringPathsChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
diff --git a/BodyshopUploader/Views/Main.xaml b/BodyshopUploader/Views/Main.xaml
index 57e1a0e..fc3b8da 100644
--- a/BodyshopUploader/Views/Main.xaml
+++ b/BodyshopUploader/Views/Main.xaml
@@ -159,6 +159,9 @@
+