예제 #1
0
        private bool IsIdentificationNumberUnique(RegisteredUser user)
        {
            var exists = userRepository.GetAll().SingleOrDefault(entity => entity.IdentificationNumber.Equals(user.IdentificationNumber));

            if (exists != null)
            {
                var userType   = user.GetType();
                var existsType = exists.GetType();
                if (userType.IsAssignableFrom(existsType) || existsType.IsAssignableFrom(userType))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        ResumeFile IResumeFilesQuery.GetResumeFile(RegisteredUser recipient, Member member, Candidate candidate, Resume resume)
        {
            if (candidate == null)
            {
                throw new ArgumentNullException("candidate");
            }
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }

            EmployerMemberView view;
            var employer = recipient as Employer;

            if (employer != null)
            {
                view = _employerMemberViewsQuery.GetEmployerMemberView(employer, member);
            }
            else if (recipient is Member)
            {
                if (recipient.Id != member.Id)
                {
                    throw new ApplicationException("Downloading the resume of another member is not supported.");
                }
                view = new EmployerMemberView(member, candidate, resume, null, ProfessionalContactDegree.Self, false, false);
            }
            else if (recipient is Administrator)
            {
                view = new EmployerMemberView(member, candidate, resume, null, ProfessionalContactDegree.Self, false, false);
            }
            else
            {
                throw new ApplicationException("Unexpected type of recipient: " + recipient.GetType().FullName);
            }

            return(ConvertResume(view, resume));
        }