Refactor GQL code. Auto load and save active shops. Auto start monitors.
This commit is contained in:
@@ -83,15 +83,12 @@ namespace BodyshopUploader.Utils
|
||||
}
|
||||
|
||||
private static async Task UpsertQueueItem(DTO_QueueItem item)
|
||||
{
|
||||
//Save the job to the DB.
|
||||
|
||||
|
||||
{
|
||||
item.Job.shopid = "52b7357c-0edd-4c95-85c3-dfdbcdfad9ac";
|
||||
item.Job.est_number = "123";
|
||||
item.Job.vehicle.data.shopid = "52b7357c-0edd-4c95-85c3-dfdbcdfad9ac";
|
||||
|
||||
logger.Info("Should upsert the job graphqlly here. {0}", item.Job);
|
||||
logger.Info("Manually setting the shop id! {0}", item.Job);
|
||||
|
||||
var r = new GraphQLRequest
|
||||
{
|
||||
@@ -104,20 +101,25 @@ namespace BodyshopUploader.Utils
|
||||
}
|
||||
}",
|
||||
Variables = new
|
||||
{
|
||||
|
||||
{
|
||||
jobInput = item.Job
|
||||
}
|
||||
};
|
||||
|
||||
using (var g = Utils.GraphQL.CreateGQLClient())
|
||||
var d = await Utils.GraphQL.ExecuteQuery(r);
|
||||
if(d!= null)
|
||||
{
|
||||
var graphQLResponse = await g.PostAsync(r);
|
||||
if(graphQLResponse.Errors == null)
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
logger.Trace("Job posted succesfully.");
|
||||
}
|
||||
Growler.AddNotification(new Notification()
|
||||
{
|
||||
Title = Properties.Resources.Msg_NewJobUploadError,
|
||||
Subtitle = item.Job?.owner?.first_name?.Value + " " + item.Job?.owner?.last_name?.Value,
|
||||
Message = item.Job?.vehicle?.v_model_yr?.Value + " " + item.Job?.vehicle?.v_make_desc?.Value + " " + item.Job?.vehicle?.v_model_desc?.Value
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_jobs.Dequeue();
|
||||
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
|
||||
Reference in New Issue
Block a user