public object[] db_access(string strSQL)
        {
            ADODB.Connection objCon;
            ADODB.Recordset objRec;
            object[,] dataRows;
            object[] dataSuite;
            string strCon;

            objCon = new ADODB.Connection();
            objRec = new ADODB.Recordset();

            //establish the connection string and open the database connection
            strCon = "driver={MySQL ODBC 5.1 Driver};server=107.22.232.228;uid=qa_people;pwd=thehandcontrols;" +
                "database=functional_test_data;option=3";

            objCon.Open(strCon);

            //execute the SQL and return the recrodset of results
            objRec = objCon.Execute(strSQL, out missing, 0);

            //populate a two dinmensional object array with the results
            dataRows = objRec.GetRows();

            //get a one dimensional array that can be placed into the Test Suite dropdown
            dataSuite = thinArray(dataRows);

            //close the recordset
            objRec.Close();

            //close the database connection
            objCon.Close();

            return dataSuite;
        }
Example #2
0
        public static string ReadExcel(string FilePath, int C, int R)
        {
            ADODB.Connection conn = new ADODB.Connection();
            ADODB.Recordset  rs   = new ADODB.Recordset();

            string Sql = "Select * From [Sheet1$]";

            //Select 宗地编码,土地类型,承包方名称,承包方编码 From [地块信息$] Order By 承包方编码,宗地编码
            conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=" + FilePath);
            rs.Open(Sql, conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly, -1);
            object ary = rs.GetRows();

            object[,] aa = (object[, ])ary;

            rs.Close();
            conn.Close();



            if ((string)aa[C - 1, R - 2] == null)
            {
                return("");
            }


            return((string)aa[C - 1, R - 2]);
        }
        public object[] db_access(string strSQL)
        {
            ADODB.Connection objCon;
            ADODB.Recordset  objRec;
            object[,] dataRows;
            object[] dataSuite;
            string   strCon;

            objCon = new ADODB.Connection();
            objRec = new ADODB.Recordset();

            //establish the connection string and open the database connection
            strCon = "driver={MySQL ODBC 5.1 Driver};server=107.22.232.228;uid=qa_people;pwd=thehandcontrols;" +
                     "database=functional_test_data;option=3";

            objCon.Open(strCon);

            //execute the SQL and return the recrodset of results
            objRec = objCon.Execute(strSQL, out missing, 0);

            //populate a two dinmensional object array with the results
            dataRows = objRec.GetRows();

            //get a one dimensional array that can be placed into the Test Suite dropdown
            dataSuite = thinArray(dataRows);

            //close the recordset
            objRec.Close();

            //close the database connection
            objCon.Close();

            return(dataSuite);
        }
Example #4
0
        public static DataTable LoadDBF(string FilePath, string Sql)
        {
            ADODB.Recordset  rs   = new ADODB.Recordset();
            ADODB.Connection conn = new ADODB.Connection();
            try
            {
                conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties='dbase 5.0';Data Source = " + System.IO.Path.GetDirectoryName(FilePath));


                rs.Open(Sql, conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly);
                object ary = rs.GetRows();
                object[,] aa = (object[, ])ary;

                int UB1 = aa.GetUpperBound(1);
                int UB0 = aa.GetUpperBound(0);


                DataTable dt = new DataTable();

                for (int i = 0; i <= UB0; i++)
                {
                    dt.Columns.Add(i.ToString());
                }



                for (int i = 0; i <= UB1; i++)
                {
                    DataRow dr = dt.NewRow();

                    for (int j = 0; j <= UB0; j++)
                    {
                        dr[j] = aa[j, i].ToString();
                    }

                    dt.Rows.Add(dr);
                }

                rs.Close();
                conn.Close();


                return(dt);
            }
            catch (Exception e)
            {
                rs.Close();
                conn.Close();
                return(null);
            }
        }
Example #5
0
        public static object[,] LoadExcelAry(string FilePath, string Sql)
        {
            ADODB.Connection conn = new ADODB.Connection();
            ADODB.Recordset  rs   = new ADODB.Recordset();

            try
            {
                //FilePath = "C:\\Users\\Administrator\\Desktop\\测试模版\\Shp\\1\\凤凰观村2组.xls";
                //Sql = "Select 宗地编码,土地类型,承包方名称,承包方编码 From [地块信息$] Order By 承包方编码,宗地编码";

                //Select 宗地编码,土地类型,承包方名称,承包方编码 From [地块信息$] Order By 承包方编码,宗地编码
                //Select * From [发包方信息$A1:BB2000]
                conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=" + FilePath);
                rs.Open(Sql, conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly, -1);
                object ary = rs.GetRows();
                object[,] aa = (object[, ])ary;

                rs.Close();
                conn.Close();



                int UB1 = aa.GetUpperBound(1);
                int UB0 = aa.GetUpperBound(0);

                for (int i = 0; i <= UB1; i++)
                {
                    for (int j = 0; j <= UB0; j++)
                    {
                        ErrorMsg = (i + "-" + j);
                        if (Convert.IsDBNull(aa[j, i]) || aa[j, i] == null)
                        {
                            aa[j, i] = "";
                        }
                    }
                }


                //object test0 = aa[1, 3];
                //object test1 = aa[15, 3];
                //object test2 = aa[17, 3];
                return(aa);
            }
            catch (Exception)
            {
                rs.Close();
                conn.Close();
                return(null);
            }
        }
Example #6
0
        private static int expectedStep(string inStep, string argID, ADODB.Connection objCon, ADODB.Recordset objRec)
        {
            object[,] tmpArray;
            int    retVal;
            string strSQL;

            retVal = 0;

            switch (inStep)
            {
            case "Login":
            case "navLinks":
            case "addOutcome":
                retVal = 2;
                break;

            case "clkButton":
            case "inputText":
                retVal = 4;
                break;

            case "chkCheckbox":
                retVal = 5;
                break;

            case "selDropdown":
                retVal = 6;
                break;

            case "tblSelect":
                retVal = 10;
                break;

            case "vfyTableEntry":
                strSQL = "SELECT COUNT(*) FROM argument WHERE argument_set_id = '" + argID + "'";

                objRec.Open(strSQL, objCon);
                tmpArray = objRec.GetRows();
                retVal   = Convert.ToInt32(tmpArray[0, 0]);
                objRec.Close();
                break;
            }
            return(retVal);
        }
Example #7
0
        //IMEX=1 把混合型数据作为文本读取


        //select DISTINCT 承包方编码 From [地块信息$] order by 承包方编码
        //Select 宗地编码,土地类型,承包方名称,承包方编码 From [地块信息$] Order By 承包方编码,宗地编码
        public static DataTable LoadExcel(string FilePath, string Sql)
        {
            ADODB.Connection conn = new ADODB.Connection();
            ADODB.Recordset  rs   = new ADODB.Recordset();

            try
            {
                //FilePath = "C:\\Users\\Administrator\\Desktop\\测试模版\\Shp\\1\\凤凰观村2组.xls";
                //Sql = "Select 宗地编码,土地类型,承包方名称,承包方编码 From [地块信息$] Order By 承包方编码,宗地编码";

                //Select 宗地编码,土地类型,承包方名称,承包方编码 From [地块信息$] Order By 承包方编码,宗地编码
                conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties='Excel 8.0;IMEX=1';Data Source=" + FilePath);
                rs.Open(Sql, conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly, -1);
                object ary = rs.GetRows();
                object[,] aa = (object[, ])ary;

                int UB1 = aa.GetUpperBound(1);
                int UB0 = aa.GetUpperBound(0);


                DataTable dt = new DataTable();



                //读取SQL判断表名
                //string Str1 = Sql.ToLower().Substring(Sql.IndexOf("select") + 6, Sql.IndexOf("from") - Sql.IndexOf("select") - 6);

                //Str1 = Str1.Trim();
                //string[] NameAry = Str1.Split(',');


                //foreach (var item in NameAry)
                //{
                //    dt.Columns.Add(item);
                //}

                for (int i = 0; i <= UB0; i++)
                {
                    dt.Columns.Add(i.ToString());
                }



                for (int i = 0; i <= UB1; i++)
                {
                    DataRow dr = dt.NewRow();

                    for (int j = 0; j <= UB0; j++)
                    {
                        if (Convert.IsDBNull(aa[j, i]))
                        {
                            dr[j] = "";
                        }
                        else
                        {
                            dr[j] = aa[j, i].ToString();
                        }
                    }

                    dt.Rows.Add(dr);
                }

                rs.Close();
                conn.Close();


                return(dt);
            }
            catch (Exception)
            {
                rs.Close();
                conn.Close();
                return(null);
            }
        }
Example #8
0
        //---------------------------------------------------------------------------------------
        //   1.ID           : Gf_Only_Display
        //   2.Input  Value : Conn Connection, Sc Collection, sQuery String,
        //                    {iDupCnt Long}, {nCheckControl Collection}, {mCheckControl Collection},
        //                    {MsgChk Boolean},  {EvenRowChk Boolean}
        //   3.Return Value : Boolean
        //   4.Create Date  :
        //   5.Modify Date  :
        //   6.Comment      : Only Display
        //---------------------------------------------------------------------------------------
        public bool Gf_Only_Display(ADODB.Connection Conn, Collection Sc, string sQuery, int iDupCnt, Collection nCheckControl, Collection mCheckControl, bool MsgChk, bool EvenRowChk)
        {
            bool returnValue = false;

            SpreadCommon SpreadCommon = new SpreadCommon();
            MasterCommon MasterCommon = new MasterCommon();

            int JJ;
            int j;

            int    lRowCount;
            int    lColCount;
            string sMsg;

            string[] sTemp;
            string   sSpreadClip;

            ADODB.Recordset AdoRs;
            object          ArrayRecords;

            //Db Connection Check
            if (Conn.State == 0)
            {
                if (GeneralCommon.GF_DbConnect() == false)
                {
                    returnValue = false;
                }
                return(returnValue);
            }

            try
            {
                if (nCheckControl != null)
                {
                    sMsg = MasterCommon.Gf_Ms_NeceCheck(nCheckControl);
                    if (sMsg != "OK")
                    {
                        sMsg = "必须输入 " + sMsg.Trim() + " ...!!!";
                        GeneralCommon.Gp_MsgBoxDisplay(sMsg, "", "");
                        returnValue = false;
                        return(returnValue);
                    }
                }

                if (mCheckControl != null)
                {
                    sMsg = MasterCommon.Gf_Ms_NeceCheck2(mCheckControl);
                    if (sMsg != "OK")
                    {
                        sMsg = "输入的项目必须符合 " + sMsg.Trim() + " 的长度...!!!";
                        GeneralCommon.Gp_MsgBoxDisplay(sMsg, "", "");
                        returnValue = false;
                        return(returnValue);
                    }
                }

                AdoRs = new ADODB.Recordset();

                FarPoint.Win.Spread.FpSpread with_1 = (FarPoint.Win.Spread.FpSpread)Sc["Spread"];



                returnValue = true;

                with_1.Sheets[0].RowCount = 0;


                //with_1.ReDraw = false;
                with_1.Sheets[0].RowCount = 0;

                Cursor.Current = Cursors.WaitCursor;

                //Ado Execute
                AdoRs.Open(sQuery, Conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly, -1);

                if (AdoRs.BOF || AdoRs.EOF)
                {
                    if (MsgChk)
                    {
                        GeneralCommon.Gp_MsgBoxDisplay("无法找到该资料...!!!", "I", "");
                    }

                    returnValue = false;
                    //with_1.ReDraw = true;

                    AdoRs.Close();
                    AdoRs          = null;
                    Cursor.Current = Cursors.Default;
                    return(returnValue);
                }

                ArrayRecords = AdoRs.GetRows();
                AdoRs.Close();
                AdoRs = null;

                if (iDupCnt > 0)
                {
                    sTemp = new string[iDupCnt + 1];
                }



                if ((AdoRs.RecordCount - 1) >= 0)
                {
                    with_1.Sheets[0].RowCount = AdoRs.RecordCount;
                    for (lRowCount = 0; lRowCount <= AdoRs.RecordCount - 1; lRowCount++)
                    {
                        sSpreadClip = "";

                        for (lColCount = iDupCnt; lColCount <= AdoRs.Fields.Count; lColCount++)
                        {
                            sSpreadClip = sSpreadClip + AdoRs.Fields[lColCount].Value.ToString() + '\t';
                        }

                        with_1.Sheets[0].SetClip(lRowCount, 0, lRowCount, lColCount, sSpreadClip);
                    }
                }

                if (EvenRowChk)
                {
                    SpreadCommon.Gp_Sp_EvenRowBackcolor((FarPoint.Win.Spread.FpSpread)Sc["Spread"], 0);
                }

                //.OperationMode = FPSpread.OperationModeConstants.OperationModeRow
                //with_1.ReDraw = true;


                returnValue    = true;
                Cursor.Current = Cursors.Default;
                return(returnValue);
            }
            catch (Exception ex)
            {
                AdoRs          = null;
                returnValue    = false;
                Cursor.Current = Cursors.Default;
                GeneralCommon.Gp_MsgBoxDisplay((string)("Gf_Only_Display Error : " + ex.Message), "", "");
            }

            return(returnValue);
        }
        public static void tstBrowser(string pth, string datSource, string steName, string tstName, int radnum, string baseURL, ref string[,] tstResult, out int fndExcep, out int fnlFail)
        {
            testname = tstName;
            int vfyFunc;
            int eleNum;
            int maxCols;
            int stpCount;
            int itmCount;
            int tstFail;
            char chr = Convert.ToChar(34);
            object[,] tmpArray;
            string[] outArray;
            string[] lstTest;
            string[] dbArray;
            string[,] dataArray;
            string[,] rsltArray;
            string argID;
            string functionID;
            string getNeg;
            string nmFunc;
            string step;
            string strCon;
            string strSQL;
            string tstID;
            string xlPath;
            ADODB.Connection objCon;
            ADODB.Recordset objRec;
            TestSuite lstObject;

            getNeg = "";
            tstFail = 0;
            fnlFail = 0;
            fndExcep = 0;
            DateTime tmp = DateTime.Now;                            //date-time at the time of test running
            vfyFunc = 0;
            rsltArray = new string[1, 6];

            //open browser based on selection on the GUI
            tstObject tstObj = new tstObject(radnum);

            //TextFileOps.Write(pth, "<li>", 100);

            switch (datSource)
            {
                case "DB":
                {
                    //db connection string
                    strCon = "driver={MySQL ODBC 5.1 Driver};server=107.22.232.228;uid=qa_people;pwd=thehandcontrols;" +
                                "database=functional_test_data;option=3";

                    //database connections objects
                    objCon = new ADODB.Connection();
                    objRec = new ADODB.Recordset();
                    //open the connection to the database
                    objCon.Open(strCon);

                    //SQL to execute
                    strSQL = "SELECT id FROM test WHERE name = '" + tstName + "'";

                    //open recordset and get test id with SQL
                    objRec.Open(strSQL, objCon);

                    //set test id to a string variable
                    tmpArray = objRec.GetRows();
                    tstID = Convert.ToString(tmpArray[0, 0]);

                    //close the recordset
                    objRec.Close();

                    //SQL to execute
                    strSQL = "SELECT COUNT(*) FROM step WHERE test_id = '" + tstID + "'";

                    //open recordset and get the number of stepsto execute with SQL
                    objRec.Open(strSQL, objCon);

                    //get the count value from the recordset and convert to an int fpor use in the step loop
                    tmpArray = objRec.GetRows();
                    stpCount = Convert.ToInt32(tmpArray[0, 0]);

                    //close the recordset
                    objRec.Close();

                    //set up a for loop to run all steps in a test
                    for (int stp = 0; stp < stpCount; stp++)
                    {
                        if (stp == 23)
                            stp = 23;
                        step = "Step " + Convert.ToString(stp + 1);
                        //SQL to execute
                        strSQL = "SELECT function_id, argument_set_id FROM step WHERE (test_id = '" + tstID + "') AND (number = " + (stp + 1) + ")";

                        //open recordset and get all the ids necessary for this step
                        objRec.Open(strSQL, objCon);
                        tmpArray = objRec.GetRows();

                        //set the function id
                        functionID = Convert.ToString(tmpArray[0, 0]);

                        //set the hash string for the argument set
                        argID = Convert.ToString(tmpArray[1, 0]);

                        //close the recordset
                        objRec.Close();

                        //get the function name
                        strSQL = "SELECT function_name FROM function WHERE id = '" + functionID + "'";
                        objRec.Open(strSQL, objCon);
                        tmpArray = objRec.GetRows();

                        //set the function name variable
                        nmFunc = Convert.ToString(tmpArray[0, 0]);

                        //close the recordset
                        objRec.Close();

                        // get the number of argments to be set to the application
                        strSQL = "SELECT COUNT(*) FROM argument WHERE argument_set_id = '" + argID + "'";
                        objRec.Open(strSQL, objCon);
                        tmpArray = objRec.GetRows();

                        //set the itmCount varable
                        itmCount = Convert.ToInt32(tmpArray[0, 0]);

                        //close the recordset
                        objRec.Close();

                        if (itmCount > 0)
                        {
                            //set the array size for the inArray parameter of the drive function
                            dbArray = new string[itmCount];

                            //set the array with blank values
                            for (int x = 0; x < itmCount; x++)
                                dbArray[x] = String.Empty;

                            //get the argument data from the database and populate into the dbArray
                            strSQL = "SELECT value FROM argument WHERE argument_set_id = '" + argID + "' ORDER BY seq ASC";
                            objRec.Open(strSQL, objCon);
                            tmpArray = objRec.GetRows();

                            //close the recordset
                            objRec.Close();

                            for (int stpData = 0; stpData < tmpArray.Length; stpData++)
                            {
                                if (stpData != tmpArray.Length)
                                    dbArray[stpData] = Convert.ToString(tmpArray[0, stpData]);
                            }
                        }
                        else
                        {
                            dbArray = new string[1];
                            dbArray[0] = "";
                        }

                        //call driveFunction to execute the step noted in dataArray[tstSuite. 0]
                        TextFileOps.Write(pth, "<li>", 100);

                        //initialize anm array to hold all of the test results that wiill be written to the results file
                        tstResult = new string[1, 9];

                        //pass the appropriate vars to the drivefunction
                        tstObj.driveFunction(tstObj, nmFunc, step, dbArray, baseURL, datSource, pth, ref getNeg, ref tstResult, out fndExcep, out tstFail);

                        for (int x = 0; x < tstResult.GetLength(0); x++)
                        {
                            TextFileOps.Write(pth, "<div>", 100);

                            if (fndExcep != -1)
                            {
                                if (tstResult[x, 0] == "verify")
                                {
                                    switch (tstResult[x, 1].Trim())
                                    {
                                        case "button":
                                            Recorder.btnVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], pth, getNeg);
                                            break;
                                        case "dropdown":
                                            Recorder.dropdownListVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 5], tstResult[x, 3], pth, getNeg);
                                            break;
                                        case "field":
                                            Recorder.fldVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                            break;
                                        case "grades":
                                            Recorder.gradeVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], tstResult[x, 6], tstResult[x, 7], tstResult[x, 8], pth);
                                            break;
                                        case "image":
                                            Recorder.imgVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                            break;
                                        case "link":
                                            Recorder.lnkVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                            break;
                                        case "table":
                                            Recorder.tblVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], pth, getNeg);
                                            break;
                                        case "text":
                                        case "field text":
                                            Recorder.txtVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                            break;
                                        case "outcome":
                                            Recorder.outcomeVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], tstResult[x, 6], tstResult[x, 7], tstResult[x, 8], pth);
                                            break;
                                        case "percentage":
                                            Recorder.pctVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], pth);
                                            break;

                                    }
                                }
                                else
                                {
                                    TextFileOps.Write(pth, tstResult[x, 1].ToString(), Convert.ToInt32(tstResult[x, 2]));
                                }

                            }
                            else
                            {
                                TextFileOps.Write(pth, "<div>", 100);
                                TextFileOps.Write(pth, "Exception Found.............(" + step + ")", 80);
                                TextFileOps.Write(pth, "<br />", 100);
                                TextFileOps.Write(pth, tstResult[x, 1].ToString(), -1);
                            }

                            TextFileOps.Write(pth, "</div>", 100);
                        }

                        tstResult = null;

                        TextFileOps.Write(pth, "<br />", 100);
                        TextFileOps.Write(pth, "</li>", 100);

                        if (tstFail == -1)
                            fnlFail = -1;

                        if (fndExcep == -1)
                        {
                            break;
                        }
                    }

                    break;
                }
                case "EX":
                {
                    //Initialize Firefox and construct the dataArray
                    //the out parameter is the maxColumns in what will be the fnlArray and hence the width of each item in the array
                    xlPath = TestSuite.getXlPath(steName);

                    lstObject = new TestSuite();
                    lstObject.getTestListing(out lstTest, xlPath);

                    dataArray = tstObj.xlFunctions(tstObj, xlPath, tstName, "Master", out maxCols);

                    //set eleNum (number of elements) to 0
                    for (int runStep = 0; runStep < dataArray.GetLength(0); runStep++)
                    {
                        eleNum = 0;
                        for (int stpNum = 3; stpNum < dataArray.GetLength(1); stpNum++)
                        {
                            //Get the number of elements in this step data from dataArray
                            if (dataArray[runStep, stpNum] != null)
                            {
                                eleNum++;                           //increment elenum in the presence of a value
                            }                                       //in dataArray[tstSuite, stpNum]
                            else
                            {
                                break;
                            }

                        }

                        //initialize and set outArray with all data values in the dataArray line item
                        if (eleNum != 0)
                        {
                            outArray = new string[eleNum];      //set outArray to eleNum

                            //set the outarray with all data values or passing to driveFunction
                            for (int setArray = 0; setArray < eleNum; setArray++)
                            {
                                outArray[setArray] = dataArray[runStep, setArray + 3];
                            }
                        }
                        else
                        {
                            outArray = new string[1];
                            outArray[0] = "";
                        }

                        nmFunc = dataArray[runStep, 0];
                        step = dataArray[runStep, 2];
                        dbArray = outArray;

                        //call driveFunction to execute the step noted in dataArray[tstSuite. 0]
                        TextFileOps.Write(pth, "<li>", 100);

                        //initialize anm array to hold all of the test results that wiill be written to the results file
                        tstResult = new string[1, 9];

                        //pass the appropriate vars to the drivefunction
                        tstObj.driveFunction(tstObj, nmFunc, step, dbArray, baseURL, datSource, pth, ref getNeg, ref tstResult, out fndExcep, out tstFail);

                        for (int x = 0; x < tstResult.GetLength(0); x++)
                        {
                            TextFileOps.Write(pth, "<div>", 100);

                            if (fndExcep != -1)
                            {
                                if (tstResult[x, 0] == "verify")
                                    switch (tstResult[x, 1].Trim())
                                    {
                                        case "button":
                                            Recorder.btnVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], pth, getNeg);
                                            break;
                                        case "dropdown":
                                            Recorder.dropdownListVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 5], tstResult[x, 3], pth, getNeg);
                                            break;
                                        case "field":
                                            Recorder.fldVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                            break;
                                        case "grades":
                                            Recorder.gradeVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], tstResult[x, 6], tstResult[x, 7], tstResult[x, 8], pth);
                                            break;
                                        case "image":
                                            Recorder.imgVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                            break;
                                        case "link":
                                            Recorder.lnkVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                            break;
                                        case "table":
                                            Recorder.tblVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], pth, getNeg);
                                            break;
                                        case "text":
                                        case "field text":
                                            Recorder.txtVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                            break;
                                        case "outcome":
                                            Recorder.outcomeVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], tstResult[x, 6], tstResult[x, 7], tstResult[x, 8], pth);
                                            break;
                                        case "percentage":
                                            Recorder.pctVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], pth);
                                            break;
                                        case "weight":
                                            Recorder.weightWrite(tstResult[x, 2], tstResult[x, 3], pth);
                                            break;

                                    }
                                else
                                {
                                    TextFileOps.Write(pth, tstResult[x, 1].ToString(), Convert.ToInt32(tstResult[x, 2]));
                                }

                            }
                            else
                            {
                                TextFileOps.Write(pth, "<div>", 100);
                                TextFileOps.Write(pth, "Exception Found.............(" + step + ")", 80);
                                TextFileOps.Write(pth, tstResult[x, 1].ToString(), -1);
                            }

                            TextFileOps.Write(pth, "</div>", 100);
                        }

                        vfyFunc = 0;
                        tstResult = null;

                        TextFileOps.Write(pth, "<br />", 100);

                        //call driveFunction to execute the step noted in dataArray[tstSuite. 0]
                        TextFileOps.Write(pth, "</li>", 100);

                        if (tstFail == -1)
                            fnlFail = -1;

                        if (fndExcep == -1)
                        {
                            break;
                        }

                    }

                    break;
                }
            }

            TextFileOps.Write(pth, "</ul>", 100);

            switch (radnum)
            {
                case 1:
                {
                    TextFileOps.Write(pth, "<li>", 80);
                    TextFileOps.Write(pth, "Closing Chrome..........\r\n", 80);
                    TextFileOps.Write(pth, "</li>", 80);
                    break;
                }
                case 2:
                    TextFileOps.Write(pth, "<li>", 80);
                    TextFileOps.Write(pth, "Closing Internet Explorer..........\r\n", 80);
                    TextFileOps.Write(pth, "</li>", 80);
                    break;
                {
                }
                default:
                    //close Firefox
                    TextFileOps.Write(pth, "<li>", 80);
                    TextFileOps.Write(pth, "Closing Firefox..........\r\n", 80);
                    TextFileOps.Write(pth, "</li>", 80);
                    break;
            }

            //exit chromedriver.exe if Chrome is the browser being used if niot here by an exception
            if (fndExcep != -1)
            {
                if (radnum == 1 || radnum == 2)
                    tstObj.Quit();
                else
                    tstObj.Close();
            }
            //put a couple newlines in the result file to seperate results
            for (int a = 0; a < 1; a++)
                TextFileOps.Write(pth, "\r\n", 0);
        }
        public static void tstBrowser(string pth, string datSource, string steName, string tstName, int radnum, string baseURL, ref string[,] tstResult, out int fndExcep, out int fnlFail)
        {
            testname = tstName;
            int  vfyFunc;
            int  eleNum;
            int  maxCols;
            int  stpCount;
            int  itmCount;
            int  tstFail;
            char chr = Convert.ToChar(34);

            object[,] tmpArray;
            string[] outArray;
            string[] lstTest;
            string[] dbArray;
            string[,] dataArray;
            string[,] rsltArray;
            string argID;
            string functionID;
            string getNeg;
            string nmFunc;
            string step;
            string strCon;
            string strSQL;
            string tstID;
            string xlPath;

            ADODB.Connection objCon;
            ADODB.Recordset  objRec;
            TestSuite        lstObject;

            getNeg   = "";
            tstFail  = 0;
            fnlFail  = 0;
            fndExcep = 0;
            DateTime tmp = DateTime.Now;                            //date-time at the time of test running

            vfyFunc   = 0;
            rsltArray = new string[1, 6];

            //open browser based on selection on the GUI
            tstObject tstObj = new tstObject(radnum);

            //TextFileOps.Write(pth, "<li>", 100);

            switch (datSource)
            {
            case "DB":
            {
                //db connection string
                strCon = "driver={MySQL ODBC 5.1 Driver};server=107.22.232.228;uid=qa_people;pwd=thehandcontrols;" +
                         "database=functional_test_data;option=3";

                //database connections objects
                objCon = new ADODB.Connection();
                objRec = new ADODB.Recordset();
                //open the connection to the database
                objCon.Open(strCon);

                //SQL to execute
                strSQL = "SELECT id FROM test WHERE name = '" + tstName + "'";

                //open recordset and get test id with SQL
                objRec.Open(strSQL, objCon);

                //set test id to a string variable
                tmpArray = objRec.GetRows();
                tstID    = Convert.ToString(tmpArray[0, 0]);

                //close the recordset
                objRec.Close();

                //SQL to execute
                strSQL = "SELECT COUNT(*) FROM step WHERE test_id = '" + tstID + "'";

                //open recordset and get the number of stepsto execute with SQL
                objRec.Open(strSQL, objCon);

                //get the count value from the recordset and convert to an int fpor use in the step loop
                tmpArray = objRec.GetRows();
                stpCount = Convert.ToInt32(tmpArray[0, 0]);

                //close the recordset
                objRec.Close();

                //set up a for loop to run all steps in a test
                for (int stp = 0; stp < stpCount; stp++)
                {
                    if (stp == 23)
                    {
                        stp = 23;
                    }
                    step = "Step " + Convert.ToString(stp + 1);
                    //SQL to execute
                    strSQL = "SELECT function_id, argument_set_id FROM step WHERE (test_id = '" + tstID + "') AND (number = " + (stp + 1) + ")";

                    //open recordset and get all the ids necessary for this step
                    objRec.Open(strSQL, objCon);
                    tmpArray = objRec.GetRows();

                    //set the function id
                    functionID = Convert.ToString(tmpArray[0, 0]);

                    //set the hash string for the argument set
                    argID = Convert.ToString(tmpArray[1, 0]);

                    //close the recordset
                    objRec.Close();

                    //get the function name
                    strSQL = "SELECT function_name FROM function WHERE id = '" + functionID + "'";
                    objRec.Open(strSQL, objCon);
                    tmpArray = objRec.GetRows();

                    //set the function name variable
                    nmFunc = Convert.ToString(tmpArray[0, 0]);

                    //close the recordset
                    objRec.Close();

                    // get the number of argments to be set to the application
                    strSQL = "SELECT COUNT(*) FROM argument WHERE argument_set_id = '" + argID + "'";
                    objRec.Open(strSQL, objCon);
                    tmpArray = objRec.GetRows();

                    //set the itmCount varable
                    itmCount = Convert.ToInt32(tmpArray[0, 0]);

                    //close the recordset
                    objRec.Close();

                    if (itmCount > 0)
                    {
                        //set the array size for the inArray parameter of the drive function
                        dbArray = new string[itmCount];

                        //set the array with blank values
                        for (int x = 0; x < itmCount; x++)
                        {
                            dbArray[x] = String.Empty;
                        }

                        //get the argument data from the database and populate into the dbArray
                        strSQL = "SELECT value FROM argument WHERE argument_set_id = '" + argID + "' ORDER BY seq ASC";
                        objRec.Open(strSQL, objCon);
                        tmpArray = objRec.GetRows();

                        //close the recordset
                        objRec.Close();

                        for (int stpData = 0; stpData < tmpArray.Length; stpData++)
                        {
                            if (stpData != tmpArray.Length)
                            {
                                dbArray[stpData] = Convert.ToString(tmpArray[0, stpData]);
                            }
                        }
                    }
                    else
                    {
                        dbArray    = new string[1];
                        dbArray[0] = "";
                    }

                    //call driveFunction to execute the step noted in dataArray[tstSuite. 0]
                    TextFileOps.Write(pth, "<li>", 100);

                    //initialize anm array to hold all of the test results that wiill be written to the results file
                    tstResult = new string[1, 9];

                    //pass the appropriate vars to the drivefunction
                    tstObj.driveFunction(tstObj, nmFunc, step, dbArray, baseURL, datSource, pth, ref getNeg, ref tstResult, out fndExcep, out tstFail);

                    for (int x = 0; x < tstResult.GetLength(0); x++)
                    {
                        TextFileOps.Write(pth, "<div>", 100);

                        if (fndExcep != -1)
                        {
                            if (tstResult[x, 0] == "verify")
                            {
                                switch (tstResult[x, 1].Trim())
                                {
                                case "button":
                                    Recorder.btnVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], pth, getNeg);
                                    break;

                                case "dropdown":
                                    Recorder.dropdownListVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 5], tstResult[x, 3], pth, getNeg);
                                    break;

                                case "field":
                                    Recorder.fldVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                    break;

                                case "grades":
                                    Recorder.gradeVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], tstResult[x, 6], tstResult[x, 7], tstResult[x, 8], pth);
                                    break;

                                case "image":
                                    Recorder.imgVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                    break;

                                case "link":
                                    Recorder.lnkVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                    break;

                                case "table":
                                    Recorder.tblVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], pth, getNeg);
                                    break;

                                case "text":
                                case "field text":
                                    Recorder.txtVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                    break;

                                case "outcome":
                                    Recorder.outcomeVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], tstResult[x, 6], tstResult[x, 7], tstResult[x, 8], pth);
                                    break;

                                case "percentage":
                                    Recorder.pctVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], pth);
                                    break;
                                }
                            }
                            else
                            {
                                TextFileOps.Write(pth, tstResult[x, 1].ToString(), Convert.ToInt32(tstResult[x, 2]));
                            }
                        }
                        else
                        {
                            TextFileOps.Write(pth, "<div>", 100);
                            TextFileOps.Write(pth, "Exception Found.............(" + step + ")", 80);
                            TextFileOps.Write(pth, "<br />", 100);
                            TextFileOps.Write(pth, tstResult[x, 1].ToString(), -1);
                        }


                        TextFileOps.Write(pth, "</div>", 100);
                    }

                    tstResult = null;

                    TextFileOps.Write(pth, "<br />", 100);
                    TextFileOps.Write(pth, "</li>", 100);

                    if (tstFail == -1)
                    {
                        fnlFail = -1;
                    }

                    if (fndExcep == -1)
                    {
                        break;
                    }
                }

                break;
            }

            case "EX":
            {
                //Initialize Firefox and construct the dataArray
                //the out parameter is the maxColumns in what will be the fnlArray and hence the width of each item in the array
                xlPath = TestSuite.getXlPath(steName);

                lstObject = new TestSuite();
                lstObject.getTestListing(out lstTest, xlPath);

                dataArray = tstObj.xlFunctions(tstObj, xlPath, tstName, "Master", out maxCols);

                //set eleNum (number of elements) to 0
                for (int runStep = 0; runStep < dataArray.GetLength(0); runStep++)
                {
                    eleNum = 0;
                    for (int stpNum = 3; stpNum < dataArray.GetLength(1); stpNum++)
                    {
                        //Get the number of elements in this step data from dataArray
                        if (dataArray[runStep, stpNum] != null)
                        {
                            eleNum++;                               //increment elenum in the presence of a value
                        }                                           //in dataArray[tstSuite, stpNum]
                        else
                        {
                            break;
                        }
                    }

                    //initialize and set outArray with all data values in the dataArray line item
                    if (eleNum != 0)
                    {
                        outArray = new string[eleNum];          //set outArray to eleNum

                        //set the outarray with all data values or passing to driveFunction
                        for (int setArray = 0; setArray < eleNum; setArray++)
                        {
                            outArray[setArray] = dataArray[runStep, setArray + 3];
                        }
                    }
                    else
                    {
                        outArray    = new string[1];
                        outArray[0] = "";
                    }

                    nmFunc  = dataArray[runStep, 0];
                    step    = dataArray[runStep, 2];
                    dbArray = outArray;

                    //call driveFunction to execute the step noted in dataArray[tstSuite. 0]
                    TextFileOps.Write(pth, "<li>", 100);

                    //initialize anm array to hold all of the test results that wiill be written to the results file
                    tstResult = new string[1, 9];

                    //pass the appropriate vars to the drivefunction
                    tstObj.driveFunction(tstObj, nmFunc, step, dbArray, baseURL, datSource, pth, ref getNeg, ref tstResult, out fndExcep, out tstFail);

                    for (int x = 0; x < tstResult.GetLength(0); x++)
                    {
                        TextFileOps.Write(pth, "<div>", 100);

                        if (fndExcep != -1)
                        {
                            if (tstResult[x, 0] == "verify")
                            {
                                switch (tstResult[x, 1].Trim())
                                {
                                case "button":
                                    Recorder.btnVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], pth, getNeg);
                                    break;

                                case "dropdown":
                                    Recorder.dropdownListVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 5], tstResult[x, 3], pth, getNeg);
                                    break;

                                case "field":
                                    Recorder.fldVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                    break;

                                case "grades":
                                    Recorder.gradeVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], tstResult[x, 6], tstResult[x, 7], tstResult[x, 8], pth);
                                    break;

                                case "image":
                                    Recorder.imgVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                    break;

                                case "link":
                                    Recorder.lnkVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                    break;

                                case "table":
                                    Recorder.tblVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], pth, getNeg);
                                    break;

                                case "text":
                                case "field text":
                                    Recorder.txtVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 5], pth, getNeg);
                                    break;

                                case "outcome":
                                    Recorder.outcomeVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], tstResult[x, 6], tstResult[x, 7], tstResult[x, 8], pth);
                                    break;

                                case "percentage":
                                    Recorder.pctVerify(Convert.ToBoolean(tstResult[x, 2]), tstResult[x, 3], tstResult[x, 4], tstResult[x, 5], pth);
                                    break;

                                case "weight":
                                    Recorder.weightWrite(tstResult[x, 2], tstResult[x, 3], pth);
                                    break;
                                }
                            }
                            else
                            {
                                TextFileOps.Write(pth, tstResult[x, 1].ToString(), Convert.ToInt32(tstResult[x, 2]));
                            }
                        }
                        else
                        {
                            TextFileOps.Write(pth, "<div>", 100);
                            TextFileOps.Write(pth, "Exception Found.............(" + step + ")", 80);
                            TextFileOps.Write(pth, tstResult[x, 1].ToString(), -1);
                        }

                        TextFileOps.Write(pth, "</div>", 100);
                    }

                    vfyFunc   = 0;
                    tstResult = null;

                    TextFileOps.Write(pth, "<br />", 100);

                    //call driveFunction to execute the step noted in dataArray[tstSuite. 0]
                    TextFileOps.Write(pth, "</li>", 100);

                    if (tstFail == -1)
                    {
                        fnlFail = -1;
                    }

                    if (fndExcep == -1)
                    {
                        break;
                    }
                }



                break;
            }
            }

            TextFileOps.Write(pth, "</ul>", 100);

            switch (radnum)
            {
            case 1:
            {
                TextFileOps.Write(pth, "<li>", 80);
                TextFileOps.Write(pth, "Closing Chrome..........\r\n", 80);
                TextFileOps.Write(pth, "</li>", 80);
                break;
            }

            case 2:
                TextFileOps.Write(pth, "<li>", 80);
                TextFileOps.Write(pth, "Closing Internet Explorer..........\r\n", 80);
                TextFileOps.Write(pth, "</li>", 80);
                break;
                {
                }

            default:
                //close Firefox
                TextFileOps.Write(pth, "<li>", 80);
                TextFileOps.Write(pth, "Closing Firefox..........\r\n", 80);
                TextFileOps.Write(pth, "</li>", 80);
                break;
            }

            //exit chromedriver.exe if Chrome is the browser being used if niot here by an exception
            if (fndExcep != -1)
            {
                if (radnum == 1 || radnum == 2)
                {
                    tstObj.Quit();
                }
                else
                {
                    tstObj.Close();
                }
            }
            //put a couple newlines in the result file to seperate results
            for (int a = 0; a < 1; a++)
            {
                TextFileOps.Write(pth, "\r\n", 0);
            }
        }