Exemplo n.º 1
0
        public static void CreateMasterTest()
        {
            InputBox ib = new InputBox("Имя мастер теста", "Введите имя мастер теста:");

            if (ib.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            if (ProjectState.TestHelpers.Where(c => c.TestName == ib.Input).Count() > 0)
            {
                SystemMessage.ShowWarningMessage("Данное имя теста уже используется.");
                return;
            }
            TestorData td = new TestorData();

            TestorData.CoreTestsRow testRow = HtmlStore.CreateCoreTest(td, ib.Input);
            testRow.IsMasterTest = true;
            td.CoreTests.AddCoreTestsRow(testRow);
            TestHelper testHelper = new TestHelper(ProjectState.DataPackageManager);

            testHelper.TestKey      = testRow.TestKey.ToString();
            testHelper.ConvTime     = DateTime.Now;
            testHelper.FullFileName = String.Empty;
            testHelper.TestorData   = td;
            testHelper.TestName     = ib.Input;
            testHelper.QuestCount   = 0;
            testHelper.IsMasterTest = true;
            List <TestHelper> helperList = new List <TestHelper>();

            helperList.Add(testHelper);
            ProjectState.AddTests(helperList);
        }
Exemplo n.º 2
0
 public void CreateMasterTest(string testName)
 {
     TestorData data = new TestorData();
     TestorData.CoreTestsRow row = HtmlStore.CreateCoreTest(data, testName);
     row.IsMasterTest = true;
     data.CoreTests.Rows.Add(row);
     SendTests(data, new List<int>());
 }
Exemplo n.º 3
0
        public TestorTreeItem CreateFolder(int parentId, string folderName)
        {
            Debug.Assert(parentId >= 0);
            Debug.Assert(!String.IsNullOrEmpty(folderName));

            Provider.TestRoles(TestorUserRole.Administrator, TestorUserRole.Teacher, TestorUserRole.Laboratorian);

            using (DataClassesTestorCoreDataContext dataContext = new DataClassesTestorCoreDataContext(TestorSecurityProvider.ConnectionString))
            {
                TestorData td = new TestorData();
                TestorData.CoreTestsRow testRow = HtmlStore.CreateCoreTest(td, folderName);
                CoreTest coreTest = new CoreTest();
                CreateCoreTest(testRow, coreTest);
                dataContext.CoreTests.InsertOnSubmit(coreTest);
                dataContext.SubmitChanges();
                int            result   = dataContext.AddTestTreeItem(GetId(parentId), (int)TestorItemType.Folder, coreTest.TestId, Provider.CurrentUser.UserId);
                TestorTreeItem retValue = new TestorTreeItem(
                    result, coreTest.TestId, folderName, TestorItemType.Folder, new TestorTreeItem[] { });
                retValue.ItemOwner = Provider.CurrentUser.UserId;
                return(retValue);
            }
        }