This commit is contained in:
2021-08-20 17:11:53 +00:00
parent a164cd92de
commit 96a1c27c44

View File

@@ -235,8 +235,13 @@ namespace AyaNova.PlugIn.V8
private async System.Threading.Tasks.Task CreateSubstitute(Guid id, RootObjectTypes desiredType) private async System.Threading.Tasks.Task CreateSubstitute(Guid id, RootObjectTypes desiredType)
{ {
//create the simplest possible version of this object desired //create the simplest possible version of this object desired
dynamic d = new JObject();
string sName = MissingDataNamePrefix + " " + id.ToString();
d.name = sName;//usually this will suffice, for the rare cases it doesn't add to the correct property below, the name property will be ignored if it's not applicable
string route = "";
switch (desiredType) switch (desiredType)
{ {
//set route and make dynamic object
case RootObjectTypes.Part: case RootObjectTypes.Part:
{ {
@@ -249,12 +254,18 @@ namespace AyaNova.PlugIn.V8
break; break;
case RootObjectTypes.Client: case RootObjectTypes.Client:
{ {
route = "customer";
} }
break; break;
default: default:
throw new Exception("Error: CreateSubstitute (source id: " + id.ToString() + " for type: " + desiredType.ToString() + ") THIS TYPE NOT CODED YET"); throw new Exception("Error: CreateSubstitute (source id: " + id.ToString() + " for type: " + desiredType.ToString() + ") THIS TYPE NOT CODED YET");
} }
//post route and dynamic object, insert into map and return
var rMainObject = await util.PostAsync("customer", d.ToString(Formatting.None));//test formatting none, if works then propogate everywhere
long RavenId = util.IdFromResponse(rMainObject);
Addv7v8IdMap(id, RavenId);
} }