Exemplo n.º 1
0
        private void Bind()
        {
            if (!Id.Equals(Guid.Empty))
            {
                Page.Title = "编辑题库";

                QuestionSubject bll   = new QuestionSubject();
                var             model = bll.GetModel(Id);
                if (model != null)
                {
                    txtName.Value    = model.QuestionContent;
                    qbId.Value       = model.QuestionBankId.ToString();
                    selectType.Value = model.QuestionType.ToString();
                    hId.Value        = Id.ToString();
                    if (model.IsDisable)
                    {
                        rdFalse.Checked = false;
                        rdTrue.Checked  = true;
                    }
                    else
                    {
                        rdFalse.Checked = true;
                        rdTrue.Checked  = false;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static Question GetQuestion(QuestionSubject subject, params NationalGoverningBody[] bodies)
        {
            List <Answer> answers = new List <Answer>()
            {
                new Answer("Question_Sample_Answer1", false), new Answer("Question_Sample_Answer2", true)
            };

            answers.Add(new Answer("Question_Sample_Answer3", false));
            answers.Add(new Answer("Question_Sample_Answer4", false));
            return(new Question("Factory Question", subject, "https://www.youtube.com/embed/BKSoi96X6fA?start=67&end=70", "Question_Sample_Text", answers, "Question_Sample_Explanation", bodies));
        }
Exemplo n.º 3
0
 private static void CreatePositions(QuestionSubject qSubject, int difficulty, int elementsCount)
 {
     if (qSubject == QuestionSubject.PT)
     {
         ptQuestions[difficulty] = new Question[elementsCount];
     }
     else
     {
         matQuestions[difficulty] = new Question[elementsCount];
     }
 }
Exemplo n.º 4
0
        public static void LoadQuestions()
        {
            XDocument xDoc = XDocument.Load("Content/questions.xml");

            foreach (XElement xmlSubjects in xDoc.Elements("subjects"))
            {
                foreach (XElement xmlSubject in xmlSubjects.Elements("subject"))
                {
                    QuestionSubject subject;
                    if (QuestionSubject.TryParse(xmlSubject.FirstAttribute.Value.ToString(), out subject))
                    {
                        foreach (XElement xmlDifficulty in xmlSubject.Elements("difficulty"))
                        {
                            int difficulty;
                            if (Int32.TryParse(xmlDifficulty.FirstAttribute.Value.ToString(), out difficulty))
                            {
                                CreatePositions(subject, difficulty, xmlDifficulty.Nodes().Count());
                                int indexCount = 0;
                                foreach (XElement xmlQuestion in xmlDifficulty.Elements("question"))
                                {
                                    List <string> answers = new List <string>();
                                    foreach (XElement xmlAnswer in xmlQuestion.Elements("answer"))
                                    {
                                        int        repeat    = 1;
                                        XAttribute xmlRepeat = xmlAnswer.Attribute("repeat");
                                        if (xmlRepeat != null)
                                        {
                                            Int32.TryParse(xmlRepeat.Value, out repeat);
                                        }

                                        string     modifier    = "";
                                        XAttribute xmlModifier = xmlAnswer.Attribute("modifier");
                                        if (xmlModifier != null)
                                        {
                                            modifier = "|modifier=" + xmlModifier.Value.Replace("larger", ">").Replace("smaller", "<") + "|";
                                        }

                                        for (int i = 0; i < repeat; i++)
                                        {
                                            answers.Add(modifier + xmlAnswer.Value);
                                        }
                                    }

                                    createQuestion(subject, xmlQuestion.Element("header").Value, (string[])answers.ToArray(), difficulty, indexCount);

                                    indexCount++;
                                }
                            }
                        }
                    }
                }
            }
        }
        private void Bind()
        {
            //查询条件
            GetSearchItem();

            int             totalRecords = 0;
            QuestionSubject bll          = new QuestionSubject();

            rpData.DataSource = bll.GetListOW(pageIndex, pageSize, out totalRecords, sqlWhere, parms == null ? null : parms.ToArray());
            rpData.DataBind();

            myDataAppend.Append("<div id=\"myDataForPage\" style=\"display:none;\">[{\"PageIndex\":\"" + pageIndex + "\",\"PageSize\":\"" + pageSize + "\",\"TotalRecord\":\"" + totalRecords + "\",\"QueryStr\":\"" + queryStr + "\"}]</div>");
        }
Exemplo n.º 6
0
        private static void createQuestion(QuestionSubject qSubject, string header, string[] answers, int difficulty, int indexCount)
        {
            Question q = new Question(qSubject, header, answers);

            if (qSubject == QuestionSubject.PT)
            {
                ptQuestions[difficulty][indexCount] = q;
            }
            else
            {
                matQuestions[difficulty][indexCount] = q;
            }
        }
Exemplo n.º 7
0
        public static QuestionGameObject CreateQuestion(RunnerLevel level, QuestionSubject subject, Renderer3D renderer, List <CollidableGameObject> collidableObjects, List <QuestionGameObject> existingQuestions)
        {
            Question q = null;

            switch (subject)
            {
            case (QuestionSubject.PT):
                q = GenerateQuestion((int)level, existingQuestions, QuestionsDatabase.PT_Questions);
                break;

            default:
                q = GenerateQuestion((int)level, existingQuestions, QuestionsDatabase.MAT_Questions);
                break;
            }
            return(new QuestionGameObject(renderer, collidableObjects, q));
        }
Exemplo n.º 8
0
 public Question(string publicId, QuestionSubject subject, string gifName, string questionText,
                 List <Answer> answers, string answerExplanation, params string[] bodies)
 {
     this.PublicId          = publicId;
     this.Subject           = subject;
     this.GifName           = String.IsNullOrEmpty(gifName) ? null : gifName;
     this.QuestionText      = questionText;
     this.Answers           = answers;
     this.AnswerExplanation = answerExplanation;
     if (bodies == null || bodies.Contains(Models.NationalGoverningBody.All.ToString()) || bodies.Count() == 0)
     {
         this.NationalGoverningBodies = "ALL";
     }
     else
     {
         this.NationalGoverningBodies = string.Join(";", bodies);
     }
 }
Exemplo n.º 9
0
 public Question(QuestionSubject subject, string header, string[] answers)
 {
     this.subject = subject;
     this.header  = header;
     this.answers = answers;
 }