public static void AddToDataset(TestorData dataSet, TestorData.CoreTestsRow testRow, HtmlStore[] store) { if (dataSet == null) { return; } foreach (var question in store.OrderBy(c => c.QuestIndex)) { TestorData.CoreQuestionsRow newRow = dataSet.CoreQuestions.NewCoreQuestionsRow(); newRow.QuestionId = question.QuestIndex; newRow.QuestionType = (byte)question.QuestionType; newRow.Question = question.Html; newRow.TestId = testRow.TestId; newRow.QuestionMark = 1; dataSet.CoreQuestions.AddCoreQuestionsRow(newRow); ProcessBLOBs(dataSet, question, newRow.QuestionId); foreach (var answer in question.SubItems) { TestorData.CoreAnswersRow ansRow = dataSet.CoreAnswers.NewCoreAnswersRow(); ansRow.QuestionId = newRow.QuestionId; ansRow.Answer = answer.Html; ansRow.IsTrue = answer.IsTrue; dataSet.CoreAnswers.AddCoreAnswersRow(ansRow); ProcessBLOBs(dataSet, answer, newRow.QuestionId); } } }
private void tscbMark_SelectedIndexChanged(object sender, EventArgs e) { TestorData.CoreQuestionsRow currentRow = ((bindingSourceQuest.Current as DataRowView).Row as TestorData.CoreQuestionsRow); short currentMark = (short)(tscbMark.SelectedIndex + 1); if (currentMark != currentRow.QuestionMark) { currentRow.QuestionMark = currentMark; ProjectState.HasChanges = true; } }
private void bindingSourceQuest_CurrentItemChanged(object sender, EventArgs e) { if (bindingSourceQuest.CurrencyManager.Position == -1) { return; } TestorData.CoreQuestionsRow currentRow = ((bindingSourceQuest.Current as DataRowView).Row as TestorData.CoreQuestionsRow); tscbMark.SelectedIndex = (int)Math.Round(currentRow.QuestionMark, 0) - 1; try { _provider.SetHtmlStore(HtmlStore.GetHtmlStore(_data, currentRow.QuestionId)); webBrowserQuestion.Navigate(TestingHttpServer.BaseUrl); } catch { } }