From a8b11b7ff667a962e899a289122b03fcf232bf47 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sat, 2 May 2020 21:58:04 +0000 Subject: [PATCH] --- source/Plugins/AyaNova.Plugin.V8/V8.cs | 4 +- source/Plugins/AyaNova.Plugin.V8/util.cs | 213 +++++++++++++---------- 2 files changed, 127 insertions(+), 90 deletions(-) diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index d67a127..3144318 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -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"); diff --git a/source/Plugins/AyaNova.Plugin.V8/util.cs b/source/Plugins/AyaNova.Plugin.V8/util.cs index 8a64a07..824c047 100644 --- a/source/Plugins/AyaNova.Plugin.V8/util.cs +++ b/source/Plugins/AyaNova.Plugin.V8/util.cs @@ -328,112 +328,149 @@ 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"); } } /// - /// All AyaNova types and their attributes indicating what features that type will support (tagging, attachments etc) - /// - public enum AyaType : int - { - //COREBIZOBJECT attribute must be set on objects that are: - //Attachable objects can have attachments, - //wikiable objects can have a wiki - //reviewable objects can have a review which is basically the same as a Reminder but with an object attached (was follow up schedmarker in v7) - //PIckList-able (has picklist template) - //Pretty much everything that represents some kind of real world object is wikiable or attachable as long as it has an ID and a type - //exceptions would be utility type objects like datalistview, formcustom etc that are not + /// All AyaNova types and their attributes indicating what features that type will support (tagging, attachments etc) + /// + public enum AyaType : int + { + //COREBIZOBJECT attribute must be set on objects that are: + //Attachable objects can have attachments, + //wikiable objects can have a wiki + //reviewable objects can have a review which is basically the same as a Reminder but with an object attached (was follow up schedmarker in v7) + //PIckList-able (has picklist template) + //Pretty much everything that represents some kind of real world object is wikiable or attachable as long as it has an ID and a type + //exceptions would be utility type objects like datalistview, formcustom etc that are not - //NOTE: NEW CORE OBJECTS - All areas of server AND CLIENT code that require adding any new core objects have been tagged with the following comment: - //CoreBizObject add here - //Search for that IN SERVER AND CLIENT CODE and you will see all areas that need coding for the new object + //NOTE: NEW CORE OBJECTS - All areas of server AND CLIENT code that require adding any new core objects have been tagged with the following comment: + //CoreBizObject add here + //Search for that IN SERVER AND CLIENT CODE and you will see all areas that need coding for the new object - //***IMPORTANT: Also need to add translations for any new biz objects added that don't match exactly the name here in the key - //because enumlist gets it that way, i.e. "Global" would be the expected key + //***IMPORTANT: Also need to add translations for any new biz objects added that don't match exactly the name here in the key + //because enumlist gets it that way, i.e. "Global" would be the expected key - NoType = 0, - Global = 1, - //Corebiz - Widget = 2,//attachable, wikiable, reviewable - //Corebiz - User = 3,//attachable, wikiable, reviewable - ServerState = 4, - License = 5, - LogFile = 6, - PickListTemplate = 7, - //Corebiz - Customer = 8, - ServerJob = 9, - //Corebiz - Contract = 10, - TrialSeeder = 11, - Metrics = 12, - Translation = 13, - UserOptions = 14, - //Corebiz - HeadOffice = 15, - //Corebiz - LoanUnit = 16, - FileAttachment = 17, - DataListView = 18, - FormCustom = 19, - //Corebiz - Part = 20, - //Corebiz - PM = 21, - //Corebiz - PMItem = 22, - //Corebiz - PMTemplate = 23, - //Corebiz - PMTemplateItem = 24, - //Corebiz - Project = 25, - //Corebiz - PurchaseOrder = 26, - //Corebiz - Quote = 27, - //Corebiz - QuoteItem = 28, - //Corebiz - QuoteTemplate = 29, - //Corebiz - QuoteTemplateItem = 30, - //Corebiz - Unit = 31, - //Corebiz - UnitModel = 32, - //Corebiz - Vendor = 33, - //Corebiz - WorkOrder = 34, - //Corebiz - WorkOrderItem = 35, - //Corebiz - WorkOrderTemplate = 36, - //Corebiz - WorkOrderTemplateItem = 37 + NoType = 0, + Global = 1, + //Corebiz + Widget = 2,//attachable, wikiable, reviewable + //Corebiz + User = 3,//attachable, wikiable, reviewable + ServerState = 4, + License = 5, + LogFile = 6, + PickListTemplate = 7, + //Corebiz + Customer = 8, + ServerJob = 9, + //Corebiz + Contract = 10, + TrialSeeder = 11, + Metrics = 12, + Translation = 13, + UserOptions = 14, + //Corebiz + HeadOffice = 15, + //Corebiz + LoanUnit = 16, + FileAttachment = 17, + DataListView = 18, + FormCustom = 19, + //Corebiz + Part = 20, + //Corebiz + PM = 21, + //Corebiz + PMItem = 22, + //Corebiz + PMTemplate = 23, + //Corebiz + PMTemplateItem = 24, + //Corebiz + Project = 25, + //Corebiz + PurchaseOrder = 26, + //Corebiz + Quote = 27, + //Corebiz + QuoteItem = 28, + //Corebiz + QuoteTemplate = 29, + //Corebiz + QuoteTemplateItem = 30, + //Corebiz + Unit = 31, + //Corebiz + UnitModel = 32, + //Corebiz + Vendor = 33, + //Corebiz + WorkOrder = 34, + //Corebiz + WorkOrderItem = 35, + //Corebiz + WorkOrderTemplate = 36, + //Corebiz + WorkOrderTemplateItem = 37 - //NOTE: New objects added here need to also be added to the following classes: - //AyaNova.Biz.BizObjectExistsInDatabase - //AyaNova.Biz.BizObjectFactory - //AyaNova.Biz.BizRoles - //AyaNova.Biz.BizObjectNameFetcherDIRECT - //and in the CLIENT in ayatype.js + //NOTE: New objects added here need to also be added to the following classes: + //AyaNova.Biz.BizObjectExistsInDatabase + //AyaNova.Biz.BizObjectFactory + //AyaNova.Biz.BizRoles + //AyaNova.Biz.BizObjectNameFetcherDIRECT + //and in the CLIENT in ayatype.js - //and need TRANSLATION KEYS because any type could show in the event log at teh client end + //and need TRANSLATION KEYS because any type could show in the event log at teh client end - } + }