예제 #1
0
 private static void UpdateReport(ResumeSearchActivityReport report, CheckBoxValue includeDisabledUsers)
 {
     if (includeDisabledUsers != null)
     {
         report.IncludeDisabledUsers = includeDisabledUsers.IsChecked;
     }
 }
        public void ReportActivityToAccountManager()
        {
            LogSearch();

            // Define the report

            var report = new ResumeSearchActivityReport
            {
                ClientId                  = _orgUnit.Id,
                SendToAccountManager      = true,
                SendToClient              = false,
                IncludeChildOrganisations = true
            };

            // Doesn't make any difference in this test, just exercising another code path

            _reportsCommand.CreateReport(report);

            // To AM only.

            Execute(true);

            var emails = _emailServer.AssertEmailsSent(1);

            emails[0].AssertSubject(GetSubject());
            emails[0].AssertAddresses(Return, Return, _admin);
            emails[0].AssertAttachments(1);
        }
        public void ReportActivityToClient()
        {
            LogSearch();

            // Define the report

            var report = new ResumeSearchActivityReport
            {
                ClientId             = _orgUnit.Id,
                SendToAccountManager = false,
                SendToClient         = true,
                IncludeDisabledUsers = true,
            };

            _reportsCommand.CreateReport(report);

            // To client only - but no primary contact email is set.

            Execute(true);
            _emailServer.AssertNoEmailSent();

            // Set the primary contact

            _orgUnit.ContactDetails = new ContactDetails {
                FirstName = ClientFirstName, LastName = ClientLastName, EmailAddress = ClientEmail
            };
            _organisationsCommand.UpdateOrganisation(_orgUnit);

            Execute(true);
            var emails = _emailServer.AssertEmailsSent(1);

            emails[0].AssertSubject(GetSubject());
            emails[0].AssertAddresses(_admin, Return, new EmailRecipient(ClientEmail, ClientFirstName.CombineLastName(ClientLastName), ClientFirstName, ClientLastName));
            emails[0].AssertAttachments(1);
        }
예제 #4
0
 public ResumeSearchActivityReportRunner(ICreditReportsQuery creditReportsQuery, ResumeSearchActivityReport report, bool includeCredits, IOrganisation organisation, IAdministrator accountManager, DateRange dateRange)
     : base(organisation, accountManager, dateRange)
 {
     _creditReportsQuery = creditReportsQuery;
     _report             = report;
     _includeCredits     = includeCredits;
 }
        public override TemplateEmail GeneratePreview(Community community)
        {
            var employer = CreateEmployer();
            var report   = new ResumeSearchActivityReport
            {
                ClientId             = employer.Organisation.Id,
                SendToAccountManager = true,
                SendToClient         = true,
            };
            var email = new AccountManagerReportEmail(CreateAdministrator(), report, employer.Organisation as VerifiedOrganisation, DateTime.Now.Date.AddDays(-31), DateTime.Now.Date.AddDays(-1));

            var fileName         = report.Name + " - " + employer.Organisation.FullName + ".pdf";
            var attachmentStream = new MemoryStream();

            email.AddAttachments(new[] { new ContentAttachment(attachmentStream, fileName, MediaType.Pdf) });

            return(email);
        }
        public void ReportNoActivity()
        {
            // Define the report

            var report = new ResumeSearchActivityReport
            {
                ClientId             = _orgUnit.Id,
                SendToAccountManager = false,
                SendToClient         = true
            };

            _reportsCommand.CreateReport(report);

            // To client only and there's no activity, so no report.

            Execute(true);
            _emailServer.AssertNoEmailSent();

            // To client and AM, but no activity, so sent to AM only.

            report.SendToAccountManager = true;
            _reportsCommand.UpdateReport(report);

            Execute(true);

            var emails = _emailServer.AssertEmailsSent(1);

            emails[0].AssertSubject("No resume search activity for " + _orgUnit.FullName + " for " + ReportPeriodText);
            emails[0].AssertAddresses(Return, Return, _admin);
            emails[0].AssertAttachments(1);

            // Try again - no duplicate report should be sent.

            Execute(true);
            _emailServer.AssertNoEmailSent();
        }
예제 #7
0
        private void TestMultipleReports(Func <IEmployer, bool> createClientActvity, Func <IEmployer, bool> createJobBoardActivity, bool sendToAccountManager)
        {
            // Create everyone.

            var administrator = CreateAdministrator();
            var organisation  = CreateOrganisation(administrator.Id);

            organisation.ContactDetails = new ContactDetails {
                FirstName = ClientFirstName, LastName = ClientLastName, EmailAddress = ClientEmail
            };
            _organisationsCommand.UpdateOrganisation(organisation);
            var employer = CreateEmployer(organisation);

            // Define the reports.

            var resumeSearchActivityReport = new ResumeSearchActivityReport
            {
                ClientId             = organisation.Id,
                SendToAccountManager = sendToAccountManager,
                SendToClient         = true,
            };

            _reportsCommand.CreateReport(resumeSearchActivityReport);

            var jobBoardActivityReport = new JobBoardActivityReport
            {
                ClientId             = organisation.Id,
                SendToAccountManager = sendToAccountManager,
                SendToClient         = true,
            };

            _reportsCommand.CreateReport(jobBoardActivityReport);

            // Create activity to report on.

            var isResumeSearchActivity = createClientActvity(employer);
            var isJobBoardActivity     = createJobBoardActivity(employer);
            var clientStatus           = new ReportStatus(resumeSearchActivityReport, isResumeSearchActivity);
            var jobBoardStatus         = new ReportStatus(jobBoardActivityReport, isJobBoardActivity);

            // Run the reports.

            Execute();

            if (sendToAccountManager)
            {
                if ((isResumeSearchActivity && isJobBoardActivity) || (!isResumeSearchActivity && !isJobBoardActivity))
                {
                    var emails = _emailServer.AssertEmailsSent(2);
                    AssertAdministratorEmail(emails[0], administrator, organisation, clientStatus, jobBoardStatus);
                    AssertClientEmail(emails[1], administrator, organisation, clientStatus, jobBoardStatus);
                }
                else
                {
                    var emails = _emailServer.AssertEmailsSent(3);
                    AssertAdministratorEmail(emails[0], administrator, organisation, jobBoardStatus);
                    AssertClientEmail(emails[1], administrator, organisation, clientStatus, jobBoardStatus);
                    AssertAdministratorEmail(emails[2], administrator, organisation, clientStatus);
                }
            }
            else
            {
                var emails = _emailServer.AssertEmailsSent(1);
                AssertClientEmail(emails[0], administrator, organisation, clientStatus, jobBoardStatus);
            }
        }