Beispiel #1
0
        public ActionResult SendRejections(RejectionMemberMessage message, Guid jobAdId, Guid[] candidateIds)
        {
            try
            {
                // Get the employer.

                var employer = CurrentEmployer;

                // Ensure all candidateIds have applications. At this stage they *should*
                var validCandidateIds = (from a in _jobAdApplicantsQuery.GetApplicationsByPositionId(jobAdId)
                                         where candidateIds.Contains(a.ApplicantId)
                                         select a.ApplicantId);

                // Get the members.

                var views = _employerMemberViewsQuery.GetProfessionalViews(employer, validCandidateIds);

                _employerMemberContactsCommand.RejectMembers(employer, views, message);
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new StandardErrorHandler());
            }

            return(Json(new JsonResponseModel()));
        }
Beispiel #2
0
        public void TestContactNoAttachments()
        {
            var employer = CreateEmployer(0);
            var member   = CreateMember(0);

            _allocationsCommand.CreateAllocation(new Allocation {
                CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, OwnerId = employer.Id
            });

            // Check attachments.

            AssertAttachments(employer);

            // Create messages.

            var templateMessage = new RejectionMemberMessage {
                Subject = Subject, Body = Body
            };

            _employerMemberContactsCommand.RejectMember(employer, _employerMemberViewsQuery.GetProfessionalView(employer, member), templateMessage);

            // Check.

            var messages = _employerMemberContactsQuery.GetMessages(employer, member.Id);

            Assert.AreEqual(1, messages.Count);
            AssertMessage(templateMessage, messages[0], null, _employerContactsRepository.GetMemberMessageRepresentative(messages[0].Id));
        }
        void IEmployerMemberContactsCommand.RejectMembers(IEmployer employer, ProfessionalViews views, RejectionMemberMessage messageTemplate)
        {
            var cleaner        = new MemberMessageCleaner();
            var cleanedBody    = cleaner.CleanBody(messageTemplate.Body);
            var cleanedSubject = cleaner.CleanSubject(messageTemplate.Subject);

            // Get the member and the representative if there is one.

            var representativeIds = _memberContactsQuery.GetRepresentativeContacts(from m in views select m.Id);

            // Iterate through them all exercising credits when needed.

            var handlers = MessageCreated;

            foreach (var view in views)
            {
                var representativeId = representativeIds[view.Id];
                ContactMember(messageTemplate, employer, view, cleanedSubject, cleanedBody, representativeId, null, handlers);
            }
        }
        void IEmployerMemberContactsCommand.RejectMember(IEmployer employer, ProfessionalView view, RejectionMemberMessage messageTemplate)
        {
            var cleaner        = new MemberMessageCleaner();
            var cleanedBody    = cleaner.CleanBody(messageTemplate.Body);
            var cleanedSubject = cleaner.CleanSubject(messageTemplate.Subject);

            // Save the message.
            var handlers         = MessageCreated;
            var representativeId = _memberContactsQuery.GetRepresentativeContact(view.Id);

            ContactMember(messageTemplate, employer, view, cleanedSubject, cleanedBody, representativeId, null, handlers);
        }