├── .dockerignore ├── .editorconfig ├── .gitignore ├── Data ├── JudgeSystem.Data.Common │ ├── JudgeSystem.Data.Common.csproj │ ├── Models │ │ ├── BaseDeletableModel.cs │ │ ├── BaseModel.cs │ │ ├── IAuditInfo.cs │ │ ├── IDeletableEntity.cs │ │ └── IOrderable.cs │ └── Repositories │ │ ├── IDeletableEntityRepository.cs │ │ └── IRepository.cs ├── JudgeSystem.Data.Models │ ├── AllowedIpAddress.cs │ ├── AllowedIpAddressContest.cs │ ├── ApplicationRole.cs │ ├── ApplicationUser.cs │ ├── Contest.cs │ ├── Course.cs │ ├── Enums │ │ ├── LessonType.cs │ │ ├── SchoolClassType.cs │ │ ├── SubmissionType.cs │ │ ├── TestExecutionResultType.cs │ │ ├── TestingStrategy.cs │ │ └── TestsImportStrategy.cs │ ├── ExecutedTest.cs │ ├── Feedback.cs │ ├── JudgeSystem.Data.Models.csproj │ ├── Lesson.cs │ ├── Practice.cs │ ├── Problem.cs │ ├── Resource.cs │ ├── SchoolClass.cs │ ├── Student.cs │ ├── Submission.cs │ ├── Test.cs │ ├── UserContest.cs │ └── UserPractice.cs └── JudgeSystem.Data │ ├── ApplicationDbContext.cs │ ├── ApplicationRoleStore.cs │ ├── ApplicationUserStore.cs │ ├── DesignTimeDbContextFactory.cs │ ├── EfExpressionHelper.cs │ ├── EntityIndexesConfiguration.cs │ ├── JudgeSystem.Data.csproj │ ├── Migrations │ ├── 20190130121918_InitialCreate.Designer.cs │ ├── 20190130121918_InitialCreate.cs │ ├── 20190518175711_AddRelatedToCourseEntities.Designer.cs │ ├── 20190518175711_AddRelatedToCourseEntities.cs │ ├── 20190523181512_AddSubmisionEntity.Designer.cs │ ├── 20190523181512_AddSubmisionEntity.cs │ ├── 20190616063255_SubmisisonAndExecutedTestCreate.Designer.cs │ ├── 20190616063255_SubmisisonAndExecutedTestCreate.cs │ ├── 20190616083335_RemoveSettingsEntity.Designer.cs │ ├── 20190616083335_RemoveSettingsEntity.cs │ ├── 20190616135151_SubmissionExecuedTestRelation.Designer.cs │ ├── 20190616135151_SubmissionExecuedTestRelation.cs │ ├── 20190616184505_AddColumnsToExecutedTest.Designer.cs │ ├── 20190616184505_AddColumnsToExecutedTest.cs │ ├── 20190616194909_ChangeColumnMemoryUsedType.Designer.cs │ ├── 20190616194909_ChangeColumnMemoryUsedType.cs │ ├── 20190617164829_DeletableProblem.Designer.cs │ ├── 20190617164829_DeletableProblem.cs │ ├── 20190617173855_AddContestEntity.Designer.cs │ ├── 20190617173855_AddContestEntity.cs │ ├── 20190618063715_AddNameColumnToContest.Designer.cs │ ├── 20190618063715_AddNameColumnToContest.cs │ ├── 20190618082629_RenameSubmissionTable.Designer.cs │ ├── 20190618082629_RenameSubmissionTable.cs │ ├── 20190620104212_AddStudentEntity.Designer.cs │ ├── 20190620104212_AddStudentEntity.cs │ ├── 20190620195218_AddColumnIsActivated.Designer.cs │ ├── 20190620195218_AddColumnIsActivated.cs │ ├── 20190620195630_ChangeStudentFullNameType.Designer.cs │ ├── 20190620195630_ChangeStudentFullNameType.cs │ ├── 20190622151317_AddNameAndSurnameToUser.Designer.cs │ ├── 20190622151317_AddNameAndSurnameToUser.cs │ ├── 20190623145029_AddActualPointsColumnToSubmission.Designer.cs │ ├── 20190623145029_AddActualPointsColumnToSubmission.cs │ ├── 20190623171308_ActualPointsNonNullable.Designer.cs │ ├── 20190623171308_ActualPointsNonNullable.cs │ ├── 20190721124903_AddSubmissionTypeColumnToProblemEntity.Designer.cs │ ├── 20190721124903_AddSubmissionTypeColumnToProblemEntity.cs │ ├── 20190727080922_AddPracticeEntity.Designer.cs │ ├── 20190727080922_AddPracticeEntity.cs │ ├── 20190727092359_ChangeRelationBetweenPracticeAndLesson.Designer.cs │ ├── 20190727092359_ChangeRelationBetweenPracticeAndLesson.cs │ ├── 20190731214403_RemoveResourceTypeColumn.Designer.cs │ ├── 20190731214403_RemoveResourceTypeColumn.cs │ ├── 20190802202911_AddAllowedTimeAndAlowedMemoryColumnsToProblem.Designer.cs │ ├── 20190802202911_AddAllowedTimeAndAlowedMemoryColumnsToProblem.cs │ ├── 20190802210714_RenameAllowedTimeInSecondsToRenameAllowedTimeInMiliseconds.Designer.cs │ ├── 20190802210714_RenameAllowedTimeInSecondsToRenameAllowedTimeInMiliseconds.cs │ ├── 20190803083643_FixProblemColumnName.Designer.cs │ ├── 20190803083643_FixProblemColumnName.cs │ ├── 20190803103715_AddConstraints.Designer.cs │ ├── 20190803103715_AddConstraints.cs │ ├── 20190908123555_MakeSubmissionEntityDeletable.Designer.cs │ ├── 20190908123555_MakeSubmissionEntityDeletable.cs │ ├── 20191004140034_FeedbackEntity.Designer.cs │ ├── 20191004140034_FeedbackEntity.cs │ ├── 20191004142111_FeedbackSenderRequired.Designer.cs │ ├── 20191004142111_FeedbackSenderRequired.cs │ ├── 20200303161125_AddPropertyInProblemEntity.Designer.cs │ ├── 20200303161125_AddPropertyInProblemEntity.cs │ ├── 20200304205852_AllowedIpAddressEntity.Designer.cs │ ├── 20200304205852_AllowedIpAddressEntity.cs │ ├── 20200307075447_AddPropertyTestingStrategyToProblem.Designer.cs │ ├── 20200307075447_AddPropertyTestingStrategyToProblem.cs │ ├── 20200308073359_AddAutomatedTestingProjectProperty.Designer.cs │ ├── 20200308073359_AddAutomatedTestingProjectProperty.cs │ ├── 20200314161459_AddProblemAllowedCodeDifferenceProperty.Designer.cs │ ├── 20200314161459_AddProblemAllowedCodeDifferenceProperty.cs │ ├── 20210914212731_OrderableEntities.Designer.cs │ ├── 20210914212731_OrderableEntities.cs │ ├── 20210922081004_UserValidationsAndAddedColumn.Designer.cs │ ├── 20210922081004_UserValidationsAndAddedColumn.cs │ └── ApplicationDbContextModelSnapshot.cs │ ├── Repositories │ ├── EfDeletableEntityRepository.cs │ └── EfRepository.cs │ ├── Seeding │ ├── AdminSeeder.cs │ ├── ApplicationDbContextSeeder.cs │ ├── ISeeder.cs │ ├── RolesSeeder.cs │ └── SchoolClassesSeeder.cs │ └── appsettings.json ├── Documentation ├── Architecture.jpg ├── Awards │ ├── НТИТ-Грамота.jpg │ ├── НТИТ-ГрамотаКупа.jpg │ ├── НТИТ-Купа.jpg │ ├── УчИМИ - Двадесетата ученическа секция.pdf │ ├── УчИМИ-Грамота.jpg │ ├── УчИМИ-ГрамотаМедал.jpg │ └── УчИМИ-Медал.jpg ├── Judge System - Documentation.docx ├── Next steps │ ├── How to improve Computer science education.pptx │ └── Judge System next steps.docx ├── SubmissionEvaluation.jpg ├── TestGenerator │ ├── SolutionTransformer │ │ ├── Code │ │ │ └── Code.cs │ │ ├── SolutionTransformer.csproj │ │ └── Transformer.cs │ ├── TestGenerator.sln │ └── TestGenerator │ │ ├── Data │ │ ├── inputs.txt │ │ └── tests.json │ │ ├── Generator.cs │ │ ├── Test.cs │ │ └── TestGenerator.csproj ├── coursesModule.png └── usersModule.png ├── JudgeSystem.Common ├── AppSettingsSections.cs ├── ErrorMessages.cs ├── Exceptions │ ├── BadRequestException.cs │ └── EntityNotFoundException.cs ├── Extensions │ ├── EnumerableExtensions.cs │ ├── JsonExtensions.cs │ ├── ProcessExtensions.cs │ └── StreamExtensions.cs ├── GlobalConstants.cs ├── Helpers │ └── UserHelper.cs ├── InfoMessages.cs ├── JudgeSystem.Common.csproj ├── ModelConstants.cs ├── Models │ └── Result.cs ├── Settings │ ├── AdminSettings.cs │ └── AzureBlobSettings.cs └── Validator.cs ├── JudgeSystem.sln ├── LICENSE ├── README.md ├── Services ├── JudgeSystem.Services.Data │ ├── AllowedIpAddressService.cs │ ├── ContestService.cs │ ├── CourseService.cs │ ├── ExecutedTestService.cs │ ├── FeedbackService.cs │ ├── IAllowedIpAddressService.cs │ ├── IContestService.cs │ ├── ICourseService.cs │ ├── IExecutedTestService.cs │ ├── IFeedbackService.cs │ ├── ILessonService.cs │ ├── ILessonsRecommendationService.cs │ ├── IPracticeService.cs │ ├── IProblemService.cs │ ├── IResourceService.cs │ ├── ISchoolClassService.cs │ ├── IStudentService.cs │ ├── ISubmissionService.cs │ ├── ITestService.cs │ ├── IUserService.cs │ ├── JudgeSystem.Services.Data.csproj │ ├── LessonService.cs │ ├── LessonsRecommendationService.cs │ ├── PracticeService.cs │ ├── ProblemService.cs │ ├── ResourceService.cs │ ├── SchoolClassService.cs │ ├── StudentService.cs │ ├── SubmissionService.cs │ ├── TestService.cs │ └── UserService.cs ├── JudgeSystem.Services.Mapping │ ├── AutoMapperConfig.cs │ ├── IHaveCustomMappings.cs │ ├── IMapFrom.cs │ ├── IMapTo.cs │ ├── JudgeSystem.Services.Mapping.csproj │ └── MapppingExtensions.cs ├── JudgeSystem.Services.Messaging │ ├── BaseEmailOptions.cs │ ├── EmailSender.cs │ ├── JudgeSystem.Services.Messaging.csproj │ └── SendGridOptions.cs ├── JudgeSystem.Services.Models │ ├── JudgeSystem.Services.Models.csproj │ └── Users │ │ └── UserImportServiceModel.cs └── JudgeSystem.Services │ ├── AzureStorageService.cs │ ├── Checker.cs │ ├── CodeCompareer.cs │ ├── Estimator.cs │ ├── ExcelFileGenerator.cs │ ├── FileSystemService.cs │ ├── IAzureStorageService.cs │ ├── IChecker.cs │ ├── ICodeCompareer.cs │ ├── IEstimator.cs │ ├── IExcelFileGenerator.cs │ ├── IFileSystemService.cs │ ├── IJsonUtiltyService.cs │ ├── IPaginationService.cs │ ├── IPasswordHashService.cs │ ├── IProcessRunner.cs │ ├── IRouteBuilder.cs │ ├── IStringFormatter.cs │ ├── IStudentProfileService.cs │ ├── IUtilityService.cs │ ├── IValidationService.cs │ ├── JsonUtiltyService.cs │ ├── JudgeSystem.Services.csproj │ ├── Models │ ├── AutomatedTestResult.cs │ └── ProcessResult.cs │ ├── PaginationService.cs │ ├── PasswordHashService.cs │ ├── ProcessRunner.cs │ ├── RouteBuilder.cs │ ├── StringFormatter.cs │ ├── StudentProfileService.cs │ ├── UtilityService.cs │ ├── ValidationService.cs │ └── Validations │ ├── Contracts │ ├── IEmailValidationService.cs │ └── IUserValidationService.cs │ ├── EmailValidationService.cs │ └── UserValidationService.cs ├── Tests ├── JudgeSystem.Services.Data.Tests │ ├── ClassFixtures │ │ ├── InMemoryDatabaseFactory.cs │ │ └── MappingsProvider.cs │ ├── ContestServiceTests.cs │ ├── CourseServiceTests.cs │ ├── ExecutedTestServiceTests.cs │ ├── Factories │ │ └── ApplicationDbContextFactory.cs │ ├── FeedbackServiceTests.cs │ ├── JudgeSystem.Services.Data.Tests.csproj │ ├── LessonServiceTests.cs │ ├── PracticeServiceTests.cs │ ├── ProblemServiceTests.cs │ ├── ResourceServiceTests.cs │ ├── SchoolClassServiceTests.cs │ ├── SingletonDbContextProvider.cs │ ├── StudentServiceTests.cs │ ├── SubmissionServiceTests.cs │ ├── TestServiceTests.cs │ ├── TransientDbContextProvider.cs │ └── UserServiceTests.cs ├── JudgeSystem.Services.Tests │ ├── CheckerTests.cs │ ├── EstimatorTests.cs │ ├── FileSystemServiceTests.cs │ ├── JudgeSystem.Services.Tests.csproj │ ├── PaginationServiceTests.cs │ ├── PasswordHashServiceTests.cs │ ├── RouteBuilderTests.cs │ ├── ServiceTestsConstants.cs │ ├── StringFormatterTests.cs │ ├── StudentProfileServiceTests.cs │ ├── TestData │ │ └── ZippedSolution.zip │ ├── UtilityServiceTests.cs │ └── ValidationServiceTests.cs ├── JudgeSystem.Web.Tests │ ├── Administration │ │ └── Controllers │ │ │ ├── AdministrationBaseControllerTests.cs │ │ │ ├── ContestControllerTests.cs │ │ │ ├── CourseControllerTests.cs │ │ │ ├── FeedbackControllerTests.cs │ │ │ ├── LessonControllerTests.cs │ │ │ ├── PracticeControllerTests.cs │ │ │ ├── ProblemControllerTests.cs │ │ │ ├── ResourceControllerTests.cs │ │ │ ├── SettingsControllerTests.cs │ │ │ ├── StudentControllerTests.cs │ │ │ ├── TestControllerTests.cs │ │ │ └── UserControllerTests.cs │ ├── Controllers │ │ ├── BaseControllerTests.cs │ │ ├── ContestControllerTests.cs │ │ ├── CourseControllerTests.cs │ │ ├── FeedbackControllerTests.cs │ │ ├── HomeControllerTests.cs │ │ ├── LessonControllerTests.cs │ │ ├── PracticeControllerTests.cs │ │ ├── ProblemControllerTests.cs │ │ ├── SearchControllerTests.cs │ │ ├── StudentControllerTests.cs │ │ ├── SubmissionControllerTests.cs │ │ └── UserControllerTests.cs │ ├── Infrastructure │ │ └── Routes │ │ │ └── RouteStringTests.cs │ ├── JudgeSystem.Web.Tests.csproj │ ├── Mocks │ │ ├── AzureStorageServiceMock.cs │ │ ├── DistributedCacheMock.cs │ │ └── HostingEnvironmentMock.cs │ ├── Routes │ │ └── FeedbackControllerRouteTests.cs │ ├── SeleniumServerFactory.cs │ ├── SeleniumTests.cs │ ├── TestData │ │ ├── ApplicationUserTestData.cs │ │ ├── ContestTestData.cs │ │ ├── CourseTestData.cs │ │ ├── ExecutedTestTestData.cs │ │ ├── FeedbackTestData.cs │ │ ├── LessonTestData.cs │ │ ├── PracticeTestData.cs │ │ ├── ProblemTestData.cs │ │ ├── ResourceTestData.cs │ │ ├── RoleTestData.cs │ │ ├── SchoolClassTestData.cs │ │ ├── StudentTestData.cs │ │ ├── SubmissionTestData.cs │ │ ├── TestApplicationUser.cs │ │ ├── TestConstnts.cs │ │ ├── TestTestData.cs │ │ ├── UserContestTestData.cs │ │ └── UserPracticeTestData.cs │ ├── TestStartup.cs │ └── WebTests.cs └── Sandbox │ ├── Program.cs │ ├── Sandbox.csproj │ ├── SandboxOptions.cs │ └── appsettings.json ├── Web ├── JudgeSystem.Web.Dtos │ ├── Common │ │ ├── FileDto.cs │ │ └── TimeRemainingDto.cs │ ├── Contest │ │ └── ContestStartEndTimeDto.cs │ ├── Course │ │ └── ContestCourseDto.cs │ ├── ExecutedTest │ │ └── ExecutedTestResult.cs │ ├── JudgeSystem.Web.Dtos.csproj │ ├── Lesson │ │ ├── ContestLessonDto.cs │ │ └── LessonDto.cs │ ├── ML │ │ ├── UserLesson.cs │ │ └── UserLessonScore.cs │ ├── Problem │ │ ├── ProblemConstraintsDto.cs │ │ ├── ProblemDto.cs │ │ └── ProblemSubmissionDto.cs │ ├── Resource │ │ └── ResourceDto.cs │ ├── SchoolClass │ │ └── SchoolClassDto.cs │ ├── Student │ │ └── StudentDto.cs │ ├── Submission │ │ ├── CodeFile.cs │ │ ├── SubmissionCodeDto.cs │ │ ├── SubmissionDto.cs │ │ └── SubmissionResult.cs │ └── Test │ │ ├── TestDataDto.cs │ │ └── TestDto.cs ├── JudgeSystem.Web.Infrastructure │ ├── Attributes │ │ └── Validation │ │ │ ├── AfterDateAttribute.cs │ │ │ └── AfterDateTimeNowAttribute.cs │ ├── Extensions │ │ ├── DateTimeExtensions.cs │ │ ├── EnumExtensions.cs │ │ ├── FormFileExtensions.cs │ │ ├── ModelStateDictionaryExtensions.cs │ │ └── StringExtensions.cs │ ├── JudgeSystem.Web.Infrastructure.csproj │ ├── Pagination │ │ └── PaginationData.cs │ └── Routes │ │ └── RouteString.cs ├── JudgeSystem.Web.InputModels │ ├── AllowedIpAddress │ │ └── AllowedIpAddressInputModel.cs │ ├── Contest │ │ ├── ContestAllowedIpAddressesInputModel.cs │ │ ├── ContestCreateInputModel.cs │ │ └── ContestEditInputModel.cs │ ├── Course │ │ ├── CourseEditModel.cs │ │ └── CourseInputModel.cs │ ├── Feedback │ │ └── FeedbackCreateInputModel.cs │ ├── JudgeSystem.Web.InputModels.csproj │ ├── Lesson │ │ ├── LessonAddPasswordInputModel.cs │ │ ├── LessonChangePasswordInputModel.cs │ │ ├── LessonEditInputModel.cs │ │ ├── LessonInputModel.cs │ │ ├── LessonPasswordInputModel.cs │ │ └── LessonRemovePasswordInputModel.cs │ ├── Problem │ │ ├── ProblemAddTestsInputModel.cs │ │ ├── ProblemEditInputModel.cs │ │ ├── ProblemInputModel.cs │ │ └── ProblemTestInputModel.cs │ ├── Resource │ │ ├── ResourceEditInputModel.cs │ │ └── ResourceInputModel.cs │ ├── Settings │ │ └── UserIdentityConfirmationInputModel.cs │ ├── Student │ │ ├── StudentActivateProfileInputModel.cs │ │ ├── StudentCreateInputModel.cs │ │ └── StudentEditInputModel.cs │ ├── Submission │ │ └── SubmissionInputModel.cs │ ├── Test │ │ ├── TestEditInputModel.cs │ │ └── TestInputModel.cs │ └── User │ │ └── ImportUsersInputModel.cs ├── JudgeSystem.Web.ViewModels │ ├── AllowedIpAddress │ │ └── AllowedIpAddressViewModel.cs │ ├── Contest │ │ ├── ActiveContestViewModel.cs │ │ ├── ContestAllResultsViewModel.cs │ │ ├── ContestAllViewModel.cs │ │ ├── ContestAllowedIpAddressesViewModel.cs │ │ ├── ContestResultViewModel.cs │ │ ├── ContestSubmissionsViewModel.cs │ │ ├── ContestViewModel.cs │ │ ├── FollowingContestViewModel.cs │ │ └── PreviousContestViewModel.cs │ ├── Course │ │ ├── AllCoursesViewModel.cs │ │ ├── CourseLessonsViewModel.cs │ │ └── CourseViewModel.cs │ ├── EntityNotFoundErrorViewModel.cs │ ├── ErrorViewModel.cs │ ├── ExecutedTest │ │ └── ExecutedTestViewModel.cs │ ├── Feedback │ │ ├── AllFeedbacksViewModel.cs │ │ └── FeedbackAllViewModel.cs │ ├── JudgeSystem.Web.ViewModels.csproj │ ├── Lesson │ │ ├── LessonContestViewModel.cs │ │ ├── LessonLinkViewModel.cs │ │ ├── LessonResultsViewModel.cs │ │ ├── LessonViewModel.cs │ │ └── RecommendedLessonViewModel.cs │ ├── Practice │ │ ├── PracticeAllResultsViewModel.cs │ │ ├── PracticeResultsViewModel.cs │ │ └── PracticeSubmissionsViewModel.cs │ ├── Problem │ │ ├── ContestProblemViewModel.cs │ │ ├── LessonProblemViewModel.cs │ │ ├── LessonProblemsViewComponentModel.cs │ │ ├── PracticeProblemViewModel.cs │ │ ├── ProblemAllViewModel.cs │ │ └── ProblemViewModel.cs │ ├── Resource │ │ ├── AllResourcesViewModel.cs │ │ └── ResourceViewModel.cs │ ├── Search │ │ ├── SearchLessonViewModel.cs │ │ ├── SearchProblemViewModel.cs │ │ └── SearchResultsViewModel.cs │ ├── Student │ │ ├── StudentBreifInfoViewModel.cs │ │ ├── StudentProfileViewModel.cs │ │ └── StudentsByClassViewModel.cs │ ├── Submission │ │ └── SubmissionViewModel.cs │ ├── Test │ │ ├── ProblemTestsViewModel.cs │ │ └── TestViewModel.cs │ └── User │ │ ├── UserCompeteResultViewModel.cs │ │ ├── UserNamesViewModel.cs │ │ ├── UserPracticeResultViewModel.cs │ │ ├── UserResultsViewModel.cs │ │ └── UserViewModel.cs └── JudgeSystem.Web │ ├── Areas │ ├── Administration │ │ ├── Controllers │ │ │ ├── AdministrationBaseController.cs │ │ │ ├── AllowedIpAddressController.cs │ │ │ ├── ContestController.cs │ │ │ ├── CourseController.cs │ │ │ ├── FeedbackController.cs │ │ │ ├── LessonController.cs │ │ │ ├── PracticeController.cs │ │ │ ├── ProblemController.cs │ │ │ ├── ResourceController.cs │ │ │ ├── SettingsController.cs │ │ │ ├── StudentController.cs │ │ │ ├── TestController.cs │ │ │ └── UserController.cs │ │ └── Views │ │ │ ├── AllowedIpAddress │ │ │ ├── All.cshtml │ │ │ └── Create.cshtml │ │ │ ├── Contest │ │ │ ├── ActiveContests.cshtml │ │ │ ├── AddAllowedIpAddress.cshtml │ │ │ ├── All.cshtml │ │ │ ├── AllowedIpAddresses.cshtml │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── Submissions.cshtml │ │ │ ├── Course │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ └── Edit.cshtml │ │ │ ├── Feedback │ │ │ └── All.cshtml │ │ │ ├── Lesson │ │ │ ├── AddPassword.cshtml │ │ │ ├── ChangePassword.cshtml │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── RemovePassword.cshtml │ │ │ ├── Practice │ │ │ └── Submissions.cshtml │ │ │ ├── Problem │ │ │ ├── AddTest.cshtml │ │ │ ├── AddTests.cshtml │ │ │ ├── All.cshtml │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ └── Edit.cshtml │ │ │ ├── Resource │ │ │ ├── Create.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── LessonResources.cshtml │ │ │ ├── Settings │ │ │ ├── AddAdministrator.cshtml │ │ │ └── RemoveAdministrator.cshtml │ │ │ ├── Student │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── StudentsByClass.cshtml │ │ │ ├── Test │ │ │ ├── Edit.cshtml │ │ │ └── ProblemTests.cshtml │ │ │ ├── User │ │ │ ├── All.cshtml │ │ │ ├── Import.cshtml │ │ │ └── Results.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ └── _ViewStart.cshtml │ └── Identity │ │ └── Pages │ │ ├── Account │ │ ├── AccessDenied.cshtml │ │ ├── AccessDenied.cshtml.cs │ │ ├── ConfirmEmail.cshtml │ │ ├── ConfirmEmail.cshtml.cs │ │ ├── ForgotPassword.cshtml │ │ ├── ForgotPassword.cshtml.cs │ │ ├── ForgotPasswordConfirmation.cshtml │ │ ├── ForgotPasswordConfirmation.cshtml.cs │ │ ├── Login.cshtml │ │ ├── Login.cshtml.cs │ │ ├── Logout.cshtml │ │ ├── Logout.cshtml.cs │ │ ├── Manage │ │ │ ├── ChangePassword.cshtml │ │ │ ├── ChangePassword.cshtml.cs │ │ │ ├── DeletePersonalData.cshtml │ │ │ ├── DeletePersonalData.cshtml.cs │ │ │ ├── DownloadPersonalData.cshtml │ │ │ ├── DownloadPersonalData.cshtml.cs │ │ │ ├── Index.cshtml │ │ │ ├── Index.cshtml.cs │ │ │ ├── ManageNavPages.cs │ │ │ ├── PersonalData.cshtml │ │ │ ├── PersonalData.cshtml.cs │ │ │ ├── _Layout.cshtml │ │ │ ├── _ManageNav.cshtml │ │ │ ├── _StatusMessage.cshtml │ │ │ └── _ViewStart.cshtml │ │ ├── Register.cshtml │ │ ├── Register.cshtml.cs │ │ ├── ResetPassword.cshtml │ │ └── ResetPassword.cshtml.cs │ │ ├── IdentityAreaConstants.cs │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── Components │ ├── ActiveContestsComponent.cs │ ├── ContestTimerViewComponent.cs │ ├── CourseLinksViewComponent.cs │ ├── CoursesSelectListViewComponent.cs │ ├── CoursesTreeViewComponent.cs │ ├── LessonProblemsViewComponent.cs │ ├── PreviousContestsComponent.cs │ ├── RecommendedLessonsViewComponent.cs │ ├── SchoolClassesOptionsViewComponent.cs │ ├── UserExamsViewComponent.cs │ └── UserNamesViewComponent.cs │ ├── Configuration │ ├── AzureBlobStorageConfiguration.cs │ ├── BusinessLogicConfiguration.cs │ ├── CacheConfiguration.cs │ ├── CompilersConfiguration.cs │ ├── CookieConfiguration.cs │ ├── EmailSendingConfiguration.cs │ ├── IdentityConfiguration.cs │ ├── LocalizationConfiguration.cs │ ├── MvcConfiguration.cs │ ├── RepositoriesConfiguration.cs │ └── SettingsConfiguration.cs │ ├── Controllers │ ├── BaseController.cs │ ├── ContestController.cs │ ├── CourseController.cs │ ├── FeedbackController.cs │ ├── HomeController.cs │ ├── LessonController.cs │ ├── PracticeController.cs │ ├── ProblemController.cs │ ├── ResourceController.cs │ ├── SearchController.cs │ ├── StudentController.cs │ ├── SubmissionController.cs │ └── UserController.cs │ ├── Dockerfile │ ├── Filters │ ├── EndpointExceptionFilter.cs │ └── EntityNotFoundExceptionFilter.cs │ ├── JudgeSystem.Web.csproj │ ├── MLModels │ └── JudgeSystemLessonsModel.zip │ ├── Program.cs │ ├── Resources │ ├── Areas │ │ ├── Administration │ │ │ └── Views │ │ │ │ ├── AllowedIpAddress │ │ │ │ ├── All.bg.resx │ │ │ │ └── Create.bg.resx │ │ │ │ ├── Contest │ │ │ │ ├── ActiveContests.bg.resx │ │ │ │ ├── AddAllowedIpAddresses.bg.resx │ │ │ │ ├── All.bg.resx │ │ │ │ ├── AllowedIpAddresses.bg.resx │ │ │ │ ├── Create.bg.resx │ │ │ │ ├── Delete.bg.resx │ │ │ │ ├── Details.bg.resx │ │ │ │ ├── Edit.bg.resx │ │ │ │ └── Submissions.bg.resx │ │ │ │ ├── Feedback │ │ │ │ └── All.bg.resx │ │ │ │ ├── Practice │ │ │ │ └── Submissions.bg.resx │ │ │ │ ├── Problem │ │ │ │ ├── AddTest.bg.resx │ │ │ │ └── AddTests.bg.resx │ │ │ │ ├── Student │ │ │ │ ├── Edit.bg.resx │ │ │ │ └── StudentsByClass.bg.resx │ │ │ │ ├── Test │ │ │ │ └── Edit.bg.resx │ │ │ │ └── User │ │ │ │ ├── All.bg.resx │ │ │ │ ├── Import.resx │ │ │ │ └── Results.bg.resx │ │ └── Identity │ │ │ └── Pages │ │ │ └── Account │ │ │ ├── ConfirmEmail.bg.resx │ │ │ ├── ForgotPasswordConfirmation.bg.resx │ │ │ ├── Manage │ │ │ ├── DeletePersonalData.bg.resx │ │ │ ├── PersonalData.bg.resx │ │ │ └── _Layout.bg.resx │ │ │ └── ResetPassword.bg.resx │ ├── Resources.SharedResources.bg.resx │ ├── SharedResources.cs │ └── Views │ │ ├── Contest │ │ └── Results.bg.resx │ │ ├── Course │ │ ├── All.bg.resx │ │ ├── Details.bg.resx │ │ └── Lessons.bg.resx │ │ ├── Feedback │ │ └── Send.bg.resx │ │ ├── Home │ │ ├── Documentation.bg.resx │ │ └── Index.bg.resx │ │ ├── Lesson │ │ ├── Details.bg.resx │ │ └── EnterPassword.bg.resx │ │ ├── Practice │ │ └── Results.bg.resx │ │ ├── Search │ │ ├── ErrorView.bg.resx │ │ └── Results.bg.resx │ │ ├── Shared │ │ ├── Components │ │ │ ├── CourseLinks │ │ │ │ └── Default.bg.resx │ │ │ ├── CoursesSelectList │ │ │ │ └── Default.bg.resx │ │ │ ├── CoursesTree │ │ │ │ └── Default.bg.resx │ │ │ ├── RecommendedLessons │ │ │ │ └── Default.bg.resx │ │ │ └── UserExams │ │ │ │ └── Default.bg.resx │ │ ├── SubmissionsList.bg.resx │ │ ├── _CookieConsentPartial.bg.resx │ │ ├── _Layout.bg.resx │ │ ├── _LoginPartial.bg.resx │ │ └── _ProfilePartial.bg.resx │ │ ├── Student │ │ ├── ActivateStudentProfile.bg.resx │ │ └── Profile.bg.resx │ │ ├── Submission │ │ └── Details.bg.resx │ │ └── User │ │ └── MyResults.bg.resx │ ├── Startup.cs │ ├── Utilites │ ├── ImportTests │ │ ├── ParseTestsFromJson.cs │ │ ├── ParseTestsFromTestingProject.cs │ │ ├── ParseTestsFromZip.cs │ │ ├── ParseTestsStartegyFactory.cs │ │ └── ParseTestsStrategy.cs │ └── Utility.cs │ ├── Views │ ├── Contest │ │ └── Results.cshtml │ ├── Course │ │ ├── All.cshtml │ │ ├── Details.cshtml │ │ └── Lessons.cshtml │ ├── Feedback │ │ └── Send.cshtml │ ├── Home │ │ ├── Documentation.cshtml │ │ └── Index.cshtml │ ├── Lesson │ │ ├── Details.cshtml │ │ └── EnterPassword.cshtml │ ├── Practice │ │ └── Results.cshtml │ ├── Search │ │ ├── ErrorView.cshtml │ │ └── Results.cshtml │ ├── Shared │ │ ├── Components │ │ │ ├── ActiveContests │ │ │ │ └── Default.cshtml │ │ │ ├── ContestTimer │ │ │ │ └── Default.cshtml │ │ │ ├── CourseLinks │ │ │ │ └── Default.cshtml │ │ │ ├── CoursesSelectList │ │ │ │ └── Default.cshtml │ │ │ ├── CoursesTree │ │ │ │ └── Default.cshtml │ │ │ ├── LessonProblems │ │ │ │ └── Default.cshtml │ │ │ ├── PreviousContests │ │ │ │ └── Default.cshtml │ │ │ ├── RecommendedLessons │ │ │ │ └── Default.cshtml │ │ │ ├── SchoolClassesOptions │ │ │ │ └── Default.cshtml │ │ │ ├── UserExams │ │ │ │ └── Default.cshtml │ │ │ └── UserNames │ │ │ │ └── Default.cshtml │ │ ├── EntityNotFoundError.cshtml │ │ ├── Error.cshtml │ │ ├── Partials │ │ │ ├── DeleteConfirmationModal.cshtml │ │ │ └── LessonTypeOptions.cshtml │ │ ├── SubmissionsList.cshtml │ │ ├── _ClientSidePaginationPartial.cshtml │ │ ├── _CookieConsentPartial.cshtml │ │ ├── _Layout.cshtml │ │ ├── _LoginPartial.cshtml │ │ ├── _ProfilePartial.cshtml │ │ ├── _SelectLanguagePartial.cshtml │ │ ├── _ServerSidePaginationPartial.cshtml │ │ └── _ValidationScriptsPartial.cshtml │ ├── Student │ │ ├── ActivateStudentProfile.cshtml │ │ └── Profile.cshtml │ ├── Submission │ │ └── Details.cshtml │ ├── User │ │ └── MyResults.cshtml │ ├── _ViewImports.cshtml │ └── _ViewStart.cshtml │ ├── appsettings.Development.json │ ├── bundleconfig.json │ ├── libman.json │ └── wwwroot │ ├── Templates │ ├── Cpp │ │ └── sum.cpp │ ├── EmailTemplates │ │ └── StudentProfileActivation.html │ └── Json │ │ ├── addTestsSchema.json │ │ └── addTestsTemplateFile.json │ ├── css │ ├── site.css │ └── site.min.css │ ├── icon.ico │ ├── images │ ├── error-occured.jpg │ ├── error.jpg │ └── no-access.png │ └── js │ ├── controllers │ ├── contestController.js │ ├── courseController.js │ ├── feedbackController.js │ ├── ipAddressController.js │ ├── resourceController.js │ ├── submissionController.js │ ├── testController.js │ └── userController.js │ ├── countdown.js │ ├── fileUploader.js │ ├── initializeDateTimePicker.js │ ├── notification.js │ ├── pagination.js │ ├── site.js │ └── site.min.js ├── Workers ├── JudgeSystem.Checkers │ ├── Checker.cs │ └── JudgeSystem.Checkers.csproj ├── JudgeSystem.Compilers │ ├── CPlusPlusCompiler.cs │ ├── CSharpCompiler.cs │ ├── Compiler.cs │ ├── CompilerFactory.cs │ ├── ICompiler.cs │ ├── ICompilerFactory.cs │ ├── JavaCompiler.cs │ └── JudgeSystem.Compilers.csproj ├── JudgeSystem.Executors │ ├── CPlusPlusExecutor.cs │ ├── CSharpExecutor.cs │ ├── Executor.cs │ ├── ExecutorFactory.cs │ ├── IExecutor.cs │ ├── IExecutorFactory.cs │ ├── JavaExecutor.cs │ └── JudgeSystem.Executors.csproj └── JudgeSystem.Workers.Common │ ├── CheckerResult.cs │ ├── CompilationSettings.cs │ ├── CompileResult.cs │ ├── ExecutionResult.cs │ ├── JudgeSystem.Workers.Common.csproj │ ├── ProcessExecutionResultType.cs │ └── ProgrammingLanguage.cs └── docker-compose.yml /.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Common/JudgeSystem.Data.Common.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | latest 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Common/Models/BaseDeletableModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JudgeSystem.Data.Common.Models 4 | { 5 | public abstract class BaseDeletableModel : BaseModel, IDeletableEntity 6 | { 7 | public bool IsDeleted { get; set; } 8 | 9 | public DateTime? DeletedOn { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Common/Models/BaseModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace JudgeSystem.Data.Common.Models 5 | { 6 | public abstract class BaseModel : IAuditInfo 7 | { 8 | [Key] 9 | public TKey Id { get; set; } 10 | 11 | public DateTime CreatedOn { get; set; } 12 | 13 | public DateTime? ModifiedOn { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Common/Models/IAuditInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JudgeSystem.Data.Common.Models 4 | { 5 | public interface IAuditInfo 6 | { 7 | DateTime CreatedOn { get; set; } 8 | 9 | DateTime? ModifiedOn { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Common/Models/IDeletableEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JudgeSystem.Data.Common.Models 4 | { 5 | public interface IDeletableEntity 6 | { 7 | bool IsDeleted { get; set; } 8 | 9 | DateTime? DeletedOn { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Common/Models/IOrderable.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Data.Common.Models 2 | { 3 | public interface IOrderable 4 | { 5 | int OrderBy { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Common/Repositories/IDeletableEntityRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | 4 | using JudgeSystem.Data.Common.Models; 5 | 6 | namespace JudgeSystem.Data.Common.Repositories 7 | { 8 | public interface IDeletableEntityRepository : IRepository 9 | where TEntity : class, IDeletableEntity 10 | { 11 | IQueryable AllWithDeleted(); 12 | 13 | IQueryable AllAsNoTrackingWithDeleted(); 14 | 15 | Task GetByIdWithDeletedAsync(params object[] id); 16 | 17 | Task HardDeleteAsync(TEntity entity); 18 | 19 | Task UndeleteAsync(TEntity entity); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Common/Repositories/IRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace JudgeSystem.Data.Common.Repositories 7 | { 8 | public interface IRepository : IDisposable 9 | where TEntity : class 10 | { 11 | IQueryable All(); 12 | 13 | IQueryable AllAsNoTracking(); 14 | 15 | Task AddAsync(TEntity entity); 16 | 17 | Task UpdateAsync(TEntity entity); 18 | 19 | Task DeleteAsync(TEntity entity); 20 | 21 | Task AddRangeAsync(IEnumerable entities); 22 | 23 | Task DeleteRangeAsync(IEnumerable entites); 24 | 25 | Task FindAsync(object id); 26 | 27 | Task SaveChangesAsync(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/AllowedIpAddress.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | using JudgeSystem.Data.Common.Models; 5 | 6 | namespace JudgeSystem.Data.Models 7 | { 8 | public class AllowedIpAddress : BaseDeletableModel 9 | { 10 | public AllowedIpAddress() 11 | { 12 | Contests = new HashSet(); 13 | } 14 | 15 | [Required] 16 | public string Value { get; set; } 17 | 18 | public ICollection Contests { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/AllowedIpAddressContest.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Data.Models 2 | { 3 | public class AllowedIpAddressContest 4 | { 5 | public int AllowedIpAddressId { get; set; } 6 | public AllowedIpAddress AllowedIpAddress { get; set; } 7 | 8 | public int ContestId { get; set; } 9 | public Contest Contest { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/ApplicationRole.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JudgeSystem.Data.Common.Models; 4 | 5 | using Microsoft.AspNetCore.Identity; 6 | 7 | namespace JudgeSystem.Data.Models 8 | { 9 | public class ApplicationRole : IdentityRole, IAuditInfo, IDeletableEntity 10 | { 11 | public ApplicationRole() 12 | : this(null) 13 | { 14 | } 15 | 16 | public ApplicationRole(string name) 17 | : base(name) 18 | { 19 | this.Id = Guid.NewGuid().ToString(); 20 | } 21 | 22 | public DateTime CreatedOn { get; set; } 23 | 24 | public DateTime? ModifiedOn { get; set; } 25 | 26 | public bool IsDeleted { get; set; } 27 | 28 | public DateTime? DeletedOn { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Course.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | using JudgeSystem.Common; 5 | using JudgeSystem.Data.Common.Models; 6 | 7 | namespace JudgeSystem.Data.Models 8 | { 9 | public class Course : BaseDeletableModel 10 | { 11 | public Course() 12 | { 13 | Lessons = new HashSet(); 14 | } 15 | 16 | [Required] 17 | [MaxLength(ModelConstants.CourseNameMaxLength)] 18 | public string Name { get; set; } 19 | 20 | public int OrderBy { get; set; } 21 | 22 | public ICollection Lessons { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Enums/LessonType.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Data.Models.Enums 2 | { 3 | public enum LessonType 4 | { 5 | Homework = 1, 6 | Exercise = 2, 7 | Exam = 3 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Enums/SchoolClassType.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Data.Models.Enums 2 | { 3 | public enum SchoolClassType 4 | { 5 | A = 1, 6 | B = 2, 7 | V = 3, 8 | G = 4, 9 | D = 5 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Enums/SubmissionType.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Data.Models.Enums 2 | { 3 | public enum SubmissionType 4 | { 5 | PlainCode = 1, 6 | ZipFile = 2 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Enums/TestExecutionResultType.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Data.Models.Enums 2 | { 3 | public enum TestExecutionResultType 4 | { 5 | Success = 1, 6 | TimeLimit = 2, 7 | MemoryLimit = 3, 8 | RunTimeError = 4, 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Enums/TestingStrategy.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using static JudgeSystem.Common.ModelConstants; 4 | 5 | namespace JudgeSystem.Data.Models.Enums 6 | { 7 | public enum TestingStrategy 8 | { 9 | [Display(Name = ProblemCheckOutputStrategyDisplayName)] 10 | CheckOutput = 1, 11 | [Display(Name = ProblemRunAutomatedTestsStrategyDisplayName)] 12 | RunAutomatedTests = 2 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Enums/TestsImportStrategy.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using static JudgeSystem.Common.ModelConstants; 4 | 5 | namespace JudgeSystem.Data.Models.Enums 6 | { 7 | public enum TestsImportStrategy 8 | { 9 | [Display(Name = TestJsonImportStrategyDisplayName)] 10 | Json = 1, 11 | [Display(Name = TestZipImportStrategyDisplayName)] 12 | Zip = 2, 13 | [Display(Name = TestingProjectStrategyDisplayName)] 14 | TestingProject = 3 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/ExecutedTest.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Common.Models; 2 | using JudgeSystem.Data.Models.Enums; 3 | 4 | namespace JudgeSystem.Data.Models 5 | { 6 | public class ExecutedTest : BaseModel 7 | { 8 | public ExecutedTest() 9 | { 10 | IsCorrect = false; 11 | ExecutionResultType = TestExecutionResultType.Success; 12 | } 13 | 14 | public bool IsCorrect { get; set; } 15 | 16 | public string Output { get; set; } 17 | 18 | public string Error { get; set; } 19 | 20 | public int TestId { get; set; } 21 | public Test Test { get; set; } 22 | 23 | public int SubmissionId { get; set; } 24 | public Submission Submission { get; set; } 25 | 26 | public double TimeUsed { get; set; } 27 | 28 | public double MemoryUsed { get; set; } 29 | 30 | public TestExecutionResultType ExecutionResultType { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Feedback.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | using JudgeSystem.Data.Common.Models; 5 | 6 | namespace JudgeSystem.Data.Models 7 | { 8 | public class Feedback : BaseDeletableModel 9 | { 10 | [MaxLength(ModelConstants.FeedbackContentMaxLength)] 11 | public string Content { get; set; } 12 | 13 | [Required] 14 | public string SenderId { get; set; } 15 | public ApplicationUser Sender { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/JudgeSystem.Data.Models.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | latest 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Practice.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Data.Common.Models; 4 | 5 | namespace JudgeSystem.Data.Models 6 | { 7 | public class Practice : BaseDeletableModel 8 | { 9 | public Practice() 10 | { 11 | Submissions = new HashSet(); 12 | UserPractices = new HashSet(); 13 | } 14 | 15 | public int LessonId { get; set; } 16 | public Lesson Lesson { get; set; } 17 | 18 | public ICollection Submissions { get; set; } 19 | 20 | public ICollection UserPractices { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Resource.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | using JudgeSystem.Data.Common.Models; 5 | 6 | namespace JudgeSystem.Data.Models 7 | { 8 | public class Resource : BaseModel, IOrderable 9 | { 10 | [Required] 11 | [MaxLength(ModelConstants.ResourceNameMaxLength)] 12 | public string Name { get; set; } 13 | 14 | public int OrderBy { get; set; } 15 | 16 | [Required] 17 | public string FilePath { get; set; } 18 | 19 | public int LessonId { get; set; } 20 | public Lesson Lesson { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/SchoolClass.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | using JudgeSystem.Data.Common.Models; 5 | using JudgeSystem.Data.Models.Enums; 6 | 7 | namespace JudgeSystem.Data.Models 8 | { 9 | public class SchoolClass : BaseDeletableModel 10 | { 11 | public SchoolClass() 12 | { 13 | Students = new HashSet(); 14 | } 15 | 16 | public int ClassNumber { get; set; } 17 | 18 | public SchoolClassType ClassType { get; set; } 19 | 20 | [NotMapped] 21 | public string Name => $"{ClassNumber} {ClassType}"; 22 | 23 | public ICollection Students { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Student.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | using JudgeSystem.Data.Common.Models; 5 | 6 | namespace JudgeSystem.Data.Models 7 | { 8 | public class Student : BaseModel 9 | { 10 | [Required] 11 | [MaxLength(ModelConstants.StudentFullNameMaxLength)] 12 | public string FullName { get; set; } 13 | 14 | [Required] 15 | public string ActivationKeyHash { get; set; } 16 | 17 | [Required] 18 | [MaxLength(ModelConstants.StudentEmailMaxLength)] 19 | public string Email { get; set; } 20 | 21 | public int NumberInCalss { get; set; } 22 | 23 | public bool IsActivated { get; set; } = false; 24 | 25 | public int SchoolClassId { get; set; } 26 | public SchoolClass SchoolClass { get; set; } 27 | 28 | public ApplicationUser User { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/Test.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Common.Models; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | namespace JudgeSystem.Data.Models 6 | { 7 | public class Test : IOrderable 8 | { 9 | public Test() 10 | { 11 | IsTrialTest = false; 12 | ExecutedTests = new HashSet(); 13 | } 14 | 15 | public int Id { get; set; } 16 | 17 | public int OrderBy { get; set; } 18 | 19 | public Problem Problem { get; set; } 20 | public int ProblemId { get; set; } 21 | 22 | public string InputData { get; set; } 23 | 24 | [Required] 25 | public string OutputData { get; set; } 26 | 27 | public bool IsTrialTest { get; set; } 28 | 29 | public ICollection ExecutedTests { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/UserContest.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace JudgeSystem.Data.Models 4 | { 5 | public class UserContest 6 | { 7 | [Required] 8 | public string UserId { get; set; } 9 | public ApplicationUser User { get; set; } 10 | 11 | public int ContestId { get; set; } 12 | public Contest Contest { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data.Models/UserPractice.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace JudgeSystem.Data.Models 4 | { 5 | public class UserPractice 6 | { 7 | [Required] 8 | public string UserId { get; set; } 9 | public ApplicationUser User { get; set; } 10 | 11 | public int PracticeId { get; set; } 12 | public Practice Practice { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/ApplicationRoleStore.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | 3 | using JudgeSystem.Data.Models; 4 | 5 | using Microsoft.AspNetCore.Identity; 6 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore; 7 | 8 | namespace JudgeSystem.Data 9 | { 10 | public class ApplicationRoleStore : RoleStore< 11 | ApplicationRole, 12 | ApplicationDbContext, 13 | string, 14 | IdentityUserRole, 15 | IdentityRoleClaim> 16 | { 17 | public ApplicationRoleStore(ApplicationDbContext context, IdentityErrorDescriber describer = null) 18 | : base(context, describer) 19 | { 20 | } 21 | 22 | protected override IdentityRoleClaim CreateRoleClaim(ApplicationRole role, Claim claim) => 23 | new IdentityRoleClaim 24 | { 25 | RoleId = role.Id, 26 | ClaimType = claim.Type, 27 | ClaimValue = claim.Value, 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/EntityIndexesConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | using JudgeSystem.Data.Common.Models; 5 | 6 | using Microsoft.EntityFrameworkCore; 7 | using Microsoft.EntityFrameworkCore.Metadata; 8 | 9 | namespace JudgeSystem.Data 10 | { 11 | internal static class EntityIndexesConfiguration 12 | { 13 | public static void Configure(ModelBuilder modelBuilder) 14 | { 15 | // IDeletableEntity.IsDeleted index 16 | IEnumerable deletableEntityTypes = modelBuilder.Model 17 | .GetEntityTypes() 18 | .Where(et => et.ClrType != null && typeof(IDeletableEntity).IsAssignableFrom(et.ClrType)); 19 | foreach (IMutableEntityType deletableEntityType in deletableEntityTypes) 20 | { 21 | modelBuilder.Entity(deletableEntityType.ClrType).HasIndex(nameof(IDeletableEntity.IsDeleted)); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20190616194909_ChangeColumnMemoryUsedType.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace JudgeSystem.Data.Migrations 4 | { 5 | public partial class ChangeColumnMemoryUsedType : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AlterColumn( 10 | name: "MemoryUsed", 11 | table: "ExecutedTests", 12 | nullable: false, 13 | oldClrType: typeof(long)); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.AlterColumn( 19 | name: "MemoryUsed", 20 | table: "ExecutedTests", 21 | nullable: false, 22 | oldClrType: typeof(double)); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20190620195218_AddColumnIsActivated.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace JudgeSystem.Data.Migrations 4 | { 5 | public partial class AddColumnIsActivated : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "IsActivated", 11 | table: "Students", 12 | nullable: false, 13 | defaultValue: false); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.DropColumn( 19 | name: "IsActivated", 20 | table: "Students"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20190620195630_ChangeStudentFullNameType.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace JudgeSystem.Data.Migrations 4 | { 5 | public partial class ChangeStudentFullNameType : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AlterColumn( 10 | name: "FullName", 11 | table: "Students", 12 | nullable: true, 13 | oldClrType: typeof(int)); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.AlterColumn( 19 | name: "FullName", 20 | table: "Students", 21 | nullable: false, 22 | oldClrType: typeof(string), 23 | oldNullable: true); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20190623171308_ActualPointsNonNullable.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace JudgeSystem.Data.Migrations 4 | { 5 | public partial class ActualPointsNonNullable : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AlterColumn( 10 | name: "ActualPoints", 11 | table: "Submissions", 12 | nullable: false, 13 | oldClrType: typeof(int), 14 | oldNullable: true); 15 | } 16 | 17 | protected override void Down(MigrationBuilder migrationBuilder) 18 | { 19 | migrationBuilder.AlterColumn( 20 | name: "ActualPoints", 21 | table: "Submissions", 22 | nullable: true, 23 | oldClrType: typeof(int)); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20190721124903_AddSubmissionTypeColumnToProblemEntity.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace JudgeSystem.Data.Migrations 4 | { 5 | public partial class AddSubmissionTypeColumnToProblemEntity : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "SubmissionType", 11 | table: "Problems", 12 | nullable: false, 13 | defaultValue: 0); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.DropColumn( 19 | name: "SubmissionType", 20 | table: "Problems"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20190802210714_RenameAllowedTimeInSecondsToRenameAllowedTimeInMiliseconds.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace JudgeSystem.Data.Migrations 4 | { 5 | public partial class RenameAllowedTimeInSecondsToRenameAllowedTimeInMiliseconds : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.RenameColumn( 10 | name: "AllowedTimeInSeconds", 11 | table: "Problems", 12 | newName: "AllowedTimeInMiliseconds"); 13 | } 14 | 15 | protected override void Down(MigrationBuilder migrationBuilder) 16 | { 17 | migrationBuilder.RenameColumn( 18 | name: "AllowedTimeInMiliseconds", 19 | table: "Problems", 20 | newName: "AllowedTimeInSeconds"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20190803083643_FixProblemColumnName.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace JudgeSystem.Data.Migrations 4 | { 5 | public partial class FixProblemColumnName : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.RenameColumn( 10 | name: "AllowedTimeInMiliseconds", 11 | table: "Problems", 12 | newName: "AllowedTimeInMilliseconds"); 13 | } 14 | 15 | protected override void Down(MigrationBuilder migrationBuilder) 16 | { 17 | migrationBuilder.RenameColumn( 18 | name: "AllowedTimeInMilliseconds", 19 | table: "Problems", 20 | newName: "AllowedTimeInMiliseconds"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20191004142111_FeedbackSenderRequired.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace JudgeSystem.Data.Migrations 4 | { 5 | public partial class FeedbackSenderRequired : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AlterColumn( 10 | name: "SenderId", 11 | table: "Feedbacks", 12 | nullable: false, 13 | oldClrType: typeof(string), 14 | oldNullable: true); 15 | } 16 | 17 | protected override void Down(MigrationBuilder migrationBuilder) 18 | { 19 | migrationBuilder.AlterColumn( 20 | name: "SenderId", 21 | table: "Feedbacks", 22 | nullable: true, 23 | oldClrType: typeof(string)); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20200303161125_AddPropertyInProblemEntity.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace JudgeSystem.Data.Migrations 4 | { 5 | public partial class AddPropertyInProblemEntity : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "TimeIntervalBetweenSubmissionInSeconds", 11 | table: "Problems", 12 | nullable: false, 13 | defaultValue: 0); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.DropColumn( 19 | name: "TimeIntervalBetweenSubmissionInSeconds", 20 | table: "Problems"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20200307075447_AddPropertyTestingStrategyToProblem.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace JudgeSystem.Data.Migrations 4 | { 5 | public partial class AddPropertyTestingStrategyToProblem : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "TestingStrategy", 11 | table: "Problems", 12 | nullable: false, 13 | defaultValue: 1); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.DropColumn( 19 | name: "TestingStrategy", 20 | table: "Problems"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20200308073359_AddAutomatedTestingProjectProperty.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace JudgeSystem.Data.Migrations 5 | { 6 | public partial class AddAutomatedTestingProjectProperty : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.AddColumn( 11 | name: "AutomatedTestingProject", 12 | table: "Problems", 13 | nullable: true); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.DropColumn( 19 | name: "AutomatedTestingProject", 20 | table: "Problems"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Migrations/20200314161459_AddProblemAllowedCodeDifferenceProperty.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace JudgeSystem.Data.Migrations 4 | { 5 | public partial class AddProblemAllowedCodeDifferenceProperty : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "AllowedMinCodeDifferenceInPercentage", 11 | table: "Problems", 12 | nullable: false, 13 | defaultValue: 0); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.DropColumn( 19 | name: "AllowedMinCodeDifferenceInPercentage", 20 | table: "Problems"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/Seeding/ISeeder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace JudgeSystem.Data.Seeding 5 | { 6 | public interface ISeeder 7 | { 8 | Task SeedAsync(ApplicationDbContext dbContext, IServiceProvider serviceProvider); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Data/JudgeSystem.Data/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "DefaultConnection": "Server=DESKTOP-U6PER2I\\SQLEXPRESS;Database=JudgeSystem;Trusted_Connection=True;MultipleActiveResultSets=true" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Documentation/Architecture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/Architecture.jpg -------------------------------------------------------------------------------- /Documentation/Awards/НТИТ-Грамота.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/Awards/НТИТ-Грамота.jpg -------------------------------------------------------------------------------- /Documentation/Awards/НТИТ-ГрамотаКупа.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/Awards/НТИТ-ГрамотаКупа.jpg -------------------------------------------------------------------------------- /Documentation/Awards/НТИТ-Купа.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/Awards/НТИТ-Купа.jpg -------------------------------------------------------------------------------- /Documentation/Awards/УчИМИ - Двадесетата ученическа секция.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/Awards/УчИМИ - Двадесетата ученическа секция.pdf -------------------------------------------------------------------------------- /Documentation/Awards/УчИМИ-Грамота.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/Awards/УчИМИ-Грамота.jpg -------------------------------------------------------------------------------- /Documentation/Awards/УчИМИ-ГрамотаМедал.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/Awards/УчИМИ-ГрамотаМедал.jpg -------------------------------------------------------------------------------- /Documentation/Awards/УчИМИ-Медал.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/Awards/УчИМИ-Медал.jpg -------------------------------------------------------------------------------- /Documentation/Judge System - Documentation.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/Judge System - Documentation.docx -------------------------------------------------------------------------------- /Documentation/Next steps/How to improve Computer science education.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/Next steps/How to improve Computer science education.pptx -------------------------------------------------------------------------------- /Documentation/Next steps/Judge System next steps.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/Next steps/Judge System next steps.docx -------------------------------------------------------------------------------- /Documentation/SubmissionEvaluation.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/SubmissionEvaluation.jpg -------------------------------------------------------------------------------- /Documentation/TestGenerator/SolutionTransformer/Code/Code.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SumSquenece 4 | { 5 | class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | int n = int.Parse(data[index++]); 10 | int k = int.Parse(data[index++]); 11 | int[] nums = new int[n]; 12 | int sum = 0; 13 | nums[0] = 1; 14 | for (int i = 1; i < n; i++) 15 | { 16 | int initialPlace; 17 | if (i - k < 0) 18 | { 19 | initialPlace = 0; 20 | } 21 | else 22 | { 23 | initialPlace = i - k; 24 | } 25 | for (int j = initialPlace; j < i; j++) 26 | { 27 | sum += nums[j]; 28 | } 29 | nums[i] = sum; 30 | sum = 0; 31 | } 32 | lines.AppendLine(string.Join(" ", nums)); 33 | 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Documentation/TestGenerator/SolutionTransformer/SolutionTransformer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Documentation/TestGenerator/TestGenerator/Data/inputs.txt: -------------------------------------------------------------------------------- 1 | 6 2 | 3 3 | 4 | 8 5 | 2 6 | 7 | 9 8 | 5 9 | 10 | 12 11 | 2 12 | 13 | 10 14 | 10 -------------------------------------------------------------------------------- /Documentation/TestGenerator/TestGenerator/Data/tests.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "InputData": "6\r\n3", 4 | "OutputData": "1 1 2 4 7 13", 5 | "IsTrialTest": false 6 | }, 7 | { 8 | "InputData": "8\r\n2", 9 | "OutputData": "1 1 2 3 5 8 13 21", 10 | "IsTrialTest": false 11 | }, 12 | { 13 | "InputData": "9\r\n5", 14 | "OutputData": "1 1 2 4 8 16 31 61 120", 15 | "IsTrialTest": false 16 | }, 17 | { 18 | "InputData": "12\r\n2", 19 | "OutputData": "1 1 2 3 5 8 13 21 34 55 89 144", 20 | "IsTrialTest": false 21 | }, 22 | { 23 | "InputData": "10\r\n10", 24 | "OutputData": "1 1 2 4 8 16 32 64 128 256", 25 | "IsTrialTest": false 26 | } 27 | ] -------------------------------------------------------------------------------- /Documentation/TestGenerator/TestGenerator/Test.cs: -------------------------------------------------------------------------------- 1 | namespace TestGenerator 2 | { 3 | public class Test 4 | { 5 | public string InputData { get; set; } 6 | 7 | public string OutputData { get; set; } 8 | 9 | public bool IsTrialTest { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Documentation/TestGenerator/TestGenerator/TestGenerator.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/coursesModule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/coursesModule.png -------------------------------------------------------------------------------- /Documentation/usersModule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Documentation/usersModule.png -------------------------------------------------------------------------------- /JudgeSystem.Common/AppSettingsSections.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Common 2 | { 3 | public static class AppSettingsSections 4 | { 5 | public const string AdminSection = "Admin"; 6 | 7 | public const string AzureBlobSection = "AzureBlob"; 8 | 9 | public const string EmailSection = "Email"; 10 | 11 | public const string SendGridSection = "SendGrid"; 12 | 13 | public const string CompilersSection = "Compilers"; 14 | 15 | public const string WorkingDirectory = "WorkingDirectory"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JudgeSystem.Common/Exceptions/BadRequestException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JudgeSystem.Common.Exceptions 4 | { 5 | public class BadRequestException : ArgumentException 6 | { 7 | private const string DefaultMessage = "The request was not correct."; 8 | 9 | public BadRequestException() : base(DefaultMessage) 10 | { 11 | } 12 | 13 | public BadRequestException(string message) : base(message) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JudgeSystem.Common/Exceptions/EntityNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JudgeSystem.Common.Exceptions 4 | { 5 | public class EntityNotFoundException : ArgumentException 6 | { 7 | private const string DefaultMessage = "The required entity was not found."; 8 | 9 | public EntityNotFoundException() : base(DefaultMessage) 10 | { 11 | } 12 | 13 | public EntityNotFoundException(string entityName) : base(string.Format(ErrorMessages.NotFoundEntityMessage, entityName)) 14 | { 15 | } 16 | 17 | public EntityNotFoundException(string message, string entityName) : base(message, entityName) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JudgeSystem.Common/Extensions/EnumerableExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace JudgeSystem.Common.Extensions 5 | { 6 | public static class EnumerableExtensions 7 | { 8 | public static IQueryable GetPage(this IQueryable collection, int page, int entitesPerPage) => 9 | collection 10 | .Skip(CalculateEntitesToSkip(page, entitesPerPage)) 11 | .Take(entitesPerPage); 12 | 13 | public static IEnumerable GetPage(this IEnumerable collection, int page, int entitesPerPage) => 14 | collection 15 | .Skip(CalculateEntitesToSkip(page, entitesPerPage)) 16 | .Take(entitesPerPage); 17 | 18 | public static int CalculateEntitesToSkip(int page, int entitesPerPage) => (page - 1) * entitesPerPage; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JudgeSystem.Common/Extensions/StreamExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading.Tasks; 3 | 4 | namespace JudgeSystem.Common.Extensions 5 | { 6 | public static class StreamExtensions 7 | { 8 | public static byte[] ToArray(this Stream stream) 9 | { 10 | using (var memoryStream = new MemoryStream()) 11 | { 12 | using (stream) 13 | { 14 | stream.CopyTo(memoryStream); 15 | return memoryStream.ToArray(); 16 | } 17 | } 18 | } 19 | 20 | public static async Task ReadToEndAsync(this Stream stream) 21 | { 22 | using (var streamReader = new StreamReader(stream)) 23 | { 24 | return await streamReader.ReadToEndAsync(); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /JudgeSystem.Common/Helpers/UserHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace JudgeSystem.Common.Helpers 4 | { 5 | public static class UserHelper 6 | { 7 | public static string GetUsernameFromEmail(string email) => email.Split('@').First(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /JudgeSystem.Common/JudgeSystem.Common.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | latest 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /JudgeSystem.Common/Models/Result.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace JudgeSystem.Common.Models 5 | { 6 | public class Result 7 | { 8 | public Result() 9 | { 10 | Errors = new List(); 11 | } 12 | 13 | public Result(IEnumerable errors) 14 | { 15 | Errors = errors.ToList(); 16 | } 17 | 18 | public bool Succeeded => Errors == null || Errors.Count() == 0; 19 | 20 | public List Errors { get; set; } 21 | 22 | public static Result Success() => new Result(); 23 | 24 | public static Result Failure(IEnumerable errors) => new Result(errors); 25 | 26 | public static Result Failure(params string[] errors) => new Result(errors); 27 | 28 | public static implicit operator Result(string value) => new Result(new List() { value }); 29 | 30 | public static implicit operator Result(List errors) => new Result(errors); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /JudgeSystem.Common/Settings/AdminSettings.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Common.Settings 2 | { 3 | public class AdminSettings 4 | { 5 | public string Name { get; set; } 6 | 7 | public string Email { get; set; } 8 | 9 | public string Username { get; set; } 10 | 11 | public string Surname { get; set; } 12 | 13 | public string Password { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JudgeSystem.Common/Settings/AzureBlobSettings.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Common.Settings 2 | { 3 | public class AzureBlobSettings 4 | { 5 | public string StorageConnectionString { get; set; } 6 | 7 | public string ContainerName { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /JudgeSystem.Common/Validator.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Common.Exceptions; 2 | 3 | namespace JudgeSystem.Common 4 | { 5 | public static class Validator 6 | { 7 | public static void ThrowEntityNotFoundExceptionIfEntityIsNull(object entity, string name) 8 | { 9 | if(entity == null) 10 | { 11 | throw new EntityNotFoundException(name); 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Data/ExecutedTestService.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | 4 | using JudgeSystem.Data.Common.Repositories; 5 | using JudgeSystem.Data.Models; 6 | 7 | namespace JudgeSystem.Services.Data 8 | { 9 | public class ExecutedTestService : IExecutedTestService 10 | { 11 | private readonly IRepository repository; 12 | 13 | public ExecutedTestService(IRepository repository) 14 | { 15 | this.repository = repository; 16 | } 17 | 18 | public async Task Create(ExecutedTest executedTest) => await repository.AddAsync(executedTest); 19 | 20 | public async Task DeleteExecutedTestsByTestId(int testId) 21 | { 22 | var entities = repository.All().Where(t => t.TestId == testId).ToList(); 23 | await repository.DeleteRangeAsync(entities); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Data/IAllowedIpAddressService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | using JudgeSystem.Web.InputModels.AllowedIpAddress; 5 | using JudgeSystem.Web.ViewModels.AllowedIpAddress; 6 | 7 | namespace JudgeSystem.Services.Data 8 | { 9 | public interface IAllowedIpAddressService 10 | { 11 | Task Create(AllowedIpAddressInputModel model); 12 | 13 | IEnumerable All(); 14 | 15 | IEnumerable ContestAllowedIpAddresses(int contestId); 16 | 17 | IEnumerable NotAddedIpAdresses(int contestId); 18 | 19 | Task Delete(int id); 20 | 21 | T GetById(int id); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Data/ICourseService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | using JudgeSystem.Web.InputModels.Course; 5 | using JudgeSystem.Web.ViewModels.Course; 6 | 7 | namespace JudgeSystem.Services.Data 8 | { 9 | public interface ICourseService 10 | { 11 | Task Add(CourseInputModel course); 12 | 13 | IEnumerable All(); 14 | 15 | string GetName(int courseId); 16 | 17 | TDestination GetById(int courseId); 18 | 19 | Task Updade(CourseEditModel model); 20 | 21 | Task Delete(int id); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Data/IExecutedTestService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | using JudgeSystem.Data.Models; 4 | 5 | namespace JudgeSystem.Services.Data 6 | { 7 | public interface IExecutedTestService 8 | { 9 | Task Create(ExecutedTest executedTest); 10 | 11 | Task DeleteExecutedTestsByTestId(int testId); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Data/IFeedbackService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | using JudgeSystem.Web.InputModels.Feedback; 5 | using JudgeSystem.Web.ViewModels.Feedback; 6 | 7 | namespace JudgeSystem.Services.Data 8 | { 9 | public interface IFeedbackService 10 | { 11 | Task Create(FeedbackCreateInputModel feedback, string senderId); 12 | 13 | IEnumerable All(int page, int feedbacksPerPage); 14 | 15 | int FeedbacksCount(); 16 | 17 | Task Archive(int id); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Data/ILessonsRecommendationService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Web.ViewModels.Lesson; 4 | 5 | namespace JudgeSystem.Services.Data 6 | { 7 | public interface ILessonsRecommendationService 8 | { 9 | List GetTopTenRecommendedLessons(string userId); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Data/IPracticeService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | using JudgeSystem.Web.Dtos.Lesson; 4 | using JudgeSystem.Web.ViewModels.Practice; 5 | 6 | namespace JudgeSystem.Services.Data 7 | { 8 | public interface IPracticeService 9 | { 10 | Task Create(int lessonId); 11 | 12 | Task AddUserToPracticeIfNotAdded(string userId, int value); 13 | 14 | Task GetLesson(int practiceId); 15 | 16 | PracticeAllResultsViewModel GetPracticeResults(int id, int page, int entitesPerPage); 17 | 18 | int GetPracticeResultsPagesCount(int id, int entitesPerPage); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Data/IResourceService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | using JudgeSystem.Web.ViewModels.Resource; 5 | using JudgeSystem.Web.InputModels.Resource; 6 | using JudgeSystem.Web.Dtos.Resource; 7 | 8 | namespace JudgeSystem.Services.Data 9 | { 10 | public interface IResourceService 11 | { 12 | Task GetById(int id); 13 | 14 | Task CreateResource(ResourceInputModel model, string filePath); 15 | 16 | IEnumerable LessonResources(int lessonId); 17 | 18 | Task Update(ResourceEditInputModel model, string filePath = null); 19 | 20 | Task Delete(int id); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Data/ISchoolClassService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | using JudgeSystem.Data.Models.Enums; 5 | using JudgeSystem.Web.Dtos.SchoolClass; 6 | 7 | namespace JudgeSystem.Services.Data 8 | { 9 | public interface ISchoolClassService 10 | { 11 | IEnumerable GetAllClasses(); 12 | 13 | bool ClassExists(int classNumber, SchoolClassType classType); 14 | 15 | Task Create(int classNumber, SchoolClassType classType); 16 | 17 | Task GetById(int id); 18 | 19 | Task GetGrade(int id); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Data/ITestService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | using JudgeSystem.Web.Dtos.Test; 5 | using JudgeSystem.Web.ViewModels.Test; 6 | using JudgeSystem.Web.InputModels.Test; 7 | using JudgeSystem.Web.InputModels.Problem; 8 | 9 | namespace JudgeSystem.Services.Data 10 | { 11 | public interface ITestService 12 | { 13 | Task Add(TestInputModel model); 14 | 15 | Task AddRange(IEnumerable tests, int problemId); 16 | 17 | IEnumerable GetTestsByProblemIdOrderedByIsTrialDescending(int problemId); 18 | 19 | Task GetById(int id); 20 | 21 | Task Delete(int id); 22 | 23 | Task Update(TestEditInputModel test); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Data/IUserService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | using JudgeSystem.Services.Models.Users; 5 | using JudgeSystem.Web.ViewModels.User; 6 | 7 | namespace JudgeSystem.Services.Data 8 | { 9 | public interface IUserService 10 | { 11 | List GetContestResults(string userId); 12 | 13 | List GetPracticeResults(string userId); 14 | 15 | IEnumerable GetUserExamResults(string userId); 16 | 17 | Task DeleteUserData(string userId, string studentId); 18 | 19 | Task GetUserNames(string userId); 20 | 21 | IEnumerable All(); 22 | 23 | bool IsExistingUserWithNotConfirmedEmail(string username); 24 | 25 | Task ImportAsync(IEnumerable users); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Mapping/IHaveCustomMappings.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | 3 | namespace JudgeSystem.Services.Mapping 4 | { 5 | public interface IHaveCustomMappings 6 | { 7 | void CreateMappings(IProfileExpression configuration); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Mapping/IMapFrom.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services.Mapping 2 | { 3 | public interface IMapFrom 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Mapping/IMapTo.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services.Mapping 2 | { 3 | public interface IMapTo 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Mapping/JudgeSystem.Services.Mapping.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | latest 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Messaging/BaseEmailOptions.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services.Messaging 2 | { 3 | public class BaseEmailOptions 4 | { 5 | public string Username { get; set; } 6 | 7 | public string Name { get; set; } 8 | 9 | public string Surname { get; set; } 10 | 11 | public string Fullname => $"{Name} {Surname}"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Messaging/JudgeSystem.Services.Messaging.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | latest 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Messaging/SendGridOptions.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services.Messaging 2 | { 3 | public class SendGridOptions 4 | { 5 | public string SendGridUser { get; set; } 6 | 7 | public string SendGridKey { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Models/JudgeSystem.Services.Models.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services.Models/Users/UserImportServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services.Models.Users 2 | { 3 | public class UserImportServiceModel 4 | { 5 | public string Email { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IAzureStorageService.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading.Tasks; 3 | 4 | namespace JudgeSystem.Services 5 | { 6 | public interface IAzureStorageService 7 | { 8 | Task Upload(Stream stream, string inputFileName, string containerName); 9 | 10 | Task Download(string filePath, Stream stream); 11 | 12 | Task Delete(string filePath); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IChecker.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Services.Models; 4 | using JudgeSystem.Web.Dtos.Test; 5 | using JudgeSystem.Workers.Common; 6 | 7 | namespace JudgeSystem.Services 8 | { 9 | public interface IChecker 10 | { 11 | CheckerResult Check(ExecutionResult executionResult, string expectedOutput); 12 | 13 | IEnumerable CheckAutomatedTestsOutput(IEnumerable tests, ProcessResult testResults, string workingDirectory); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/ICodeCompareer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JudgeSystem.Services 4 | { 5 | public interface ICodeCompareer 6 | { 7 | double GetMinCodeDifference(string sourceCode, IEnumerable otherCodes); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IEstimator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JudgeSystem.Web.Dtos.Common; 4 | 5 | namespace JudgeSystem.Services 6 | { 7 | public interface IEstimator 8 | { 9 | int CalculteProblemPoints(int testsCount, int passedTests, int maxPoints); 10 | 11 | TimeRemainingDto CalculateRemainingTime(DateTime endTime); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IExcelFileGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Web.ViewModels.Contest; 4 | using JudgeSystem.Web.ViewModels.Practice; 5 | 6 | namespace JudgeSystem.Services 7 | { 8 | public interface IExcelFileGenerator 9 | { 10 | byte[] Generate(List columns, object[,] data); 11 | 12 | byte[] GenerateContestResultsReport(ContestAllResultsViewModel contestResultsData, List columns); 13 | 14 | byte[] GeneratePracticeResultsReport(PracticeAllResultsViewModel practiceResultsData, List columns); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IFileSystemService.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading.Tasks; 3 | using System.Collections.Generic; 4 | 5 | using JudgeSystem.Web.Dtos.Common; 6 | 7 | namespace JudgeSystem.Services 8 | { 9 | public interface IFileSystemService 10 | { 11 | string CreateDirectory(string directoryPath, string name); 12 | 13 | void DeleteDirectory(string directoryPath); 14 | 15 | void AddFilesInDirectory(string directoryPath, IEnumerable files); 16 | 17 | Task CreateFile(Stream stream, string filePath); 18 | 19 | Task CreateFile(byte[] fileData, string filePath); 20 | 21 | void ExtractZipToDirectory(string filePath, string destinationDirectory); 22 | 23 | void ExtractZipToDirectory(string filePath, string destinationDirectory, bool overwrite); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IJsonUtiltyService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | 4 | namespace JudgeSystem.Services 5 | { 6 | public interface IJsonUtiltyService 7 | { 8 | T ParseJsonFormStreamUsingJSchema(Stream stream, string schemaFilePath, ICollection messages); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IPaginationService.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services 2 | { 3 | public interface IPaginationService 4 | { 5 | int CalculatePagesCount(int elementsCount, int elementsPerPage); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IPasswordHashService.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services 2 | { 3 | public interface IPasswordHashService 4 | { 5 | string HashPassword(string password); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IProcessRunner.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | using JudgeSystem.Services.Models; 4 | 5 | namespace JudgeSystem.Services 6 | { 7 | public interface IProcessRunner 8 | { 9 | Task Run(string arguments, string workingDirectory, int timeout = ProcessRunner.DefaultTimeout); 10 | 11 | string PrependChangeDirectoryCommand(string command, string directoryPath); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IRouteBuilder.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Models.Enums; 2 | 3 | namespace JudgeSystem.Services 4 | { 5 | public interface IRouteBuilder 6 | { 7 | string BuildStudentByClassRoute(int? classNumber, SchoolClassType? classType, string methodName); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IStringFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services 2 | { 3 | public interface IStringFormatter 4 | { 5 | string FormatPoints(int actualPoints, int maxPoints); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IStudentProfileService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace JudgeSystem.Services 4 | { 5 | public interface IStudentProfileService 6 | { 7 | Task SendActivationEmail(string email, string baseUrl); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/IValidationService.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services 2 | { 3 | public interface IValidationService 4 | { 5 | bool IsValidFileExtension(string fileName); 6 | 7 | bool IsValidFileExtension(string fileName, params string[] extensions); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/Models/AutomatedTestResult.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Web.Dtos.Test; 2 | 3 | namespace JudgeSystem.Services.Models 4 | { 5 | public class AutomatedTestResult 6 | { 7 | public AutomatedTestResult(string ouput, bool isCorrect, TestDataDto testData) 8 | { 9 | Ouput = ouput; 10 | IsCorrect = isCorrect; 11 | TestData = testData; 12 | } 13 | 14 | public string Ouput { get; set; } 15 | 16 | public bool IsCorrect { get; set; } 17 | 18 | public TestDataDto TestData { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/Models/ProcessResult.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services.Models 2 | { 3 | public class ProcessResult 4 | { 5 | public ProcessResult(string output, string errors) 6 | { 7 | Output = output; 8 | Errors = errors; 9 | } 10 | 11 | public string Output { get; set; } 12 | 13 | public string Errors { get; set; } 14 | 15 | public bool IsSuccessfull => string.IsNullOrEmpty(Errors); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/PaginationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JudgeSystem.Services 4 | { 5 | public class PaginationService : IPaginationService 6 | { 7 | private const string InvalidElementsPerPageErrorMessage = "Elements per page cannot be negative or zero number."; 8 | private const string InvalidElementsCountErrorMessage = "Elements count cannot be negative number."; 9 | 10 | public int CalculatePagesCount(int elementsCount, int elementsPerPage) 11 | { 12 | if (elementsPerPage <= 0) 13 | { 14 | throw new ArgumentException(InvalidElementsPerPageErrorMessage); 15 | } 16 | 17 | if (elementsCount < 0) 18 | { 19 | throw new ArgumentException(InvalidElementsCountErrorMessage); 20 | } 21 | 22 | return (int)Math.Ceiling((double)elementsCount / elementsPerPage); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/PasswordHashService.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Cryptography; 2 | using System.Text; 3 | 4 | namespace JudgeSystem.Services 5 | { 6 | public class PasswordHashService : IPasswordHashService 7 | { 8 | public string HashPassword(string password) 9 | { 10 | using (var sha256Hash = SHA256.Create()) 11 | { 12 | // ComputeHash - returns byte array 13 | byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(password)); 14 | 15 | // Convert byte array to a string 16 | var builder = new StringBuilder(); 17 | for (int i = 0; i < bytes.Length; i++) 18 | { 19 | builder.Append(bytes[i].ToString("x2")); 20 | } 21 | return builder.ToString(); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/RouteBuilder.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Common; 2 | using JudgeSystem.Data.Models.Enums; 3 | 4 | namespace JudgeSystem.Services 5 | { 6 | public class RouteBuilder : IRouteBuilder 7 | { 8 | public string BuildStudentByClassRoute(int? classNumber, SchoolClassType? classType, string methodName) 9 | { 10 | string url = $"/{GlobalConstants.AdministrationArea}/Student/{methodName}?"; 11 | if (classNumber.HasValue) 12 | { 13 | url += $"{nameof(classNumber)}={classNumber}&"; 14 | } 15 | 16 | if (classType.HasValue) 17 | { 18 | url += $"{nameof(classType)}={classType}&"; 19 | } 20 | 21 | url += $"{GlobalConstants.PageKey}={{0}}"; 22 | return url; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/StringFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services 2 | { 3 | public class StringFormatter : IStringFormatter 4 | { 5 | public string FormatPoints(int actualPoints, int maxPoints) => $"{actualPoints}/{maxPoints}"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/ValidationService.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Linq; 3 | 4 | using JudgeSystem.Common; 5 | 6 | namespace JudgeSystem.Services 7 | { 8 | public class ValidationService : IValidationService 9 | { 10 | public bool IsValidFileExtension(string fileName) 11 | { 12 | string[] allowedExtensions = GlobalConstants.AllowedFileExtensoins; 13 | string fileExtension = Path.GetExtension(fileName); 14 | return allowedExtensions.Contains(fileExtension); 15 | } 16 | 17 | public bool IsValidFileExtension(string fileName, params string[] extensions) 18 | { 19 | string fileExtension = Path.GetExtension(fileName); 20 | return extensions.Contains(fileExtension); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/Validations/Contracts/IEmailValidationService.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services.Validations.Contracts 2 | { 3 | public interface IEmailValidationService 4 | { 5 | bool IsValid(string email); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Services/JudgeSystem.Services/Validations/Contracts/IUserValidationService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Common.Models; 4 | 5 | using JudgeSystem.Services.Models.Users; 6 | 7 | namespace JudgeSystem.Services.Validations.Contracts 8 | { 9 | public interface IUserValidationService 10 | { 11 | Result ValidateUsersForImport(IEnumerable users); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Services.Data.Tests/ClassFixtures/InMemoryDatabaseFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JudgeSystem.Data; 4 | using JudgeSystem.Services.Data.Tests.Factories; 5 | 6 | namespace JudgeSystem.Services.Data.Tests.ClassFixtures 7 | { 8 | public class InMemoryDatabaseFactory : IDisposable 9 | { 10 | public ApplicationDbContext Context { get; private set; } 11 | 12 | public InMemoryDatabaseFactory() 13 | { 14 | Context = ApplicationDbContextFactory.CreateInMemoryDatabase(); 15 | } 16 | 17 | public void Dispose() 18 | { 19 | Context.Dispose(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Services.Data.Tests/ClassFixtures/MappingsProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | using JudgeSystem.Services.Mapping; 4 | using JudgeSystem.Web.Dtos.Lesson; 5 | using JudgeSystem.Web.InputModels.Course; 6 | using JudgeSystem.Web.ViewModels; 7 | 8 | namespace JudgeSystem.Services.Data.Tests.ClassFixtures 9 | { 10 | public class MappingsProvider 11 | { 12 | public MappingsProvider() 13 | { 14 | //Register all mappings in the app 15 | AutoMapperConfig.RegisterMappings(typeof(ErrorViewModel).GetTypeInfo().Assembly, 16 | typeof(CourseInputModel).GetTypeInfo().Assembly, typeof(ContestLessonDto).Assembly); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Services.Data.Tests/Factories/ApplicationDbContextFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JudgeSystem.Data; 4 | 5 | using Microsoft.EntityFrameworkCore; 6 | 7 | namespace JudgeSystem.Services.Data.Tests.Factories 8 | { 9 | public static class ApplicationDbContextFactory 10 | { 11 | public static ApplicationDbContext CreateInMemoryDatabase() 12 | { 13 | DbContextOptions options = new DbContextOptionsBuilder() 14 | .UseInMemoryDatabase(Guid.NewGuid().ToString()) 15 | .Options; 16 | 17 | return new ApplicationDbContext(options); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Services.Data.Tests/SingletonDbContextProvider.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data; 2 | using JudgeSystem.Services.Data.Tests.ClassFixtures; 3 | 4 | using Xunit; 5 | 6 | namespace JudgeSystem.Services.Data.Tests 7 | { 8 | public class SingletonDbContextProvider : IClassFixture, IClassFixture 9 | { 10 | protected ApplicationDbContext Context { get; set; } 11 | 12 | public SingletonDbContextProvider(InMemoryDatabaseFactory factory) 13 | { 14 | Context = factory.Context; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Services.Data.Tests/TransientDbContextProvider.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data; 2 | using JudgeSystem.Services.Data.Tests.ClassFixtures; 3 | using JudgeSystem.Services.Data.Tests.Factories; 4 | 5 | using Xunit; 6 | 7 | namespace JudgeSystem.Services.Data.Tests 8 | { 9 | public class TransientDbContextProvider : IClassFixture 10 | { 11 | protected readonly ApplicationDbContext context; 12 | 13 | public TransientDbContextProvider() 14 | { 15 | context = ApplicationDbContextFactory.CreateInMemoryDatabase(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Services.Tests/FileSystemServiceTests.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | using Xunit; 4 | 5 | namespace JudgeSystem.Services.Tests 6 | { 7 | public class FileSystemServiceTests 8 | { 9 | private readonly FileSystemService fileSystem; 10 | 11 | public FileSystemServiceTests() 12 | { 13 | fileSystem = new FileSystemService(); 14 | } 15 | 16 | [Fact] 17 | public void DeleteDirectory_WithExistingPath_ShouldDeleteTheDirectoryAndAllFilesInIt() 18 | { 19 | string directoryName = "testDirectory"; 20 | DirectoryInfo directoryInfo = Directory.CreateDirectory(directoryName); 21 | File.WriteAllText(Path.Combine(directoryInfo.FullName, "test.txt"), "This is test file with should be deleted!"); 22 | 23 | fileSystem.DeleteDirectory(directoryName); 24 | 25 | Assert.False(Directory.Exists(directoryInfo.FullName)); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Services.Tests/JudgeSystem.Services.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp2.2 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Services.Tests/ServiceTestsConstants.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Services.Tests 2 | { 3 | public static class ServiceTestsConstants 4 | { 5 | public const string TestDataFolderName = "TestData"; 6 | 7 | public static string TestDataFolderPath = $"../../../{TestDataFolderName}"; 8 | 9 | public static string ZippedSolutionPath = $"{TestDataFolderPath}/ZippedSolution.zip"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Services.Tests/StringFormatterTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace JudgeSystem.Services.Tests 4 | { 5 | public class StringFormatterTests 6 | { 7 | [Fact] 8 | public void FormatPoints_WithActualPointsAndMaxPointsAsParameters_ShouldReturnCorrectlyFormattedString() 9 | { 10 | int actualPoints = 10; 11 | int maxPoints = 100; 12 | var formatter = new StringFormatter(); 13 | 14 | string result = formatter.FormatPoints(actualPoints, maxPoints); 15 | 16 | Assert.Equal($"{actualPoints}/{maxPoints}", result); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Services.Tests/TestData/ZippedSolution.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Tests/JudgeSystem.Services.Tests/TestData/ZippedSolution.zip -------------------------------------------------------------------------------- /Tests/JudgeSystem.Web.Tests/Administration/Controllers/AdministrationBaseControllerTests.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Common; 2 | using JudgeSystem.Web.Areas.Administration.Controllers; 3 | 4 | using MyTested.AspNetCore.Mvc; 5 | using Xunit; 6 | 7 | namespace JudgeSystem.Web.Tests.Administration.Controllers 8 | { 9 | public class AdministrationBaseControllerTests 10 | { 11 | 12 | [Fact] 13 | public void ShouldBeAllowedOnlyForAdministratorsAndBeInAreaAdministration() => 14 | MyController 15 | .Instance() 16 | .ShouldHave() 17 | .Attributes(attributes => attributes 18 | .RestrictingForAuthorizedRequests(GlobalConstants.AdministratorRoleName) 19 | .SpecifyingArea(GlobalConstants.AdministrationArea)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Web.Tests/Mocks/HostingEnvironmentMock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | using Microsoft.AspNetCore.Hosting; 5 | using Microsoft.AspNetCore.Hosting.Internal; 6 | using Moq; 7 | 8 | namespace JudgeSystem.Web.Tests.Mocks 9 | { 10 | public class HostingEnvironmentMock 11 | { 12 | private static readonly string WebRootPath = Path.Combine(Environment.CurrentDirectory, "../../../../../Web/JudgeSystem.Web/wwwroot"); 13 | 14 | public static IHostingEnvironment CreateInstance() 15 | => CreateInstance(WebRootPath); 16 | 17 | public static IHostingEnvironment CreateInstance(string webRootPath) 18 | { 19 | var hostingEnvironmentMock = new Mock(); 20 | hostingEnvironmentMock.Setup(h => h.WebRootPath).Returns(webRootPath); 21 | 22 | return hostingEnvironmentMock.Object; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Web.Tests/SeleniumTests.cs: -------------------------------------------------------------------------------- 1 | using OpenQA.Selenium; 2 | using OpenQA.Selenium.Chrome; 3 | using OpenQA.Selenium.Remote; 4 | using Xunit; 5 | 6 | namespace JudgeSystem.Web.Tests 7 | { 8 | public class SeleniumTests : IClassFixture> 9 | { 10 | private readonly SeleniumServerFactory server; 11 | private readonly IWebDriver browser; 12 | 13 | // Be sure that selenium-server-standalone-3.141.59.jar is running 14 | public SeleniumTests(SeleniumServerFactory server) 15 | { 16 | this.server = server; 17 | server.CreateClient(); 18 | var opts = new ChromeOptions(); 19 | opts.AddArgument("--headless"); // Optional, comment this out if you want to SEE the browser window 20 | opts.AddArgument("no-sandbox"); 21 | browser = new RemoteWebDriver(opts); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Web.Tests/TestData/ApplicationUserTestData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Data.Models; 4 | 5 | namespace JudgeSystem.Web.Tests.TestData 6 | { 7 | public class ApplicationUserTestData 8 | { 9 | public static IEnumerable GenerateUsers() 10 | { 11 | for (int i = 0; i < 10; i++) 12 | { 13 | yield return new ApplicationUser 14 | { 15 | Id = $"id_{i}", 16 | UserName = $"username_{i}", 17 | Surname = $"surname_{i}", 18 | Name = $"name_{i}", 19 | Email = $"email_{i}" 20 | }; 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Web.Tests/TestData/CourseTestData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using JudgeSystem.Data.Models; 4 | 5 | namespace JudgeSystem.Web.Tests.TestData 6 | { 7 | public class CourseTestData 8 | { 9 | public static Course GetEntity() => new Course 10 | { 11 | Id = 1, 12 | Name = "Programming Basics" 13 | }; 14 | 15 | internal static IEnumerable GenerateCourses() 16 | { 17 | for (int i = 0; i < 10; i++) 18 | { 19 | yield return new Course 20 | { 21 | Name = "name" + i, 22 | Id = i + 1 23 | }; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Web.Tests/TestData/ExecutedTestTestData.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Models; 2 | using JudgeSystem.Data.Models.Enums; 3 | using System.Collections.Generic; 4 | 5 | namespace JudgeSystem.Web.Tests.TestData 6 | { 7 | public class ExecutedTestTestData 8 | { 9 | public static ExecutedTest GetEntity() => new ExecutedTest() 10 | { 11 | Id = 1, 12 | Submission = SubmissionTestData.GetEntity(), 13 | Output = "some output", 14 | MemoryUsed = 12, 15 | TimeUsed = 200, 16 | ExecutionResultType = TestExecutionResultType.Success, 17 | Test = TestTestData.GetEntity(), 18 | }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Web.Tests/TestData/ResourceTestData.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Models; 2 | using System.Collections.Generic; 3 | 4 | namespace JudgeSystem.Web.Tests.TestData 5 | { 6 | public class ResourceTestData 7 | { 8 | public static Resource GetEntity() => new Resource 9 | { 10 | Id = 1, 11 | FilePath = "test/file/path", 12 | Lesson = LessonTestData.GetEntity(), 13 | Name = "Conditions" 14 | }; 15 | 16 | public static IEnumerable GenerateResources() 17 | { 18 | for (int i = 0; i < 10; i++) 19 | { 20 | yield return new Resource 21 | { 22 | Id = i + 1, 23 | FilePath = "test file path", 24 | Name = $"resource#{i}", 25 | LessonId = (i % 2) + 1 26 | }; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Web.Tests/TestData/RoleTestData.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Models; 2 | 3 | namespace JudgeSystem.Web.Tests.TestData 4 | { 5 | public class RoleTestData 6 | { 7 | public const string Id = "role_id"; 8 | 9 | public static ApplicationRole GetEntity(string roleName) => new ApplicationRole 10 | { 11 | Id = Id, 12 | Name = roleName, 13 | NormalizedName = roleName.ToUpper() 14 | }; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Web.Tests/TestData/SchoolClassTestData.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Models; 2 | using JudgeSystem.Data.Models.Enums; 3 | 4 | namespace JudgeSystem.Web.Tests.TestData 5 | { 6 | public class SchoolClassTestData 7 | { 8 | public static SchoolClass GetEntity() => new SchoolClass 9 | { 10 | Id = 1, 11 | ClassNumber = 12, 12 | ClassType = SchoolClassType.A 13 | }; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Tests/JudgeSystem.Web.Tests/TestData/TestConstnts.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.Tests.TestData 2 | { 3 | public class TestConstnts 4 | { 5 | public const string StringMoreThan50Symbols = "LongStringLongStringLongStringLongStringLongString52"; 6 | 7 | public const string StringLessThan3Symbols = "12"; 8 | 9 | public const string StringLong10Symbols = "Tensymbols"; 10 | 11 | public const string OtherUserId = "Other_User_Id"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Tests/Sandbox/SandboxOptions.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | 3 | namespace Sandbox 4 | { 5 | [Verb("sandbox", HelpText = "Run sandbox code.")] 6 | public class SandboxOptions 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Tests/Sandbox/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "DefaultConnection": "Server=.;Database=JudgeSystem;Trusted_Connection=True;MultipleActiveResultSets=true" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Common/FileDto.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.Dtos.Common 2 | { 3 | public class FileDto 4 | { 5 | public string Name { get; set; } 6 | 7 | public string Content { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Common/TimeRemainingDto.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.Dtos.Common 2 | { 3 | public class TimeRemainingDto 4 | { 5 | public string ContestName { get; set; } 6 | 7 | public int Days { get; set; } 8 | 9 | public int Hours { get; set; } 10 | 11 | public int Minutes { get; set; } 12 | 13 | public int Seconds { get; set; } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Contest/ContestStartEndTimeDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JudgeSystem.Services.Mapping; 4 | 5 | namespace JudgeSystem.Web.Dtos.Contest 6 | { 7 | public class ContestStartEndTimeDto : IMapFrom 8 | { 9 | public string Name { get; set; } 10 | 11 | public DateTime StartTime { get; set; } 12 | 13 | public DateTime EndTime { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Course/ContestCourseDto.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.Dtos.Course 4 | { 5 | public class ContestCourseDto : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public string Name { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/ExecutedTest/ExecutedTestResult.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.Dtos.ExecutedTest 2 | { 3 | public class ExecutedTestResult 4 | { 5 | public ExecutedTestResult() 6 | { 7 | IsCorrect = false; 8 | } 9 | 10 | public bool IsCorrect { get; set; } 11 | 12 | public string ExecutionResultType { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/JudgeSystem.Web.Dtos.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Lesson/ContestLessonDto.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.Dtos.Lesson 4 | { 5 | public class ContestLessonDto : IMapFrom 6 | { 7 | public string Name { get; set; } 8 | 9 | public int Id { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Lesson/LessonDto.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Models.Enums; 2 | using JudgeSystem.Services.Mapping; 3 | 4 | namespace JudgeSystem.Web.Dtos.Lesson 5 | { 6 | public class LessonDto : IMapFrom 7 | { 8 | public int Id { get; set; } 9 | 10 | public string Name { get; set; } 11 | 12 | public int CourseId { get; set; } 13 | 14 | public string LessonPassword { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/ML/UserLesson.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.ML.Data; 2 | 3 | namespace JudgeSystem.Web.Dtos.ML 4 | { 5 | public class UserLesson 6 | { 7 | [LoadColumn(0)] 8 | public string UserId { get; set; } 9 | 10 | [LoadColumn(1)] 11 | public int LessonId { get; set; } 12 | 13 | [LoadColumn(2)] 14 | public float Label { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/ML/UserLessonScore.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.Dtos.ML 2 | { 3 | public class UserLessonScore 4 | { 5 | public float Score { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Problem/ProblemConstraintsDto.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.Dtos.Problem 4 | { 5 | public class ProblemConstraintsDto : IMapFrom 6 | { 7 | public int AllowedTimeInMilliseconds { get; set; } 8 | 9 | public double AllowedMemoryInMegaBytes { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Problem/ProblemDto.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Models.Enums; 2 | using JudgeSystem.Services.Mapping; 3 | 4 | namespace JudgeSystem.Web.Dtos.Problem 5 | { 6 | public class ProblemDto : IMapFrom 7 | { 8 | public int Id { get; set; } 9 | 10 | public string Name { get; set; } 11 | 12 | public bool IsExtraTask { get; set; } 13 | 14 | public int MaxPoints { get; set; } 15 | 16 | public int AllowedTimeInMilliseconds { get; set; } 17 | 18 | public double AllowedMemoryInMegaBytes { get; set; } 19 | 20 | public int LessonId { get; set; } 21 | 22 | public SubmissionType SubmissionType { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Problem/ProblemSubmissionDto.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Models.Enums; 2 | using JudgeSystem.Services.Mapping; 3 | 4 | namespace JudgeSystem.Web.Dtos.Problem 5 | { 6 | public class ProblemSubmissionDto : IMapFrom 7 | { 8 | public TestingStrategy TestingStrategy { get; set; } 9 | 10 | public byte[] AutomatedTestingProject { get; set; } 11 | 12 | public int TimeIntervalBetweenSubmissionInSeconds { get; set; } 13 | 14 | public int AllowedMinCodeDifferenceInPercentage { get; set; } 15 | 16 | public SubmissionType SubmissionType { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Resource/ResourceDto.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.Dtos.Resource 4 | { 5 | public class ResourceDto : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public string Name { get; set; } 10 | 11 | public string FilePath { get; set; } 12 | 13 | public int LessonId { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/SchoolClass/SchoolClassDto.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Models.Enums; 2 | using JudgeSystem.Services.Mapping; 3 | 4 | namespace JudgeSystem.Web.Dtos.SchoolClass 5 | { 6 | public class SchoolClassDto : IMapFrom 7 | { 8 | public int Id { get; set; } 9 | 10 | public int ClassNumber { get; set; } 11 | 12 | public SchoolClassType ClassType { get; set; } 13 | 14 | public string Name { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Student/StudentDto.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.Dtos.Student 4 | { 5 | public class StudentDto : IMapFrom 6 | { 7 | public string Id { get; set; } 8 | 9 | public string FullName { get; set; } 10 | 11 | public string Email { get; set; } 12 | 13 | public string ActivationKeyHash { get; set; } 14 | 15 | public int NumberInCalss { get; set; } 16 | 17 | public bool IsActivated { get; set; } = false; 18 | 19 | public int SchoolClassId { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Submission/CodeFile.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.Dtos.Submission 2 | { 3 | public class CodeFile 4 | { 5 | public string Name { get; set; } 6 | 7 | public string Code { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Submission/SubmissionCodeDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JudgeSystem.Web.Dtos.Submission 4 | { 5 | public class SubmissionCodeDto 6 | { 7 | public List SourceCodes { get; set; } 8 | 9 | public byte[] Content { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Submission/SubmissionDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JudgeSystem.Services.Mapping; 4 | 5 | namespace JudgeSystem.Web.Dtos.Submission 6 | { 7 | public class SubmissionDto : IMapFrom 8 | { 9 | public int Id { get; set; } 10 | 11 | public byte[] Code { get; set; } 12 | 13 | public byte[] CompilationErrors { get; set; } 14 | 15 | public int ActualPoints { get; set; } 16 | 17 | public int ProblemId { get; set; } 18 | 19 | public int? ContestId { get; set; } 20 | 21 | public int? PracticeId { get; set; } 22 | 23 | public DateTime SubmisionDate { get; set; } 24 | 25 | public string UserId { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Submission/SubmissionResult.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Web.Dtos.ExecutedTest; 2 | 3 | using System.Collections.Generic; 4 | 5 | namespace JudgeSystem.Web.Dtos.Submission 6 | { 7 | public class SubmissionResult 8 | { 9 | public SubmissionResult() 10 | { 11 | ExecutedTests = new List(); 12 | IsCompiledSuccessfully = true; 13 | } 14 | 15 | public int Id { get; set; } 16 | 17 | public bool IsCompiledSuccessfully { get; set; } 18 | 19 | public ICollection ExecutedTests { get; set; } 20 | 21 | public int MaxPoints { get; set; } 22 | 23 | public int ActualPoints { get; set; } 24 | 25 | public string SubmissionDate { get; set; } 26 | 27 | public double TotalMemoryUsed { get; set; } 28 | 29 | public double TotalTimeUsed { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Test/TestDataDto.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.Dtos.Test 4 | { 5 | public class TestDataDto : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public string InputData { get; set; } 10 | 11 | public string OutputData { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Dtos/Test/TestDto.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.Dtos.Test 4 | { 5 | public class TestDto : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public int ProblemId { get; set; } 10 | 11 | public string InputData { get; set; } 12 | 13 | public string OutputData { get; set; } 14 | 15 | public bool IsTrialTest { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Infrastructure/Attributes/Validation/AfterDateTimeNowAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace JudgeSystem.Web.Infrastructure.Attributes.Validation 5 | { 6 | [AttributeUsage(AttributeTargets.Property)] 7 | public class AfterDateTimeNowAttribute : ValidationAttribute 8 | { 9 | public const string DefaultMessage = "The date must be in the future."; 10 | 11 | public AfterDateTimeNowAttribute() : base(DefaultMessage) 12 | { 13 | } 14 | 15 | public AfterDateTimeNowAttribute(string errorMessage) : base(errorMessage) 16 | { 17 | } 18 | 19 | public override bool IsValid(object value) => ((DateTime)value) >= DateTime.Now; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Infrastructure/Extensions/DateTimeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace JudgeSystem.Web.Infrastructure.Extensions 5 | { 6 | public static class DateTimeExtensions 7 | { 8 | public static double GetDifferenceInSeconds(this DateTime date, string otherDate, string dateFormat) 9 | { 10 | var secondDate = DateTime.ParseExact(otherDate, dateFormat, CultureInfo.InvariantCulture); 11 | TimeSpan difference = date - secondDate; 12 | return difference.TotalSeconds; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Infrastructure/Extensions/EnumExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Reflection; 6 | 7 | namespace JudgeSystem.Web.Infrastructure.Extensions 8 | { 9 | public static class EnumExtensions 10 | { 11 | public static IEnumerable GetEnumValuesAsString() 12 | { 13 | foreach (T element in Enum.GetValues(typeof(T))) 14 | { 15 | yield return element.ToString(); 16 | } 17 | } 18 | 19 | public static IEnumerable GetEnumDisplayNames() 20 | { 21 | foreach (T element in Enum.GetValues(typeof(T))) 22 | { 23 | DisplayAttribute displayAttribute = element.GetType() 24 | .GetMember(element.ToString()) 25 | .First() 26 | .GetCustomAttribute(); 27 | yield return displayAttribute?.Name ?? element.ToString(); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Infrastructure/Extensions/FormFileExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading.Tasks; 3 | 4 | using Microsoft.AspNetCore.Http; 5 | 6 | namespace JudgeSystem.Web.Infrastructure.Extensions 7 | { 8 | public static class FormFileExtensions 9 | { 10 | public static async Task ToArrayAsync(this IFormFile file) 11 | { 12 | using (var memoryStream = new MemoryStream()) 13 | { 14 | await file.CopyToAsync(memoryStream); 15 | return memoryStream.ToArray(); 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Infrastructure/Extensions/ModelStateDictionaryExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using Microsoft.AspNetCore.Mvc.ModelBinding; 4 | 5 | namespace JudgeSystem.Web.Infrastructure.Extensions 6 | { 7 | public static class ModelStateDictionaryExtensions 8 | { 9 | public static void AddErrors(this ModelStateDictionary modelState, string key, IEnumerable errors) 10 | { 11 | foreach (string error in errors) 12 | { 13 | modelState.AddModelError(key, error); 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Infrastructure/Extensions/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.Infrastructure.Extensions 2 | { 3 | public static class StringExtensions 4 | { 5 | public static string InsertSpaceBeforeUppercaseLetter(this string text) 6 | { 7 | string tempText = text; 8 | int insertedValues = 0; 9 | for (int i = 1; i < text.Length; i++) 10 | { 11 | if (char.IsUpper(text[i])) 12 | { 13 | tempText = tempText.Insert(i + insertedValues, " "); 14 | insertedValues++; 15 | } 16 | } 17 | 18 | return tempText; 19 | } 20 | 21 | public static string ToControllerName(this string controller) => controller.Replace("Controller", ""); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Infrastructure/JudgeSystem.Web.Infrastructure.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | latest 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.Infrastructure/Pagination/PaginationData.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.Infrastructure.Pagination 2 | { 3 | public class PaginationData 4 | { 5 | public int NumberOfPages { get; set; } 6 | 7 | public string Url { get; set; } 8 | 9 | public int CurrentPage { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/AllowedIpAddress/AllowedIpAddressInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Services.Mapping; 4 | 5 | namespace JudgeSystem.Web.InputModels.AllowedIpAddress 6 | { 7 | public class AllowedIpAddressInputModel : IMapTo 8 | { 9 | [Required] 10 | public string Value { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Contest/ContestAllowedIpAddressesInputModel.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.InputModels.Contest 2 | { 3 | public class ContestAllowedIpAddressesInputModel 4 | { 5 | public int Id { get; set; } 6 | 7 | public string Name { get; set; } 8 | 9 | public int IpAddressId { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Course/CourseEditModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | using JudgeSystem.Services.Mapping; 5 | 6 | namespace JudgeSystem.Web.InputModels.Course 7 | { 8 | public class CourseEditModel : IMapTo, IMapFrom 9 | { 10 | public int Id { get; set; } 11 | 12 | [Required] 13 | [StringLength(ModelConstants.CourseNameMaxLength, MinimumLength = ModelConstants.CourseNameMinLength)] 14 | public string Name { get; set; } 15 | 16 | [Range(ModelConstants.OrderByMinValue, ModelConstants.OrderByMaxValue)] 17 | public int OrderBy { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Course/CourseInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Services.Mapping; 4 | using JudgeSystem.Common; 5 | 6 | namespace JudgeSystem.Web.InputModels.Course 7 | { 8 | public class CourseInputModel : IMapTo 9 | { 10 | [Required] 11 | [StringLength(ModelConstants.CourseNameMaxLength, MinimumLength = ModelConstants.CourseNameMinLength)] 12 | public string Name { get; set; } 13 | 14 | [Range(ModelConstants.OrderByMinValue, ModelConstants.OrderByMaxValue)] 15 | public int OrderBy { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Feedback/FeedbackCreateInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | using JudgeSystem.Services.Mapping; 5 | 6 | namespace JudgeSystem.Web.InputModels.Feedback 7 | { 8 | public class FeedbackCreateInputModel : IMapTo 9 | { 10 | [Required] 11 | [MaxLength(ModelConstants.FeedbackContentMaxLength)] 12 | [MinLength(ModelConstants.FeedbackContentMinLength)] 13 | public string Content { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/JudgeSystem.Web.InputModels.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Lesson/LessonAddPasswordInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | 5 | namespace JudgeSystem.Web.InputModels.Lesson 6 | { 7 | public class LessonAddPasswordInputModel 8 | { 9 | public int Id { get; set; } 10 | 11 | [Required] 12 | [StringLength(ModelConstants.LessonPasswordMaxLength, MinimumLength = ModelConstants.LessonPasswordMinLength)] 13 | [DataType(DataType.Password)] 14 | [Display(Name = ModelConstants.LessonPasswordDisplayName)] 15 | public string LessonPassword { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Lesson/LessonChangePasswordInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | 5 | namespace JudgeSystem.Web.InputModels.Lesson 6 | { 7 | public class LessonChangePasswordInputModel 8 | { 9 | public int Id { get; set; } 10 | 11 | [Required] 12 | [DataType(DataType.Password)] 13 | [Display(Name = ModelConstants.LessonOldPasswordDisplayName)] 14 | public string OldPassword { get; set; } 15 | 16 | [Required] 17 | [StringLength(ModelConstants.LessonPasswordMaxLength, MinimumLength = ModelConstants.LessonPasswordMinLength)] 18 | [DataType(DataType.Password)] 19 | [Display(Name = ModelConstants.LessonPasswordDisplayName)] 20 | public string NewPassword { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Lesson/LessonEditInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | using JudgeSystem.Data.Models.Enums; 5 | using JudgeSystem.Services.Mapping; 6 | 7 | namespace JudgeSystem.Web.InputModels.Lesson 8 | { 9 | public class LessonEditInputModel : IMapTo, IMapFrom 10 | { 11 | public int Id { get; set; } 12 | 13 | [Required] 14 | [StringLength(ModelConstants.LessonNameMaxLength, MinimumLength = ModelConstants.LessonNameMinLength)] 15 | public string Name { get; set; } 16 | 17 | public LessonType Type { get; set; } 18 | 19 | public bool IsLocked { get; set; } 20 | 21 | [Range(ModelConstants.OrderByMinValue, ModelConstants.OrderByMaxValue)] 22 | public int OrderBy { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Lesson/LessonInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Data.Models.Enums; 4 | using JudgeSystem.Services.Mapping; 5 | using JudgeSystem.Common; 6 | 7 | namespace JudgeSystem.Web.InputModels.Lesson 8 | { 9 | public class LessonInputModel : IMapTo 10 | { 11 | [Required] 12 | [StringLength(ModelConstants.LessonNameMaxLength, MinimumLength = ModelConstants.LessonNameMinLength)] 13 | public string Name { get; set; } 14 | 15 | public int CourseId { get; set; } 16 | 17 | [Display(Name = ModelConstants.LessonPasswordDisplayName)] 18 | [DataType(DataType.Password)] 19 | [StringLength(ModelConstants.LessonPasswordMaxLength, MinimumLength = ModelConstants.LessonPasswordMinLength)] 20 | public string LessonPassword { get; set; } 21 | 22 | [Required] 23 | public LessonType Type { get; set; } 24 | 25 | [Range(ModelConstants.OrderByMinValue, ModelConstants.OrderByMaxValue)] 26 | public int OrderBy { get; set; } 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Lesson/LessonPasswordInputModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Common; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace JudgeSystem.Web.InputModels.Lesson 5 | { 6 | public class LessonPasswordInputModel 7 | { 8 | public int Id { get; set; } 9 | 10 | [Required] 11 | [StringLength(ModelConstants.LessonPasswordMaxLength, MinimumLength = ModelConstants.LessonPasswordMinLength)] 12 | [DataType(DataType.Password)] 13 | [Display(Name = ModelConstants.LessonPasswordDisplayName)] 14 | public string LessonPassword { get; set; } 15 | 16 | public int? PracticeId { get; set; } 17 | 18 | public int? ContestId { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Lesson/LessonRemovePasswordInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | 5 | namespace JudgeSystem.Web.InputModels.Lesson 6 | { 7 | public class LessonRemovePasswordInputModel 8 | { 9 | public int Id { get; set; } 10 | 11 | [Required] 12 | [DataType(DataType.Password)] 13 | [Display(Name = ModelConstants.LessonOldPasswordDisplayName)] 14 | public string OldPassword { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Problem/ProblemAddTestsInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Data.Models.Enums; 4 | 5 | using Microsoft.AspNetCore.Http; 6 | 7 | namespace JudgeSystem.Web.InputModels.Problem 8 | { 9 | public class ProblemAddTestsInputModel 10 | { 11 | public int ProblemId { get; set; } 12 | 13 | public int LessonId { get; set; } 14 | 15 | public string ProblemName { get; set; } 16 | 17 | public TestsImportStrategy Strategy { get; set; } 18 | 19 | [Required] 20 | public IFormFile Tests { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Problem/ProblemTestInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | using JudgeSystem.Services.Mapping; 5 | 6 | namespace JudgeSystem.Web.InputModels.Problem 7 | { 8 | public class ProblemTestInputModel : IMapTo 9 | { 10 | [MaxLength(ModelConstants.TestInputDataMaxLength)] 11 | public string InputData { get; set; } 12 | 13 | [Required] 14 | [MaxLength(ModelConstants.TestOutputDataMaxLength)] 15 | public string OutputData { get; set; } 16 | 17 | [Required] 18 | public bool IsTrialTest { get; set; } 19 | 20 | [Range(ModelConstants.OrderByMinValue, ModelConstants.OrderByMaxValue)] 21 | public int OrderBy { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Resource/ResourceEditInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Services.Mapping; 4 | using JudgeSystem.Common; 5 | 6 | using Microsoft.AspNetCore.Http; 7 | using AutoMapper; 8 | 9 | namespace JudgeSystem.Web.InputModels.Resource 10 | { 11 | public class ResourceEditInputModel : IMapTo, IMapFrom 12 | { 13 | public int Id { get; set; } 14 | 15 | [Required] 16 | [StringLength(ModelConstants.ResourceNameMaxLength, MinimumLength = ModelConstants.ResourceNameMinLength)] 17 | public string Name { get; set; } 18 | 19 | [IgnoreMap] 20 | public IFormFile File { get; set; } 21 | 22 | [Range(ModelConstants.OrderByMinValue, ModelConstants.OrderByMaxValue)] 23 | public int OrderBy { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Resource/ResourceInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | 5 | using Microsoft.AspNetCore.Http; 6 | 7 | namespace JudgeSystem.Web.InputModels.Resource 8 | { 9 | public class ResourceInputModel 10 | { 11 | public int Id { get; set; } 12 | 13 | [Required] 14 | [StringLength(ModelConstants.ResourceNameMaxLength, MinimumLength = ModelConstants.ResourceNameMinLength)] 15 | public string Name { get; set; } 16 | 17 | public int LessonId { get; set; } 18 | 19 | public int PracticeId { get; set; } 20 | 21 | [Required] 22 | public IFormFile File { get; set; } 23 | 24 | [Range(ModelConstants.OrderByMinValue, ModelConstants.OrderByMaxValue)] 25 | public int OrderBy { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Settings/UserIdentityConfirmationInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace JudgeSystem.Web.InputModels.Settings 4 | { 5 | public class UserIdentityConfirmationInputModel 6 | { 7 | [Required] 8 | public string Username { get; set; } 9 | 10 | [Required] 11 | public string Name { get; set; } 12 | 13 | [Required] 14 | public string Surname { get; set; } 15 | 16 | [Required] 17 | [DataType(DataType.Password)] 18 | public string ConfirmPassword { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Student/StudentActivateProfileInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | 5 | namespace JudgeSystem.Web.InputModels.Student 6 | { 7 | public class StudentActivateProfileInputModel 8 | { 9 | [Required] 10 | [Display(Name = ModelConstants.StudentActivationKeyDisplayName)] 11 | public string ActivationKey { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Student/StudentCreateInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Services.Mapping; 4 | using JudgeSystem.Common; 5 | 6 | namespace JudgeSystem.Web.InputModels.Student 7 | { 8 | public class StudentCreateInputModel : IMapTo 9 | { 10 | [Required] 11 | [MinLength(ModelConstants.StudentFullNameMinLength), MaxLength(ModelConstants.StudentFullNameMaxLength)] 12 | [Display(Name = ModelConstants.StudentFullNameDisplayName)] 13 | public string FullName { get; set; } 14 | 15 | [Required] 16 | [EmailAddress] 17 | [MaxLength(ModelConstants.StudentEmailMaxLength)] 18 | public string Email { get; set; } 19 | 20 | [Range(GlobalConstants.MinStudentsInClass, GlobalConstants.MaxStudentsInClass)] 21 | [Display(Name = ModelConstants.StudentNumberInClassDisplayName)] 22 | public int NumberInCalss { get; set; } 23 | 24 | [Display(Name = ModelConstants.StudentSchoolClassIdDisplayName)] 25 | public int SchoolClassId { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/Submission/SubmissionInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | using JudgeSystem.Common; 4 | using JudgeSystem.Workers.Common; 5 | 6 | using Microsoft.AspNetCore.Http; 7 | 8 | namespace JudgeSystem.Web.InputModels.Submission 9 | { 10 | public class SubmissionInputModel 11 | { 12 | [MinLength(GlobalConstants.MinSubmissionCodeLength)] 13 | public string Code { get; set; } 14 | 15 | public ProgrammingLanguage ProgrammingLanguage { get; set; } 16 | 17 | public int ProblemId { get; set; } 18 | 19 | public int? ContestId { get; set; } 20 | 21 | public int? PracticeId { get; set; } 22 | 23 | public IFormFile File { get; set; } 24 | 25 | public byte[] SubmissionContent { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.InputModels/User/ImportUsersInputModel.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace JudgeSystem.Web.InputModels.User 5 | { 6 | public class ImportUsersInputModel 7 | { 8 | [Required] 9 | public IFormFile File { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/AllowedIpAddress/AllowedIpAddressViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.ViewModels.AllowedIpAddress 4 | { 5 | public class AllowedIpAddressViewModel : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public string Value { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Contest/ActiveContestViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JudgeSystem.Services.Mapping; 4 | 5 | using AutoMapper; 6 | 7 | namespace JudgeSystem.Web.ViewModels.Contest 8 | { 9 | public class ActiveContestViewModel : IMapFrom 10 | { 11 | public string Name { get; set; } 12 | 13 | public int Id { get; set; } 14 | 15 | public int LessonId { get; set; } 16 | 17 | public DateTime EndTime { get; set; } 18 | 19 | [IgnoreMap] 20 | public int RemainingDays => (EndTime - DateTime.Now).Days; 21 | 22 | [IgnoreMap] 23 | public int RemainingHours => (EndTime - DateTime.Now).Hours; 24 | 25 | [IgnoreMap] 26 | public int RemainingMinutes => (EndTime - DateTime.Now).Minutes; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Contest/ContestAllResultsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Collections.Generic; 3 | 4 | using JudgeSystem.Web.Infrastructure.Pagination; 5 | using JudgeSystem.Web.ViewModels.Problem; 6 | 7 | namespace JudgeSystem.Web.ViewModels.Contest 8 | { 9 | public class ContestAllResultsViewModel 10 | { 11 | public int Id { get; set; } 12 | 13 | public string Name { get; set; } 14 | 15 | public List ContestResults { get; set; } 16 | 17 | public List Problems { get; set; } 18 | 19 | public PaginationData PaginationData { get; set; } 20 | 21 | public int MaxPoints => Problems.Sum(x => x.MaxPoints); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Contest/ContestAllViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Contest 4 | { 5 | public class ContestAllViewModel 6 | { 7 | public IEnumerable Contests { get; set; } 8 | 9 | public int NumberOfPages { get; set; } 10 | 11 | public int CurrentPage { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Contest/ContestAllowedIpAddressesViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Web.ViewModels.AllowedIpAddress; 4 | 5 | namespace JudgeSystem.Web.ViewModels.Contest 6 | { 7 | public class ContestAllowedIpAddressesViewModel 8 | { 9 | public int Id { get; set; } 10 | 11 | public string Name { get; set; } 12 | 13 | public IEnumerable AllowedIpAddresses { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Contest/ContestResultViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Web.ViewModels.Lesson; 2 | using JudgeSystem.Web.ViewModels.Student; 3 | 4 | namespace JudgeSystem.Web.ViewModels.Contest 5 | { 6 | public class ContestResultViewModel : LessonResultViewModel 7 | { 8 | public StudentBreifInfoViewModel Student { get; set; } 9 | 10 | public string UserId { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Contest/ContestSubmissionsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Web.Dtos.Submission; 4 | using JudgeSystem.Web.Infrastructure.Pagination; 5 | 6 | namespace JudgeSystem.Web.ViewModels.Contest 7 | { 8 | public class ContestSubmissionsViewModel 9 | { 10 | public IEnumerable Submissions { get; set; } 11 | 12 | public string UserId { get; set; } 13 | 14 | public string ProblemName { get; set; } 15 | 16 | public int LessonId { get; set; } 17 | 18 | public string UrlPlaceholder { get; set; } 19 | 20 | public PaginationData PaginationData { get; set; } 21 | 22 | public string ContestName { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Contest/ContestViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | using JudgeSystem.Services.Mapping; 5 | using JudgeSystem.Common; 6 | 7 | using AutoMapper; 8 | 9 | namespace JudgeSystem.Web.ViewModels.Contest 10 | { 11 | public class ContestViewModel : IMapFrom 12 | { 13 | public int Id { get; set; } 14 | 15 | public string Name { get; set; } 16 | 17 | public DateTime StartTime { get; set; } 18 | 19 | public DateTime EndTime { get; set; } 20 | 21 | [IgnoreMap] 22 | public string FormatedStartTime => StartTime.ToString(GlobalConstants.StandardDateFormat, CultureInfo.InvariantCulture); 23 | 24 | [IgnoreMap] 25 | public string FormatedEndTime => EndTime.ToString(GlobalConstants.StandardDateFormat, CultureInfo.InvariantCulture); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Contest/FollowingContestViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | using JudgeSystem.Data.Models; 3 | 4 | namespace JudgeSystem.Web.ViewModels.Contest 5 | { 6 | public class ContestBreifInfoViewModel : IMapFrom 7 | { 8 | public string Name { get; set; } 9 | 10 | public int Id { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Contest/PreviousContestViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | 3 | using JudgeSystem.Common; 4 | using JudgeSystem.Services.Mapping; 5 | 6 | using AutoMapper; 7 | 8 | namespace JudgeSystem.Web.ViewModels.Contest 9 | { 10 | public class PreviousContestViewModel : IMapFrom, IHaveCustomMappings 11 | { 12 | public string Name { get; set; } 13 | 14 | public int LessonId { get; set; } 15 | 16 | public int LessonPracticeId { get; set; } 17 | 18 | public string EndTime { get; set; } 19 | 20 | public void CreateMappings(IProfileExpression configuration) 21 | { 22 | configuration.CreateMap() 23 | .ForMember(c => c.EndTime, y => y.MapFrom(s => s.EndTime.ToString(GlobalConstants.StandardDateFormat, CultureInfo.InvariantCulture))); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Course/AllCoursesViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Course 4 | { 5 | public class AllCoursesViewModel 6 | { 7 | public IEnumerable Courses { get; set; } 8 | 9 | public IEnumerable LessonTypes { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Course/CourseLessonsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Web.ViewModels.Lesson; 4 | 5 | namespace JudgeSystem.Web.ViewModels.Course 6 | { 7 | public class CourseLessonsViewModel 8 | { 9 | public int CourseId { get; set; } 10 | 11 | public IEnumerable Lessons { get; set; } 12 | 13 | public string Name { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Course/CourseViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Course 4 | { 5 | public class CourseViewModel : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public string Name { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/EntityNotFoundErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.ViewModels 2 | { 3 | public class EntityNotFoundErrorViewModel 4 | { 5 | public string Message { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.ViewModels 2 | { 3 | public class ErrorViewModel 4 | { 5 | public string RequestId { get; set; } 6 | 7 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Feedback/AllFeedbacksViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Web.Infrastructure.Pagination; 4 | 5 | namespace JudgeSystem.Web.ViewModels.Feedback 6 | { 7 | public class AllFeedbacksViewModel 8 | { 9 | public IEnumerable Feedbacks { get; set; } 10 | 11 | public PaginationData PaginationData { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Feedback/FeedbackAllViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JudgeSystem.Services.Mapping; 4 | 5 | namespace JudgeSystem.Web.ViewModels.Feedback 6 | { 7 | public class FeedbackAllViewModel : IMapFrom 8 | { 9 | public int Id { get; set; } 10 | 11 | public string Content { get; set; } 12 | 13 | public string SenderUsername { get; set; } 14 | 15 | public string SenderEmail { get; set; } 16 | 17 | public DateTime CreatedOn { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/JudgeSystem.Web.ViewModels.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | latest 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Lesson/LessonContestViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Lesson 4 | { 5 | public class LessonContestViewModel : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public string Name { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Lesson/LessonResultsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace JudgeSystem.Web.ViewModels.Lesson 5 | { 6 | public class LessonResultViewModel 7 | { 8 | public Dictionary PointsByProblem { get; set; } 9 | 10 | public int Total => PointsByProblem.Values.Sum(); 11 | 12 | public int GetPoints(int problemId) 13 | { 14 | PointsByProblem.TryGetValue(problemId, out int points); 15 | return points; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Lesson/LessonViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Services.Mapping; 4 | 5 | using JudgeSystem.Web.ViewModels.Problem; 6 | using JudgeSystem.Web.ViewModels.Resource; 7 | 8 | namespace JudgeSystem.Web.ViewModels.Lesson 9 | { 10 | public class LessonViewModel : IMapFrom 11 | { 12 | public int Id { get; set; } 13 | 14 | public string Name { get; set; } 15 | 16 | public int CourseId { get; set; } 17 | 18 | public string LessonPassword { get; set; } 19 | 20 | public int? ContestId { get; set; } 21 | 22 | public int PracticeId { get; set; } 23 | 24 | public bool IsLocked => LessonPassword != null; 25 | 26 | public ICollection Resources { get; set; } 27 | 28 | public ICollection Problems { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Lesson/RecommendedLessonViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | using JudgeSystem.Data.Models.Enums; 3 | 4 | namespace JudgeSystem.Web.ViewModels.Lesson 5 | { 6 | public class RecommendedLessonViewModel : IMapFrom 7 | { 8 | public int Id { get; set; } 9 | 10 | public string Name { get; set; } 11 | 12 | public LessonType Type { get; set; } 13 | 14 | public int PracticeId { get; set; } 15 | 16 | public float Score { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Practice/PracticeAllResultsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using JudgeSystem.Web.Infrastructure.Pagination; 4 | using JudgeSystem.Web.ViewModels.Problem; 5 | 6 | namespace JudgeSystem.Web.ViewModels.Practice 7 | { 8 | public class PracticeAllResultsViewModel 9 | { 10 | public int Id { get; set; } 11 | 12 | public string LessonName { get; set; } 13 | 14 | public List PracticeResults { get; set; } 15 | 16 | public List Problems { get; set; } 17 | 18 | public int MaxPoints => Problems.Sum(x => x.MaxPoints); 19 | 20 | public PaginationData PaginationData { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Practice/PracticeResultsViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Web.ViewModels.Lesson; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Practice 4 | { 5 | public class PracticeResultViewModel : LessonResultViewModel 6 | { 7 | public string UserId { get; set; } 8 | 9 | public string Username { get; set; } 10 | 11 | public string FullName { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Practice/PracticeSubmissionsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Web.Dtos.Submission; 4 | using JudgeSystem.Web.Infrastructure.Pagination; 5 | 6 | namespace JudgeSystem.Web.ViewModels.Practice 7 | { 8 | public class PracticeSubmissionsViewModel 9 | { 10 | public IEnumerable Submissions { get; set; } 11 | 12 | public string UserId { get; set; } 13 | 14 | public string ProblemName { get; set; } 15 | 16 | public int LessonId { get; set; } 17 | 18 | public string UrlPlaceholder { get; set; } 19 | 20 | public PaginationData PaginationData { get; set; } 21 | 22 | public string LessonName { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Problem/ContestProblemViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Problem 4 | { 5 | public class ContestProblemViewModel : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public string Name { get; set; } 10 | 11 | public int MaxPoints { get; set; } 12 | 13 | public bool IsExtraTask { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Problem/LessonProblemViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Problem 4 | { 5 | public class LessonProblemViewModel : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public string Name { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Problem/LessonProblemsViewComponentModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Problem 4 | { 5 | public class LessonProblemsViewComponentModel 6 | { 7 | public IEnumerable Problems { get; set; } 8 | 9 | public string UrlPlaceholder { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Problem/PracticeProblemViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Problem 4 | { 5 | public class PracticeProblemViewModel : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public string Name { get; set; } 10 | 11 | public int MaxPoints { get; set; } 12 | 13 | public bool IsExtraTask { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Problem/ProblemAllViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Problem 4 | { 5 | public class ProblemAllViewModel 6 | { 7 | public IEnumerable Problems { get; set; } 8 | 9 | public int LesosnId { get; set; } 10 | 11 | public int PracticeId { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Resource/AllResourcesViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Resource 4 | { 5 | public class AllResourcesViewModel 6 | { 7 | public IEnumerable Resources { get; set; } 8 | 9 | public int LessonId { get; set; } 10 | 11 | public int PracticeId { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Resource/ResourceViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | using JudgeSystem.Data.Models; 3 | 4 | namespace JudgeSystem.Web.ViewModels.Resource 5 | { 6 | public class ResourceViewModel : IMapFrom 7 | { 8 | public int Id { get; set; } 9 | 10 | public string Name { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Search/SearchLessonViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Search 4 | { 5 | public class SearchLessonViewModel : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public string Name { get; set; } 10 | 11 | public int PracticeId { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Search/SearchProblemViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Search 4 | { 5 | public class SearchProblemViewModel : IMapFrom 6 | { 7 | public string Name { get; set; } 8 | 9 | public string LessonName { get; set; } 10 | 11 | public int LessonId { get; set; } 12 | 13 | public int LessonPracticeId { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Search/SearchResultsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Search 4 | { 5 | public class SearchResultsViewModel 6 | { 7 | public List Problems { get; set; } 8 | 9 | public List Lessons { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Student/StudentBreifInfoViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Student 4 | { 5 | public class StudentBreifInfoViewModel : IMapFrom 6 | { 7 | public int ClassNumber { get; set; } 8 | 9 | public string ClassType { get; set; } 10 | 11 | public int NumberInCalss { get; set; } 12 | 13 | public string FullName { get; set; } 14 | 15 | public string ClassName => $"{ClassNumber} {ClassType}"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Student/StudentProfileViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | using AutoMapper; 4 | 5 | namespace JudgeSystem.Web.ViewModels.Student 6 | { 7 | public class StudentProfileViewModel : IMapFrom, IHaveCustomMappings 8 | { 9 | public string Id { get; set; } 10 | 11 | public string FullName { get; set; } 12 | 13 | public string Email { get; set; } 14 | 15 | public string UserId { get; set; } 16 | 17 | public int NumberInCalss { get; set; } 18 | 19 | public string SchoolClassName { get; set; } 20 | 21 | public bool IsActivated { get; set; } 22 | 23 | public void CreateMappings(IProfileExpression configuration) 24 | { 25 | configuration.CreateMap() 26 | .ForMember(x => x.SchoolClassName, y => y.MapFrom(s => $"{s.SchoolClass.ClassNumber} {s.SchoolClass.ClassType}")); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Student/StudentsByClassViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Web.Infrastructure.Pagination; 4 | 5 | namespace JudgeSystem.Web.ViewModels.Student 6 | { 7 | public class StudentsByClassViewModel 8 | { 9 | public IEnumerable Students { get; set; } 10 | 11 | public PaginationData PaginationData { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Test/ProblemTestsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Test 4 | { 5 | public class ProblemTestsViewModel 6 | { 7 | public IEnumerable Tests { get; set; } 8 | 9 | public int LessonId { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/Test/TestViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.ViewModels.Test 4 | { 5 | public class TestViewModel : IMapFrom 6 | { 7 | public int Id { get; set; } 8 | 9 | public string InputData { get; set; } 10 | 11 | public string OutputData { get; set; } 12 | 13 | public bool IsTrialTest { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/User/UserCompeteResultViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace JudgeSystem.Web.ViewModels.User 6 | { 7 | public class UserCompeteResultViewModel 8 | { 9 | public string ContestName { get; set; } 10 | 11 | public int LessonId { get; set; } 12 | 13 | public int MaxPoints { get; set; } 14 | 15 | public int ActualPoints { get; set; } 16 | 17 | public int ContestId { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/User/UserNamesViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Mapping; 2 | 3 | namespace JudgeSystem.Web.ViewModels.User 4 | { 5 | public class UserNamesViewModel : IMapFrom 6 | { 7 | public string UserName { get; set; } 8 | 9 | public string StudentFullName { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/User/UserPracticeResultViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.ViewModels.User 2 | { 3 | public class UserPracticeResultViewModel 4 | { 5 | public int LessonId { get; set; } 6 | 7 | public int PracticeId { get; set; } 8 | 9 | public string LessonName { get; set; } 10 | 11 | public int MaxPoints { get; set; } 12 | 13 | public int ActualPoints { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/User/UserResultsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JudgeSystem.Web.ViewModels.User 4 | { 5 | public class UserResultsViewModel 6 | { 7 | public List ContestResults { get; set; } 8 | 9 | public List PracticeResults { get; set; } 10 | 11 | public string UserId { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web.ViewModels/User/UserViewModel.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Models; 2 | using JudgeSystem.Services.Mapping; 3 | 4 | namespace JudgeSystem.Web.ViewModels.User 5 | { 6 | public class UserViewModel : IMapFrom 7 | { 8 | public string Id { get; set; } 9 | 10 | public string Username { get; set; } 11 | 12 | public string Name { get; set; } 13 | 14 | public string Surname { get; set; } 15 | 16 | public string Email { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Administration/Controllers/AdministrationBaseController.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Common; 2 | using JudgeSystem.Web.Controllers; 3 | 4 | using Microsoft.AspNetCore.Mvc; 5 | using Microsoft.AspNetCore.Authorization; 6 | 7 | namespace JudgeSystem.Web.Areas.Administration.Controllers 8 | { 9 | [Authorize(Roles = GlobalConstants.AdministratorRoleName)] 10 | [Area(GlobalConstants.AdministrationArea)] 11 | public class AdministrationBaseController : BaseController 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Administration/Views/AllowedIpAddress/Create.cshtml: -------------------------------------------------------------------------------- 1 | @inject IViewLocalizer Localizer 2 | @inject IStringLocalizer SharedLocalizer 3 | @model AllowedIpAddressInputModel 4 | 5 | @{ 6 | ViewData["Title"] = Localizer["Add allowed ip address"]; 7 | } 8 | 9 |

@ViewData["Title"]

10 |
11 |
12 |
13 |
14 |
15 |
16 | 17 | 18 | 19 |
20 |
21 | 22 |
23 |
24 |
25 |
26 |
27 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Administration/Views/Contest/Submissions.cshtml: -------------------------------------------------------------------------------- 1 | @inject IViewLocalizer Localizer 2 | @model ContestSubmissionsViewModel 3 | 4 | @{ 5 | ViewData["Title"] = Model.ContestName; 6 | } 7 | 8 |

9 | 10 | 11 | 12 | @Localizer["submissions for contest"] "@Model.ContestName" 13 |

14 |
15 |
16 | 17 |
18 | 19 |

@Model.ProblemName

20 | 21 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Administration/Views/Course/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @inject IStringLocalizer SharedLocalizer 2 | @model CourseViewModel 3 | 4 | @{ 5 | ViewData["Title"] = SharedLocalizer["Delete Course"]; 6 | } 7 | 8 |

@ViewData["Title"]

9 |
10 |
11 |
12 |
13 |
14 | 15 | 16 |
17 |
18 | 19 |
20 |
21 |
22 |
23 |
24 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Administration/Views/Lesson/RemovePassword.cshtml: -------------------------------------------------------------------------------- 1 | @inject IStringLocalizer SharedLocalizer 2 | @model LessonRemovePasswordInputModel 3 | 4 | @{ 5 | ViewData["Title"] = SharedLocalizer["Remove lesson password"]; 6 | } 7 | 8 |

@ViewData["Title"]

9 |
10 |
11 |
12 |
13 |
14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 |
22 |
23 |
24 |
25 |
26 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Administration/Views/Practice/Submissions.cshtml: -------------------------------------------------------------------------------- 1 | @inject IViewLocalizer Localizer 2 | @model PracticeSubmissionsViewModel 3 | 4 |

5 | 6 | 7 | 8 | @Localizer["submissions for practice"] "@Model.LessonName" 9 |

10 | 11 |
12 |
13 | 14 |
15 | 16 |

@Model.ProblemName

17 | 18 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Administration/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | this.Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/AccessDenied.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model AccessDeniedModel 3 | @inject IStringLocalizer SharedLocalizer 4 | 5 | @{ 6 | ViewData["Title"] = SharedLocalizer["Access denied"]; 7 | } 8 | 9 |

@SharedLocalizer["You don't have access to this resources"]

10 | Alternate Text 11 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/AccessDenied.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.RazorPages; 2 | 3 | namespace JudgeSystem.Web.Areas.Identity.Pages.Account 4 | { 5 | public class AccessDeniedModel : PageModel 6 | { 7 | public void OnGet() 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ConfirmEmailModel 3 | @inject IViewLocalizer Localizer 4 | 5 | @{ 6 | ViewData["Title"] = Localizer["Confirm email"]; 7 | } 8 | 9 |

@ViewData["Title"]

10 |
11 |

12 | @Localizer["Thank you for confirming your email."] 13 |

14 |
15 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ForgotPasswordModel 3 | @inject IStringLocalizer SharedLocalizer 4 | 5 | @{ 6 | ViewData["Title"] = SharedLocalizer["Forgot your password?"]; 7 | } 8 | 9 |

@ViewData["Title"]

10 |

@SharedLocalizer["Enter your email."]

11 |
12 |
13 |
14 |
15 |
16 | 17 | 18 | 19 |
20 | 21 |
22 |
23 |
24 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model ForgotPasswordConfirmation 3 | @inject IViewLocalizer Localizer 4 | 5 | @{ 6 | ViewData["Title"] = Localizer["Forgot password confirmation"]; 7 | } 8 | 9 |

@ViewData["Title"]

10 |

11 | @Localizer["Please check your email to reset your password."] 12 |

13 | 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Authorization; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | 4 | namespace JudgeSystem.Web.Areas.Identity.Pages.Account 5 | { 6 | [AllowAnonymous] 7 | public class ForgotPasswordConfirmation : PageModel 8 | { 9 | public void OnGet() 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/Logout.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model LogoutModel 3 | @{ 4 | ViewData["Title"] = "Log out"; 5 | } 6 | 7 |
8 |

@ViewData["Title"]

9 |

You have successfully logged out of the application.

10 |
-------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model DownloadPersonalDataModel 3 | @inject IStringLocalizer SharedLocalizer 4 | @{ 5 | ViewData["Title"] = SharedLocalizer["Download Your Data"]; 6 | ViewData[IdentityAreaConstants.ActivePageKey] = ManageNavPages.PersonalData; 7 | } 8 | 9 |

@ViewData["Title"]

10 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.RazorPages; 2 | 3 | namespace JudgeSystem.Web.Areas.Identity.Pages.Account.Manage 4 | { 5 | public class PersonalDataModel : PageModel 6 | { 7 | public void OnGet() 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/Manage/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | @inject IViewLocalizer Localizer 2 | @{ 3 | Layout = "/Views/Shared/_Layout.cshtml"; 4 | } 5 | 6 |

@Localizer["Manage your account"]

7 | 8 |
9 |

@Localizer["Change your account settings"]

10 |
11 |
12 |
13 | 14 |
15 |
16 | @RenderBody() 17 |
18 |
19 |
20 | 21 | @section Scripts { 22 | @RenderSection("Scripts", required: false) 23 | } 24 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/Manage/_ManageNav.cshtml: -------------------------------------------------------------------------------- 1 | @inject IStringLocalizer SharedLocalizer 2 | 3 | 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/Manage/_StatusMessage.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | @if (!String.IsNullOrEmpty(Model)) 4 | { 5 | var statusMessageClass = Model.StartsWith("Error") ? "danger" : "success"; 6 | 10 | } -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/Account/Manage/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/IdentityAreaConstants.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.Areas.Identity.Pages 2 | { 3 | public static class IdentityAreaConstants 4 | { 5 | public const string ActivePageKey = "ActivePage"; 6 | 7 | public const string ActivePageCssClass = "active"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Identity 2 | @using JudgeSystem.Web.Areas.Identity 3 | @using JudgeSystem.Data.Models 4 | @using JudgeSystem.Web.Areas.Identity.Pages.Account 5 | @using JudgeSystem.Web.Areas.Identity.Pages.Account.Manage 6 | @using JudgeSystem.Common; 7 | @using Microsoft.AspNetCore.Mvc.Localization 8 | @using Microsoft.AspNetCore.Localization 9 | @using JudgeSystem.Web.Resources 10 | @using Microsoft.Extensions.Localization; 11 | @namespace JudgeSystem.Web.Areas.Identity.Pages 12 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 13 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Areas/Identity/Pages/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Components/ActiveContestsComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | using JudgeSystem.Services.Data; 4 | 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace JudgeSystem.Web.Components 8 | { 9 | [ViewComponent(Name = "ActiveContests")] 10 | public class ActiveContestsComponent : ViewComponent 11 | { 12 | private readonly IContestService contestService; 13 | 14 | public ActiveContestsComponent(IContestService contestService) 15 | { 16 | this.contestService = contestService; 17 | } 18 | 19 | public async Task InvokeAsync() 20 | { 21 | var activeContests = await Task.Run(() => contestService.GetActiveContests()); 22 | return View(activeContests); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Components/ContestTimerViewComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | using JudgeSystem.Services; 4 | using JudgeSystem.Services.Data; 5 | using JudgeSystem.Web.Dtos.Common; 6 | using JudgeSystem.Web.Dtos.Contest; 7 | 8 | using Microsoft.AspNetCore.Mvc; 9 | 10 | namespace JudgeSystem.Web.Components 11 | { 12 | public class ContestTimerViewComponent : ViewComponent 13 | { 14 | private readonly IContestService contestService; 15 | private readonly IEstimator estimator; 16 | 17 | public ContestTimerViewComponent(IContestService contestService, IEstimator estimator) 18 | { 19 | this.contestService = contestService; 20 | this.estimator = estimator; 21 | } 22 | 23 | public async Task InvokeAsync(int contestId) 24 | { 25 | ContestStartEndTimeDto contest = await contestService.GetById(contestId); 26 | TimeRemainingDto model = estimator.CalculateRemainingTime(contest.EndTime); 27 | model.ContestName = contest.Name; 28 | return View(model); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Components/CourseLinksViewComponent.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Models.Enums; 2 | using JudgeSystem.Services.Data; 3 | using JudgeSystem.Web.Infrastructure.Extensions; 4 | using JudgeSystem.Web.ViewModels.Course; 5 | 6 | using Microsoft.AspNetCore.Mvc; 7 | 8 | namespace JudgeSystem.Web.Components 9 | { 10 | [ViewComponent(Name = "CourseLinks")] 11 | public class CourseLinksViewComponent : ViewComponent 12 | { 13 | private readonly ICourseService courseService; 14 | 15 | public CourseLinksViewComponent(ICourseService courseService) 16 | { 17 | this.courseService = courseService; 18 | } 19 | 20 | public IViewComponentResult Invoke() 21 | { 22 | var model = new AllCoursesViewModel 23 | { 24 | Courses = courseService.All() 25 | }; 26 | 27 | return View(model); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Components/CoursesSelectListViewComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | using JudgeSystem.Services.Data; 4 | 5 | using Microsoft.AspNetCore.Mvc; 6 | using Microsoft.AspNetCore.Mvc.Rendering; 7 | 8 | namespace JudgeSystem.Web.Components 9 | { 10 | [ViewComponent(Name = "CoursesSelectList")] 11 | public class CoursesSelectListViewComponent : ViewComponent 12 | { 13 | private readonly ICourseService courseService; 14 | 15 | public CoursesSelectListViewComponent(ICourseService courseService) 16 | { 17 | this.courseService = courseService; 18 | } 19 | 20 | public IViewComponentResult Invoke() 21 | { 22 | var courses = courseService.All() 23 | .Select(c => new SelectListItem { Text = c.Name, Value = c.Id.ToString() }); 24 | return View(courses); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Components/CoursesTreeViewComponent.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Services.Data; 2 | 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace JudgeSystem.Web.Components 6 | { 7 | [ViewComponent(Name = "CoursesTree")] 8 | public class CoursesTreeViewComponent : ViewComponent 9 | { 10 | private readonly ICourseService courseService; 11 | 12 | public CoursesTreeViewComponent(ICourseService courseService) 13 | { 14 | this.courseService = courseService; 15 | } 16 | 17 | public IViewComponentResult Invoke() 18 | { 19 | var courses = courseService.All(); 20 | return View(courses); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Components/LessonProblemsViewComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using System.Collections.Generic; 3 | 4 | using JudgeSystem.Services.Data; 5 | using JudgeSystem.Web.ViewModels.Problem; 6 | 7 | using Microsoft.AspNetCore.Mvc; 8 | 9 | namespace JudgeSystem.Web.Components 10 | { 11 | [ViewComponent(Name = "LessonProblems")] 12 | public class LessonProblemsViewComponent : ViewComponent 13 | { 14 | private readonly IProblemService problemService; 15 | 16 | public LessonProblemsViewComponent(IProblemService problemService) 17 | { 18 | this.problemService = problemService; 19 | } 20 | 21 | public async Task InvokeAsync(int lessonId, string url) 22 | { 23 | var problems = await Task.Run(() => problemService.LessonProblems(lessonId)); 24 | var model = new LessonProblemsViewComponentModel { Problems = problems, UrlPlaceholder = url }; 25 | return View(model); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Components/PreviousContestsComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using System.Collections.Generic; 3 | 4 | using JudgeSystem.Services.Data; 5 | using JudgeSystem.Web.ViewModels.Contest; 6 | 7 | using Microsoft.AspNetCore.Mvc; 8 | 9 | namespace JudgeSystem.Web.Components 10 | { 11 | [ViewComponent(Name = "PreviousContests")] 12 | public class PreviousContestsComponent : ViewComponent 13 | { 14 | private const int PassedDaysFromContestEndTime = 3; 15 | private readonly IContestService contestService; 16 | 17 | public PreviousContestsComponent(IContestService contestService) 18 | { 19 | this.contestService = contestService; 20 | } 21 | 22 | public async Task InvokeAsync() 23 | { 24 | var previousContests = await Task.Run(() => 25 | contestService.GetPreviousContests(PassedDaysFromContestEndTime)); 26 | return View(previousContests); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Components/UserExamsViewComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Services.Data; 4 | using JudgeSystem.Web.ViewModels.User; 5 | 6 | using Microsoft.AspNetCore.Mvc; 7 | 8 | namespace JudgeSystem.Web.Components 9 | { 10 | public class UserExamsViewComponent : ViewComponent 11 | { 12 | private readonly IUserService userService; 13 | 14 | public UserExamsViewComponent(IUserService userService) 15 | { 16 | this.userService = userService; 17 | } 18 | 19 | public IViewComponentResult Invoke(string userId) 20 | { 21 | IEnumerable examResults = userService.GetUserExamResults(userId); 22 | return View(examResults); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Components/UserNamesViewComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | using JudgeSystem.Services.Data; 4 | using JudgeSystem.Web.ViewModels.User; 5 | 6 | using Microsoft.AspNetCore.Mvc; 7 | 8 | namespace JudgeSystem.Web.Components 9 | { 10 | public class UserNamesViewComponent: ViewComponent 11 | { 12 | private readonly IUserService userService; 13 | 14 | public UserNamesViewComponent(IUserService userService) 15 | { 16 | this.userService = userService; 17 | } 18 | 19 | public async Task InvokeAsync(string userId) 20 | { 21 | UserNamesViewModel userNamesViewModel = await userService.GetUserNames(userId); 22 | return View(userNamesViewModel); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Configuration/CompilersConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | using JudgeSystem.Common; 4 | 5 | namespace JudgeSystem.Web.Configuration 6 | { 7 | public static class CompilersConfiguration 8 | { 9 | public static void CreateWorkingDirectoryIfNotExists() 10 | { 11 | string workingDirectory = GlobalConstants.CompilationDirectoryPath; 12 | if (Directory.Exists(workingDirectory)) 13 | { 14 | return; 15 | } 16 | 17 | Directory.CreateDirectory(workingDirectory); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Configuration/EmailSendingConfiguration.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Common; 2 | using JudgeSystem.Services.Messaging; 3 | 4 | using Microsoft.AspNetCore.Identity.UI.Services; 5 | using Microsoft.Extensions.Configuration; 6 | using Microsoft.Extensions.DependencyInjection; 7 | 8 | namespace JudgeSystem.Web.Configuration 9 | { 10 | public static class EmailSendingConfiguration 11 | { 12 | public static IServiceCollection AddEmailSendingService(this IServiceCollection services, IConfiguration configuration) 13 | { 14 | IConfigurationSection sendGridSection = configuration.GetSection(AppSettingsSections.SendGridSection); 15 | services.Configure(sendGridSection); 16 | 17 | IConfigurationSection emailSection = configuration.GetSection(AppSettingsSections.EmailSection); 18 | services.Configure(emailSection); 19 | 20 | services.AddTransient(); 21 | 22 | return services; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Configuration/RepositoriesConfiguration.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Data.Common.Repositories; 2 | using JudgeSystem.Data.Repositories; 3 | 4 | using Microsoft.Extensions.DependencyInjection; 5 | 6 | namespace JudgeSystem.Web.Configuration 7 | { 8 | public static class RepositoriesConfiguration 9 | { 10 | public static IServiceCollection AddRepositories(this IServiceCollection services) 11 | { 12 | services.AddScoped(typeof(IDeletableEntityRepository<>), typeof(EfDeletableEntityRepository<>)); 13 | services.AddScoped(typeof(IRepository<>), typeof(EfRepository<>)); 14 | 15 | return services; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Controllers/ProblemController.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | using JudgeSystem.Services.Data; 4 | using JudgeSystem.Web.Dtos.Problem; 5 | using JudgeSystem.Web.Filters; 6 | 7 | using Microsoft.AspNetCore.Authorization; 8 | using Microsoft.AspNetCore.Mvc; 9 | 10 | namespace JudgeSystem.Web.Controllers 11 | { 12 | [Authorize] 13 | public class ProblemController : BaseController 14 | { 15 | private readonly IProblemService problemService; 16 | 17 | public ProblemController(IProblemService problemService) 18 | { 19 | this.problemService = problemService; 20 | } 21 | 22 | [EndpointExceptionFilter] 23 | public async Task Get(int id) 24 | { 25 | ProblemConstraintsDto problem = await problemService.GetById(id); 26 | return Ok(problem); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Controllers/SearchController.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | using JudgeSystem.Web.ViewModels.Search; 5 | using JudgeSystem.Services.Data; 6 | 7 | using Microsoft.AspNetCore.Mvc; 8 | 9 | namespace JudgeSystem.Web.Controllers 10 | { 11 | public class SearchController : BaseController 12 | { 13 | private readonly IProblemService problemService; 14 | private readonly ILessonService lessonService; 15 | 16 | public SearchController(IProblemService problemService, ILessonService lessonService) 17 | { 18 | this.problemService = problemService; 19 | this.lessonService = lessonService; 20 | } 21 | 22 | public IActionResult Results([Required] string keyword) 23 | { 24 | var searchResults = new SearchResultsViewModel 25 | { 26 | Problems = problemService.SearchByName(keyword).ToList(), 27 | Lessons = lessonService.SearchByName(keyword).ToList() 28 | }; 29 | 30 | return View(searchResults); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Filters/EndpointExceptionFilter.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Common; 2 | using JudgeSystem.Common.Exceptions; 3 | 4 | using Microsoft.AspNetCore.Mvc; 5 | using Microsoft.AspNetCore.Mvc.Filters; 6 | 7 | namespace JudgeSystem.Web.Filters 8 | { 9 | public class EndpointExceptionFilter : ExceptionFilterAttribute 10 | { 11 | public override void OnException(ExceptionContext context) 12 | { 13 | string errorMessage = ErrorMessages.EndpointErrorMessage; 14 | if(context.Exception is EntityNotFoundException entityNotFoundException) 15 | { 16 | errorMessage = entityNotFoundException.Message; 17 | } 18 | else if(context.Exception is BadRequestException badRequestException) 19 | { 20 | errorMessage = badRequestException.Message; 21 | } 22 | 23 | context.Result = new BadRequestObjectResult(errorMessage); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/MLModels/JudgeSystemLessonsModel.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Web/JudgeSystem.Web/MLModels/JudgeSystemLessonsModel.zip -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Resources/SharedResources.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Web.Resources 2 | { 3 | public class SharedResources 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Utilites/ImportTests/ParseTestsStartegyFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JudgeSystem.Data.Models.Enums; 4 | 5 | namespace JudgeSystem.Web.Utilites.ImportTests 6 | { 7 | public class ParseTestsStartegyFactory 8 | { 9 | private const string UnsupportedTestsImportStrategyErrorMessage = "This tests import strategy is not supported!"; 10 | 11 | public ParseTestsStrategy CreateStrategy(TestsImportStrategy strategy) 12 | { 13 | switch(strategy) 14 | { 15 | case TestsImportStrategy.Json: 16 | return new ParseTestsFromJson(); 17 | case TestsImportStrategy.Zip: 18 | return new ParseTestsFromZip(); 19 | case TestsImportStrategy.TestingProject: 20 | return new ParseTestsFromTestingProject(); 21 | default: 22 | throw new ArgumentException(UnsupportedTestsImportStrategyErrorMessage); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Utilites/ImportTests/ParseTestsStrategy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using JudgeSystem.Web.InputModels.Problem; 5 | 6 | using Microsoft.AspNetCore.Http; 7 | 8 | namespace JudgeSystem.Web.Utilites.ImportTests 9 | { 10 | public abstract class ParseTestsStrategy 11 | { 12 | public abstract IEnumerable Parse(IServiceProvider serviceProvider, IFormFile file, ICollection errorMessages); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Feedback/Send.cshtml: -------------------------------------------------------------------------------- 1 | @inject IViewLocalizer Localizer 2 | @model FeedbackCreateInputModel 3 | 4 | @{ 5 | ViewData["Title"] = Localizer["Send feedback"]; 6 | } 7 | 8 |

@ViewData["Title"]

9 |
10 |
11 |
12 |
13 |
14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 |
22 |
23 |
24 |
25 |
26 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Lesson/EnterPassword.cshtml: -------------------------------------------------------------------------------- 1 | @inject IViewLocalizer Localizer 2 | @inject IStringLocalizer SharedLocalizer 3 | @model LessonPasswordInputModel 4 | 5 | @{ 6 | ViewData["Title"] = Localizer["Enter Password for lesson"]; 7 | } 8 | 9 |
10 |
11 |
12 |

@Localizer["Enter valid password to continue"]

13 |
14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 |
22 |
23 |
24 |
25 |
26 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Search/ErrorView.cshtml: -------------------------------------------------------------------------------- 1 | @inject IViewLocalizer Localizer 2 | 3 | @{ 4 | ViewData["Title"] = Localizer["Search Results"]; 5 | } 6 | 7 |

@Localizer["Search keyword is required."]

8 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/Components/ActiveContests/Default.cshtml: -------------------------------------------------------------------------------- 1 | @inject IStringLocalizer SharedLocalizer 2 | @model IEnumerable 3 | 4 | @foreach (var contest in Model) 5 | { 6 | string remainingDaysText = contest.RemainingDays <= 0 ? "" : $"{contest.RemainingDays} {SharedLocalizer["days"]}, "; 7 | string remainingHoursText = contest.RemainingHours <= 0 ? "" : $"{contest.RemainingHours} {SharedLocalizer["hours"]} {SharedLocalizer["and"]} "; 8 | 9 |
10 | @contest.Name 12 |

@SharedLocalizer["Remaining time"]: @remainingDaysText@remainingHoursText@contest.RemainingMinutes @SharedLocalizer["minutes"].

13 |
14 | } 15 | 16 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/Components/ContestTimer/Default.cshtml: -------------------------------------------------------------------------------- 1 | @inject IStringLocalizer SharedLocalizer 2 | @model TimeRemainingDto 3 | 4 |
5 |
6 | @SharedLocalizer["Contest"]: @Model.ContestName 7 |
8 |
9 | @SharedLocalizer["Remaining time"]: 10 | 11 | @Model.Days @SharedLocalizer["d"], 12 | @Model.Hours @SharedLocalizer["h"], 13 | @Model.Minutes @SharedLocalizer["m"] @SharedLocalizer["and"] 14 | @Model.Seconds @SharedLocalizer["s"] 15 | 16 |
17 |
-------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/Components/CourseLinks/Default.cshtml: -------------------------------------------------------------------------------- 1 | @inject IStringLocalizer SharedLocalizer 2 | @inject IViewLocalizer Localizer 3 | @model AllCoursesViewModel 4 | 5 | 6 | @foreach (var course in Model.Courses) 7 | { 8 |
  • 9 | 14 | @course.Name 15 | 16 |
  • 17 | } 18 | 19 | 22 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/Components/CoursesSelectList/Default.cshtml: -------------------------------------------------------------------------------- 1 | @inject IViewLocalizer Localizer 2 | @model IEnumerable 3 | 4 |
    5 | 6 | 13 |
    -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/Components/LessonProblems/Default.cshtml: -------------------------------------------------------------------------------- 1 | @model LessonProblemsViewComponentModel 2 | 3 |
    4 |
      5 | @foreach (var problem in Model.Problems) 6 | { 7 | string url = string.Format(Model.UrlPlaceholder, problem.Id); 8 |
    • 9 | @problem.Name 10 |
    • 11 | } 12 |
    13 |
    -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/Components/PreviousContests/Default.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @foreach (var contest in Model) 4 | { 5 |
    6 |
    7 | @contest.Name 10 |

    Ended: @contest.EndTime

    11 |
    12 |
    13 | } -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/Components/SchoolClassesOptions/Default.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @foreach (var schoolClass in Model) 4 | { 5 | if (schoolClass.Selected) 6 | { 7 | 8 | } 9 | else 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/Components/UserNames/Default.cshtml: -------------------------------------------------------------------------------- 1 | @model UserNamesViewModel 2 | 3 | @if (!string.IsNullOrEmpty(Model.StudentFullName)) 4 | { 5 | @Model.StudentFullName (@Model.UserName) 6 | } 7 | else 8 | { 9 | @Model.UserName 10 | } 11 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/EntityNotFoundError.cshtml: -------------------------------------------------------------------------------- 1 | @model EntityNotFoundErrorViewModel 2 | 3 |
    4 | Error cool image 5 |
    6 |

    @Model.Message

    7 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | @{ 3 | this.ViewData["Title"] = "Error"; 4 | } 5 | 6 |

    Error.

    7 |

    An error occurred while processing your request.

    8 | 9 | @if (this.Model.ShowRequestId) 10 | { 11 |

    12 | Request ID: @this.Model.RequestId 13 |

    14 | } 15 | 16 |

    Development Mode

    17 |

    18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |

    20 |

    21 | The Development environment shouldn't be enabled for deployed applications. 22 | It can result in displaying sensitive information from exceptions to end users. 23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 24 | and restarting the app. 25 |

    26 | Error cool image 27 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/Partials/LessonTypeOptions.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | @{ 3 | IEnumerable lessonTypes = Utility.GetSelectListItems(); 4 | } 5 | 6 | @foreach (var lessonType in lessonTypes) 7 | { 8 | if (Model == lessonType.Value) 9 | { 10 | 11 | } 12 | else 13 | { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Shared/_SelectLanguagePartial.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | var returnUrl = string.IsNullOrEmpty(Context.Request.Path) ? "~/" : $"~{Context.Request.Path.Value}"; 3 | returnUrl += Context.Request.QueryString.ToString(); 4 | IRequestCultureFeature currentCulture = Context.Features.Get(); 5 | string requestedCultureName = string.Empty; 6 | string requestedCultureDisplayName = string.Empty; 7 | 8 | if(currentCulture.RequestCulture.Culture.Name == GlobalConstants.CurrentCultureInfo) 9 | { 10 | requestedCultureName = GlobalConstants.EnglishCultureInfo; 11 | requestedCultureDisplayName = "EN"; 12 | } 13 | else 14 | { 15 | requestedCultureName = GlobalConstants.CurrentCultureInfo; 16 | requestedCultureDisplayName = "BG"; 17 | } 18 | 19 | } 20 | 21 | 26 | @requestedCultureDisplayName 27 | 28 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/Student/ActivateStudentProfile.cshtml: -------------------------------------------------------------------------------- 1 | @inject IViewLocalizer Localizer 2 | @model StudentActivateProfileInputModel 3 | 4 | @{ 5 | ViewData["Title"] = Localizer["Activate Student Profile"]; 6 | } 7 | 8 |

    @ViewData["Title"]

    9 |
    10 |
    11 |
    12 |
    13 |
    14 | 15 | 16 | 17 |
    18 | 19 |
    20 |
    21 |
    22 | 23 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | this.Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/bundleconfig.json: -------------------------------------------------------------------------------- 1 | // Configure bundling and minification for the project. 2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241 3 | [ 4 | { 5 | "outputFileName": "wwwroot/css/site.min.css", 6 | // An array of relative input file paths. Globbing patterns supported 7 | "inputFiles": [ 8 | "wwwroot/css/site.css" 9 | ] 10 | }, 11 | { 12 | "outputFileName": "wwwroot/js/site.min.js", 13 | "inputFiles": [ 14 | "wwwroot/js/site.js" 15 | ], 16 | // Optionally specify minification options 17 | //TODO: change enable to true when the project is ready 18 | //"enabled": true, 19 | "minify": { 20 | "enabled": false, 21 | "renameLocals": true 22 | }, 23 | // Optionally generate .map file 24 | "sourceMap": false 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/Templates/Cpp/sum.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int a; 6 | cin >> a; 7 | int b; 8 | cin >> b; 9 | cout << a + b; 10 | } -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/Templates/Json/addTestsSchema.json: -------------------------------------------------------------------------------- 1 | { 2 | "definitions": {}, 3 | "$schema": "http://json-schema.org/draft-07/schema#", 4 | "$id": "http://example.com/root.json", 5 | "type": "array", 6 | "title": "Tests", 7 | "items": { 8 | "$id": "tests", 9 | "type": "object", 10 | "title": "The Tests Schema", 11 | "required": [ 12 | "InputData", 13 | "OutputData", 14 | "IsTrialTest" 15 | ], 16 | "properties": { 17 | "InputData": { 18 | "$id": "InputData", 19 | "type": "string", 20 | "title": "The Inputdata Schema", 21 | "default": "" 22 | }, 23 | "OutputData": { 24 | "$id": "OutputData", 25 | "type": "string", 26 | "title": "The Outputdata Schema", 27 | "default": "" 28 | }, 29 | "IsTrialTest": { 30 | "$id": "IsTrialTest", 31 | "type": "boolean", 32 | "title": "The Istrialtest Schema", 33 | "default": false, 34 | "examples": [ 35 | true 36 | ] 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/Templates/Json/addTestsTemplateFile.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "InputData": "your first test input comes here. Use \r\n for new line.", 4 | "OutputData": "your first test expected output comes here. Use \r\n for new line.", 5 | "IsTrialTest": true 6 | }, 7 | { 8 | "InputData": "your second test input comes here. Use \r\n for new line.", 9 | "OutputData": "your second test expected output comes here. Use \r\n for new line.", 10 | "IsTrialTest": false 11 | }, 12 | { 13 | "InputData": "your third test input comes here. Use \r\n for new line.", 14 | "OutputData": "your third test expected output comes here. Use \r\n for new line.", 15 | "IsTrialTest": false 16 | } 17 | ] 18 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Web/JudgeSystem.Web/wwwroot/icon.ico -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/images/error-occured.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Web/JudgeSystem.Web/wwwroot/images/error-occured.jpg -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/images/error.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Web/JudgeSystem.Web/wwwroot/images/error.jpg -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/images/no-access.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaskoIT/JudgeSystem/c9aa9e2462ed80fa180756e3e3fe578b4bbd739e/Web/JudgeSystem.Web/wwwroot/images/no-access.png -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/js/controllers/courseController.js: -------------------------------------------------------------------------------- 1 | //Dropdown courses 2 | var toggler = $(".rotate"); 3 | 4 | for (let i = 0; i < toggler.length; i++) { 5 | $(toggler[i]).click(() => { 6 | $(toggler[i].parentElement.querySelector(".hidden-element")).toggle("active"); 7 | toggler[i].classList.toggle("rotate-down"); 8 | }); 9 | } -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/js/controllers/feedbackController.js: -------------------------------------------------------------------------------- 1 | $(".feedback-delete-btn").on('click', (e) => { 2 | let button = $(e.target)[0]; 3 | let feedbackId = button.dataset.id; 4 | 5 | $.post('/Administration/Feedback/Archive', { id: feedbackId }) 6 | .done((response) => { 7 | $(button.parentElement.parentElement).hide(); 8 | showInfo(response); 9 | }) 10 | .fail((error) => { 11 | showError(error.responseText); 12 | }); 13 | }); -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/js/controllers/ipAddressController.js: -------------------------------------------------------------------------------- 1 | //Delete ip address 2 | let clickedDeleteButton; 3 | 4 | $("#delete-confirm-btn").on('click', (e) => { 5 | 6 | if (clickedDeleteButton) { 7 | let ipAddressId = clickedDeleteButton.dataset.id; 8 | 9 | $.post('/Administration/AllowedIpAddress/Delete', { id: ipAddressId }) 10 | .done((response) => { 11 | $(clickedDeleteButton.parentElement.parentElement).hide(); 12 | showInfo(response); 13 | }) 14 | .fail((error) => { 15 | showError(error.responseText); 16 | }); 17 | } 18 | }); 19 | 20 | $(".ipAddressDeleteBtn").on('click', (e) => { 21 | clickedDeleteButton = $(e.target)[0]; 22 | }); -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/js/fileUploader.js: -------------------------------------------------------------------------------- 1 | $("form").on("change", ".file-upload-field", function () { 2 | var files = this.files; 3 | let fileNames = "Select your files!"; 4 | if (files.length > 0) { 5 | fileNames = Array.from(files).map(x => x.name).join(", "); 6 | } 7 | 8 | 9 | $(this).parent(".file-upload-wrapper").attr("data-text", fileNames); 10 | let value = this.files; 11 | }); -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/js/initializeDateTimePicker.js: -------------------------------------------------------------------------------- 1 | function initializeDateTimePicker(id) { 2 | $(`#${id}`).datetimepicker({ 3 | format: 'd/m/Y H:i', 4 | lang: 'en', 5 | }); 6 | } -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/js/notification.js: -------------------------------------------------------------------------------- 1 | function showInfo(message) { 2 | let infoBox = $('#infoBox'); 3 | infoBox.find('div > span').text(message); 4 | infoBox.show(); 5 | setTimeout(function () { 6 | $('#infoBox').fadeOut(); 7 | }, 4000); 8 | } 9 | 10 | function showError(err) { 11 | let errorBox = $('#errorBox'); 12 | errorBox.find('div > span').text(err); 13 | errorBox.show(); 14 | } 15 | -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | //Show error or info message 2 | let infoBox = $('#infoBox'); 3 | let errorBox = $('#errorBox'); 4 | 5 | infoBox.on('click', () => { 6 | infoBox.hide(); 7 | }); 8 | 9 | errorBox.on('click', () => { 10 | errorBox.hide(); 11 | }); 12 | 13 | if (infoBox.find('span').text().trim() !== "") { 14 | infoBox.show(); 15 | setTimeout(function () { 16 | $('#infoBox').fadeOut(); 17 | }, 4000); 18 | } 19 | 20 | if (errorBox.find('span').text() !== "") { 21 | errorBox.show(); 22 | } -------------------------------------------------------------------------------- /Web/JudgeSystem.Web/wwwroot/js/site.min.js: -------------------------------------------------------------------------------- 1 | //Show error or info message 2 | let infoBox = $('#infoBox'); 3 | let errorBox = $('#errorBox'); 4 | 5 | infoBox.on('click', () => { 6 | infoBox.hide(); 7 | }); 8 | 9 | errorBox.on('click', () => { 10 | errorBox.hide(); 11 | }); 12 | 13 | if (infoBox.find('span').text().trim() !== "") { 14 | infoBox.show(); 15 | setTimeout(function () { 16 | $('#infoBox').fadeOut(); 17 | }, 4000); 18 | } 19 | 20 | if (errorBox.find('span').text() !== "") { 21 | errorBox.show(); 22 | } -------------------------------------------------------------------------------- /Workers/JudgeSystem.Checkers/Checker.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | using JudgeSystem.Executors; 4 | using JudgeSystem.Workers.Common; 5 | 6 | namespace JudgeSystem.Checkers 7 | { 8 | public class Checker 9 | { 10 | private readonly IExecutor executor; 11 | 12 | public Checker(IExecutor executor) 13 | { 14 | this.executor = executor; 15 | } 16 | 17 | public async Task Check(string filePath, string input, string expectedOutput, int timeLimit, int memoryLimit) 18 | { 19 | ExecutionResult executionResult = await executor.Execute(filePath, input, timeLimit, memoryLimit); 20 | var checkerResult = new CheckerResult(executionResult); 21 | if (!executionResult.IsSuccesfull) 22 | { 23 | checkerResult.IsCorrect = false; 24 | return checkerResult; 25 | } 26 | 27 | if(executionResult.Output.Trim() == expectedOutput.Trim()) 28 | { 29 | checkerResult.IsCorrect = true; 30 | } 31 | else 32 | { 33 | checkerResult.IsCorrect = false; 34 | } 35 | 36 | return checkerResult; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Checkers/JudgeSystem.Checkers.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Compilers/Compiler.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | using JudgeSystem.Common; 4 | using JudgeSystem.Workers.Common; 5 | 6 | namespace JudgeSystem.Compilers 7 | { 8 | internal class Compiler 9 | { 10 | public CompileResult Compile(string arguments, string processFileName) 11 | { 12 | var process = new Process(); 13 | var info = new ProcessStartInfo 14 | { 15 | Arguments = arguments, 16 | FileName = processFileName, 17 | UseShellExecute = false, 18 | RedirectStandardError = true, 19 | CreateNoWindow = true 20 | }; 21 | 22 | process.StartInfo = info; 23 | 24 | process.Start(); 25 | string errors = process.StandardError.ReadToEnd(); 26 | process.WaitForExit(); 27 | 28 | return new CompileResult(errors); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Compilers/CompilerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JudgeSystem.Workers.Common; 4 | 5 | namespace JudgeSystem.Compilers 6 | { 7 | public class CompilerFactory : ICompilerFactory 8 | { 9 | private const string UnsupportedCompilerErrorMessage = "Unsupported compiler."; 10 | 11 | public ICompiler CreateCompiler(ProgrammingLanguage programmingLanguage) 12 | { 13 | switch (programmingLanguage) 14 | { 15 | case ProgrammingLanguage.CSharp: 16 | return new CSharpCompiler(); 17 | case ProgrammingLanguage.CPlusPlus: 18 | return new CPlusPlusCompiler(); 19 | case ProgrammingLanguage.Java: 20 | return new JavaCompiler(); 21 | default: 22 | throw new ArgumentException(UnsupportedCompilerErrorMessage); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Compilers/ICompiler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using JudgeSystem.Workers.Common; 4 | 5 | namespace JudgeSystem.Compilers 6 | { 7 | public interface ICompiler 8 | { 9 | CompileResult Compile(string fileName, string workingDirectory, IEnumerable sources = null); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Compilers/ICompilerFactory.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Workers.Common; 2 | 3 | namespace JudgeSystem.Compilers 4 | { 5 | public interface ICompilerFactory 6 | { 7 | ICompiler CreateCompiler(ProgrammingLanguage programmingLanguage); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Compilers/JudgeSystem.Compilers.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Executors/CPlusPlusExecutor.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Runtime.InteropServices; 3 | using System.Threading.Tasks; 4 | 5 | using JudgeSystem.Common; 6 | using JudgeSystem.Workers.Common; 7 | 8 | namespace JudgeSystem.Executors 9 | { 10 | public class CPlusPlusExecutor : IExecutor 11 | { 12 | public Task Execute(string filePath, string input, int timeLimit, int memoryLimit) 13 | { 14 | string arguments = filePath; 15 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) 16 | { 17 | arguments = $"{GlobalConstants.ConsoleComamndPrefix} {CompilationSettings.SetCPlusPlusCompilerPathCommand} & {arguments}"; 18 | } 19 | 20 | var executor = new Executor(); 21 | return executor.Execute(arguments, input, timeLimit, memoryLimit); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Executors/CSharpExecutor.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Threading.Tasks; 3 | 4 | using JudgeSystem.Common; 5 | using JudgeSystem.Workers.Common; 6 | 7 | namespace JudgeSystem.Executors 8 | { 9 | public class CSharpExecutor : IExecutor 10 | { 11 | public Task Execute(string filePath, string input, int timeLimit, int memoryLimit) 12 | { 13 | string arguments = $"{GlobalConstants.ConsoleComamndPrefix} dotnet {filePath}"; 14 | var executor = new Executor(); 15 | return executor.Execute(arguments, input, timeLimit, memoryLimit); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Executors/ExecutorFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using JudgeSystem.Workers.Common; 4 | 5 | namespace JudgeSystem.Executors 6 | { 7 | public class ExecutorFactory : IExecutorFactory 8 | { 9 | private const string UnsupportedExecutorErrorMessage = "Unsupported executor."; 10 | 11 | public IExecutor CreateExecutor(ProgrammingLanguage programmingLanguage) 12 | { 13 | switch (programmingLanguage) 14 | { 15 | case ProgrammingLanguage.CSharp: 16 | return new CSharpExecutor(); 17 | case ProgrammingLanguage.CPlusPlus: 18 | return new CPlusPlusExecutor(); 19 | case ProgrammingLanguage.Java: 20 | return new JavaExecutor(); 21 | default: 22 | throw new ArgumentException(UnsupportedExecutorErrorMessage); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Executors/IExecutor.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Workers.Common; 2 | using System.Threading.Tasks; 3 | 4 | namespace JudgeSystem.Executors 5 | { 6 | public interface IExecutor 7 | { 8 | Task Execute(string filePath, string input, int timeLimit, int memoryLimit); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Executors/IExecutorFactory.cs: -------------------------------------------------------------------------------- 1 | using JudgeSystem.Workers.Common; 2 | 3 | namespace JudgeSystem.Executors 4 | { 5 | public interface IExecutorFactory 6 | { 7 | IExecutor CreateExecutor(ProgrammingLanguage programmingLanguage); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Executors/JudgeSystem.Executors.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Workers.Common/CheckerResult.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Workers.Common 2 | { 3 | public class CheckerResult : ExecutionResult 4 | { 5 | public CheckerResult(ExecutionResult executionResult) 6 | { 7 | Error = executionResult.Error; 8 | Output = executionResult.Output; 9 | ExitCode = executionResult.ExitCode; 10 | MemoryUsed = executionResult.MemoryUsed; 11 | PrivilegedProcessorTime = executionResult.PrivilegedProcessorTime; 12 | TimeWorked = executionResult.TimeWorked; 13 | Type = executionResult.Type; 14 | UserProcessorTime = executionResult.UserProcessorTime; 15 | } 16 | 17 | public bool IsCorrect { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Workers.Common/CompileResult.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Workers.Common 2 | { 3 | public class CompileResult 4 | { 5 | public CompileResult() 6 | { 7 | } 8 | 9 | public CompileResult(string errors) 10 | { 11 | Errors = errors; 12 | } 13 | 14 | public string OutputFilePath { get; set; } 15 | 16 | public string Errors { get; private set; } 17 | 18 | public bool IsCompiledSuccessfully => string.IsNullOrEmpty(Errors); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Workers.Common/ExecutionResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JudgeSystem.Workers.Common 4 | { 5 | public class ExecutionResult 6 | { 7 | public ExecutionResult() 8 | { 9 | Output = string.Empty; 10 | Error = string.Empty; 11 | ExitCode = 0; 12 | Type = ProcessExecutionResultType.Success; 13 | PrivilegedProcessorTime = default; 14 | UserProcessorTime = default; 15 | MemoryUsed = 0; 16 | } 17 | 18 | public string Output { get; set; } 19 | 20 | public string Error { get; set; } 21 | 22 | public bool IsSuccesfull => string.IsNullOrEmpty(Error); 23 | 24 | public int ExitCode { get; set; } 25 | 26 | public ProcessExecutionResultType Type { get; set; } 27 | 28 | public TimeSpan TimeWorked { get; set; } 29 | 30 | public TimeSpan PrivilegedProcessorTime { get; set; } 31 | 32 | public TimeSpan UserProcessorTime { get; set; } 33 | 34 | public long MemoryUsed { get; set; } 35 | 36 | public TimeSpan TotalProcessorTime => PrivilegedProcessorTime + UserProcessorTime; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Workers.Common/JudgeSystem.Workers.Common.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | latest 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Workers.Common/ProcessExecutionResultType.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Workers.Common 2 | { 3 | public enum ProcessExecutionResultType 4 | { 5 | Success = 1, 6 | TimeLimit = 2, 7 | MemoryLimit = 3, 8 | RunTimeError = 4, 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Workers/JudgeSystem.Workers.Common/ProgrammingLanguage.cs: -------------------------------------------------------------------------------- 1 | namespace JudgeSystem.Workers.Common 2 | { 3 | public enum ProgrammingLanguage 4 | { 5 | CSharp = 1, 6 | Java = 2, 7 | CPlusPlus = 3 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | 3 | services: 4 | judge-system: 5 | build: 6 | context: . 7 | dockerfile: Web\JudgeSystem.Web/Dockerfile 8 | image: judge-system-image:latest 9 | ports: 10 | - "80:80" 11 | container_name: judge-system-instance 12 | restart: on-failure --------------------------------------------------------------------------------