private void lnkAddOutput_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Point start;

            if (pnlOutput.Controls.Count > 0)
            {
                start   = pnlOutput.Controls[pnlOutput.Controls.Count - 1].Location;
                start.Y = start.Y + pnlOutput.Controls[pnlOutput.Controls.Count - 1].Height;
            }
            else
            {
                start = new Point(3, 3);
            }

            OutputResultCtrl ctrl = new OutputResultCtrl();

            ctrl.Location            = start;
            ctrl.DataChanged        += new EventHandler(ChildData_DataChanged);
            ctrl.RemoveOutputResult += new EventHandler(SprocTestConfigCtrl_RemoveOutputResult);
            ctrl.Anchor              = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            ctrl.Width = pnlOutput.Width - 10;
            pnlOutput.Controls.Add(ctrl);
        }
        private void BindData()
        {
            this.grpTestCase.Text = "Test Case Definition for " + this.sprocName;
            pnlParameters.Controls.Clear();
            pnlOutput.Controls.Clear();

            List <ParameterCtrl> paramCtrls = new List <ParameterCtrl>();

            this.txtCaseName.Text             = this.tCase.Name;
            this.ddExecutionType.SelectedItem = this.tCase.ExecuteType;

            #region Add Parameter controls
            bool  foundMatch;
            Point paramStart = new Point(3, 3);

            if (derivedParameters != null && derivedParameters.Count > 0)
            {
                //Loop through derived parameters and match to test case.
                for (int i = 0; i < derivedParameters.Count; i++)
                {
                    foundMatch = false;
                    if (this.tCase.Parameter != null)
                    {
                        for (int j = 0; j < this.tCase.Parameter.Length; j++)
                        {
                            if (this.tCase.Parameter[j].Name.ToLower() == this.derivedParameters[i].ParameterName.ToLower())
                            {
                                this.tCase.Parameter[j].HasDerivedParameterMatch = true;
                                ParameterCtrl ctrl = new ParameterCtrl(ref this.tCase.Parameter[j]);
                                ctrl.ParameterStatus = ParameterStatus.Matching;
                                ctrl.DbType          = this.derivedParameters[i].SqlDbType;
                                ctrl.DbLength        = this.derivedParameters[i].Size;
                                paramCtrls.Add(ctrl);
                                foundMatch = true;
                                break;
                                // new Int32Converter().ConvertFrom(this.derivedParameters[i].Precision)
                            }
                        }
                    }

                    if (!foundMatch)
                    {
                        ParameterCtrl ctrl = new ParameterCtrl(this.derivedParameters[i].ParameterName);
                        ctrl.ParameterStatus = ParameterStatus.NotInTestCase;
                        ctrl.DbType          = this.derivedParameters[i].SqlDbType;
                        ctrl.DbLength        = this.derivedParameters[i].Size;
                        paramCtrls.Add(ctrl);
                    }
                }

                //Loop through the test case and add any "extra" parameters.
                if (this.tCase.Parameter != null)
                {
                    for (int i = 0; i < this.tCase.Parameter.Length; i++)
                    {
                        if (!this.tCase.Parameter[i].HasDerivedParameterMatch)
                        {
                            ParameterCtrl ctrl = new ParameterCtrl(ref this.tCase.Parameter[i]);
                            ctrl.ParameterStatus = ParameterStatus.NotInDatabase;
                            paramCtrls.Add(ctrl);
                        }
                    }
                }
            }
            else if (this.tCase.Parameter != null)
            {
                //If there are no derived parameters...
                for (int i = 0; i < this.tCase.Parameter.Length; i++)
                {
                    ParameterCtrl ctrl = new ParameterCtrl(ref this.tCase.Parameter[i]);
                    ctrl.ParameterStatus = ParameterStatus.NotInDatabase;
                    paramCtrls.Add(ctrl);
                }
            }


            for (int i = 0; i < paramCtrls.Count; i++)
            {
                paramCtrls[i].Location         = paramStart;
                paramStart.Y                  += paramCtrls[i].Height;
                paramCtrls[i].Width            = pnlParameters.Width - 10;
                paramCtrls[i].RemoveParameter += new EventHandler(SprocTestConfigCtrl_RemoveParameter);
                paramCtrls[i].DataChanged     += new EventHandler(ChildData_DataChanged);
                paramCtrls[i].Anchor           = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                pnlParameters.Controls.Add(paramCtrls[i]);
            }


            #endregion

            if (this.tCase.ExpectedResult != null)
            {
                if (this.tCase.ExpectedResult.RowCountSpecified)
                {
                    this.txtRowCount.Text = this.tCase.ExpectedResult.RowCount.ToString();
                }
                else
                {
                    this.txtRowCount.Text = "";
                }

                if (this.tCase.ExpectedResult.ColumnCountSpecified)
                {
                    this.txtColumnCount.Text = this.tCase.ExpectedResult.ColumnCount.ToString();
                }
                else
                {
                    this.txtColumnCount.Text = "";
                }

                if (this.tCase.ExpectedResult.RowCountOperatorSpecified)
                {
                    this.ddRowCountOperator.SelectedItem = this.tCase.ExpectedResult.RowCountOperator;
                }
                else
                {
                    this.ddRowCountOperator.SelectedItem = RowCountOperator.EqualTo;
                }

                this.ddResultType.SelectedItem = this.tCase.ExpectedResult.ResultType;

                #region Add Output Controls
                List <OutputResultCtrl> outputCtrls = new List <OutputResultCtrl>();
                Point outputStart = new Point(3, 3);
                if (this.tCase.ExpectedResult.OutputResult != null)
                {
                    for (int i = 0; i < this.tCase.ExpectedResult.OutputResult.Length; i++)
                    {
                        OutputResultCtrl ctrl = new OutputResultCtrl(ref this.tCase.ExpectedResult.OutputResult[i]);
                        outputCtrls.Add(ctrl);
                    }
                }
                for (int i = 0; i < outputCtrls.Count; i++)
                {
                    outputCtrls[i].Location            = outputStart;
                    outputStart.Y                     += outputCtrls[i].Height;
                    outputCtrls[i].DataChanged        += new EventHandler(ChildData_DataChanged);
                    outputCtrls[i].RemoveOutputResult += new EventHandler(SprocTestConfigCtrl_RemoveOutputResult);
                    outputCtrls[i].Anchor              = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                    outputCtrls[i].Width               = pnlOutput.Width - 10;
                    pnlOutput.Controls.Add(outputCtrls[i]);
                }
                #endregion
            }
            ddExecutionType_SelectionChangeCommitted(null, EventArgs.Empty);
            ddResultType_SelectionChangeCommitted(null, EventArgs.Empty);
            this.DataChanged = false;
        }