public IEnumerable <Candidate> GetCandidates(CandidateStatus status) { using (var context = new CandidateTrackerDBDataContext(_connectionString)) { return(context.Candidates.Where(c => c.Status == (int)status).ToList()); } }
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; } }
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()); }
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); }
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()); }
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); }
public int GetCount(CandidateStatus status) { using (var context = new CandidateTrackerDBDataContext(_connectionString)) { int result = context.Candidates.Where(c => c.Status == (int)status).Count(); return(result); } }
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" }); }
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); }
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); }
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) })); }
/// <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)); }
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); }
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 }
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); }
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); }
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; } }
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"); } }
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"); } }
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"); } }
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(); }
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(); } }