DataSet GetTopTwoDepartments()
        {
            DataSet      ds = null;
            SQLDataLayer dl = null;

            try
            {
                dl = new SQLDataLayer(ResourceSettings.Instance.GetDBConnString());
                dl.BeginTransaction();
                ds = dl.ExecuteSQL("select top 2 Department_SID, Department from dbo.tb_Department;");
                dl.Commit();
                if (ds.Tables[0].Rows.Count <= 1)
                {
                    throw new Exception("not enough departments to test with");
                }
            }
            catch (Exception ex)
            {
                dl.Rollback();
                ErrorOnThread = true;
                TestContext.WriteLine(string.Format("Exception: ", ex.Message));
            }
            finally
            {
                dl.Dispose();
            }
            return(ds);
        }
        void UpdateDepartment(object p)
        {
            SQLDataLayer           dl  = null;
            UpdateDepartmentParams par = (UpdateDepartmentParams)p;

            try
            {
                dl = new SQLDataLayer(ResourceSettings.Instance.GetDBConnString());
                dl.BeginTransaction();
                DataSet ds = dl.ExecuteSP("dbo.sp_Department_Update",
                                          dl.CreateParam("piDepartmentSid", par.DepartmentSid),
                                          dl.CreateParam("piDepartment", par.DeptValue),
                                          dl.CreateParam("piIsIT", true),
                                          dl.CreateParam("piActive", true));
                dl.Commit();
                if ((int)ds.Tables[0].Rows[0]["RowsAffected"] > 0)
                {
                    TestContext.WriteLine(string.Format("INSERTED for {0}{1}", par.DeptValue, par.ThreadNum));
                }
                else
                {
                    TestContext.WriteLine(string.Format("Already exists for {0}{1}", par.DeptValue, par.ThreadNum));
                }
            }
            catch (Exception ex)
            {
                dl.Rollback();
                ErrorOnThread = true;
                TestContext.WriteLine(string.Format("Exception for {0}:{1}", par.ThreadNum, ex.Message));
            }
            finally
            {
                dl.Dispose();
            }
        }