예제 #1
0
        private static Type GetComparisonType(TemplateEmail email)
        {
            // It's OK to combine NoSearchActivityEmail with CustomerReportEmail, but otherwise
            // keep different types of emails separate.

            Type type = email.GetType();

            return(type == typeof(NoSearchActivityEmail) ? typeof(EmployerReportEmail) : type);
        }
예제 #2
0
        private void Add(Community community, TemplateEmail templateEmail, MockEmail mockEmail)
        {
            CommunityEmails emails;

            _communityEmails.TryGetValue(community == null ? string.Empty : community.Name, out emails);
            if (emails == null)
            {
                emails = new CommunityEmails();
                _communityEmails[community == null ? string.Empty : community.Name] = emails;
            }

            if (templateEmail.GetType().IsSubclassOf(typeof(EmployerToMemberNotification)))
            {
                emails.EmployerToMemberNotifications[templateEmail] = mockEmail;
            }
            else if (templateEmail.GetType().IsSubclassOf(typeof(MemberToMemberNotification)))
            {
                emails.MemberToMemberNotifications[templateEmail] = mockEmail;
            }
            else if (templateEmail.GetType().IsSubclassOf(typeof(MemberAlertEmail)))
            {
                emails.MemberAlerts[templateEmail] = mockEmail;
            }
            else if (templateEmail.GetType().IsSubclassOf(typeof(MemberEmail)))
            {
                emails.MemberEmails[templateEmail] = mockEmail;
            }
            else if (templateEmail.GetType().IsSubclassOf(typeof(EmployerEmail)))
            {
                emails.EmployerEmails[templateEmail] = mockEmail;
            }
            else if (templateEmail.GetType().IsSubclassOf(typeof(CustodianEmail)))
            {
                emails.CustodianEmails[templateEmail] = mockEmail;
            }
            else if (templateEmail.GetType().IsSubclassOf(typeof(UserEmail)))
            {
                emails.RegisteredUserEmails[templateEmail] = mockEmail;
            }
            else if (templateEmail.GetType().IsSubclassOf(typeof(InternalEmail)))
            {
                emails.InternalEmails[templateEmail] = mockEmail;
            }
            else
            {
                throw new ApplicationException("Non-recognised email type '" + templateEmail.GetType() + "'.");
            }
        }