private void btnAdd_Click(object sender, EventArgs e)
        {
            frmFieldSetup setup = new frmFieldSetup()
            {
                theSystemDBTag = this.theSystemDBTag, UserCurrentInfo = this.UserCurrentInfo
            };

            setup.formAction1 = currentAction.caAdd;
            setup.TempId      = TempID;
            setup.ShowDialog();

            //tableGrid.Clear();

            MWDataManager.clsDataAccess _dbManGrid = new MWDataManager.clsDataAccess();
            _dbManGrid.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection);
            _dbManGrid.SqlStatement     = "select Distinct pf.FieldID [FieldID],pf.FieldName [Field Name],ppf.fieldDescription [Field Type],pf2.FieldName[Parent]  from PlanProt_Fields pf " +
                                          "left outer join " +
                                          "PlanProt_FieldTypes ppf " +
                                          "on pf.FieldType = ppf.fieldTypeID " +
                                          "left outer join " +
                                          "PlanProt_Fields pf2 " +
                                          "on pf.ParentID = pf2.FieldID " +
                                          " where pf.TemplateID = '" + TempID + "'";
            _dbManGrid.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
            _dbManGrid.queryReturnType    = MWDataManager.ReturnType.DataTable;
            _dbManGrid.ExecuteInstruction();

            gridOutput.DataSource = _dbManGrid.ResultsDataTable; // Populate Grid
        }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            FieldID = Convert.ToInt32(tableGrid.Rows[viewFields.FocusedRowHandle]["FieldID"].ToString());
            frmFieldSetup fieldSetup = new frmFieldSetup {
                theSystemDBTag = this.theSystemDBTag, UserCurrentInfo = this.UserCurrentInfo
            };

            fieldSetup.formAction1 = currentAction.caEdit;
            fieldSetup.TempId      = TempID;
            fieldSetup.FieldID     = FieldID;
            MWDataManager.clsDataAccess _dbManGrid = new MWDataManager.clsDataAccess();
            _dbManGrid.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection);
            _dbManGrid.SqlStatement     = "select Distinct pf.FieldID [FieldID],pf.FieldName [Field Name],ppf.fieldDescription [Field Type],pf2.FieldName[Parent]  from PlanProt_Fields pf " +
                                          "left outer join " +
                                          "PlanProt_FieldTypes ppf " +
                                          "on pf.FieldType = ppf.fieldTypeID " +
                                          "left outer join " +
                                          "PlanProt_Fields pf2 " +
                                          "on pf.ParentID = pf2.FieldID " +
                                          " where pf.TemplateID = '" + TempID + "'";
            _dbManGrid.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
            _dbManGrid.queryReturnType    = MWDataManager.ReturnType.DataTable;
            _dbManGrid.ExecuteInstruction();


            gridOutput.DataSource = _dbManGrid.ResultsDataTable;
            fieldSetup.ShowDialog();
        }