public void addIfValid( string emailAddress, int universityId, StudentRepository studentRepository, UniversityRepository universityRepository) { Logger.log("Start add student with email", emailAddress); validateEmail(emailAddress); if (studentRepository.exists(emailAddress)) { return; } University university = universityRepository.getByID(universityId); Student student = studentRepository.createStudent(emailAddress, universityId); PackageType type = university.getPackageType(); BookAllowanceSetter allowanceSetter = new BookAllowanceSetter(student); allowanceSetter.SetAllowance(type); studentRepository.add(student); Logger.log("End add student with email", emailAddress); }
public IList<University> GetAll() { using (UniversityRepository repository = new UniversityRepository()) { return repository.GetAll(); } }
public AddStudyGroupServerAction(IServiceProvider serviceProvider, ProfileRepository profileRepository, UniversityRepository universityRepository, StudyGroupRepository studyGroupRepository, StringStandardizationService stringStandardizationService, TextService textService) : base(serviceProvider) { _universityRepository = universityRepository; _studyGroupRepository = studyGroupRepository; _stringStandardizationService = stringStandardizationService; _textService = textService; }
public IActionResult UniversityFullInfo(int IDUniversity) { var university = UniversityRepository.Get(IDUniversity); var universityViewModel = Mapper.Map <UniversityViewModel>(university); return(View(universityViewModel)); }
public IActionResult UniversityList() { var universities = UniversityRepository .GetAll() .Select(x => Mapper.Map <UniversityViewModel>(x)) .ToList(); return(View(universities)); }
public void AddUniversity(University university) { if (university == null) throw new ArgumentNullException("university"); using (UniversityRepository universityRepository = new UniversityRepository()) { universityRepository.Add(university); universityRepository.Commit(); } }
public void AddSpecialityTest() { UniversityAppService target = new UniversityAppService(); Speciality speciality = Speciality.CreateSpeciality(specialityId, "计算机", "理科", new Guid("D4FCA237-DA28-4B30-B357-0005CE66716A"), "工学","电气信息类", 4); target.AddSpeciality(speciality); UniversityRepository repository = new UniversityRepository(); var university = repository.Get(speciality.UniversityId); var createdSpeciality = university.Specialities.SingleOrDefault<Speciality>(s => s.Id == specialityId); Assert.AreNotEqual(createdSpeciality, null); Assert.AreEqual(createdSpeciality.Id, specialityId); }
////Adding //Adding Button Clicks private void AddUniversityButton_Click(object sender, EventArgs e) { var universityRepository = new UniversityRepository(); var universityName = addUniversityNameTextBox.Text; var university = new University(universityName); if (_inspecting != Inspecting.Universities) { return; } universityRepository.Create(university); RefreshUniversitiesList(); }
public UnitOfWork(AcaShareDbContext dbContext) { _db = dbContext; Universities = new UniversityRepository(_db.University); Departments = new DepartmentRepository(_db.Department); Semesters = new SemesterRepository(_db.Semester); Subjects = new SubjectRepository(_db.Subject); Lessons = new LessonRepository(_db.Lesson); Users = new UserRepository(_db.User); Materials = new MaterialRepository(_db.Material, _db.File, _db.ChangeReason, _db.DeleteRequest, _db.EditRequest); MaterialStates = new MaterialStatesRepository(_db.MaterialState); SidebarRepository = new SidebarRepository(_db.Comment, _db.Material, _db.Favorites); StatisticsRepository = new StatisticsRepository(_db.DeleteRequest); NotificationRepository = new NotificationRepository(_db.Notification); MainModeratorRepository = new MainModeratorRepository(_db.UniversityMainModerator); }
private void SelectCellFromUniversityRow(DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { ShowContextMenu(e); return; } var universityRepository = new UniversityRepository(); var table = universityRepository.FindAll(); var universityId = table.Rows[e.RowIndex].Field <int>("UniversityID"); _inspecting = Inspecting.Groups; _inspectingList.Add(universityId); RefreshGroupsList(universityId); }
public void setUp() { obj = new UniversitiesController(_linkGenerator, _logger, _universityService); id = new Guid("1B7F86DD-FCD0-42A5-5E5F-08D7D5A16E26"); repository = new UniversityRepository(dbContext); source = new CancellationTokenSource(); token = source.Token; pagedResourceParameters = new UniversityResourceParameters(); context = new ActionContext(); universityDto = new UniversityDto(); //serviceProvider var serviceCollection = new ServiceCollection(); //serviceCollection.AddSingleton<IUniversityService, UniversityService>(); //serviceCollection.AddTransient<University>(); serviceCollection.AddTransient <IInstitutionService, InstitutionService>(); _serviceProvider = serviceCollection.BuildServiceProvider(); //-------------------------------------------------------------- uow = new UnitOfWork(dbContext, _serviceProvider); //logger var loggerFactory = LoggerFactory.Create(builder => { builder .AddFilter("Microsoft", LogLevel.Warning) .AddFilter("System", LogLevel.Warning) .AddFilter("LoggingConsoleApp.University", LogLevel.Debug) .AddConsole() .AddEventLog(); }); logger = loggerFactory.CreateLogger <UniversityService>(); logger.LogInformation("Example log message"); //------------------------------------------------------------------ _mapper = new MapperConfiguration(mc => { mc.AddProfile(new MappingProfile()); }).CreateMapper(); universityService = new UniversityService(uow, _mapper, logger); }
public LecturerService(UniversityRepository <Lecturer> lecturerRepository) { this.lecturerRepository = lecturerRepository; }
public StudentService(UniversityRepository <Student> studentRepository) { this.studentRepository = studentRepository; }
public void AddUniversityTest() { UniversityAppService target = new UniversityAppService(); University university = University.CreateUniversity(universityId, "上海测试大学", "普通高校", "无", "上海市福州路1号", false, true, false, "上海市", "上海市"); target.AddUniversity(university); using (UniversityRepository repository = new UniversityRepository()) { var createdUniversity = repository.Get(universityId); Assert.AreNotEqual(createdUniversity, null); Assert.AreEqual(createdUniversity.Name, "上海测试大学"); } }
public void UpdateUniversityTest() { UniversityAppService target = new UniversityAppService(); using (UniversityRepository repository = new UniversityRepository()) { var university = repository.Get(new Guid("AA1E7B07-3701-41FC-9291-D742B9E17DDE"));//universityId); university.Email = "*****@*****.**"; target.UpdateUniversity(university); repository.Refresh(university); Assert.AreEqual(university.Email, "*****@*****.**"); } }
public void UpdateUniversity(University university) { if (university == null) throw new ArgumentNullException("university"); using (UniversityRepository universityRepository = new UniversityRepository()) { var original = universityRepository.Get(university.Id); universityRepository.Merge(university); universityRepository.Commit(); } }
public EducationalInstitutionController(UniversityRepository universityRepository, SchoolRepository schoolRepository, IMapper mapper) { UniversityRepository = universityRepository; SchoolRepository = schoolRepository; Mapper = mapper; }
public CourseService(UniversityRepository <Lecturer> lecturerRepository, UniversityRepository <Course> courseRepository, UniversityRepository <Student> studentRepository) { this.lecturerRepository = lecturerRepository; this.courseRepository = courseRepository; this.studentRepository = studentRepository; }
public CoursesController(UniversityContext context, IMapper mapper) { repo = new UniversityRepository(context); this.mapper = mapper; }
public GetUniversitiesAndStudyGroupsServerAction(IServiceProvider serviceProvider, UniversityRepository universityRepository, UniwikiContext uniwikiContext) : base(serviceProvider) { _universityRepository = universityRepository; _uniwikiContext = uniwikiContext; }
public UniversityManager() { _IUniversityRepository = new UniversityRepository(); }
public void RemoveUniversity(Guid universityId) { using (UniversityRepository universityRepository = new UniversityRepository()) { var university = universityRepository.Get(universityId); if (university != null) { universityRepository.Remove(university); universityRepository.Commit(); } } }
public HomeTaskService(UniversityRepository <Course> courseRepository, UniversityRepository <HomeTask> homeTaskRepository) { this.courseRepository = courseRepository; this.homeTaskRepository = homeTaskRepository; }
public AddUniversityServerAction(IServiceProvider serviceProvider, UniversityRepository universityRepository, TextService textService) : base(serviceProvider) { _universityRepository = universityRepository; _textService = textService; }