コード例 #1
0
 public SqlDataService(PaylocityDbContext paylocityDbContext)
 {
     DependentsRepository     = new DependentRepository(paylocityDbContext);
     DependentTypesRepository = new DependentTypeRepository(paylocityDbContext);
     EmployeesRepository      = new EmployeeRepository(paylocityDbContext);
     EmployersRepository      = new EmployerRepository(paylocityDbContext);
 }
コード例 #2
0
        public UnitOfWork(AddressRepository addressRepository, CandidateRepository candidateRepository, EmployerRepository employerRepository,
                          GorvernmentRepository gorvernmentRepository, JobRepository jobRepository, MicroCredentialRepository microCredentialRepository, MoocProviderRepository moocProviderRepository,
                          RecruitmentAgencyRepository recruitmentAgencyRepository, AccreditationBodyRepository accreditationBodyRepository, CandidateMicroCredentialCourseRepository candidateMicroCredentialCourseRepository,
                          EndorsementBodyRepository endorsementBodyRepository, CandidateJobApplicationRepository candidateJobApplicationRepository, CandidatetMicroCredentialBadgesRepository candidatetMicroCredentialBadgesRepository,
                          StratisAccountRepository stratisAccountRepository)
        {
            _addressRepository = addressRepository;

            _candidateRepository = candidateRepository;

            _employerRepository = employerRepository;

            _gorvernmentRepository = gorvernmentRepository;

            _jobRepository = jobRepository;

            _microCredentialRepository = microCredentialRepository;

            _moocProviderRepository = moocProviderRepository;

            _recruitmentAgencyRepository = recruitmentAgencyRepository;

            _accreditationBodyRepository = accreditationBodyRepository;

            _candidateMicroCredentialCourseRepository = candidateMicroCredentialCourseRepository;

            _endorsementBodyRepository = endorsementBodyRepository;

            _candidateJobApplicationRepository = candidateJobApplicationRepository;

            _candidatetMicroCredentialBadgesRepository = candidatetMicroCredentialBadgesRepository;

            _stratisAccountRepository = stratisAccountRepository;
        }
コード例 #3
0
        public void GetListOfEmployersAndCheckAreEqualLikeModels()
        {
            //Arrange
            Employer employer1 = new Employer()
            {
                Id   = 66,
                Name = "test",
                NIP  = "unit"
            };

            Employer employer2 = new Employer()
            {
                Id   = 67,
                Name = "test1",
                NIP  = "unit1"
            };

            var options = new DbContextOptionsBuilder <Context>()
                          .UseInMemoryDatabase(databaseName: "UsersDirectoryMVC")
                          .Options;

            using (var context = new Context(options))
            {
                //Act
                var employerRepository = new EmployerRepository(context);
                employerRepository.AddEmployer(employer1);
                employerRepository.AddEmployer(employer2);

                var listOfEmployers = employerRepository.GetAllActiveEmployers();

                //Assert
                listOfEmployers.FirstOrDefault(e => e.Id == 66).Should().Equals(employer1);
                listOfEmployers.FirstOrDefault(e => e.Id == 67).Should().Equals(employer2);
            }
        }
コード例 #4
0
 public EmployerController(JobseekerRepository jobseekerRepository, EmployerRepository employerRepository, CompanyRepository companyRepository, ExperienceRepository experienceRepository, UserRepository userRepository)
     : base(userRepository, experienceRepository)
 {
     this.employerRepository  = employerRepository;
     this.companyRepository   = companyRepository;
     this.jobseekerRepository = jobseekerRepository;
 }
コード例 #5
0
        public void CheckEmployerExistAfterDelete()
        {
            //Arrange
            Employer employer1 = new Employer()
            {
                Id   = 66,
                Name = "test",
                NIP  = "unit"
            };
            Employer employer2 = new Employer()
            {
                Id   = 77,
                Name = "test",
                NIP  = "unit"
            };

            var options = new DbContextOptionsBuilder <Context>()
                          .UseInMemoryDatabase(databaseName: "UsersDirectoryMVC")
                          .Options;

            using (var context = new Context(options))
            {
                //Act
                var employerRepository = new EmployerRepository(context);
                employerRepository.AddEmployer(employer1);
                employerRepository.AddEmployer(employer2);
                employerRepository.DeleteEmployer(66);
                var gerEmployer1 = employerRepository.GetEmployer(66);
                var gerEmployer2 = employerRepository.GetEmployer(77);
                //Assert
                gerEmployer1.Should().BeNull();
                gerEmployer2.Should().Equals(employer2);
            }
        }
コード例 #6
0
 public ApplicantRegisterForm(DataService service)
 {
     this.service = service;
     appRepos     = new ApplicantRepository(this.service);
     empRepos     = new EmployerRepository(this.service);
     InitializeComponent();
 }
コード例 #7
0
        public async Task TestEmployerRepositoryReturnsList()
        {
            var employerRepository = new EmployerRepository();
            var actual             = await employerRepository.GetAll().ConfigureAwait(false);

            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Any());
        }
コード例 #8
0
 public JobseekerController(EmployerRepository employerRepository, JobseekerRepository jobseekerRepository, ExperienceRepository experienceRepository, BinaryFileRepository fileRepository,
                            UserRepository userRepository) : base(userRepository, experienceRepository)
 {
     this.jobseekerRepository  = jobseekerRepository;
     this.employerRepository   = employerRepository;
     this.experienceRepository = experienceRepository;
     this.fileRepository       = fileRepository;
 }
コード例 #9
0
        private const string dateTimeFormat = "d.MM.yyyy";   // Use this format.

        public FormSalaries()
        {
            InitializeComponent();

            salRepo = new SalaryRepository();   //contains data
            empRepo = new EmployerRepository(); //contains data FK

            RefreshGui();
        }
        public void ThenTheDatabaseShouldHaveANewEmployerNamed1066Enterprise()
        {
            Thread.Sleep(10000);
            var employerRepository = new EmployerRepository(new MatchingDbContext());
            var employer           = employerRepository.GetByName("1066 Enterprise");

            Thread.Sleep(10000);
            Assert.AreEqual(employer.AlsoKnownAs, "1066 Enterprise");
        }
コード例 #11
0
 public FluentRecordBase AddRepoEmployer()
 {
     if (_dbFactory == null)
     {
         AddDBFactory();
     }
     _repoE = new EmployerRepository(_dbFactory);
     return(this);
 }
コード例 #12
0
        public UnitOfWork(DbContextOptions contextOptions)
        {
            _context = new DatabaseContext(contextOptions);

            Employers = new EmployerRepository(_context);
            Workers   = new WorkerRepository(_context);

            Migrate();
        }
コード例 #13
0
        public FormEmployeesEdit(DepartmentRepository repositoryOfDepartments) //adding
        {
            InitializeComponent();
            empRepo      = new EmployerRepository();
            se           = new SoloEmployer();
            this.dpmRepo = repositoryOfDepartments;

            comboBoxDep.DataSource    = dpmRepo.getComboBoxSource();
            comboBoxDep.DisplayMember = "Name";
            comboBoxDep.ValueMember   = "IDdpm";
        }
コード例 #14
0
        public FormReports()
        {
            InitializeComponent();
            dpmRepo          = new DepartmentRepository();
            empRepo          = new EmployerRepository();
            salRepo          = new SalaryRepository();
            people           = new List <HumanItem>();
            salariesPerMonth = new Dictionary <DateTime, List <double> >();

            RefreshGui();
        }
コード例 #15
0
 public ResumeAdderForm(DataService service, Applicant applicant)
 {
     this.service   = service;
     this.applicant = applicant;
     this.appRepos  = new ApplicantRepository(this.service);
     this.empRepos  = new EmployerRepository(this.service);
     this.vacRepos  = new VacancyRepository(this.service);
     this.resRepos  = new ResumeRepository(this.service);
     this.reqRepos  = new RequestRepository(this.service);
     InitializeComponent();
 }
コード例 #16
0
        public UnitOfWork(IDbConnection connection,
                          IDbTransaction dbTransaction)
        {
            _connection    = connection;
            _dbTransaction = dbTransaction;

            DepartmentRepository = new DepartmentRepository(_connection, _dbTransaction);
            EmployerRepository   = new EmployerRepository(_connection, _dbTransaction);
            OccupationRepository = new OccupationRepository(_connection, _dbTransaction);
            UserAuthRepository   = new UserAuthRepository(_connection, _dbTransaction);
            UserRepository       = new UserRepository(_connection, _dbTransaction);
        }
コード例 #17
0
 public VacancyEditorForm(DataService service, Employer employer, Vacancy vacancy)
 {
     this.service  = service;
     this.employer = employer;
     this.vacancy  = vacancy;
     this.appRepos = new ApplicantRepository(this.service);
     this.empRepos = new EmployerRepository(this.service);
     this.vacRepos = new VacancyRepository(this.service);
     this.resRepos = new ResumeRepository(this.service);
     this.reqRepos = new RequestRepository(this.service);
     InitializeComponent();
 }
コード例 #18
0
        public FormSalariesEdit(EmployerRepository repositoryOfEmployee)
        {
            InitializeComponent();

            salRepo      = new SalaryRepository();
            ss           = new SoloSalary();
            this.empRepo = repositoryOfEmployee;
            monthCalendarUntil.SetDate(DateTime.Today.AddYears(1)); //add default end date
            comboBoxEmp.DataSource    = empRepo.getComboBoxSource();
            comboBoxEmp.DisplayMember = "Name3";                    //changing by event
            comboBoxEmp.ValueMember   = "ID";
            comboBoxEmp.SelectedIndex = -1;                         //not implicitely touch other users
        }
コード例 #19
0
        public UnitOfWork(HotelContext context)
        {
            Rooms           = new RoomRepository(context);
            RoomTypes       = new RoomTypeRepository(context);
            Customers       = new CustomerRepository(context);
            Contracts       = new ContractRepository(context);
            Employers       = new EmployerRepository(context);
            ServiceRooms    = new ServiceRepository(context);
            Bills           = new BillRepository(context);
            ContractDetails = new ContractDetailRepository(context);

            _context = context;
        }
コード例 #20
0
 public EmployerMainForm(DataService service, Employer employer)
 {
     this.service   = service;
     this.employer  = employer;
     this.appRepos  = new ApplicantRepository(this.service);
     this.empRepos  = new EmployerRepository(this.service);
     this.vacRepos  = new VacancyRepository(this.service);
     this.resRepos  = new ResumeRepository(this.service);
     this.reqRepos  = new RequestRepository(this.service);
     this.vacancies = vacRepos.VacanciesByLogin(this.employer.Login);
     this.resumes   = resRepos.ShownResumes();
     this.requests  = reqRepos.RequestsByEmployer(vacRepos, this.employer.Login);
     InitializeComponent();
 }
コード例 #21
0
 public ApplicantMainForm(DataService service, Applicant applicant)
 {
     this.service   = service;
     this.applicant = applicant;
     this.appRepos  = new ApplicantRepository(this.service);
     this.empRepos  = new EmployerRepository(this.service);
     this.vacRepos  = new VacancyRepository(this.service);
     this.resRepos  = new ResumeRepository(this.service);
     this.reqRepos  = new RequestRepository(this.service);
     this.resumes   = resRepos.ResumesByLogin(this.applicant.Login);
     this.vacancies = vacRepos.ShownVacancies();
     this.requests  = reqRepos.RequestByApplicant(this.resRepos, this.applicant.Login);
     InitializeComponent();
 }
コード例 #22
0
        public void ShouldUpdateEmployerNameAndNIP()
        {
            //Arrange
            Employer employer = new Employer()
            {
                Id   = 66,
                Name = "test",
                NIP  = "unit"
            };

            Employer updatedEmployer = new Employer()
            {
                Id   = 66,
                Name = "test1",
                NIP  = "unit1"
            };

            var options = new DbContextOptionsBuilder <Context>()
                          .UseInMemoryDatabase(databaseName: "UsersDirectoryMVC")
                          .Options;

            using (var context = new Context(options))
            {
                //Act
                var employerRepository = new EmployerRepository(context);
                employerRepository.AddEmployer(employer);
            }

            using (var context = new Context(options))
            {
                //Act
                var employerRepository = new EmployerRepository(context);
                //
                employerRepository.UpdateEmployer(updatedEmployer);
                var employerToCheckAfter = employerRepository.GetEmployer(66);

                //Assert
                employerToCheckAfter.Should().NotBeNull();
                employerToCheckAfter.Name.Should().Equals(updatedEmployer.Name);
                employerToCheckAfter.NIP.Should().Equals(updatedEmployer.NIP);
            }
        }
コード例 #23
0
        public FormSalariesEdit(SalaryRepository salariesRepo, EmployerRepository employeesRepo, int v)
        {
            InitializeComponent();
            this.salRepo          = salariesRepo;
            this.empRepo          = employeesRepo;
            this.SelectedSalIndex = v;
            ss = new SoloSalary();
            ss = salRepo.SelectById(SelectedSalIndex);

            labelID.Text = String.Format("ID of salary record: {0}", SelectedSalIndex);

            comboBoxEmp.DataSource    = empRepo.getComboBoxSource();
            comboBoxEmp.DisplayMember = "Name3";                         //changing to full name by event
            comboBoxEmp.ValueMember   = "ID";
            comboBoxEmp.SelectedValue = empRepo.SelectById(ss.IDemp).ID; //select ID where sal.IDemp = emp.IDemp

            numericUpDownAm.Value = (decimal)ss.Amount;
            monthCalendarFrom.SetDate(ss.validFrom);
            monthCalendarUntil.SetDate(ss.validUntil);
        }
コード例 #24
0
ファイル: Program.cs プロジェクト: Rene9203/test-app
        private static AppUser CreateEmployerUser(IServiceProvider services, AppDbContext appDbContext)
        {
            IEmployerRepository   employerRespository = new EmployerRepository(appDbContext);
            UserManager <AppUser> userManager         = services.GetService <UserManager <AppUser> >();

            AppUser johnDoe = new AppUser()
            {
                Email     = "*****@*****.**",
                FirstName = "Jane",
                LastName  = "Doe",
                UserName  = "******"
            };

            if (userManager.CreateAsync(johnDoe, "J4n3D03Pa$$").Result.Succeeded)
            {
                return(johnDoe);
            }

            return(null);
        }
コード例 #25
0
        public FormEmployeesEdit(EmployerRepository employerRepository, DepartmentRepository repositoryOfDepartments, int index) //editing
        {
            se = new SoloEmployer();
            employerRepository = new EmployerRepository();

            InitializeComponent();
            this.SelectedEmpIndex = index;
            this.empRepo          = employerRepository;
            this.dpmRepo          = repositoryOfDepartments;

            se                        = employerRepository.SelectById(SelectedEmpIndex);
            labelID.Text              = String.Format("ID of emloyer: {0}", SelectedEmpIndex);
            textBoxName1.Text         = se.Name1;
            textBoxName2.Text         = se.Name2;
            textBoxName3.Text         = se.Name3;
            textBoxEmail.Text         = se.Email;
            comboBoxDep.DataSource    = dpmRepo.getComboBoxSource();
            comboBoxDep.DisplayMember = "Name";
            comboBoxDep.ValueMember   = "IDdpm";
            //comboBoxDep.SelectedItem
        }
コード例 #26
0
        /// <summary>
        /// 核心【验证用户是否登陆并且已经通过审核】
        /// </summary>
        /// <param name="httpContext"></param>
        /// <returns></returns>
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            //检查Cookies["User"]是否存在
            if (httpContext.Request.Cookies["Employer"] == null)
            {
                return(false);
            }
            //验证用户名密码是否正确
            HttpCookie _cookie          = httpContext.Request.Cookies["Employer"];
            string     _employerAccount = _cookie["EmployerAccount"];
            string     _employerPwd     = _cookie["EmployerPwd"]; //cookie里存的先自己加密,再url加密的密码
            string     _isDelete        = _cookie["IsDelete"];

            if (_employerAccount == "" || _employerPwd == "")
            {
                return(false);
            }
            EmployerRepository _employerRsy = new EmployerRepository();

            if (_employerRsy.Authentication(_employerAccount, httpContext.Server.UrlDecode(_employerPwd)) == 1)
            {
                //再检验是否通过审核
                if (_isDelete == "0")
                {
                    return(true);
                }
                else
                {
                    //账号密码正确但是没通过审核,就跳转到待审核页面
                    httpContext.Response.Redirect("~/Employer/WaitAudit?Time=-1");
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
コード例 #27
0
        /// <summary>
        /// 核心【验证用户是否登陆】
        /// </summary>
        /// <param name="httpContext"></param>
        /// <returns></returns>
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            //检查Cookies["User"]是否存在

            if (httpContext.Request.Cookies["Employer"] == null)
            {
                return(false);
            }
            //验证用户名密码是否正确
            HttpCookie _cookie          = httpContext.Request.Cookies["Employer"];
            string     _employerAccount = _cookie["EmployerAccount"];
            string     _employerPwd     = _cookie["EmployerPwd"];//cookie里存的先自己加密,再url加密的密码
            string     _isDelete        = _cookie["IsDelete"];

            if (_employerAccount == "" || _employerPwd == "")
            {
                return(false);
            }
            EmployerRepository _employerRsy = new EmployerRepository();

            if (_employerRsy.Authentication(_employerAccount, httpContext.Server.UrlDecode(_employerPwd)) == 1)
            {
                if (_isDelete != "1")
                {
                    //只要登录账号密码匹配,并且不是被删除的记录,都有这个权限
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
コード例 #28
0
        public void CheckEmployerIdExistAfterAdd()
        {
            //Arrange
            Employer employer = new Employer()
            {
                Id   = 66,
                Name = "test",
                NIP  = "unit"
            };

            var options = new DbContextOptionsBuilder <Context>()
                          .UseInMemoryDatabase(databaseName: "UsersDirectoryMVC")
                          .Options;

            using (var context = new Context(options))
            {
                //Act
                var employerRepository = new EmployerRepository(context);
                var employerResult     = employerRepository.AddEmployer(employer);

                //Assert
                employerResult.Should().Equals(employer.Id);
            }
        }
コード例 #29
0
ファイル: Payday.cs プロジェクト: Dissmind/st_test_task
 public Payday()
 {
     _repository = new EmployerRepository();
 }
コード例 #30
0
 public EmployerController()
 {
     this.employerRepository = new EmployerRepository();
 }