public ActionResult EditTestCategory(string id)
        {
            var testCatRepo = new TestCategoryRepository();
            var testCat     = testCatRepo.GetById(Guid.Parse(id));

            return(View(testCat));
        }
Пример #2
0
        public ActionResult FinishedTests(int?page, Guid?swTypeGuid, Guid?testCatGuid, string searchTerm)
        {
            TestsRepository testsRepo = new TestsRepository();

            SoftwareTypeRepository swTypeRepo = new SoftwareTypeRepository();

            ViewBag.SoftTypes = swTypeRepo.GetAllValid();

            TestCategoryRepository testCatRepo = new TestCategoryRepository();

            ViewBag.TestCategories = testCatRepo.GetAllValid();

            ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>();
            Tester tester = userRepo.GetByUserName(User.Identity.Name);

            int itemsOnPage = 8;
            int pg          = page ?? 1;
            int startIndex  = (pg * itemsOnPage) - itemsOnPage;

            SoftwareType swType = null;

            if (swTypeGuid != null)
            {
                swType           = swTypeRepo.GetById((Guid)swTypeGuid);
                ViewBag.SoftType = swType;
            }

            TestCategory testCat = null;

            if (testCatGuid != null)
            {
                testCat = testCatRepo.GetById((Guid)testCatGuid);
                ViewBag.TestCategory = testCat;
            }

            ViewBag.CurrentSearch = searchTerm;
            IList <TestsStatus> statuses = new List <TestsStatus>();

            statuses.Add(TestsStatus.Finished);
            statuses.Add(TestsStatus.Reviewed);
            IList <DataAccess.Model.Tests.Tests> tests = testsRepo.GetAvailableEntities(out var totalTests, tester, statuses, swType, testCat, startIndex, itemsOnPage, searchTerm);

            ViewBag.Pages       = (int)Math.Ceiling((double)totalTests / (double)itemsOnPage);
            ViewBag.CurrentPage = pg;

            if (Request.IsAjaxRequest())
            {
                return(PartialView(tests));
            }

            return(View(tests));
        }
Пример #3
0
        public async Task <ActionResult> TesterTests(int?page, Guid?swTypeGuid, Guid?testCatGuid, string searchTerm)
        {
            TestCaseRepository testCaseRepo = new TestCaseRepository();

            ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>();
            var testerTask = userRepo.GetByUserNameAsync(User.Identity.Name);

            SoftwareTypeRepository swTypeRepo = new SoftwareTypeRepository();

            ViewBag.SoftTypes = swTypeRepo.GetAllValid();

            TestCategoryRepository testCatRepo = new TestCategoryRepository();

            ViewBag.TestCategories = testCatRepo.GetAllValid();

            int itemsOnPage = 8;
            int pg          = page ?? 1;
            int startIndex  = (pg * itemsOnPage) - itemsOnPage;

            SoftwareType swType = null;

            if (swTypeGuid != null)
            {
                swType           = swTypeRepo.GetById((Guid)swTypeGuid);
                ViewBag.SoftType = swType;
            }

            TestCategory testCat = null;

            if (testCatGuid != null)
            {
                testCat = testCatRepo.GetById((Guid)testCatGuid);
                ViewBag.TestCategory = testCat;
            }

            ViewBag.CurrentSearch = searchTerm;
            IList <TestCase> testCases = testCaseRepo.GetAvailableEntities(out var totalTests, DateTime.Today, await testerTask, swType, testCat, startIndex, itemsOnPage, searchTerm);

            ViewBag.Pages       = (int)Math.Ceiling((double)totalTests / (double)itemsOnPage);
            ViewBag.CurrentPage = pg;

            if (Request.IsAjaxRequest())
            {
                return(PartialView(testCases));
            }

            return(View(testCases));
        }
        public ActionResult ToggleValidTestCategory(IList <TestCategory> rows)
        {
            var testCatRepo = new TestCategoryRepository();

            foreach (var row in rows)
            {
                var testCat = testCatRepo.GetById(row.Id);

                if (testCat.Valid)
                {
                    testCat.Valid = false;
                }
                else if (!testCat.Valid)
                {
                    testCat.Valid = true;
                }

                testCatRepo.Update(testCat);
            }

            TempData["success"] = "Test category/ies was updated!";

            return(View("TestCategories"));
        }
        public ActionResult DeleteTestCategory(IList <TestCategory> rows)
        {
            var testCatRepo = new TestCategoryRepository();

            foreach (var row in rows)
            {
                var testCat = testCatRepo.GetById(row.Id);

                try
                {
                    testCatRepo.Delete(testCat);
                }
                catch (Exception e)
                {
                    TempData["error"] = "Test category/ies can't be delete, because it used in some part of system!";

                    return(View("TestCategories"));
                }
            }

            TempData["success"] = "Test category/ies was deleted!";

            return(View("TestCategories"));
        }