Пример #1
0
        public EmailResponse SendEnrollmentReceiptWithArgs(EmailArgs args)
        {
            var response = new Trawick.Common.Email.EmailResponse()
            {
            };

            try
            {
                var receiptHtml = GetReceiptString();
                args.EmailBody          = receiptHtml;
                args.MasterEnrollmentId = this.m_EnrollmentId;
                var Mailer = Trawick.Common.Email.EmailFactory.GetEmailFactory();

                return(Mailer.SendMail(args));
            }
            catch (Exception e)
            {
                log.Error("Error Sending Receipt Email", e);

                return(new EmailResponse()
                {
                    Message = "Error Creating Email_Cue Record for Enrollment", Status = 99
                });
            }
        }
        public static Trawick.Common.Email.EmailResponse SendPortalContact(EmailArgs args)
        {
            var response = new Trawick.Common.Email.EmailResponse()
            {
            };

            response = Trawick.Common.Email.EmailFactory.GetEmailFactory().SendMail(args);
            return(response);
        }
        public static Trawick.Common.Email.EmailResponse SendCancelEnrollmentCancellationRequest(Trawick.Data.Models.EnrollmentCancellationRequest request)
        {
            string toEmail = "*****@*****.**";
            string subject = "Enrollment Cancellation Request";
            string message = string.Format("Please <strong> DO NOT </strong> Cancel Enrollment {0} on the Following Date: {1}", request.MasterEnrollmentId, request.RequestDate.ToShortDateString());

            string header = "<h2>{0}</h2> ";

            string body = "";

            body += string.Format(header, message);
            body += "<br/>";
            body += request.RequestMessage;
            string title = string.Format("<h5>{0}</h5>", subject);

            message = body;

            string ccEmail = "";

            if (request.CopyAgent)
            {
                var agent = ContactRepo.Contact_GetById(request.AgentId);
                if (agent != null && !string.IsNullOrEmpty(agent.admin_email))
                {
                    ccEmail = agent.admin_email;
                }
            }

            var args = new Common.Email.EmailArgs()
            {
                EmailBody    = message,
                EmaillCC     = ccEmail,
                EmailTo      = toEmail,
                EmailSubject = subject,
                IsHtml       = true
            };

            var response = new Trawick.Common.Email.EmailResponse()
            {
            };

            response = Trawick.Common.Email.EmailFactory.GetEmailFactory().SendMail(args);
            return(response);
        }
Пример #4
0
        public EmailResponse SendEnrollmentReceipt(int tranType, bool isTest)
        {
            var response = new Trawick.Common.Email.EmailResponse()
            {
            };

            try
            {
                var receiptHtml = GetReceiptString();

                if (!string.IsNullOrEmpty(receiptHtml))
                {
                    var Enroll = Trawick.Data.Models.EnrollmentRepo.GetById(m_EnrollmentId).Where(m => m.member_relationship_id == 8).FirstOrDefault();

                    if (Enroll != null)
                    {
                        var Agent = Trawick.Data.Models.ContactRepo.Contact_GetById(Enroll.agent_id);

                        var args = new EmailArgs()
                        {
                            EmailBody          = receiptHtml,
                            IsHtml             = true,
                            EmailSubject       = tranType == 1 ? "Insurance Purchase Notification for Member " : "Renewal Receipt for Member ",
                            MasterEnrollmentId = m_EnrollmentId,
                            MemberId           = Enroll.member_id,
                            EmailTo            = Enroll.email1,
                            IsTest             = isTest
                        };

                        args.EmailSubject = args.EmailSubject + Enroll.userid.ToString();


                        //Add BCC
                        if (!string.IsNullOrEmpty(Agent.admin_email) && ((tranType == 1 && Agent.copy_on_enrollment_email) || (tranType == 2 && Agent.copy_on_renewal_emails.GetValueOrDefault())))
                        {
                            args.EmailBCC = Agent.admin_email;
                        }

                        var otherBcc = System.Configuration.ConfigurationManager.AppSettings["MailSender.Bcc"];
                        if (!string.IsNullOrEmpty(otherBcc))
                        {
                            args.EmailBCC += "," + otherBcc;
                        }

                        var Mailer = Trawick.Common.Email.EmailFactory.GetEmailFactory();

                        return(Mailer.SendMail(args));
                    }
                }
            }
            catch (Exception e)
            {
                log.Error("Error Sending Receipt Email", e);

                return(new EmailResponse()
                {
                    Message = "Error Creating Email_Cue Record for Enrollment", Status = 99
                });
            }

            return(new EmailResponse()
            {
                Message = "Error Creating Email_Cue Record for Enrollment", Status = 99
            });
        }