コード例 #1
0
        private IList <RegisteredUser> MatchEmployers(Criteria criteria)
        {
            var employerCriteria = criteria as OrganisationEmployerSearchCriteria;

            return(employerCriteria == null
                ? new List <RegisteredUser>()
                : _executeEmployerSearchCommand.Search(employerCriteria).Cast <RegisteredUser>().ToList());
        }
コード例 #2
0
        public ActionResult Search(AdministrativeEmployerSearchCriteria criteria, [Bind(Include = "MatchOrganisationNameExactly")] CheckBoxValue matchOrganisationNameExactly, [Bind(Include = "IsEnabled")] CheckBoxValue isEnabled, [Bind(Include = "IsDisabled")] CheckBoxValue isDisabled)
        {
            // Search.

            criteria.IsEnabled  = isEnabled.IsChecked;
            criteria.IsDisabled = isDisabled.IsChecked;
            criteria.MatchOrganisationNameExactly = matchOrganisationNameExactly.IsChecked;
            var employers = _executeEmployerSearchCommand.Search(criteria);

            // Get logins.

            var loginIds = _loginCredentialsQuery.GetLoginIds(from e in employers select e.Id);

            return(View(new EmployerSearchModel
            {
                Criteria = criteria,
                Employers = (from e in employers
                             select new EmployerModel
                {
                    Employer = e,
                    LoginId = loginIds.ContainsKey(e.Id) ? loginIds[e.Id] : null
                }).ToList()
            }));
        }
コード例 #3
0
        public void TestNoWildCards()
        {
            var organisation = _organisationsCommand.CreateTestOrganisation(0);
            var employer1    = _employerAccountsCommand.CreateTestEmployer(EmailAddress, FirstName, LastName, organisation);

            _employerAccountsCommand.CreateTestEmployer(2, _organisationsCommand.CreateTestOrganisation(0));
            _employerAccountsCommand.CreateTestEmployer(3, _organisationsCommand.CreateTestOrganisation(0));

            var criteria = new AdministrativeEmployerSearchCriteria
            {
                OrganisationName = organisation.Name,
                FirstName        = FirstName,
                LastName         = LastName,
                LoginId          = LoginId,
                EmailAddress     = EmailAddress,
                IsEnabled        = true,
                IsDisabled       = true
            };

            var employers = _executeEmployerSearchCommand.Search(criteria);

            Assert.AreEqual(1, employers.Count);
            AssertEmployer(employer1, employers[0]);
        }