private void bulkAddFromExecutionScriptsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <string>   errors = new List <string>();
            PasteScriptForm frmP   = new PasteScriptForm(true);

            if (DialogResult.OK == frmP.ShowDialog())
            {
                string[] scripts = frmP.BulkScripts;
                frmP.Dispose();

                for (int i = 0; i < scripts.Length; i++)
                {
                    if (!AddNewTestCaseFromScript(scripts[i]))
                    {
                        string err = (scripts[i].Length < 100) ? scripts[1] : scripts[i].Substring(0, 100) + "...";
                        errors.Add(err);
                    }
                }
                this.testConfig.SaveConfiguration(this.configFileName);
                this.BindTreeView();
                if (errors.Count > 0)
                {
                    StringBuilder sb = new StringBuilder("Unable to generate test cases for:\r\n");
                    for (int i = 0; i < errors.Count; i++)
                    {
                        sb.Append(errors[i] + "\r\n");
                    }

                    MessageBox.Show(sb.ToString(), "Unable to process some items...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
        private void addNewFromExecutionScriptToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PasteScriptForm frmScr = new PasteScriptForm();

            if (DialogResult.OK == frmScr.ShowDialog())
            {
                string script = frmScr.ScriptText;
                Dictionary <string, string> parameterList;
                string spName;
                TestManager.GetConfigurationFromScript(script, this.connData, out spName, out parameterList);
                TestCase tc = this.testConfig.AddNewTestCase(spName, parameterList);
                this.testConfig.SaveConfiguration(this.configFileName);
                if (tc != null)
                {
                    this.testConfig.SaveConfiguration(this.configFileName);
                    this.BindTreeView();


                    TreeNode newNode = FindTreeNode(spName, tc);
                    if (newNode != null)
                    {
                        newNode.EnsureVisible();
                        treeView1.SelectedNode = newNode;
                    }
                }
            }
        }
        private void lnkGetSqlScript_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            TestCase        updatedTC = RefreshTestCaseData();
            string          script    = TestManager.GenerateTestSql(this.sprocName, this.databaseName, updatedTC);
            PasteScriptForm frmScript = new PasteScriptForm();

            frmScript.ScriptText = script;
            frmScript.ShowDialog();
        }
 private void showExecutedSqlToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.listView1.SelectedItems.Count > 0)
     {
         PasteScriptForm frmPaste = new PasteScriptForm();
         frmPaste.ScriptText = this.listView1.SelectedItems[0].SubItems[4].Text;
         frmPaste.ShowDialog();
     }
 }
        private void lnkPasteParameters_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            PasteScriptForm frmScript = new PasteScriptForm();

            if (DialogResult.OK == frmScript.ShowDialog())
            {
                Dictionary <string, string> paramvalues = TestManager.ParseParameterValuesFromScript(this.sprocName, RetrieveParameterNames(), frmScript.ScriptText);
                foreach (Control ctrl in pnlParameters.Controls)
                {
                    if (ctrl is ParameterCtrl)
                    {
                        ParameterCtrl pC = (ParameterCtrl)ctrl;
                        if (paramvalues.ContainsKey(pC.Parameter.Name))
                        {
                            pC.Parameter.Value    = paramvalues[pC.Parameter.Name];
                            pC.ParameterTextValue = paramvalues[pC.Parameter.Name];
                        }
                    }
                }
            }
        }