diff --git a/BodyshopUploader/Utils/JobProcessingQueue.cs b/BodyshopUploader/Utils/JobProcessingQueue.cs index 1618782..bc2ff97 100644 --- a/BodyshopUploader/Utils/JobProcessingQueue.cs +++ b/BodyshopUploader/Utils/JobProcessingQueue.cs @@ -85,22 +85,9 @@ namespace BodyshopUploader.Utils private static async Task UpsertQueueItem(DTO_QueueItem item) { - //Old Direct Insert - //var r = new GraphQLRequest - //{ - // Query = @" - // mutation INSERT_JOB($jobInput: [jobs_insert_input!]!) { - // insert_jobs(objects: $jobInput) { - // returning { - // id - // } - // } - // }", - // Variables = new - // { - // jobInput = item.Job - // } - //}; + //TODO: This should perform some sort of upsert to update the vehicle with more up to date information. + + //Add to Holding Queue dynamic newJob = new JObject(); @@ -111,10 +98,8 @@ namespace BodyshopUploader.Utils newJob.ownr_name = item.Job.ownr_fn.Value + " " + item.Job.ownr_ln.Value; newJob.vehicle_info = item.Job.vehicle.data.v_model_yr.Value + " " + item.Job.vehicle.data.v_make_desc.Value + " " + item.Job.vehicle.data.v_model_desc.Value; newJob.clm_no = item.Job.clm_no.Value; - var vv = item.Job.vehicle.data.v_vin.Value; - //TODO: This should perform some sort of upsert to update the vehicle with more up to date information. - var vehuuid = await Utils.Queries.VehicleQueries.GetVehicleUuidByVin(vv) ; + var vehuuid = await Utils.Queries.VehicleQueries.GetVehicleUuidByVin(item?.Job?.vehicle?.data?.v_vin.Value ?? ""); if (!string.IsNullOrEmpty(vehuuid)) { newJob.est_data.vehicle = null; @@ -151,6 +136,7 @@ namespace BodyshopUploader.Utils }); }); } + catch (Exception Ex) { logger.Error("Job insert failed. Show notification"); diff --git a/BodyshopUploader/ViewModels/MainViewModel.cs b/BodyshopUploader/ViewModels/MainViewModel.cs index 1ccfb63..e014862 100644 --- a/BodyshopUploader/ViewModels/MainViewModel.cs +++ b/BodyshopUploader/ViewModels/MainViewModel.cs @@ -208,17 +208,17 @@ namespace BodyshopUploader.ViewModels }; Growler.AddNotification(_n); - var r = new GraphQLRequest - { - Query = @" - query QUERY_BODYSHOPS { - bodyshops { - shopname - id - } - }" - }; - await Utils.GraphQL.ExecuteQuery(r); + //var r = new GraphQLRequest + //{ + // Query = @" + // query QUERY_BODYSHOPS { + // bodyshops { + // shopname + // id + // } + // }" + //}; + //await Utils.GraphQL.ExecuteQuery(r); } } }