예제 #1
0
        static void InsertValues(FitnessAppFYPLAB.StrengthInsertRead StrengthFunctions, FitnessAppFYPLAB.CardioInsertRead CardioFunctions, FitnessAppFYPLAB.BalanceInsertRead BalanceFunctions, FitnessAppFYPLAB.CreateFunction SynthesizeTables, SQLiteConnection sqlite_conn_strength, SQLiteConnection sqlite_conn_cardio, SQLiteConnection sqlite_conn_balance, ref string ChooseTable, ref int Choice1, ref int Choice2, ref int Choice3, ref int Choice4)
        {
            if (Choice1 == 1)
            {
                SynthesizeTables.CreateTable(sqlite_conn_strength);



                StrengthFunctions.InsertDataStrength(sqlite_conn_strength, ref Choice2, ref Choice3, ref Choice4);
            }


            if (Choice1 == 2)
            {
                SynthesizeTables.CreateTable(sqlite_conn_cardio);



                CardioFunctions.InsertDataCardio(sqlite_conn_cardio, ref Choice2, ref Choice3, ref Choice4);
            }

            if (Choice1 == 3)
            {
                SynthesizeTables.CreateTable(sqlite_conn_balance);


                BalanceFunctions.InsertDataBalance(sqlite_conn_balance, ref Choice2);
            }
        }
예제 #2
0
        static void DeleteFunction(FitnessAppFYPLAB.StrengthInsertRead StrengthFunctions, FitnessAppFYPLAB.CardioInsertRead CardioFunctions, FitnessAppFYPLAB.BalanceInsertRead BalanceFunctions, FitnessAppFYPLAB.CreateFunction SynthesizeTables, SQLiteConnection sqlite_conn_strength, SQLiteConnection sqlite_conn_cardio, SQLiteConnection sqlite_conn_balance, ref string ChooseTable, ref int Choice1, ref int Choice2, ref int Choice3, ref int Choice4)
        {
            SQLiteConnection ConnType = null;

            if (Choice1 == 1)
            {
                ConnType = sqlite_conn_strength;

                SynthesizeTables.CreateTable(sqlite_conn_strength);


                StrengthFunctions.ReadDataStrength(sqlite_conn_strength, ref ChooseTable, ref Choice2, ref Choice3, ref Choice4);
            }


            if (Choice1 == 2)
            {
                ConnType = sqlite_conn_cardio;
                SynthesizeTables.CreateTable(sqlite_conn_cardio);

                CardioFunctions.ReadDataCardio(sqlite_conn_cardio, ref ChooseTable, ref Choice2, ref Choice3, ref Choice4);
            }

            if (Choice1 == 3)
            {
                ConnType = sqlite_conn_balance;

                SynthesizeTables.CreateTable(sqlite_conn_balance);
                BalanceFunctions.ReadDataBalance(sqlite_conn_balance, ref ChooseTable, ref Choice2, ref Choice3, ref Choice4);
            }


            Console.Write("Please enter the number in the Index column to delete the workout: ");


            int    ToDelete    = ReadInt32(Console.ReadLine());
            string DeleteQuery = "DELETE FROM " + ChooseTable + " WHERE PK = " + ToDelete;


            SQLiteCommand DelQuery;

            DelQuery             = ConnType.CreateCommand();
            DelQuery.CommandText = DeleteQuery;
            DelQuery.CommandType = System.Data.CommandType.Text;
            DelQuery.ExecuteNonQuery();
        }