Esempio n. 1
0
        public static void UpdateTexEntry()
        {
            Functions.ConsoleWrite("Tippen Sie die Übungseinheit ein, bei der Sie die Aufgabe ändern wollen: ", ConsoleColor.DarkBlue);
            string getInput = Console.ReadLine();

            string[] allInput = getInput.Split(',');
            try
            {
                int[] splitInput = new int[allInput.Length];
                for (int m = 0; m < allInput.Length; m++)
                {
                    splitInput[m] = Int32.Parse(allInput[m]);
                }
            } catch (FormatException e)
            {
                Functions.ConsoleWrite("\n Diese Eingabe war leider ungueltig. \n", ConsoleColor.DarkRed);
                UpdateTexEntry();
            }
            Functions.AllUebungenFromNumner(allInput);
            Functions.ConsoleWrite("Welche Aufgabe moechten Sie ändern? Tippen Sie die ID ein: ", ConsoleColor.DarkBlue);
            string getUserInput   = Console.ReadLine();
            int    uebungseinheit = Int32.Parse(getUserInput);

            m_dbConnection.Open();
            string sql       = "select Uebungsaufgabe from MKB where ID=" + uebungseinheit + "";
            string entryPath = "uebungsaufgabe.tex";

            ExportData.CreatePath(sql, m_dbConnection, entryPath, 2);
            Console.WriteLine("Tippen Sie 'weiter' sobald Sie die Übungsaufgabe geändert haben.");
            getUserInput = Console.ReadLine();
            string line           = "";
            string uebungsaufgabe = "";

            System.IO.StreamReader file =
                new System.IO.StreamReader(@"..\..\..\..\" + entryPath);
            while ((line = file.ReadLine()) != null)
            {
                uebungsaufgabe += "\n" + line;
            }
            uebungsaufgabe = Functions.ReplaceStringToDB(uebungsaufgabe);
            sql            = "update MKB set Uebungsaufgabe='" + uebungsaufgabe + "' where ID='" + getUserInput + "'";
            SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);

            command.ExecuteNonQuery();
            m_dbConnection.Close();
        }