Exemplo n.º 1
0
        /// <summary>
        /// Get quiz's questions.
        /// </summary>
        /// <returns>A List of DisplayQuestionModel.</returns>
        public async Task <List <DisplayQuestionModel> > GetQuestions()
        {
            QuestionData questionData = new QuestionData(_db);
            List <DisplayQuestionModel> questionModels     = new List <DisplayQuestionModel>();
            List <DataQuestionModel>    dataQuestionModels = await questionData.GetQuestions();

            foreach (var dataQuestionModel in dataQuestionModels)
            {
                DisplayQuestionModel newDisplayQuestionModel = new DisplayQuestionModel
                {
                    DomainId       = dataQuestionModel.DomainId,
                    Id             = dataQuestionModel.Id,
                    Question       = dataQuestionModel.Question,
                    QuestionTypeId = dataQuestionModel.QuestionTypeId,
                };

                if (!DisplayLinks.Any(x => x.QuestionId == dataQuestionModel.Id))
                {
                    // Les questions non ajoutées sont ajoutées dans la liste déroulante
                    questionModels.Add(newDisplayQuestionModel);
                }
                else
                {
                    // Les questions déjà liées sont affichées dans le tableau
                    DisplayQuestions.Add(newDisplayQuestionModel);
                }
            }

            return(questionModels);
        }
Exemplo n.º 2
0
        private void Consult_btn_Click(object sender, EventArgs e)
        {
            Select.Enabled = true;
            DisplayQuestions cleaner = new DisplayQuestions();

            cleaner.Clear_Info();
            textBox1.Text = "";
            listBox1.Items.Clear();
            listBox2.Items.Clear();
            listBox3.Items.Clear();
            id_facts.Clear();
            name_questions.Clear();
            id_value.Clear();


            textBox1.Text = "";
            listBox1.Items.Clear();
            listBox2.Items.Clear();

            id_facts.Clear();
            name_questions.Clear();
            id_value.Clear();

            Get_All_Questions();
            int numFact = id_facts[0];

            textBox1.Text = name_questions[0].ToString();
            AddValues(numFact);
        }
Exemplo n.º 3
0
        private void Get_All_Questions()
        {
            DisplayQuestions writer = new DisplayQuestions();
            SortedDictionary <int, string> displayer = writer.questions();

            foreach (var item in displayer)
            {
                id_facts.Add(item.Key);         //записывает ID факта
                name_questions.Add(item.Value); //записывает вопросы
            }
        }
Exemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            DisplayQuestions cleaner = new DisplayQuestions();

            cleaner.Clear_Info();
        }