コード例 #1
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     if (!_isServerMode)
     {
         TestHelper helper = (TestHelper)cbAddTest.SelectedItem;
         _tests.Add(helper.TestKey, 0);
         dataGridView.Rows.Add(helper.TestKey, helper.TestName, 0, helper.QuestCount);
         cbAddTest.Items.Remove(helper);
         ProcessItemsCountChange();
     }
     else
     {
         SelectItemsForm selectTests = new SelectItemsForm(TestingServerItemType.TestTree);
         if (selectTests.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         TestorTreeItem[] items = selectTests.TestorTreeItems;
         foreach (var item in items)
         {
             TestorMasterPart part = new TestorMasterPart()
             {
                 Name = item.ItemName, PartTestId = item.TestId.Value, QuestionsNumber = 0
             };
             if (_serverMasterParts.Where(c => c.PartTestId == part.PartTestId).Count() == 0 && item.TestId != _testId)
             {
                 _serverMasterParts.Add(part);
                 dataGridView.Rows.Add(part.PartTestId, part.Name, part.QuestionsNumber, "нет данных");
             }
         }
     }
 }
コード例 #2
0
        private void buttonAddReq_Click(object sender, EventArgs e)
        {
            SelectItemsForm selectForm = new SelectItemsForm(TestingServerItemType.TestTree);

            if (selectForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            TestorTreeItem[] items = selectForm.TestorTreeItems;
            var currentItems       = GetItems(false);

            foreach (var item in items)
            {
                if (currentItems.Where(c => c.TestId == item.TestId).Count() == 0 && item.TestId != _adapter.TestId)
                {
                    clbAddSettings.Items.Add(item, true);
                }
            }
        }
コード例 #3
0
        private void buttonAddGroups_Click(object sender, EventArgs e)
        {
            SelectItemsForm selectForm = new SelectItemsForm(TestingServerItemType.GroupTree);

            if (selectForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            TestorTreeItem[] items = selectForm.TestorTreeItems;
            foreach (var item in items)
            {
                item.IsGroupAdmin = false;
                if (_userGroups.Where(c => c.ItemId == item.ItemId).Count() <= 0)
                {
                    _userGroups.Add(item);
                }
            }
            _bindingSource.CurrencyManager.Refresh();
        }