Added supplement checking.
This commit is contained in:
@@ -317,6 +317,7 @@
|
|||||||
<Compile Include="Utils\JsonConverter.cs" />
|
<Compile Include="Utils\JsonConverter.cs" />
|
||||||
<Compile Include="Utils\JsonExtensions.cs" />
|
<Compile Include="Utils\JsonExtensions.cs" />
|
||||||
<Compile Include="Utils\LoginHelpers.cs" />
|
<Compile Include="Utils\LoginHelpers.cs" />
|
||||||
|
<Compile Include="Utils\Queries\JobsQueries.cs" />
|
||||||
<Compile Include="Utils\Queries\VehicleQueries.cs" />
|
<Compile Include="Utils\Queries\VehicleQueries.cs" />
|
||||||
<Compile Include="Utils\RelayCommand.cs" />
|
<Compile Include="Utils\RelayCommand.cs" />
|
||||||
<Compile Include="Utils\TrayIcon.cs" />
|
<Compile Include="Utils\TrayIcon.cs" />
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace BodyshopUploader.Utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task GetOpCodes()
|
private static async Task GetOpCodes()
|
||||||
{
|
{
|
||||||
var r = new GraphQLRequest
|
var r = new GraphQLRequest
|
||||||
@@ -91,7 +91,7 @@ namespace BodyshopUploader.Utils
|
|||||||
}",
|
}",
|
||||||
Variables = new
|
Variables = new
|
||||||
{
|
{
|
||||||
key = AppMetaData.ShopRegion + "_ciecaopcodes"
|
key = AppMetaData.ShopRegion + "_ciecaopcodes"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var data = await Utils.GraphQL.ExecuteQuery(r);
|
var data = await Utils.GraphQL.ExecuteQuery(r);
|
||||||
@@ -122,6 +122,7 @@ namespace BodyshopUploader.Utils
|
|||||||
newJob.ownr_name = item.Job.ownr_fn?.Value + " " + item.Job.ownr_ln?.Value;
|
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.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;
|
newJob.clm_no = item.Job.clm_no?.Value;
|
||||||
|
newJob.clm_amt = item.Job.clm_total?.Value;
|
||||||
|
|
||||||
var vehuuid = await Utils.Queries.VehicleQueries.GetVehicleUuidByVin(item?.Job?.vehicle?.data?.v_vin.Value ?? "");
|
var vehuuid = await Utils.Queries.VehicleQueries.GetVehicleUuidByVin(item?.Job?.vehicle?.data?.v_vin.Value ?? "");
|
||||||
if (!string.IsNullOrEmpty(vehuuid))
|
if (!string.IsNullOrEmpty(vehuuid))
|
||||||
@@ -130,6 +131,12 @@ namespace BodyshopUploader.Utils
|
|||||||
newJob.est_data.vehicleid = vehuuid;
|
newJob.est_data.vehicleid = vehuuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (await Utils.Queries.JobsQueries.GetJobUuidByClmNo(item.Job.clm_no?.Value ?? ""))
|
||||||
|
{
|
||||||
|
newJob.issupplement = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
var r = new GraphQLRequest
|
var r = new GraphQLRequest
|
||||||
{
|
{
|
||||||
Query = @"
|
Query = @"
|
||||||
|
|||||||
50
BodyshopUploader/Utils/Queries/JobsQueries.cs
Normal file
50
BodyshopUploader/Utils/Queries/JobsQueries.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using GraphQL.Common.Request;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BodyshopUploader.Utils.Queries
|
||||||
|
{
|
||||||
|
class JobsQueries
|
||||||
|
{
|
||||||
|
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
public static async Task<bool> GetJobUuidByClmNo(string ClmNo)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(ClmNo))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var r = new GraphQLRequest
|
||||||
|
{
|
||||||
|
Query = @"query QUERY_JOB_BY_CLM_NO($clm_no: String!) {
|
||||||
|
jobs(where: {clm_no: {_eq: $clm_no}}) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}",
|
||||||
|
Variables = new
|
||||||
|
{
|
||||||
|
clm_no = ClmNo
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var d = await Utils.GraphQL.ExecuteQuery(r);
|
||||||
|
return d.jobs?.Count > 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (ArgumentOutOfRangeException Ex)
|
||||||
|
{
|
||||||
|
logger.Trace(Ex, "No jobs returned in GQL query.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (Exception Ex)
|
||||||
|
{
|
||||||
|
logger.Error(Ex, "Querying for jobs by clm_no failed.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Reference in New Issue
Block a user