Exemple #1
0
        }//TestDBI_T_strength_Read_from_DB

        /// <summary>
        /// TestDBI_T_strength_T3 -  clear the SQLServer strength table, write some demo data to SQLServer DB,
        /// query the affirmatin table by Project ID,
        /// </summary>
        static void TestDBI_T_strength_T3()
        {
            Console.WriteLine("  --START: TestDBI_T_strength_T3");

            //Construct myTable in RAM
            SQLServerDB.strength_Table myTable = new SQLServerDB.strength_Table();

            //put demo records into myTable
            for (int i = 1; i < 10; i++)
            {
                SQLServerDB.strength sItem = new SQLServerDB.strength();
                sItem.ID               = i;
                sItem.notes            = "aff_Name_" + i.ToString();
                sItem.processArea      = "aff_Type_" + i.ToString();
                sItem.specificGoal     = "aff_specificGoal_" + i.ToString();
                sItem.specificPractice = "aff_specificPractice_" + i.ToString();
                sItem.genericGoal      = "aff_genericGoal_" + i.ToString();
                sItem.genericPractice  = "aff_genericPractice_" + i.ToString();
                sItem.projectId        = i;

                myTable.itemList.Add(sItem);
            }

            //Count SQLServerDB strength table rows before clearing
            int iRows = myTable.CountRows();

            Console.WriteLine("myTable.CountRows = " + iRows.ToString());

            Console.WriteLine("  --before clear SQLServer database table");
            Util.pause();

            myTable.Clear_Database_Table();
            int iRows2 = myTable.CountRows();

            Console.WriteLine("myTable.CountRows = " + iRows2.ToString());
            Util.pause();

            myTable.WriteItemListToDatabase();
            Console.WriteLine("after writing to SQLServerDB");
            Util.pause();

            int iRows3 = myTable.CountRows();

            Console.WriteLine("myTable.CountRows = " + iRows3.ToString());
            Util.pause();

            int iSeek_ProjectID = 3;

            Console.WriteLine("seek item:  iSeek_ProjectID= " + iSeek_ProjectID);
            myTable.ReadItemListFromDatabase_ByProjectID(iSeek_ProjectID);

            Console.WriteLine("SEEK items found: myTable.itemList.Count =" + myTable.itemList.Count.ToString());

            SQLServerDB.strength strengthItem = myTable.itemList[0];
            strengthItem.Show();

            Util.pause();

            Console.WriteLine("  --DONE: TestDBI_T_strength_T3");
        }