Beispiel #1
0
        /// <summary>
        /// this function gives to the program a list of fake topics in case the program cannot access to the external database
        /// </summary>
        private void addFakeTopics()
        {
            AppDatabase  myDataBase = new AppDatabase();
            List <Topic> topicList  = new List <Topic>();

            /// fake topic data
            Topic myTopic = new Topic();

            myTopic.Name     = "topic 1";
            myTopic.Info     = "topic test 1";
            myTopic.Order    = 1;
            myTopic.VideoUrl = "none";
            myTopic.Image    = "none";
            myTopic.Icon     = "none";
            topicList.Add(myTopic);
            myTopic          = new Topic();
            myTopic.Name     = "topic 2";
            myTopic.Info     = "topic test 2";
            myTopic.Order    = 2;
            myTopic.VideoUrl = "none";
            myTopic.Image    = "none";
            myTopic.Icon     = "none";
            topicList.Add(myTopic);
            myTopic          = new Topic();
            myTopic.Name     = "topic 3";
            myTopic.Info     = "topic test 3";
            myTopic.Order    = 3;
            myTopic.VideoUrl = "none";
            myTopic.Image    = "none";
            myTopic.Icon     = "none";
            topicList.Add(myTopic);
            // fake question data
            myDataBase.insertTopics(topicList.ToArray());
        }
Beispiel #2
0
        /// <summary>
        /// this function gives to the program a list of fake questions in case the program cannot access to the external database
        /// </summary>
        private void addFakeQuestions()
        {
            AppDatabase     myDataBase   = new AppDatabase();
            List <Question> questionList = new List <Question>();
            Question        myQuestion   = new Question();

            myQuestion.Name        = "question 1";
            myQuestion.Info        = "question 1 topic 1";
            myQuestion.Order       = 1;
            myQuestion.DragAndDrop = false;
            myQuestion.TopicId     = 1;
            questionList.Add(myQuestion);
            myQuestion             = new Question();
            myQuestion.Name        = "question 2";
            myQuestion.Info        = "question 2 topic 1";
            myQuestion.Order       = 2;
            myQuestion.DragAndDrop = true;
            myQuestion.TopicId     = 1;
            questionList.Add(myQuestion);
            myQuestion             = new Question();
            myQuestion.Name        = "question 3";
            myQuestion.Info        = "question 3 topic 1";
            myQuestion.Order       = 3;
            myQuestion.DragAndDrop = false;
            myQuestion.TopicId     = 1;
            questionList.Add(myQuestion);
            myQuestion             = new Question();
            myQuestion.Name        = "question 1";
            myQuestion.Info        = "question 1 topic 2";
            myQuestion.Order       = 1;
            myQuestion.DragAndDrop = true;
            myQuestion.TopicId     = 2;
            questionList.Add(myQuestion);
            myQuestion             = new Question();
            myQuestion.Name        = "question 2";
            myQuestion.Info        = "question 2 topic 2";
            myQuestion.Order       = 2;
            myQuestion.DragAndDrop = false;
            myQuestion.TopicId     = 2;
            questionList.Add(myQuestion);
            myQuestion             = new Question();
            myQuestion.Name        = "question 1";
            myQuestion.Info        = "question 1 topic 3";
            myQuestion.Order       = 1;
            myQuestion.DragAndDrop = false;
            myQuestion.TopicId     = 3;
            questionList.Add(myQuestion);
            myDataBase.insertQuestions(questionList.ToArray());
        }
Beispiel #3
0
        /// <summary>
        /// this function will check if there is internal data
        /// </summary>
        private void checkData()
        {
            try
            {
                AppDatabase myDataBase = new AppDatabase();

                Topic myTopic = myDataBase.GetTopic(1);

                if (myTopic == null)
                {
                    invokeData();
                }
                else
                {
                    isData = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error" + e.Message);
                isData = false;
                throw;
            }
        }