private QuestionSet AddQuestionSet(QuestionSet set) { if (set.Root != Root) { throw new NotImplementedException(); } QuestionSet qs = new QuestionSet(set.Value, this); connection.TestQuestionSetSet.TestContents.AddTestContentsRow(Value, qs.Value, 0); Dataset.QuestionSetsExRow row = FullDataset.QuestionSetsEx.AddQuestionSetsExRow(qs.Value.Id, qs.Value.Name, qs.Value.Description, qs.Value.NumberOfQuestionsToPick, 1, 1, 1, qs.Value.NumberOfQuestionsInZone1, qs.Value.NumberOfQuestionsInZone2, qs.Value.NumberOfQuestionsInZone3, FullDataset.Tests[0].Id, 0); //Check!qs.Value.Id, if (qs.Value.IsTimeLimitNull()) { row.SetTimeLimitNull(); } else { row.TimeLimit = qs.Value.TimeLimit; } if (qs.Value.IsQuestionTypeIdNull()) { row.SetQuestionTypeIdNull(); } else { row.QuestionTypeId = qs.Value.QuestionTypeId; } if (qs.Value.IsQuestionSubtypeIdNull()) { row.SetQuestionSubtypeIdNull(); } else { row.QuestionSubtypeId = qs.Value.QuestionSubtypeId; } contentIsChanged = true; OnStructureChangedInternally(); return(qs); }
public void AddExistingSetToTest(Dataset data, int testId) { this.testId = testId; int setOrder = data.QuestionSetsEx.Count; SelectSet sS = new SelectSet(connection, testId, setId, setOrder, this); sS.ShowDialog(); if (sS.DialogResult == DialogResult.Yes) { connection.TestQuestionSetSet.TestContents.AddTestContentsRow( connection.TestQuestionSetSet.Tests.FindById(testId), connection.TestQuestionSetSet.QuestionSets.FindById(setId), Convert.ToByte(setOrder)); Dataset.QuestionSetsExRow row = FullDataset.QuestionSetsEx.AddQuestionSetsExRow(setId, sS.qsRow.Name, sS.qsRow.Description, sS.qsRow.NumberOfQuestionsToPick, sS.qsRow.IsTimeLimitNull() ? (0) : (sS.qsRow.TimeLimit), sS.qsRow.IsQuestionSubtypeIdNull() ? (0) : (sS.qsRow.QuestionSubtypeId), sS.qsRow.IsQuestionTypeIdNull() ? (0) : (sS.qsRow.QuestionTypeId), sS.qsRow.NumberOfQuestionsInZone1, sS.qsRow.NumberOfQuestionsInZone2, sS.qsRow.NumberOfQuestionsInZone3, testId, Convert.ToByte(setOrder)); if (row.TimeLimit == 0) { row.SetTimeLimitNull(); } if (row.QuestionTypeId == 0) { row.SetQuestionTypeIdNull(); } if (row.QuestionSubtypeId == 0) { row.SetQuestionSubtypeIdNull(); } connection.DataProvider.AddQuestionsExToDataSet(FullDataset, row.Id); FullDataset.Tests.FindById(testId).Name += ""; ApplicationController.Instance.Refresh(connection); OnStructureChangedInternally(); //data.Clear(); //connection.DataProvider.FillTest(data, testId); //TestQuestionSetSet tempValue = new TestQuestionSetSet(); //tempValue.QuestionSets.AddQuestionSetsRow(setId, sS.qsEx.Name, sS.qsEx.Description, sS.qsEx.NumberOfQuestionsToPick, sS.qsEx.IsTimeLimitNull() ? (0) : (sS.qsEx.TimeLimit), sS.qsEx.IsQuestionSubtypeIdNull() ? (0) : (sS.qsEx.QuestionSubtypeId), sS.qsEx.IsQuestionTypeIdNull() ? (0) : (sS.qsEx.QuestionTypeId), sS.qsEx.NumberOfQuestionsInZone1, sS.qsEx.NumberOfQuestionsInZone2, sS.qsEx.NumberOfQuestionsInZone3); //// //if(sS.qsEx.IsTimeLimitNull()) //{ // tempValue.QuestionSets[0].SetTimeLimitNull(); //} //if (sS.qsEx.IsQuestionTypeIdNull()) //{ // tempValue.QuestionSets[0].SetQuestionTypeIdNull(); //} //if (sS.qsEx.IsQuestionSubtypeIdNull()) //{ // tempValue.QuestionSets[0].SetQuestionSubtypeIdNull(); //} //QuestionSet qs = new QuestionSet(tempValue.QuestionSets[0], this); //AddQuestionSet(qs); //Provider provider = connection.DataProvider; //provider.AddExistingSetToTest(sS.setId, testId, setOrder); //provider.Dispose(); } else { return; } }