Exemplo n.º 1
0
        private void addTabcontrol7(Trail trail)
        {
            Learning learning = new Learning();
            Judgment judgment = new Judgment();
            Match match = new Match();
            Choice choice = new Choice();
            Puzzle puzzle = new Puzzle();
            if (!this.tabcontrol7learnQuestionType.Text.Equals("不存在"))
            {
                learning.ExciseName = this.tabcontrol7LearnExciseName.Text;
                learning.QuestionType = this.tabcontrol7learnQuestionType.Text;
                learning.Question = new ImageItem();
                learning.Question.Image = this.tabcontrol7LearnImage.Text;
                learning.Speech = this.tabcontrol0learnSound.Text;
                learning.Question.SpeechText = this.tabcontr0LearnKeyText.Text;
                learning.Question.Text = this.tabcontr0LearnKeyText.Text;

                learning.PinYing = this.tabcontrol7LearnPy.Text;
                 trail.Questions.Add(learning);
                // MessageBox.Show(strSerializeJSON);

            }
            else if (!this.tabcontrol7JudgeQuestionType.Text.Equals("不存在"))
            {
                judgment.ExciseName = this.tabcontrol7JudgeExciseName.Text;
                judgment.Speech = this.tabcontrol7JudgeSound.Text;
                judgment.QuestionType = this.tabcontrol7JudgeQuestionType.Text;
                judgment.Question = new ImageItem();

                judgment.Question.Image = this.tabcontrol7JudgeRightImage.Text;

                judgment.Distractor = new ImageItem();
                judgment.Distractor.Image = this.tabcontrol7JudgeWrongImage.Text;

                 trail.Questions.Add(judgment);

                //  MessageBox.Show(judgeSerializeJSON);

            }
            else if (!this.tabcontrol7MatchQuestionType.Text.Equals("不存在"))
            {
                match.ExciseName = this.tabcontrol7MatchExciseName.Text;
                match.QuestionType = this.tabcontrol7MatchQuestionType.Text;
                match.Speech = this.tabcontrol7MatchSound.Text;
                match.Question = new ImageItem();
                match.Question.Image = this.tabcontrol7MatchQuestionImage.Text;
                match.Answer = new ImageItem();
                match.Answer.Image = this.tabcontrol7MatchAnswerImage.Text;
                match.Distractor = new ImageItem();
                match.Distractor.Image = this.tabcontrol7MatchDistraImage.Text;
                trail.Questions.Add(match);

                //   MessageBox.Show(matchSerializeJSON);

            }
            else if (!this.tabcontrol7ChoiceQuestionType.Text.Equals("不存在"))
            {
                choice.ExciseName = this.tabcontrol7ChoiceExciseName.Text;
                choice.QuestionType = this.tabcontrol7ChoiceQuestionType.Text;
                choice.Speech = this.tabcontrol7ChoiceSound.Text;
                choice.Answer = new ImageItem();
                choice.Answer.Image = this.tabcontrol7ChoiceRightImage.Text;
                choice.Answer.SpeechText = this.tabcontrol7ChoiceRightText.Text;
                choice.Distractor = new ImageItem();
                choice.Distractor.Image = this.tabcontrol7ChoiceDistraImage.Text;
                choice.Distractor.SpeechText = this.tabcontrol7ChoiceDistraText.Text;

               trail.Questions.Add(choice);

            }
            else if (!this.tabcontrol7PuzzleQuestionType.Text.Equals("不存在"))
            {
                puzzle.ExciseName = this.tabcontrol7PuzzleExciseName.Text;
                puzzle.Speech = this.tabcontrol7PuzzleSound.Text;
                puzzle.QuestionType = this.tabcontrol7PuzzleQuestionType.Text;
                puzzle.PuzzleImage = new ImageItem();
                puzzle.PuzzleImage.Image = this.tabcontrol7PuzzleRightImage.Text;
                puzzle.Distractor = new ImageItem();
                puzzle.Distractor.Image = this.tabcontrol7PuzzleDistraImage.Text;

                trail.Questions.Add(puzzle);

                // MessageBox.Show(puzzleSerializeJSON);

            }
        }
Exemplo n.º 2
0
        private void save()
        {
            Trail trail = new Trail();

            addTabcontrol0(trail);
            addTabcontrol1(trail);
            addTabcontrol2(trail);
            addTabcontrol3(trail);
            addTabcontrol4(trail);
            addTabcontrol5(trail);
            addTabcontrol6(trail);
            addTabcontrol7(trail);
            addTabcontrol8(trail);
            addTabcontrol9(trail);
            addTabcontrol10(trail);
            addTabcontrol11(trail);
            addTabcontrol12(trail);
            addTabcontrol13(trail);
            string lessonname = this.lessonName.Text;

            string trailChineseName = this.trailChineseName.Text;
            string trailSerializeJSON = JsonConvert.SerializeObject(trail);
            //Console.WriteLine(trailSerializeJSON);
            int count = dbhelper.GetLessonTrailCount(lessonname, trailChineseName);
            if (count > 0)
            {
                MessageBox.Show("已存在该课程的训练!");
                return;
            }
            else
            {
                string sql = "insert into lessontrail (lessonName, trialName,chineseName,jsondata) values ('" + lessonname + "','" + "" + "','" + trailChineseName + "'," + "'" + trailSerializeJSON + "'" + ")";
                dbhelper.RunSQL(sql);
            }
        }