private void buildRecordTree(MyTreeView treeView, netsuiteRecord[] entityRecords, netsuiteRecord[] itemRecords, netsuiteRecord[] customRecords) { commonClient commonClient = new commonClient(); treeView.Nodes.Clear(); TreeNode recordsNode = treeView.Nodes.Add("records"); TreeNode entityRecordsNode = commonClient.addNode(recordsNode, "entityRecords"); buildRecordTreeNodes(commonClient, treeView, entityRecordsNode, entityRecords); TreeNode itemRecordsNode = commonClient.addNode(recordsNode, "itemRecords"); buildRecordTreeNodes(commonClient, treeView, itemRecordsNode, itemRecords); TreeNode customRecordsNode = commonClient.addNode(recordsNode, "customRecords"); buildRecordTreeNodes(commonClient, treeView, customRecordsNode, customRecords); }
private void buildRecordTreeNodes(commonClient commonClient, MyTreeView treeView, TreeNode parentNode, netsuiteRecord[] records) { for (int i = 0; i < records.Length; i++) { netsuiteRecord record = records[i]; TreeNode recordNode = commonClient.addNode(parentNode, record.recordName); TreeNode recordInternalIdNode = commonClient.addNode(commonClient.addNode(recordNode, "internalId"), record.internalId); TreeNode recordRecordIdNode = commonClient.addNode(commonClient.addNode(recordNode, "recordId"), record.recordId); TreeNode recordRecordsFieldsNode = commonClient.addNode(recordNode, "recordFields"); string[] recordFields = records[i].recordFields; Array.Sort(recordFields); for (int j = 0; j < recordFields.Length; j++) { commonClient.addNode(recordRecordsFieldsNode, recordFields[j]); } } }
private void buildScriptTree(MyTreeView treeView, netsuiteCustomScript[] customScripts) { commonClient commonClient = new commonClient(); treeView.Nodes.Clear(); TreeNode customScriptsNode = treeView.Nodes.Add("customScripts"); for (int i = 0; i < customScripts.Length; i++) { netsuiteCustomScript customScript = customScripts[i]; TreeNode customScriptNode = commonClient.addNode(customScriptsNode, customScript.scriptName); commonClient.addNode(commonClient.addNode(customScriptNode, "internalId"), customScript.internalId); commonClient.addNode(commonClient.addNode(customScriptNode, "scriptId"), customScript.scriptId); commonClient.addNode(commonClient.addNode(customScriptNode, "scriptType"), customScript.scriptType); commonClient.addNode(commonClient.addNode(customScriptNode, "scriptAPIVersion"), customScript.scriptAPIVersion); TreeNode customScriptScriptFunctionsNode = commonClient.addNode(customScriptNode, "scriptFunctions"); netsuiteCustomScriptFunction[] customScriptFunctions = customScript.scriptFunctions.ToArray(); Array.Sort(customScriptFunctions, delegate(netsuiteCustomScriptFunction scriptFunction1, netsuiteCustomScriptFunction scriptFunction2) { return(scriptFunction1.functionType.CompareTo(scriptFunction2.functionType)); }); for (int j = 0; j < customScriptFunctions.Length; j++) { TreeNode customScriptScriptFunctionsFunctionTypeNode = commonClient.addNode(customScriptScriptFunctionsNode, customScriptFunctions[j].functionType); commonClient.addNode(customScriptScriptFunctionsFunctionTypeNode, customScriptFunctions[j].function); } TreeNode customScriptScriptFileNode = commonClient.addNode(customScriptNode, "scriptFile"); commonClient.addNode(commonClient.addNode(customScriptScriptFileNode, "internalId"), customScript.scriptFile.internalId); commonClient.addNode(commonClient.addNode(customScriptScriptFileNode, "name"), customScript.scriptFile.name); commonClient.addNode(commonClient.addNode(customScriptScriptFileNode, "folder"), customScript.scriptFile.folderId); commonClient.addNode(commonClient.addNode(customScriptScriptFileNode, "type"), customScript.scriptFile.fileType); commonClient.addNode(commonClient.addNode(customScriptScriptFileNode, "size"), customScript.scriptFile.size); commonClient.addNode(commonClient.addNode(customScriptScriptFileNode, "content"), customScript.scriptFile.content); TreeNode customScriptScriptLibrariesNode = commonClient.addNode(customScriptNode, "scriptLibraries"); netsuiteFile[] customScriptLibraries = customScript.scriptLibraries.ToArray(); Array.Sort(customScriptLibraries, delegate(netsuiteFile scriptLibrary1, netsuiteFile scriptLibrary2) { return(scriptLibrary1.name.CompareTo(scriptLibrary2.name)); }); for (int j = 0; j < customScriptLibraries.Length; j++) { TreeNode customScriptLibrariesScriptLibraryNode = commonClient.addNode(customScriptScriptLibrariesNode, customScriptLibraries[j].name); commonClient.addNode(commonClient.addNode(customScriptLibrariesScriptLibraryNode, "internalId"), customScriptLibraries[j].internalId); commonClient.addNode(commonClient.addNode(customScriptLibrariesScriptLibraryNode, "folder"), customScriptLibraries[j].folderId); commonClient.addNode(commonClient.addNode(customScriptLibrariesScriptLibraryNode, "type"), customScriptLibraries[j].fileType); commonClient.addNode(commonClient.addNode(customScriptLibrariesScriptLibraryNode, "size"), customScriptLibraries[j].size); commonClient.addNode(commonClient.addNode(customScriptLibrariesScriptLibraryNode, "content"), customScriptLibraries[j].content); } TreeNode customScriptScriptDeploymentsNode = commonClient.addNode(customScriptNode, "scriptDeployments"); netsuiteCustomScriptDeployment[] customScriptDeployments = customScript.scriptDeployments.ToArray(); Array.Sort(customScriptDeployments, delegate(netsuiteCustomScriptDeployment scriptDeployment1, netsuiteCustomScriptDeployment scriptDeployment2) { return(scriptDeployment1.scriptDeploymentId.CompareTo(scriptDeployment2.scriptDeploymentId)); }); for (int j = 0; j < customScriptDeployments.Length; j++) { TreeNode customScriptScriptDeploymentsScriptDeploymentNode = commonClient.addNode(customScriptScriptDeploymentsNode, customScriptDeployments[j].scriptDeploymentId); commonClient.addNode(commonClient.addNode(customScriptScriptDeploymentsScriptDeploymentNode, "internalId"), customScriptDeployments[j].internalId); commonClient.addNode(commonClient.addNode(customScriptScriptDeploymentsScriptDeploymentNode, "isDeployed"), customScriptDeployments[j].isDeployed); commonClient.addNode(commonClient.addNode(customScriptScriptDeploymentsScriptDeploymentNode, "recordType"), customScriptDeployments[j].recordType); commonClient.addNode(commonClient.addNode(customScriptScriptDeploymentsScriptDeploymentNode, "status"), customScriptDeployments[j].status); } } }