예제 #1
0
		public MultipleChoice(Question question, SetEditor editor)
		{
			InitializeComponent();
			if(question != null)
			{
				button1.Text = "Apply";
				numericUpDown1.Value = question.choices.Count();
				textBox1.Text = question.question;

				textBox2.Text = question.choices[0];
				textBox3.Text = question.choices[1];
				if (numericUpDown1.Value > 2)
					textBox4.Text = question.choices[2];				
				if (numericUpDown1.Value > 3)
					textBox5.Text = question.choices[3];

				for (int i = 0; i < numericUpDown1.Value; i++ )
				{
					if (question.choices[i].ToLower().Equals(question.answer.ToLower()))
					{
						if (i == 0) radioButton1.Checked = true;
						else if (i == 1) radioButton2.Checked = true;
						else if (i == 2) radioButton3.Checked = true;
						else if (i == 3) radioButton4.Checked = true;
						break;
					}
			
				}

				this.question = question;
			}
			this.set = editor.set;
			this.editor = editor;
		}
예제 #2
0
        public ItemQuestionSet(Item item, QuestionSet questionSet, int order)
        {
            Item = item;
            QuestionSet = questionSet;
            Order = order;

            SetDefaults();
        }
        // creates a question object then adds it to a questionset and returns the object
        public static Question MakeQuestion(string text, QuestionSet qs)
        {
            Question q = new Question {
                Text = text
            };

            q.Answers = new List <Answer>();
            qs.Questions.Add(q);
            return(q);
        }
예제 #4
0
 public void SetTextBox(QuestionSet quest)
 {
     if (quest != null)
     {
         textBox1.Text = quest.AnswerSet.ToList()[0].AnswerVarible;
         textBox2.Text = quest.AnswerSet.ToList()[1].AnswerVarible;
         textBox3.Text = quest.AnswerSet.ToList()[2].AnswerVarible;
         textBox4.Text = quest.AnswerSet.ToList()[3].AnswerVarible;
     }
 }
예제 #5
0
    public override void OnInspectorGUI()
    {
//        DrawDefaultInspector();

        _questionSet = target as QuestionSet;

        DrawQuestions();

        EditorUtility.SetDirty(_questionSet);
    }
    private IEnumerator Start()
    {
        set         = new QuestionSet();
        set.results = new List <Question>();
        yield return(GetAccessToken());

        yield return(GetTotalQuestions());

        yield return(GetText(timesToRun, finalRunAmount));
    }
예제 #7
0
        public IHttpActionResult PutquestionSet(QuestionSet questionSet)
        {
            foreach (var service in _questionServices)
            {
                service.ScoreQuestions(questionSet.Questions);
            }

            _cacheService.AddUpdateQuestionSetInCache(questionSet);
            return(Ok(questionSet));
        }
예제 #8
0
        /// <summary>
        /// Create a new quantity answer.
        /// </summary>
        /// <param name="transaction"></param>
        /// <param name="questionSet"></param>
        /// <param name="question"></param>
        /// <param name="answer"></param>
        /// <param name="quantityId">Leave null if creating a new quantity sequence</param>
        public QuantityAnswer(Transaction transaction, QuestionSet questionSet, Question question, string answer, Guid? quantityId)
        {
            Transaction = transaction;
            QuestionSet = questionSet;
            Question = question;
            Answer = answer;

            QuantityId = quantityId ?? Guid.NewGuid();
            QuantityIdNotEmpty = false;
        }
예제 #9
0
        private async Task CreateUpdateLatestQuestionSet(QuestionSet questionSet)
        {
            if (questionSet?.IsCurrent == true)
            {
                questionSet.PartitionKey       = "latest-questionset";
                questionSet.QuestionSetVersion = $"latest-{questionSet.AssessmentType}";

                await client.UpsertDocumentAsync(DocumentCollectionUri, questionSet).ConfigureAwait(false);
            }
        }
        public HttpResponseMessage SaveQuestionSet(QuestionSet questionSet)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ""));
            }
            var savedQuestionSetId = _questionSetService.SaveQuestionSet(questionSet);

            return(Request.CreateResponse(HttpStatusCode.OK, savedQuestionSetId));
        }
예제 #11
0
        public void AddUpdateQuestionSetInCache(QuestionSet questionSet)
        {
            var existingSet = GetQuestionSetFromCache(questionSet.Id);

            if (existingSet != null)
            {
                _memCache.Remove(questionSet.Id);
            }

            _memCache.Add(questionSet.Id, questionSet.Questions, DateTimeOffset.Now.AddDays(1));
        }
        public async Task <ActionResult <QuestionSet> > PostQuestionSet([FromBody] QuestionSet questionSet)
        {
            if (questionSet.Questions.Count < 1)
            {
                return(BadRequest());
            }

            await m_repoWrapper.QuestionSet.CreateQuestionSetAsync(questionSet);

            return(CreatedAtAction(nameof(GetQuestionSet), new { id = questionSet.QuestionSetId }, questionSet));
        }
예제 #13
0
        public async Task <IActionResult> Create([Bind("ID,OwnerUserId,Title")] QuestionSet questionSet)
        {
            if (ModelState.IsValid)
            {
                _context.Add(questionSet);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(questionSet));
        }
예제 #14
0
 private void questionSetdataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == -1)
     {
         TestQuestionSetSet.QuestionSetsRow questionSetRow =
             ((Test)dbObject).GetTestTestQuestionSetSetQuestiomSetRow(
                 (int)questionSetdataGridView.SelectedRows[0].Cells[0].Value);
         QuestionSet qset = new QuestionSet(questionSetRow, (Test)(dbObject));
         ApplicationController.Instance.Edit(qset);
     }
 }
예제 #15
0
        public async Task RemoveQuestionFromSetAsync(QuestionSet model)
        {
            if (model.Set.OwnerId != _currentUserId)
            {
                throw new AccessDeniedException();
            }

            _context.QuestionSets.Remove(model);

            await _context.SaveChangesAsync();
        }
예제 #16
0
        private async Task CreateUpdateLatestQuestionSet(QuestionSet questionSet)
        {
            if (questionSet?.IsCurrent == true)
            {
                questionSet.PartitionKey       = "latest-questionset";
                questionSet.QuestionSetVersion = $"latest-{questionSet.AssessmentType}";

                var uri = UriFactory.CreateDocumentCollectionUri(cosmosSettings.DatabaseName, collectionName);
                await client.UpsertDocumentAsync(uri, questionSet);
            }
        }
예제 #17
0
 public RandomQuestion(QuestionSet questionSet)
 {
     InitializeComponent();
     currentQuestion = questionSet;
     Panels.SimpleQuestion simpleQuestion = new Panels.SimpleQuestion(questionSet)
     {
         Anchor = AnchorStyles.Left | AnchorStyles.Right
     };
     currentPanel = simpleQuestion;
     Controls.Add(simpleQuestion);
 }
예제 #18
0
    // Set Question onto the UI
    private void SetQuestion(QuestionSet q)
    {
        questionsText.GetComponent <TextMeshProUGUI>().text = q.Question;
        choice1Text.GetComponent <TextMeshProUGUI>().text   = q.Choice1;
        choice2Text.GetComponent <TextMeshProUGUI>().text   = q.Choice2;
        choice3Text.GetComponent <TextMeshProUGUI>().text   = q.Choice3;
        choice4Text.GetComponent <TextMeshProUGUI>().text   = q.Choice4;
        currentQuestion = q;

        //Debug.Log("New Questions: " + q.Question);
    }
예제 #19
0
        public async Task <ActionResult> AttachQuestionResults(string quizId)
        {
            var quiz = await QuizService.GetQuiz(quizId);

            var set = new QuestionSet()
            {
                QuizId        = quizId,
                QuizQuestions = (await UserQuestionPool.GetUserOwnedQuestions(User.Identity.GetUserId())).Where(x => quiz.Questions.Any(z => z.Id != x.Id)) //removes already added questions questions
            };

            return(View("_AttachQuestionsStore", set));
        }
예제 #20
0
        private void toolStripQuestionListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var selectitem = (string)toolStripQuestionListBox.SelectedItem;
            var item       = QuestIdentification.Get(selectitem);

            using (ForumContainer container = new ForumContainer())
            {
                QuestionSet = container.QuestionSet.FirstOrDefault(x => x.QuestionId == item.id);
            }
            QuestionLabel.Text = item.text;
            contextMenuStrip.Close();
        }
예제 #21
0
        public string GetQuestionsByQuestionSetID(string id)
        {
            string      questions   = "";
            QuestionSet questionSet = repository.QuestionSets.Where(q => q.QuestionSetId == Convert.ToInt32(id)).FirstOrDefault();

            if (questionSet != null)
            {
                questions = questionSet.Questions;
            }

            return(questions);
        }
예제 #22
0
        private static void SortQuestionSet(QuestionSet qset)
        {
            qset.Questions = qset.Questions.OrderBy(q => q.Order).ToList();

            foreach (var question in qset.Questions)
            {
                if (question.Options != null)
                {
                    question.Options = question.Options.OrderBy(qo => qo.Order).ToList();
                }
            }
        }
예제 #23
0
        public async Task <bool> UpdateQuestionSet(QuestionSetParam param)
        {
            QuestionSet entity = await _uow.QuestionSetRepository.GetFirst(filter : set => set.SetId == param.SetId);

            if (entity != null)
            {
                entity.SectionTypeId = param.SectionTypeId;
                entity.SetName       = param.SetName;
                _uow.QuestionSetRepository.Update(entity);
            }
            return(await _uow.CommitAsync() > 0);
        }
예제 #24
0
 public ActionResult Edit([Bind(Include = "Question_ID,Question,Option1,Option2,Option3,Option4,correctOption,MainCateogryID,Subject_id,Topic_id")] QuestionSet questionSet)
 {
     if (ModelState.IsValid)
     {
         db.Entry(questionSet).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MainCateogryID = new SelectList(db.maincateogries, "MainCateogryID", "MainCateogryName", questionSet.MainCateogryID);
     ViewBag.Subject_id     = new SelectList(db.Subjects, "Subject_id", "SubjectName", questionSet.Subject_id);
     ViewBag.Topic_id       = new SelectList(db.Topics, "Topic_id", "TopicName", questionSet.Topic_id);
     return(View(questionSet));
 }
예제 #25
0
        public override List <ValidationProblem> Validate(QuestionSet questionSet)
        {
            List <ValidationProblem> problems = new List <ValidationProblem>();

            foreach (Media media in questionSet.Media)
            {
                if (new FileInfo(media.FullPath).Length > MAX_FILE_SIZE)
                {
                    problems.Add(new ValidationProblem(ProblemSeverity.Error, string.Format(ValidationProblems.MEDIA_TOO_LARGE, media.Name, media.FileName), media));
                }
            }
            return(problems);
        }
        public async Task <Document> CreateOrUpdateQuestionSet(QuestionSet questionSet)
        {
            var uri = UriFactory.CreateDocumentCollectionUri(cosmosSettings.DatabaseName, collectionName);

            try
            {
                return(await client.CreateDocumentAsync(uri, questionSet));
            }
            catch
            {
                return(await client.UpsertDocumentAsync(uri, questionSet));
            }
        }
예제 #27
0
        private void miStart_Click(object sender, EventArgs e)
        {
            SuspendTimer();
            if (EnsureSaveQuestionSet(true))
            {
                DlgStart dlgStart = new DlgStart(startParams);
                if (dlgStart.ShowDialog() == DialogResult.OK)
                {
                    startParams = dlgStart.OutParams;
                    openQS      = startParams.qs;

                    testQS = openQS.GenererateTest(startParams.fragLimit, startParams.randomize);
                    if (testQS.Count == 0)
                    {
                        return;
                    }
                    miEditMode.Checked = false;

                    tvQuestionList.BeginUpdate();
                    tvQuestionList.Nodes.Clear();
                    for (int i = 0; i < testQS.Count; i++)
                    {
                        addTreeViewItem(i);
                    }
                    {
                        int i = 0;
                        foreach (TreeNode root in tvQuestionList.Nodes)
                        {
                            foreach (TreeNode node in root.Nodes)
                            {
                                node.Text = string.Format("Вопрос {0}", ++i);
                            }
                        }
                    }
                    tvQuestionList.EndUpdate();
                    tvQuestionList.Select();
                    tvQuestionList.SelectedNode = tvQuestionList.Nodes[0].Nodes[0];

                    pbFinish.Show();
                    panelTest.Show();

                    lblTimer.Text        = "";
                    timerState.span      = new TimeSpan(0, startParams.timeLimit, 0);
                    timerState.growthUp  = (timerState.span.Ticks == 0) ? 1 : -1;
                    timerState.lastStart = DateTime.Now;
                    timerState.suspended = false;
                    timer1.Start();
                }
            }
            ResumeTimer();
        }
예제 #28
0
        public SimpleQuestion(QuestionSet questionSet)
        {
            InitializeComponent();
            QuestionSet        = questionSet;
            QuestionLabel.Text = QuestionSet.QuestionText;

            QuestionTypes.QuestionPanel = QuestionPanel;
            QuestType = QuestionTypes.GetQuestionType(QuestionSet);
            var question = QuestType.getUserControl();

            QuestionTypes.SetQuest(question, QuestionSet);

            QuestionPanel.Controls.Add(question);
        }
예제 #29
0
        public bool DeleteQuestionSet(int questionSetId)
        {
            QuestionSet questionSetToDelete = repository.QuestionSets.Where(q => q.QuestionSetId == questionSetId).FirstOrDefault();

            if (questionSetToDelete != null)
            {
                if (repository.DeleteQuestionSet(questionSetId) != null)
                {
                    return(true);
                }
                ;
            }
            return(false);
        }
예제 #30
0
 public bool ShowQuestion(QuestionSet qs, Question q)
 {
     if (EnsureSaveChanges(true))
     {
         Clear();
         this.qs = qs;
         if (q != null)
         {
             return(SetQuestion(q.ID));
         }
         return(true);
     }
     return(false);
 }
예제 #31
0
    private void GenerateQuestions()
    {
        for (int i = 0; i < MaxQuestions; i++)
        {
            Question annoying   = GetRandomQuestion(ReactionType.Annoying);
            Question okay       = GetRandomQuestion(ReactionType.Okay);
            Question comforting = GetRandomQuestion(ReactionType.Comforting);

            QuestionSet questionSet = new QuestionSet(annoying, okay, comforting);
            questionSet.Shuffle();

            QuestionSets.Enqueue(questionSet);
        }
    }
예제 #32
0
        public override List <ValidationProblem> Validate(QuestionSet questionSet)
        {
            List <ValidationProblem> problems = new List <ValidationProblem>();

            if (questionSet.Questions == null || questionSet.Questions.Count == 0)
            {
                problems.Add(new ValidationProblem(ProblemSeverity.Error, ValidationProblems.QUESTION_SET_EMPTY, null));
            }
            if (questionSet.TopicName == "Invalid topic")
            {
                problems.Add(new ValidationProblem(ProblemSeverity.Error, ValidationProblems.QUESTION_SET_INVALID_TOPIC, null));
            }
            return(problems);
        }
예제 #33
0
        // GET: QuestionSets/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            QuestionSet questionSet = db.QuestionSets.Find(id);

            if (questionSet == null)
            {
                return(HttpNotFound());
            }
            return(View(questionSet));
        }
예제 #34
0
		public FillIn(Question question, SetEditor editor)
		{
			InitializeComponent();

			if(question != null)
			{
				textBox1.Text = question.question;
				textBox2.Text = question.answer;
				button1.Text = "Apply";
			}

			this.question = question;
			this.set = editor.set;
			this.editor = editor;
		}
예제 #35
0
		private void button1_Click(object sender, EventArgs e)
		{
			if (textBox1.Text.Length == 0) MessageBox.Show("Please enter a name.");
			else if (textBox2.Text.Length == 0) MessageBox.Show("Please enter a description.");
			else
			{
				QuestionSet qs = new QuestionSet(textBox1.Text, textBox2.Text);
				qs.icon = Convert.ToInt32(files[listView1.SelectedIndices[0]].Replace("icons/", "").Replace(".png", ""));

				StuddyBuddyForm.sets.Add(qs);
				StuddyBuddyForm.instance.populateForm();

				this.Close();
			}
		}
예제 #36
0
	public void exportQuestions(QuestionSet questions) {
		if (File.Exists(DATABASE_NAME)) {
			File.Delete(DATABASE_NAME);
		}
		StreamWriter file = new StreamWriter(DATABASE_NAME);

		questionList = questions.getQuestionList();
		foreach (Question question in questionList) {
			string line = question.getQuestionMode().ToString() + "|" + question.getQuestionText();
			answerList = question.getAnswers();
			foreach (Answer answer in answerList) {
				line += "|" + answer.getText() + "|" + answer.isCorrect().ToString();
			}
			file.WriteLine(line);
		}

		file.Close();
	}
예제 #37
0
	public QuestionSet importQuestions() {
		StreamReader file = new StreamReader(DATABASE_NAME);
		QuestionSet importedQuestionSet = new QuestionSet();
		string line;

		while((line = file.ReadLine()) != null) {
			string[] split = line.Split('|');
			Question question = new Question(split[1], (Question.QuestionType) System.Enum.Parse(typeof(Question.QuestionType), split[0], false));

			for (int i = 2; i < split.Length; i += 2) {
				question.addAnswer(split[i], System.Convert.ToBoolean(split[i+1]));
			}

			importedQuestionSet.addQuestion(question);
		}

		file.Close();

		return importedQuestionSet;
	}
예제 #38
0
	// Use this for initialization
	void Start () {
		inputQuestion = GameObject.Find("question_input").GetComponent<InputField>();

		inputField1 = GameObject.Find("answer1_input").GetComponent<InputField>();
		inputField2 = GameObject.Find("answer2_input").GetComponent<InputField>();
		inputField3 = GameObject.Find("answer3_input").GetComponent<InputField>();
		inputField4 = GameObject.Find("answer4_input").GetComponent<InputField>();

		toggle1 = GameObject.Find("answer1_toggle").GetComponent<Toggle>();
		toggle2 = GameObject.Find("answer2_toggle").GetComponent<Toggle>();
		toggle3 = GameObject.Find("answer3_toggle").GetComponent<Toggle>();
		toggle4 = GameObject.Find("answer4_toggle").GetComponent<Toggle>();

		questionNumberText = GameObject.Find("question_number").GetComponent<Text>();
		questionNumber = 1;
		questionNumberText.text = questionNumber.ToString();

		questionSetManager = new QuestionSetManager();
		questionSet = new QuestionSet();
	}
예제 #39
0
	// Use this for initialization
	void Start () {

		hoverImage = GameObject.Find("Image").GetComponent<Image>();

		answer1 = GameObject.Find("answer1_button").GetComponent<Button>();
		answer2 = GameObject.Find("answer2_button").GetComponent<Button>();
		answer3 = GameObject.Find("answer3_button").GetComponent<Button>();
		answer4 = GameObject.Find("answer4_button").GetComponent<Button>();

		questionText = GameObject.Find("question_text").GetComponent<Text>();

		// read settings from file
		string[] preferences = PreferencesManager.read();
		string sound = preferences[0];
		int font_size = int.Parse (preferences[1]);
		timeDelay = int.Parse (preferences[2]);

		// set font size
		answer1.GetComponentInChildren<Text> ().fontSize = font_size;
		answer2.GetComponentInChildren<Text> ().fontSize = font_size;
		answer3.GetComponentInChildren<Text> ().fontSize = font_size;
		answer4.GetComponentInChildren<Text> ().fontSize = font_size;
		questionText.GetComponentInChildren<Text> ().fontSize = font_size;

		questionSetManager = new QuestionSetManager ();
		questionSet = questionSetManager.importQuestions();

		questionIndex = -1;
		timeSinceLastCall = 0f;
		hoverEngaged = false;
		hoverImage.gameObject.SetActive(true);
		hoverImage.fillAmount = 0f;
		hoveredButton = null;
		buttonPressed = false;

		loadNewQuestion();
	}
예제 #40
0
파일: Item.cs 프로젝트: ucdavis/CRP
 public virtual void AddTransactionQuestionSet(QuestionSet questionSet)
 {
     //if(QuestionSets.Where(a => a.QuestionSet == questionSet).Where(a => a.TransactionLevel).Any())
     //{
     //    //Already has it
     //    return;
     //}
     var itemQuestionSet = new ItemQuestionSet(this, questionSet, QuestionSets.Count);
     itemQuestionSet.TransactionLevel = true;
     QuestionSets.Add(itemQuestionSet);
 }
예제 #41
0
        private void CreateSet3(HomePage homePage)
        {
            var questionSet3 = new QuestionSet();
            questionSet3.Content = new QuestionSet.ContentTab();
            questionSet3.Content.WelcomeParagraph = new DataTypes.BuiltIn.RichtextEditor() { Value = "This question set tests your knowledge of declaring and using code-first dictionaries." };
            questionSet3.NodeDetails.Name = "Dictionary Quiz";
            questionSet3.Persist(parentId: homePage.NodeDetails.UmbracoId, publish: true);

            var question1 = CreateQuestion
            (
                "Dictionary attribute",
                "What is the correct attribute to use to signal that a class represents a dictionary?",
                "[Dictionary]",
                "[CodeFirstDictionary]",
                "[Dict]",
                "[UmbracoDictionary]",
                1
            );
            question1.Extras = new Question.ExtrasTab();
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Persist(parentId: questionSet3.NodeDetails.UmbracoId, publish: true);

            var question2 = CreateQuestion
            (
                "Dictionary items",
                "What is the correct attribute to use to signal that a property represents a dictionary item?",
                "[DictItem]",
                "[DictionaryItem]",
                "[Item]",
                "[DictionaryEntry]",
                3
            );
            question2.Extras = new Question.ExtrasTab();
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Persist(parentId: questionSet3.NodeDetails.UmbracoId, publish: true);

            var question3 = CreateQuestion
            (
                "Dictionary base class",
                "What is the correct base class to inherit from when declaring a dictionary class?",
                "CodeFirstDictionaryBase",
                "DictBase",
                "UmbracoDictionary",
                "DictionaryBase",
                4
            );
            question3.Extras = new Question.ExtrasTab();
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Persist(parentId: questionSet3.NodeDetails.UmbracoId, publish: true);
        }
예제 #42
0
        private void CreateSet1(HomePage homePage)
        {
            var questionSet1 = new QuestionSet();
            questionSet1.Content = new QuestionSet.ContentTab();
            questionSet1.Content.WelcomeParagraph = new DataTypes.BuiltIn.RichtextEditor() { Value = "This question set tests your knowledge of declaring and using code-first document types." };
            questionSet1.NodeDetails.Name = "Document Type Quiz";
            questionSet1.Persist(parentId: homePage.NodeDetails.UmbracoId, publish: true);

            var question1 = CreateQuestion
            (
                "Document type attribute",
                "What is the correct attribute to use to signal that a class represents a document type?",
                "[DocumentType]",
                "[ContentType]",
                "[DocumentClass]",
                "[CodeFirstDocument]",
                1
            );
            question1.Extras = new Question.ExtrasTab();
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Persist(parentId: questionSet1.NodeDetails.UmbracoId, publish: true);

            var question2 = CreateQuestion
            (
                "Document type base",
                "What is the correct base class to inherit from when declaring a document type class?",
                "CodeFirstDocumentType",
                "ContentTypeBase",
                "BaseDocumentType",
                "DocumentTypeBase",
                4
            );
            question2.Extras = new Question.ExtrasTab();
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Persist(parentId: questionSet1.NodeDetails.UmbracoId, publish: true);

            var question3 = CreateQuestion
            (
                "Property type",
                "What is the correct attribute to use to signal that a property of a class represents an Umbraco property type?",
                "[Property]",
                "[ContentProperty]",
                "[DocumentProperty]",
                "[CodeFirstProperty]",
                2
            );
            question3.Extras = new Question.ExtrasTab();
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Persist(parentId: questionSet1.NodeDetails.UmbracoId, publish: true);
        }
예제 #43
0
        private void CreateSet2(HomePage homePage)
        {
            var questionSet2 = new QuestionSet();
            questionSet2.Content = new QuestionSet.ContentTab();
            questionSet2.Content.WelcomeParagraph = new DataTypes.BuiltIn.RichtextEditor() { Value = "This question set tests your knowledge of declaring and using code-first data types." };
            questionSet2.NodeDetails.Name = "Data Type Quiz";
            questionSet2.Persist(parentId: homePage.NodeDetails.UmbracoId, publish: true);

            var question1 = CreateQuestion
            (
                "Data type attribute",
                "What is the correct attribute to use to signal that a class represents a data type?",
                "[Type]",
                "[CodeFirstData]",
                "[UmbracoDataType]",
                "[DataType]",
                4
            );
            question1.Extras = new Question.ExtrasTab();
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Persist(parentId: questionSet2.NodeDetails.UmbracoId, publish: true);

            var question2 = CreateQuestion
            (
                "Data type interfaces",
                "Which of the following is the correct interface to implement to create a data type which is stored as a string and can accomodate a large amount of data?",
                "IUmbracoNtextDataType",
                "IUmbracoStringDataType",
                "IUmbracoDataTypeNtext",
                "IUmbracoDataTypeString",
                1
            );
            question2.Extras = new Question.ExtrasTab();
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Persist(parentId: questionSet2.NodeDetails.UmbracoId, publish: true);

            var question3 = CreateQuestion
            (
                "Data type implementation",
                "When is it OK to leave the interface methods unimplemented on a data type?",
                "When strongly-typed views are not being used, or that data type is not being used within them",
                "When the data value is always null/default",
                "For any data value which is stored as a string in the database",
                "Never",
                1
            );
            question3.Extras = new Question.ExtrasTab();
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Persist(parentId: questionSet2.NodeDetails.UmbracoId, publish: true);
        }