public static HtmlStore GetHtmlStore(TestorData testorData, int questionId) { HtmlStore retValue = new HtmlStore(); var currentRows = testorData.CoreQuestions.Where(c => c.QuestionId == questionId); if (currentRows.Count() == 0) { return(null); } var currentRow = currentRows.FirstOrDefault(); retValue.QuestIndex = currentRow.QuestionId; retValue.Html = currentRow.Question; retValue.QuestionType = (QuestionType)currentRow.QuestionType; foreach (var blob in currentRow.GetCoreBLOBsRows()) { retValue.Images.Add(blob.BLOBId, blob.BLOBContent); } foreach (var ans in currentRow.GetCoreAnswersRows()) { HtmlStore answer = new HtmlStore(); answer.QuestIndex = ans.AnswerId; answer.Html = ans.Answer; answer.IsTrue = ans.IsTrue; retValue.SubItems.Add(answer); } return(retValue); }
public static TestorData GetDataSet(HtmlStore[] store, string testName) { TestorData retValue = new TestorData(); TestorData.CoreTestsRow testRow = CreateCoreTest(retValue, testName); retValue.CoreTests.AddCoreTestsRow(testRow); HtmlStore.AddToDataset(retValue, testRow, store); return(retValue); }
private static void ProcessBLOBs(TestorData dataSet, HtmlStore store, int questionId) { foreach (var image in store.Images) { TestorData.CoreBLOBsRow blobRow = dataSet.CoreBLOBs.NewCoreBLOBsRow(); blobRow.BLOBId = image.Key; blobRow.QuestionId = questionId; blobRow.BLOBContent = image.Value; dataSet.CoreBLOBs.AddCoreBLOBsRow(blobRow); } }