示例#1
0
 public IEnumerable <Candidate> GetCandidates(CandidateStatus status)
 {
     using (var context = new CandidateTrackerDBDataContext(_connectionString))
     {
         return(context.Candidates.Where(c => c.Status == (int)status).ToList());
     }
 }
示例#2
0
        void ICandidateStatusCommand.ConfirmStatus(Guid candidateId, CandidateStatus status)
        {
            var service = _serviceFactory.Create();

            try
            {
                switch (status)
                {
                case CandidateStatus.ActivelyLooking:
                    service.OnActivelyLookingConfirmed(candidateId);
                    break;

                case CandidateStatus.AvailableNow:
                    service.OnAvailableNowConfirmed(candidateId);
                    break;
                }

                _serviceFactory.Close(service);
            }
            catch (Exception)
            {
                _serviceFactory.Abort(service);
                throw;
            }
        }
示例#3
0
 public void ChangeStatus(int candidateId, CandidateStatus status)
 {
     using (var context = new CandidateTrackerDBDataContext(_connectionString))
     {
         context.ExecuteCommand("UPDATE Candidates SET Status = {0} WHERE Id = {1}", status, candidateId);
     }
 }
        public async Task <IActionResult> PutCandidateStatus([FromRoute] int id, [FromBody] CandidateStatus candidateStatus)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != candidateStatus.CandidateStatusId)
            {
                return(BadRequest());
            }

            _context.Entry(candidateStatus).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CandidateStatusExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#5
0
        protected ReadOnlyUrl GetUpdateStatusUrl(CandidateStatus status)
        {
            var url = _updateStatusUrl.AsNonReadOnly();

            url.QueryString["status"] = status.ToString();
            return(url);
        }
        private void TestConfirm(bool isLoggedIn)
        {
            // Create member.

            const CandidateStatus status = CandidateStatus.ActivelyLooking;
            var member = CreateMember(0, status);

            Assert.AreEqual(status, _candidatesCommand.GetCandidate(member.Id).Status);

            // Send email.

            _emailsCommand.TrySend(new CandidateLookingConfirmationEmail(member));

            // Follow link.

            var expectedUrl = new ReadOnlyApplicationUrl(true, "~/members/profile/status/update", new ReadOnlyQueryString("status", status.ToString()));

            if (isLoggedIn)
            {
                LogIn(member);
            }
            else
            {
                LogOut();
            }
            AssertLink(GetLinkUrl(0, 3), GetEmailUrl(Definition, expectedUrl));

            // Confirm status.

            ConfirmStatus(member, status);
        }
        private void TestChangeStatus(bool isLoggedIn)
        {
            const CandidateStatus previousStatus = CandidateStatus.ActivelyLooking;
            const CandidateStatus newStatus      = CandidateStatus.AvailableNow;

            var member = CreateMember(0, previousStatus);

            Assert.AreEqual(previousStatus, _candidatesCommand.GetCandidate(member.Id).Status);

            // Send email.

            _emailsCommand.TrySend(new CandidateLookingConfirmationEmail(member));

            // Follow link.

            if (isLoggedIn)
            {
                LogIn(member);
            }
            else
            {
                LogOut();
            }
            AssertLink(GetLinkUrl(1, 3), GetEmailUrl(Definition, GetUpdateStatusUrl()));

            // Change the status.

            ChangeStatus(member, previousStatus, newStatus);
        }
示例#8
0
        public static string CandidateStatusString(this CandidateStatus status)
        {
            switch (status)
            {
            case CandidateStatus.New:
                return("New");

            case CandidateStatus.Rejected:
                return("Rejected");

            case CandidateStatus.Selected:
                return("Selected");

            case CandidateStatus.TestAssigned:
                return("Test assigned");

            case CandidateStatus.TestSubmitted:
                return("Test submitted");

            case CandidateStatus.UnderEvaluation:
                return("Under evaluation");

            case CandidateStatus.Archived:
                return("Archived");

            case CandidateStatus.OnHold:
                return("On Hold");

            default: return("");
            }
        }
        public void TestOtherConfirm()
        {
            // Create 2 members.

            const CandidateStatus status1 = CandidateStatus.ActivelyLooking;
            var member1 = CreateMember(1, status1);
            const CandidateStatus status2 = CandidateStatus.AvailableNow;
            var member2 = CreateMember(2, status2);

            // Send email to member1.

            _emailsCommand.TrySend(new CandidateLookingConfirmationEmail(member1));

            // Follow link logged in as other member.

            var expectedUrl = new ReadOnlyApplicationUrl(true, "~/members/profile/status/update", new ReadOnlyQueryString("status", status1.ToString()));

            LogIn(member2);
            AssertLink(GetLinkUrl(0, 3), GetEmailUrl(Definition, expectedUrl));

            // Status should have been changed for other member.

            AssertPageContains("Your work status has been updated to");

            // Should not be shown options.

            Assert.IsFalse(_availableNowRadioButton.IsVisible);
            Assert.IsFalse(_activelyLookingRadioButton.IsVisible);
            Assert.IsFalse(_openToOffersRadioButton.IsVisible);
            Assert.IsFalse(_notLookingRadioButton.IsVisible);
            Assert.IsFalse(_saveButton.IsVisible);

            Assert.AreEqual(status1, _candidatesCommand.GetCandidate(member1.Id).Status);
            Assert.AreEqual(status1, _candidatesCommand.GetCandidate(member2.Id).Status);
        }
        public JsonResult Edit(CandidateStatus model)
        {
            if (ModelState.IsValid)
            {
                var user    = CurrentUser;
                var userLog = new UserLog
                {
                    ByUserId   = user.UserId,
                    ByUserName = user.Name,
                    UserId     = user.UserId
                };

                if (model.IsNew)
                {
                    _db.CandidateStatuses.Add(model);
                    userLog.Comment = "Added new candidate status - " + model.Name;
                }
                else
                {
                    _db.Entry(model).State = System.Data.EntityState.Modified;
                    userLog.Comment        = "Updated candidate status - " + model.Name;
                }
                _db.UserLogs.Add(userLog);
                _db.SaveChanges();
            }
            return(GetErrorMsgJSON());
        }
        private void HandleStatusChanged(Guid candidateId, CandidateStatus status)
        {
            // SettingsCommand will fire the CategoryFrequencyUpdated event
            // that will be handled in this.OnFrequencyChanged() method.

            _settingsCommand.SetFrequency(candidateId, _categoryId, status.SuggestedJobsFrequency());
        }
示例#12
0
        private void TestSelectStatus(bool loggedIn)
        {
            const CandidateStatus previousStatus = CandidateStatus.AvailableNow;
            const CandidateStatus newStatus      = CandidateStatus.ActivelyLooking;

            var member = CreateMember(0, previousStatus);

            AssertStatus(member.Id, previousStatus);

            if (loggedIn)
            {
                LogIn(member);
            }

            var url = GetUpdateStatusUrl();

            Get(url);

            if (!loggedIn)
            {
                // Should be prompted to log in.

                var loginUrl = GetLoginUrl(url);
                AssertUrl(loginUrl);
                SubmitLogIn(member);
            }

            AssertUrl(url);

            // Should be shown options.

            Assert.IsTrue(_availableNowRadioButton.IsVisible);
            Assert.IsTrue(_activelyLookingRadioButton.IsVisible);
            Assert.IsTrue(_openToOffersRadioButton.IsVisible);
            Assert.IsTrue(_notLookingRadioButton.IsVisible);
            Assert.IsTrue(_saveButton.IsVisible);

            Assert.AreEqual(previousStatus == CandidateStatus.AvailableNow, _availableNowRadioButton.IsChecked);
            Assert.AreEqual(previousStatus == CandidateStatus.ActivelyLooking, _activelyLookingRadioButton.IsChecked);
            Assert.AreEqual(previousStatus == CandidateStatus.OpenToOffers, _openToOffersRadioButton.IsChecked);
            Assert.AreEqual(previousStatus == CandidateStatus.NotLooking, _notLookingRadioButton.IsChecked);

            // Change status.

            _activelyLookingRadioButton.IsChecked = true;
            _saveButton.Click();

            url = GetUpdateStatusUrl(newStatus);
            AssertUrl(url);

            AssertPageContains("Your work status has been updated to");
            Assert.IsFalse(_availableNowRadioButton.IsVisible);
            Assert.IsFalse(_activelyLookingRadioButton.IsVisible);
            Assert.IsFalse(_openToOffersRadioButton.IsVisible);
            Assert.IsFalse(_notLookingRadioButton.IsVisible);
            Assert.IsFalse(_saveButton.IsVisible);

            AssertStatus(member.Id, newStatus);
        }
示例#13
0
 public int GetCount(CandidateStatus status)
 {
     using (var context = new CandidateTrackerDBDataContext(_connectionString))
     {
         int result = context.Candidates.Where(c => c.Status == (int)status).Count();
         return(result);
     }
 }
示例#14
0
        private void UpdateStatus(Guid memberId, CandidateStatus status)
        {
            var candidate = _candidatesQuery.GetCandidate(memberId);
            candidate.Status = status;
            _candidatesCommand.UpdateCandidate(candidate);

            //return RedirectToRoute(ProfilesRoutes.Profile, new { succInfoType = "updateStatus" });
        }
示例#15
0
        protected Member CreateMember(int index, CandidateStatus status)
        {
            var member    = _memberAccountsCommand.CreateTestMember(index);
            var candidate = _candidatesCommand.GetCandidate(member.Id);

            candidate.Status = status;
            _candidatesCommand.UpdateCandidate(candidate);
            return(member);
        }
示例#16
0
        private Member CreateMember(int index, CandidateStatus status)
        {
            var member    = CreateMember(index);
            var candidate = _candidatesQuery.GetCandidate(member.Id);

            candidate.Status = status;
            _candidatesCommand.UpdateCandidate(candidate);
            return(member);
        }
示例#17
0
        public ActionResult UpdateStatus(int id, CandidateStatus status)
        {
            var repo = new CandidatesRepository(Properties.Settings.Default.ConStr);

            repo.ChangeStatus(id, status);
            return(Json(new { pending = repo.GetCount(CandidateStatus.Pending),
                              accepted = repo.GetCount(CandidateStatus.Accepted),
                              rejected = repo.GetCount(CandidateStatus.Rejected) }));
        }
示例#18
0
        /// <summary>
        /// Change candidate status.
        /// </summary>
        /// <param name="candidateStatus"></param>
        /// <returns></returns>
        public Result ChangeStatus(CandidateStatus candidateStatus)
        {
            if (CandidateStatus == candidateStatus)
            {
                return(Result.Fail("Cannot set status to the same one"));
            }

            //Here will go future validation of the statuses of candidates
            CandidateStatus = candidateStatus;

            return(Result.Ok());
        }
 IList <Guid> ICandidateReportsRepository.GetCandidateStatuses(CandidateStatus status)
 {
     using (var dc = CreateDataContext(true))
     {
         return((from u in dc.RegisteredUserEntities
                 join m in dc.MemberEntities on u.id equals m.id
                 join c in dc.CandidateEntities on m.id equals c.id
                 where (u.flags & (int)UserFlags.Disabled) == 0 &&
                 c.status == (byte)status
                 select u.id).ToList());
     }
 }
        public void TestOtherChangeStatus()
        {
            const CandidateStatus previousStatus = CandidateStatus.ActivelyLooking;
            const CandidateStatus newStatus      = CandidateStatus.AvailableNow;

            // Create 2 members.

            const CandidateStatus status1 = previousStatus;
            var member1 = CreateMember(1, status1);
            const CandidateStatus status2 = previousStatus;
            var member2 = CreateMember(2, status2);

            // Send email to member 1.

            _emailsCommand.TrySend(new CandidateLookingConfirmationEmail(member1));

            // Follow link logged in as other member.

            LogIn(member2);
            AssertLink(GetLinkUrl(1, 3), GetEmailUrl(Definition, GetUpdateStatusUrl()));

            // Change the status.

            Assert.IsTrue(_availableNowRadioButton.IsVisible);
            Assert.IsTrue(_activelyLookingRadioButton.IsVisible);
            Assert.IsTrue(_openToOffersRadioButton.IsVisible);
            Assert.IsTrue(_notLookingRadioButton.IsVisible);
            Assert.IsTrue(_saveButton.IsVisible);

            Assert.AreEqual(previousStatus == CandidateStatus.AvailableNow, _availableNowRadioButton.IsChecked);
            Assert.AreEqual(previousStatus == CandidateStatus.ActivelyLooking, _activelyLookingRadioButton.IsChecked);
            Assert.AreEqual(previousStatus == CandidateStatus.OpenToOffers, _openToOffersRadioButton.IsChecked);
            Assert.AreEqual(previousStatus == CandidateStatus.NotLooking, _notLookingRadioButton.IsChecked);

            // Change status.

            _availableNowRadioButton.IsChecked = true;
            _saveButton.Click();

            var url = GetUpdateStatusUrl(newStatus);

            AssertUrl(url);

            AssertPageContains("Your work status has been updated to");
            Assert.IsFalse(_availableNowRadioButton.IsVisible);
            Assert.IsFalse(_activelyLookingRadioButton.IsVisible);
            Assert.IsFalse(_openToOffersRadioButton.IsVisible);
            Assert.IsFalse(_notLookingRadioButton.IsVisible);
            Assert.IsFalse(_saveButton.IsVisible);

            AssertStatus(member1.Id, previousStatus);
            AssertStatus(member2.Id, newStatus);
        }
        public async Task <IActionResult> PostCandidateStatus([FromBody] CandidateStatus candidateStatus)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.CandidateStatuses.Add(candidateStatus);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCandidateStatus", new { id = candidateStatus.CandidateStatusId }, candidateStatus));
        }
示例#22
0
        protected Member CreateMember(CandidateStatus status, string desiredJobTitle)
        {
            var member    = _memberAccountsCommand.CreateTestMember(EmailAddress, FirstName, LastName);
            var candidate = _candidatesCommand.GetCandidate(member.Id);

            candidate.Status = status;
            if (!string.IsNullOrEmpty(desiredJobTitle))
            {
                candidate.DesiredJobTitle = desiredJobTitle;
            }
            _candidatesCommand.UpdateCandidate(candidate);
            return(member);
        }
示例#23
0
文件: Service.cs 项目: formist/LinkMe
        void IService.OnStatusChanged(Guid candidateId, CandidateStatus status)
        {
            #region Log
            const string method = "OnStatusChanged";
            EventSource.Raise(Event.FlowEnter, method, Event.Arg("candidateId", candidateId), Event.Arg("status", status));
            #endregion

            HandleExternalEvent(candidateId, status, i => _dataExchange.OnStatusChanged(i, status.ToState()), method);

            #region Log
            EventSource.Raise(Event.FlowExit, method, Event.Arg("candidateId", candidateId), Event.Arg("status", status));
            #endregion
        }
示例#24
0
        protected void ChangeStatus(Member member, CandidateStatus previousStatus, CandidateStatus newStatus)
        {
            // Should be shown options.

            Assert.IsTrue(_availableNowRadioButton.IsVisible);
            Assert.IsTrue(_activelyLookingRadioButton.IsVisible);
            Assert.IsTrue(_openToOffersRadioButton.IsVisible);
            Assert.IsTrue(_notLookingRadioButton.IsVisible);
            Assert.IsTrue(_saveButton.IsVisible);

            Assert.AreEqual(previousStatus == CandidateStatus.AvailableNow, _availableNowRadioButton.IsChecked);
            Assert.AreEqual(previousStatus == CandidateStatus.ActivelyLooking, _activelyLookingRadioButton.IsChecked);
            Assert.AreEqual(previousStatus == CandidateStatus.OpenToOffers, _openToOffersRadioButton.IsChecked);
            Assert.AreEqual(previousStatus == CandidateStatus.NotLooking, _notLookingRadioButton.IsChecked);

            // Change status.

            switch (newStatus)
            {
            case CandidateStatus.ActivelyLooking:
                _activelyLookingRadioButton.IsChecked = true;
                break;

            case CandidateStatus.AvailableNow:
                _availableNowRadioButton.IsChecked = true;
                break;

            case CandidateStatus.NotLooking:
                _notLookingRadioButton.IsChecked = true;
                break;

            case CandidateStatus.OpenToOffers:
                _openToOffersRadioButton.IsChecked = true;
                break;
            }

            _saveButton.Click();

            var url = GetUpdateStatusUrl(newStatus);

            AssertUrl(url);

            AssertPageContains("Your work status has been updated to");
            Assert.IsFalse(_availableNowRadioButton.IsVisible);
            Assert.IsFalse(_activelyLookingRadioButton.IsVisible);
            Assert.IsFalse(_openToOffersRadioButton.IsVisible);
            Assert.IsFalse(_notLookingRadioButton.IsVisible);
            Assert.IsFalse(_saveButton.IsVisible);

            AssertStatus(member.Id, newStatus);
        }
示例#25
0
        protected void ConfirmStatus(Member member, CandidateStatus status)
        {
            AssertPageContains("Your work status has been confirmed as");

            // Should not be shown options.

            Assert.IsFalse(_availableNowRadioButton.IsVisible);
            Assert.IsFalse(_activelyLookingRadioButton.IsVisible);
            Assert.IsFalse(_openToOffersRadioButton.IsVisible);
            Assert.IsFalse(_notLookingRadioButton.IsVisible);
            Assert.IsFalse(_saveButton.IsVisible);

            Assert.AreEqual(status, _candidatesCommand.GetCandidate(member.Id).Status);
        }
示例#26
0
        private void HandleStatusChanged(Guid candidateId, CandidateStatus status)
        {
            var proxy = _proxyManager.Create();

            try
            {
                proxy.OnStatusChanged(candidateId, status);
                _proxyManager.Close(proxy);
            }
            catch (Exception)
            {
                _proxyManager.Abort(proxy);
                throw;
            }
        }
示例#27
0
        protected string GetCssIconClass(CandidateStatus status)
        {
            switch (status)
            {
            case CandidateStatus.ActivelyLooking:
                return("actively-looking");

            case CandidateStatus.AvailableNow:
                return("available-now");

            case CandidateStatus.OpenToOffers:
                return("open-to-offers");

            default:
                return("not-looking");
            }
        }
示例#28
0
文件: Mapper.cs 项目: formist/LinkMe
        public static Frequency SuggestedJobsFrequency(this CandidateStatus status)
        {
            switch (status)
            {
            case CandidateStatus.Unspecified:
            case CandidateStatus.NotLooking:
                return(Frequency.Monthly);

            case CandidateStatus.OpenToOffers:
                return(Frequency.Weekly);

            case CandidateStatus.ActivelyLooking:
            case CandidateStatus.AvailableNow:
                return(Frequency.Daily);

            default:
                throw new ArgumentOutOfRangeException("status");
            }
        }
示例#29
0
        public static State ToState(this CandidateStatus status)
        {
            switch (status)
            {
            case CandidateStatus.Unspecified:
            case CandidateStatus.NotLooking:
            case CandidateStatus.OpenToOffers:
                return(State.Passive);

            case CandidateStatus.ActivelyLooking:
                return(State.ActivelyLooking);

            case CandidateStatus.AvailableNow:
                return(State.AvailableNow);

            default:
                throw new ArgumentOutOfRangeException("status");
            }
        }
示例#30
0
文件: Service.cs 项目: formist/LinkMe
        private void CreateWorkflow(Guid candidateId, CandidateStatus status, bool ignoreTimeoutOnce)
        {
            // Create new workflow instance.

            var parameters = new Dictionary <string, object>
            {
                { "CandidateId", candidateId },
                { "State", status.ToState() },
                { "IgnoreTimeoutOnce", ignoreTimeoutOnce },
            };

            var workflow = CreateWorkflow <Design.CandidateStatusWorkflow.Workflow>(parameters);

            // Record workflow instance in LinkMe database.

            _candidatesWorkflowCommand.AddStatusWorkflow(candidateId, workflow.InstanceId);

            // Start running the workflow.

            workflow.Start();
        }
示例#31
0
 public void UpdateStatus(CandidateStatus status,int candidateID)
 {
     Candidate objDb = GetById(candidateID.ToString());
     if (objDb != null)
     {
         objDb.Status = (int)status;
         //new CandidateLogDao().WriteLogForUpdateStatus(objDb, ELogAction.Update);
         dbContext.SubmitChanges();
     }
 }