public virtual Explanations.ExplanationsDataTable GetData(int testId) { this.Adapter.SelectCommand = this.CommandCollection[0]; this.Adapter.SelectCommand.Parameters[0].Value = ((int)(testId)); Explanations.ExplanationsDataTable dataTable = new Explanations.ExplanationsDataTable(); this.Adapter.Fill(dataTable); return(dataTable); }
public virtual int Fill(Explanations.ExplanationsDataTable dataTable, int testId) { this.Adapter.SelectCommand = this.CommandCollection[0]; this.Adapter.SelectCommand.Parameters[0].Value = ((int)(testId)); if ((this.ClearBeforeFill == true)) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); return(returnValue); }
public PracticeNavigator(TestSet.TestsRow test, Manager manager) : base(test, manager) { questionsAnswers = new QuestionAnswerSet[sets.QuestionSets.Count]; activeQuestionIndexes = new int[sets.QuestionSets.Count]; int i = 0; int timeMin = 0; totalQuestions = 0; Random r = new Random(); foreach (QuestionSetSet.QuestionSetsRow set in sets.QuestionSets) { totalQuestions += set.NumberOfQuestionsToPick; if (timeMin >= 0) { if (set.IsTimeLimitNull()) { timeMin = -1; } else { timeMin += set.TimeLimit; } } activeQuestionIndexes[i] = -1; questionsAnswers[i] = new QuestionAnswerSet(); manager.DataProvider.GetQuestionsAnswersByQuestionSetId(set.Id, questionsAnswers[i]); _explanationsDataTable = manager.DataProvider.GetExplanations(test.Id); if (questionsAnswers[i].Questions.Count < set.NumberOfQuestionsToPick) { throw new Exception( "Test is not valid: NumberOfQuestionsToPick is greater then total number of questions assigned to the test"); } //Take random questions from the set so we have only NumberOfQuestionsToPick questions. int count = questionsAnswers[i].Questions.Count; if (set.NumberOfQuestionsToPick - questionsAnswers[i].Questions.Count < set.NumberOfQuestionsToPick / 2) { while (count != set.NumberOfQuestionsToPick) { int j; do { j = r.Next(questionsAnswers[i].Questions.Count); } while (questionsAnswers[i].Questions[j].RowState == DataRowState.Deleted); questionsAnswers[i].Questions[j].Delete(); --count; } } else { foreach (QuestionAnswerSet.QuestionsRow row in questionsAnswers[i].Questions) { row.Delete(); } count = 0; while (count != set.NumberOfQuestionsToPick) { int j; do { j = r.Next(questionsAnswers[i].Questions.Count); } while (questionsAnswers[i].Questions[j].RowState != DataRowState.Deleted); questionsAnswers[i].Questions[j].RejectChanges(); ++count; } } questionsAnswers[i].Questions.AcceptChanges(); ++i; } if (timeMin >= 0) { totalTime = new TimeSpan(0, timeMin, 0); } else { totalTime = TimeSpan.MaxValue; } SetActiveSet(sets.QuestionSets[0].Id); SetActiveQuestion(questionsAnswers[0].Questions[0].Id); }
public virtual int Update(Explanations.ExplanationsDataTable dataTable) { return(this.Adapter.Update(dataTable)); }