public void TestHasPrivateNotes()
        {
            var employer0 = CreateEmployer(0);
            var employer1 = CreateEmployer(1, employer0.Organisation);

            var member = CreateMember(0);
            var note   = new CandidateNote {
                CandidateId = member.Id, Text = NoteText
            };

            _candidateNotesCommand.CreatePrivateNote(employer0, note);

            TestCount(employer0, member.Id, 1, v => v.Notes);
            TestCount(employer1, member.Id, 0, v => v.Notes);
        }
Esempio n. 2
0
        public ActionResult NewNote(Guid[] candidateIds, string text, bool isShared)
        {
            try
            {
                var employer = CurrentEmployer;

                // Create them.

                foreach (var candidateId in candidateIds)
                {
                    var note = new CandidateNote
                    {
                        Text        = text,
                        CandidateId = candidateId,
                    };

                    if (isShared)
                    {
                        _candidateNotesCommand.CreateSharedNote(employer, note);
                    }
                    else
                    {
                        _candidateNotesCommand.CreatePrivateNote(employer, note);
                    }
                }
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new StandardErrorHandler());
            }

            return(Json(new JsonResponseModel()));
        }
Esempio n. 3
0
        public void TestFilterHasNotes()
        {
            var member1  = CreateMember(1);
            var member2  = CreateMember(2);
            var employer = _employersCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(1));

            // Member1 has notes.

            var note = new CandidateNote {
                CandidateId = member1.Id, Text = "A note"
            };

            _candidateNotesCommand.CreatePrivateNote(employer, note);

            // Filter.

            TestFilter(employer, CreateHasNotesCriteria, new[] { member1.Id, member2.Id }, new[] { member1.Id }, new[] { member2.Id });
        }
Esempio n. 4
0
        private CandidateNote CreateNote(int index, IEmployer noteCreator, Guid memberId, bool isShared)
        {
            var note = new CandidateNote {
                CandidateId = memberId, Text = string.Format(TextFormat, index)
            };

            if (isShared)
            {
                _candidateNotesCommand.CreateSharedNote(noteCreator, note);
            }
            else
            {
                _candidateNotesCommand.CreatePrivateNote(noteCreator, note);
            }
            return(note);
        }
Esempio n. 5
0
        public void TestHasNotes()
        {
            var organisation = _organisationsCommand.CreateTestOrganisation(0);
            var employer0    = CreateEmployer(0, organisation);
            var employer1    = CreateEmployer(1, organisation);

            var credit = _creditsQuery.GetCredit <ContactCredit>();

            _allocationsCommand.CreateAllocation(new Allocation {
                CreditId = credit.Id, InitialQuantity = 100, OwnerId = employer0.Id
            });
            _allocationsCommand.CreateAllocation(new Allocation {
                CreditId = credit.Id, InitialQuantity = 100, OwnerId = employer1.Id
            });

            // Put them all in the short list folder.

            var folder = _candidateFoldersQuery.GetShortlistFolder(employer0);

            // No notes.

            var index  = 0;
            var months = 0;
            var member = _memberAccountsCommand.CreateTestMember(++index);

            _candidateListsCommand.AddCandidateToFolder(employer0, folder, member.Id);

            // One private note.

            member = _memberAccountsCommand.CreateTestMember(++index);
            _candidateListsCommand.AddCandidateToFolder(employer0, folder, member.Id);
            _candidateNotesCommand.CreatePrivateNote(employer0, new CandidateNote {
                CandidateId = member.Id, CreatedTime = DateTime.Now.AddMonths(--months), UpdatedTime = DateTime.Now.AddMonths(--months), Text = "Private note"
            });

            // Multiple private notes.

            member = _memberAccountsCommand.CreateTestMember(++index);
            _candidateListsCommand.AddCandidateToFolder(employer0, folder, member.Id);
            _candidateNotesCommand.CreatePrivateNote(employer0, new CandidateNote {
                CandidateId = member.Id, CreatedTime = DateTime.Now.AddMonths(--months), UpdatedTime = DateTime.Now.AddMonths(--months), Text = "Multiple private notes"
            });
            _candidateNotesCommand.CreatePrivateNote(employer0, new CandidateNote {
                CandidateId = member.Id, CreatedTime = DateTime.Now.AddMonths(--months), UpdatedTime = DateTime.Now.AddMonths(--months), Text = "Multiple private notes"
            });

            // Shared note.

            member = _memberAccountsCommand.CreateTestMember(++index);
            _candidateListsCommand.AddCandidateToFolder(employer0, folder, member.Id);
            _candidateNotesCommand.CreateSharedNote(employer0, new CandidateNote {
                CandidateId = member.Id, CreatedTime = DateTime.Now.AddMonths(--months), UpdatedTime = DateTime.Now.AddMonths(--months), Text = "Shared note"
            });

            // Other shared note.

            member = _memberAccountsCommand.CreateTestMember(++index);
            _candidateListsCommand.AddCandidateToFolder(employer0, folder, member.Id);
            _candidateNotesCommand.CreateSharedNote(employer1, new CandidateNote {
                CandidateId = member.Id, CreatedTime = DateTime.Now.AddMonths(--months), UpdatedTime = DateTime.Now.AddMonths(--months), Text = "Other shared note"
            });

            // All.

            member = _memberAccountsCommand.CreateTestMember(++index);
            _candidateListsCommand.AddCandidateToFolder(employer0, folder, member.Id);
            _candidateNotesCommand.CreatePrivateNote(employer0, new CandidateNote {
                CandidateId = member.Id, CreatedTime = DateTime.Now.AddMonths(--months), UpdatedTime = DateTime.Now.AddMonths(--months), Text = "All private note"
            });
            _candidateNotesCommand.CreateSharedNote(employer0, new CandidateNote {
                CandidateId = member.Id, CreatedTime = DateTime.Now.AddMonths(--months), UpdatedTime = DateTime.Now.AddMonths(--months), Text = "All shared note"
            });
            _candidateNotesCommand.CreateSharedNote(employer1, new CandidateNote {
                CandidateId = member.Id, CreatedTime = DateTime.Now.AddMonths(--months), UpdatedTime = DateTime.Now.AddMonths(--months), Text = "All other shared note"
            });
        }