diff --git a/BodyshopUploader/Utils/Decoder/EstimateDecoder.cs b/BodyshopUploader/Utils/Decoder/EstimateDecoder.cs index 3860fea..a4b1be1 100644 --- a/BodyshopUploader/Utils/Decoder/EstimateDecoder.cs +++ b/BodyshopUploader/Utils/Decoder/EstimateDecoder.cs @@ -101,6 +101,8 @@ namespace BodyshopPartner.Utils.Decoder { var reader = new DBFReader(fis); + var type = reader.GetType(); + 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/GraphQL.cs b/BodyshopUploader/Utils/GraphQL.cs index 674ccbe..573a960 100644 --- a/BodyshopUploader/Utils/GraphQL.cs +++ b/BodyshopUploader/Utils/GraphQL.cs @@ -27,7 +27,7 @@ namespace BodyshopPartner.Utils using (var g = Utils.GraphQL.CreateGQLClient()) { logger.Trace("Firing a GQL Query!"); - // logger.Trace("Firing GQL Query: {0} {1}", r.Query.ToString(), r.Variables); + logger.Trace("Firing GQL Query: {0} {1}", r.Query.ToString(), r.Variables); var graphQLResponse = await g.SendQueryAsync(r); if (graphQLResponse.Errors == null) { diff --git a/BodyshopUploader/Utils/HTTPServer.cs b/BodyshopUploader/Utils/HTTPServer.cs index 1579b9c..9529bb4 100644 --- a/BodyshopUploader/Utils/HTTPServer.cs +++ b/BodyshopUploader/Utils/HTTPServer.cs @@ -11,6 +11,7 @@ using Newtonsoft.Json.Linq; using BodyshopPartner.Models; using ToastNotifications.Messages; using System.Threading; +using System.Reflection; namespace BodyshopPartner.Utils { @@ -36,6 +37,19 @@ namespace BodyshopPartner.Utils (req, res, props) => { HandleQbPost(req, res); } , "POST"); + Route.Add("/ping/", (req, res, props) => + { + hlog("Received a ping from ImEX.online"); + res.WithCORS(); + //res.AddHeader("Access-Control-Allow-Origin", "http://localhost:3000 https://localhost:3000 http://localhost:5000 https://localhost:5000 https://*.imex.online,imex.online"); + res.Close(); + }, "OPTIONS"); + + Route.Add("/ping/", + (req, res, props) => { HandlePing(req, res); } + , "POST"); + + logger.Trace("Starting HTTP server..."); hlog = HttpLogger; @@ -125,6 +139,22 @@ namespace BodyshopPartner.Utils } + private static void HandlePing(System.Net.HttpListenerRequest req, System.Net.HttpListenerResponse res) + { + logger.Trace("/ping/ - POST"); + hlog("Received QuickBooks Receivable request."); + //Input will be an array of objects containing XMLs. + + dynamic response = new JObject(); + response.appver = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + response.qbpath = Properties.Settings.Default.QuickBooksFilePath; + + var t = JsonConvert.SerializeObject(response); + + res.WithCORS().AsText((string)t.ToString()); + + } + public static List ParseRequest(System.Net.HttpListenerRequest req) { System.IO.Stream body = req.InputStream; diff --git a/BodyshopUploader/ViewModels/MainViewModel.cs b/BodyshopUploader/ViewModels/MainViewModel.cs index bcd6371..bb6bc63 100644 --- a/BodyshopUploader/ViewModels/MainViewModel.cs +++ b/BodyshopUploader/ViewModels/MainViewModel.cs @@ -222,11 +222,13 @@ namespace BodyshopPartner.ViewModels { ShopData = Data.bodyshops.ToObject>(); } - - ActiveShop = ShopData.Where(_ => _.AssociationActive == true).FirstOrDefault(); - Properties.Settings.Default.LastSelectedShop = ActiveShop.Id ?? null; - Properties.Settings.Default.Save(); - + + ActiveShop = ShopData.Where(_ => _.AssociationActive == true).FirstOrDefault(); + Utils.AppMetaData.ActiveShopId = ActiveShop?.Id; + Utils.AppMetaData.ShopRegion = ActiveShop?.RegionConfig; + Properties.Settings.Default.LastSelectedShop = ActiveShop.Id ?? null; + Properties.Settings.Default.Save(); + } public async Task SetActiveBodyshop()