public bool IsSubsetOf(QuestionType questionType) { if (questionType.questionTypeId.HasValue) { if (this.questionTypeId.HasValue) { return(questionType.questionTypeId.Value == this.questionTypeId.Value); } else { if (!this.questionSubtypeId.HasValue) { return(false); } if (questionType.questionTypeId.Value == (int)BuisinessObjects.Type.Quantitative) { return (questionSubtypeId.Value == (int)BuisinessObjects.Subtype.CriticalReasoning || questionSubtypeId.Value == (int)BuisinessObjects.Subtype.Algebra || questionSubtypeId.Value == (int)BuisinessObjects.Subtype.Arithmetic || questionSubtypeId.Value == (int)BuisinessObjects.Subtype.Combinations || questionSubtypeId.Value == (int)BuisinessObjects.Subtype.Geometry || questionSubtypeId.Value == (int)BuisinessObjects.Subtype.Probability || questionSubtypeId.Value == (int)BuisinessObjects.Subtype.SentenceCorrection || questionSubtypeId.Value == (int)BuisinessObjects.Subtype.Statistics || questionSubtypeId.Value == (int)BuisinessObjects.Subtype.WordProblems); } else { return(questionSubtypeId.Value == (int)BuisinessObjects.Subtype.ReadingComprehensionQuestionToPassage || questionSubtypeId.Value == (int)BuisinessObjects.Subtype.CriticalReasoning || this.questionSubtypeId.Value == (int)BuisinessObjects.Subtype.SentenceCorrection); } } } if (!questionType.questionSubtypeId.HasValue) { return(true); } if (!this.questionSubtypeId.HasValue) { return(false); } return(this.questionSubtypeId.Value == questionType.questionSubtypeId.Value); }
public int CompareTo(object obj) { if (!(obj is QuestionType)) { throw new ArgumentException("Argument is not an QuestionType", "obj"); } QuestionType arg = (QuestionType)obj; int res = questionSubtypeId.CompareTo(arg.questionSubtypeId); if (res != 0) { return(res); } return(questionTypeId.CompareTo(arg.questionTypeId)); }
/*private static TestQuestionSetSet.QuestionSetsRow Convert(Dataset.QuestionSetsExRow value) * { * TestQuestionSetSet t = new TestQuestionSetSet(); * TestQuestionSetSet.QuestionSetsRow row = t.QuestionSets.AddQuestionSetsRow(value.Name, value.Description, value.NumberOfQuestionsToPick, 0, 0, 0, value.NumberOfQuestionsInZone1, value.NumberOfQuestionsInZone2, value.NumberOfQuestionsInZone3); * * if (value.IsTimeLimitNull()) * row.SetTimeLimitNull(); * else * row.TimeLimit = value.TimeLimit; * * if (value.IsQuestionTypeIdNull()) * row.SetQuestionTypeIdNull(); * else * row.QuestionTypeId = value.QuestionTypeId; * * if (value.IsQuestionSubtypeIdNull()) * row.SetQuestionSubtypeIdNull(); * else * row.QuestionSubtypeId = value.QuestionSubtypeId; * * return row; * }*/ public static QuestionSet Create(QuestionType questionType, Connection connection) { int setId = 0; for (int i = 0; i < connection.TestQuestionSetSet.QuestionSets.Count; ++i) { if (setId < connection.TestQuestionSetSet.QuestionSets[i].Id) { setId = connection.TestQuestionSetSet.QuestionSets[i].Id; } } setId += 1; TestQuestionSetSet.QuestionSetsRow row = connection.TestQuestionSetSet.QuestionSets.AddQuestionSetsRow(setId, "New Question Set", "", 0, 0, 0, 0, 0, 0, 0); //setId, row.SetTimeLimitNull(); if (!questionType.QuestionTypeId.HasValue) { row.SetQuestionTypeIdNull(); } else { row.QuestionTypeId = questionType.QuestionTypeId.Value; } if (!questionType.QuestionSubtypeId.HasValue) { row.SetQuestionSubtypeIdNull(); } else { row.QuestionSubtypeId = questionType.QuestionSubtypeId.Value; } QuestionSet qs = new QuestionSet(row); bool added = false; //locate where to add the question set foreach (Entity entity in connection.Children) { if (entity is QuestionSets) { foreach (Entity child in entity.Children) { if (child.CanAddNewChild(qs)) { child.AddNewChild(qs); qs.connection = ((Connection)qs.Root); added = true; break; } } break; } } if (!added) { throw new Exception("Cannot find folder for new question set"); } OnStructureChangedInternally(); return(qs); }
public DbObject(string name, QuestionType questionType) : base(name, null) { this.questionType = questionType; }
public DbObject(QuestionType questionType) : base("DbObject", null) { this.questionType = questionType; }