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

            var member = CreateMember(0);
            var folder = new CandidateFolder {
                Name = FolderName
            };

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

            TestCount(employer0, member.Id, 1, v => v.Folders);
            TestCount(employer1, member.Id, 1, v => v.Folders);
        }
示例#2
0
        protected CandidateFolder CreateSharedFolder(IEmployer employer, int index)
        {
            var folder = new CandidateFolder {
                Name = string.Format(FolderNameFormat, index), RecruiterId = employer.Id
            };

            _candidateFoldersCommand.CreateSharedFolder(employer, folder);
            return(folder);
        }
示例#3
0
        public ActionResult NewFolder(string name, bool isShared, Guid[] candidateIds)
        {
            try
            {
                // Create the folder.

                var employer = CurrentEmployer;
                var folder   = new CandidateFolder
                {
                    Name           = name,
                    OrganisationId = isShared ? employer.Organisation.Id : (Guid?)null,
                    RecruiterId    = employer.Id
                };

                if (isShared)
                {
                    _candidateFoldersCommand.CreateSharedFolder(employer, folder);
                }
                else
                {
                    _candidateFoldersCommand.CreatePrivateFolder(employer, folder);
                }

                // Add candidates.

                if (candidateIds != null && candidateIds.Length > 0)
                {
                    _candidateListsCommand.AddCandidatesToFolder(employer, folder, candidateIds);
                }

                return(Json(new JsonFolderModel
                {
                    Folder = new FolderModel
                    {
                        Id = folder.Id,
                        Name = folder.Name,
                        Type = (isShared ? FolderType.Shared : FolderType.Private).ToString(),
                        CanRename = _candidateFoldersCommand.CanRenameFolder(employer, folder),
                        CanDelete = _candidateFoldersCommand.CanDeleteFolder(employer, folder),
                        Count = candidateIds == null ? 0 : candidateIds.Length,
                    }
                }));
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new StandardErrorHandler());
            }

            return(Json(new JsonResponseModel()));
        }
示例#4
0
        private void CreateLists(IEmployer employer)
        {
            _temporaryBlockList = _candidateBlockListsQuery.GetTemporaryBlockList(employer);
            _permanentBlockList = _candidateBlockListsQuery.GetPermanentBlockList(employer);
            _flagList           = _candidateFlagListsQuery.GetFlagList(employer);

            _privateFolder = new CandidateFolder {
                Name = "PrivateFolder"
            };
            _candidateFoldersCommand.CreatePrivateFolder(employer, _privateFolder);

            _sharedFolder = new CandidateFolder {
                Name = "SharedFolder"
            };
            _candidateFoldersCommand.CreateSharedFolder(employer, _sharedFolder);

            _shortlistFolder = _candidateFoldersQuery.GetShortlistFolder(employer);
            _mobileFolder    = _candidateFoldersQuery.GetMobileFolder(employer);
        }