private void loadCustomScript(TreeNode treeNode) { if ((treeNode.Level == 2 && treeNode.Text == "scriptFile") || (treeNode.Level == 3 && treeNode.Parent.Text == "scriptLibraries")) { string scriptFile1InternalId = "0"; string scriptFile2InternalId = "0"; commonClient commonClient = new commonClient(); TreeNode customScriptFile1Node = commonClient.getNodeFromPath(tvEnvironment1Scripts.Nodes[0], treeNode.FullPath); TreeNode customScriptFile2Node = commonClient.getNodeFromPath(tvEnvironment2Scripts.Nodes[0], treeNode.FullPath); if (compared) { scriptFile1InternalId = customScriptFile1Node.Nodes[0].Nodes[0].Text; scriptFile2InternalId = customScriptFile2Node.Nodes[0].Nodes[0].Text; } if (scriptFile1InternalId == "0" || scriptFile2InternalId == "0") { if (!compared) { MessageBox.Show(haveNotComparedText); } else { MessageBox.Show(missingScriptFileText); } return; } netsuiteClient netsuiteClient1 = new netsuiteClient(txtUrl1.Text, txtAccount1.Text, txtSuffix1.Text, txtEmail1.Text, txtSignature1.Text, txtRole1.Text); netsuiteClient netsuiteClient2 = new netsuiteClient(txtUrl2.Text, txtAccount2.Text, txtSuffix2.Text, txtEmail2.Text, txtSignature2.Text, txtRole2.Text); netsuiteFile netsuiteCustomScriptFile1 = netsuiteClient1.getCustomScriptFile(scriptFile1InternalId); netsuiteFile netsuiteCustomScriptFile2 = netsuiteClient2.getCustomScriptFile(scriptFile2InternalId); FileViewer scriptFileViewer = new FileViewer(); scriptFileViewer.netsuiteClient1 = netsuiteClient1; scriptFileViewer.netsuiteClient2 = netsuiteClient2; scriptFileViewer.netsuiteCustomScriptFile1 = netsuiteCustomScriptFile1; scriptFileViewer.netsuiteCustomScriptFile2 = netsuiteCustomScriptFile2; scriptFileViewer.Show(); } else if (treeNode.Level > 2 && treeNode.Text == "content") { loadCustomScript(treeNode.Parent); } }
private void pullNetsuiteEnvironmentData() { dataPulled = true; compared = false; netsuiteClient netsuiteClient1 = new netsuiteClient(txtUrl1.Text, txtAccount1.Text, txtSuffix1.Text, txtEmail1.Text, txtSignature1.Text, txtRole1.Text); netsuiteClient netsuiteClient2 = new netsuiteClient(txtUrl2.Text, txtAccount2.Text, txtSuffix2.Text, txtEmail2.Text, txtSignature2.Text, txtRole2.Text); netsuiteEntityRecords entityRecords1 = null; netsuiteEntityRecords entityRecords2 = null; netsuiteItemRecords itemRecords1 = null; netsuiteItemRecords itemRecords2 = null; netsuiteCustomRecords customRecords1 = null; netsuiteCustomRecords customRecords2 = null; netsuiteCustomScripts scripts1 = null; netsuiteCustomScripts scripts2 = null; List <Task> tasks = new List <Task>() { Task.Factory.StartNew(() => { if (chkRecords.Checked) { entityRecords1 = netsuiteClient1.getEntityRecords(); if (chkOnlyCustomFields.Checked) { foreach (var entityRecord in entityRecords1.entityRecords) { entityRecord.recordFields = entityRecord.recordFields.Where(x => x.StartsWith("custentity")).ToArray(); } } } }), Task.Factory.StartNew(() => { if (chkRecords.Checked) { entityRecords2 = netsuiteClient2.getEntityRecords(); if (chkOnlyCustomFields.Checked) { foreach (var entityRecord in entityRecords2.entityRecords) { entityRecord.recordFields = entityRecord.recordFields.Where(x => x.StartsWith("custentity")).ToArray(); } } } }), Task.Factory.StartNew(() => { if (chkRecords.Checked) { itemRecords1 = netsuiteClient1.getItemRecords(); if (chkOnlyCustomFields.Checked) { foreach (var itemRecord in itemRecords1.itemRecords) { itemRecord.recordFields = itemRecord.recordFields.Where(x => x.StartsWith("custitem")).ToArray(); } } } }), Task.Factory.StartNew(() => { if (chkRecords.Checked) { itemRecords2 = netsuiteClient2.getItemRecords(); if (chkOnlyCustomFields.Checked) { foreach (var itemRecord in itemRecords2.itemRecords) { itemRecord.recordFields = itemRecord.recordFields.Where(x => x.StartsWith("custitem")).ToArray(); } } } }), Task.Factory.StartNew(() => { if (chkRecords.Checked) { customRecords1 = netsuiteClient1.getCustomRecords(); if (chkOnlyCustomFields.Checked) { foreach (var customRecord in customRecords1.customRecords) { customRecord.recordFields = customRecord.recordFields.Where(x => x.StartsWith("custrecord")).ToArray(); } } } }), Task.Factory.StartNew(() => { if (chkRecords.Checked) { customRecords2 = netsuiteClient2.getCustomRecords(); if (chkOnlyCustomFields.Checked) { foreach (var customRecord in customRecords2.customRecords) { customRecord.recordFields = customRecord.recordFields.Where(x => x.StartsWith("custrecord")).ToArray(); } } } }), Task.Factory.StartNew(() => { if (chkScripts.Checked) { scripts1 = netsuiteClient1.getCustomScripts(settings.environment1IgnoreScripts.Select(x => x.internalId).ToList()); } }), Task.Factory.StartNew(() => { if (chkScripts.Checked) { scripts2 = netsuiteClient2.getCustomScripts(settings.environment2IgnoreScripts.Select(x => x.internalId).ToList()); } }) }; Task.WaitAll(tasks.ToArray()); if (chkRecords.Checked) { buildRecordTree(tvEnvironment1Records, entityRecords1.entityRecords, itemRecords1.itemRecords, customRecords1.customRecords); buildRecordTree(tvEnvironment2Records, entityRecords2.entityRecords, itemRecords2.itemRecords, customRecords2.customRecords); tvEnvironment1Records.AddLinkedTreeView(tvEnvironment2Records); } else { tvEnvironment1Records.Nodes.Clear(); tvEnvironment2Records.Nodes.Clear(); } if (chkScripts.Checked) { buildScriptTree(tvEnvironment1Scripts, scripts1.customScripts); buildScriptTree(tvEnvironment2Scripts, scripts2.customScripts); tvEnvironment1Scripts.AddLinkedTreeView(tvEnvironment2Scripts); } else { tvEnvironment1Scripts.Nodes.Clear(); tvEnvironment2Scripts.Nodes.Clear(); } }