This commit is contained in:
2020-05-02 21:58:04 +00:00
parent b7c10f2d57
commit a8b11b7ff6
2 changed files with 127 additions and 90 deletions

View File

@@ -1087,7 +1087,7 @@ namespace AyaNova.PlugIn.V8
MultipartFormDataContent formDataContent = new MultipartFormDataContent();
//Form data like the bizobject type and id
formDataContent.Add(new StringContent(util.RootObjectToAyaType(tid.RootObjectType).ToString()), name: "AttachToObjectType");
formDataContent.Add(new StringContent(((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString()), name: "AttachToObjectType");
formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId");
formDataContent.Add(new StringContent(ImportTag), name: "Notes");
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
@@ -1169,7 +1169,7 @@ namespace AyaNova.PlugIn.V8
MultipartFormDataContent formDataContent = new MultipartFormDataContent();
//Form data like the bizobject type and id
formDataContent.Add(new StringContent(util.RootObjectToAyaType(tid.RootObjectType).ToString()), name: "AttachToObjectType");
formDataContent.Add(new StringContent(((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString()), name: "AttachToObjectType");
formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId");
formDataContent.Add(new StringContent(doc.Description + " (" + ImportTag + ")"), name: "Notes");
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");

View File

@@ -328,13 +328,50 @@ namespace AyaNova.PlugIn.V8
}
public static int RootObjectToAyaType(biz.RootObjectTypes rot)
public static AyaType RootObjectToAyaType(biz.RootObjectTypes rot, biz.WorkorderTypes specificWoType = biz.WorkorderTypes.Unknown)
{
switch (rot)
{
case biz.RootObjectTypes.User:
return (int)AyaType.User;
return AyaType.User;
case biz.RootObjectTypes.Client:
return AyaType.Customer;
case biz.RootObjectTypes.Contract:
return AyaType.Contract;
case biz.RootObjectTypes.HeadOffice:
return AyaType.HeadOffice;
case biz.RootObjectTypes.LoanItem:
return AyaType.LoanUnit;
case biz.RootObjectTypes.Part:
return AyaType.Part;
case biz.RootObjectTypes.WorkorderPreventiveMaintenance:
return AyaType.PM;
case biz.RootObjectTypes.WorkorderItem:
switch (specificWoType)
{
case biz.WorkorderTypes.PreventiveMaintenance:
return AyaType.PMItem;
case biz.WorkorderTypes.Quote:
return AyaType.QuoteItem;
case biz.WorkorderTypes.Service:
return AyaType.WorkOrderItem;
default:
throw new NotImplementedException("V8:util:RootObjectToAyaType -> type " + rot.ToString() + "," + specificWoType.ToString() + " is not coded yet");
}
case biz.RootObjectTypes.Project:
return AyaType.Project;
case biz.RootObjectTypes.PurchaseOrder:
return AyaType.PurchaseOrder;
case biz.RootObjectTypes.Unit:
return AyaType.Unit;
case biz.RootObjectTypes.UnitModel:
return AyaType.UnitModel;
case biz.RootObjectTypes.Vendor:
return AyaType.Vendor;
default:
throw new NotImplementedException("V8:util:RootObjectToAyaType -> type " + rot.ToString() + " is not coded yet");
}