Added fetching for Shop Region + OPCODE decoding.
This commit is contained in:
@@ -3,6 +3,7 @@ using BodyshopUploader.Utils.Growls;
|
||||
using GraphQL.Client;
|
||||
using GraphQL.Common.Request;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -138,6 +139,7 @@ namespace BodyshopUploader.ViewModels
|
||||
bodyshops {
|
||||
shopname
|
||||
id
|
||||
region_config
|
||||
associations {
|
||||
id
|
||||
active
|
||||
@@ -194,31 +196,51 @@ namespace BodyshopUploader.ViewModels
|
||||
Properties.Settings.Default.LastSelectedShop = ActiveShop.Id;
|
||||
Properties.Settings.Default.Save();
|
||||
Utils.AppMetaData.ActiveShopId = ActiveShop.Id;
|
||||
Utils.AppMetaData.ShopRegion = ActiveShop.RegionConfig;
|
||||
IndeterminateLoading = false;
|
||||
}
|
||||
|
||||
public async Task TestGql()
|
||||
{
|
||||
Notification _n = new Notification()
|
||||
{
|
||||
Id = 123,
|
||||
Title = "This is a title",
|
||||
Subtitle = "Subtitle",
|
||||
Message = "Somethin"
|
||||
};
|
||||
Growler.AddNotification(_n);
|
||||
|
||||
//var r = new GraphQLRequest
|
||||
//Notification _n = new Notification()
|
||||
//{
|
||||
// Query = @"
|
||||
// query QUERY_BODYSHOPS {
|
||||
// bodyshops {
|
||||
// shopname
|
||||
// id
|
||||
// }
|
||||
// }"
|
||||
// Id = 123,
|
||||
// Title = "This is a title",
|
||||
// Subtitle = "Subtitle",
|
||||
// Message = "Somethin"
|
||||
//};
|
||||
//await Utils.GraphQL.ExecuteQuery(r);
|
||||
//Growler.AddNotification(_n);
|
||||
|
||||
var r = new GraphQLRequest
|
||||
{
|
||||
Query = @"query MyQuery($key: String!) {
|
||||
masterdata(where: {key: {_eq: $key}}) {
|
||||
value
|
||||
key
|
||||
}
|
||||
}",
|
||||
Variables = new
|
||||
{
|
||||
key = Utils.AppMetaData.ShopRegion + "_ciecaopcodes"
|
||||
}
|
||||
};
|
||||
var data = await Utils.GraphQL.ExecuteQuery(r);
|
||||
|
||||
//var t = Newtonsoft.Json.JsonConvert.DeserializeObject<List<dynamic>>(data.masterdata[0].value.Value);
|
||||
Utils.AppMetaData.CiecaOpCodes = JObject.Parse(data.masterdata[0].value.Value);
|
||||
|
||||
try
|
||||
{
|
||||
var aa = Utils.AppMetaData.CiecaOpCodes.Property("OP1").Children();
|
||||
var cc = Utils.AppMetaData.CiecaOpCodes["OP1"]["desc"].Value;
|
||||
var ab = Utils.AppMetaData.CiecaOpCodes.Property("OP1.desc");
|
||||
|
||||
}
|
||||
catch (Exception EX)
|
||||
{
|
||||
logger.Warn("Err");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user