Ejemplo n.º 1
0
        private void SendEmailLeadCreated(int LoanId)
        {
            DataAccess.DataAccess da = new DataAccess.DataAccess();
            //int fromUser=da.ge
            int BorrowerContactID = 0;

            try
            {
                BorrowerContactID = da.GetBorrowerContactID(LoanId);
            }
            catch (Exception e)
            {
                //EventLog.WriteEntry(InfoHubEventLog.LogSource, e.Message, EventLogEntryType.Warning);
            }
            List <Common.Table.TemplateEmail> templateEmails = da.GetTemplateEmail();

            if (templateEmails == null)
            {
                return;
            }

            foreach (var templateEmail in templateEmails)
            {
                try
                {
                    if (templateEmail == null)
                    {
                        continue;
                    }

                    FocusIT.Pulse.ServiceManager sm = new FocusIT.Pulse.ServiceManager();
                    using (var service = sm.StartServiceClient())
                    {
                        #region SendEmailRequest
                        //PulseLeads.LP2Service.SendEmailRequest req = new PulseLeads.LP2Service.SendEmailRequest();
                        LP2.Service.Common.SendEmailRequest req = new LP2.Service.Common.SendEmailRequest();
                        req.EmailTemplId = templateEmail.TemplEmailId;
                        req.FileId       = LoanId;
                        req.hdr          = new LP2.Service.Common.ReqHdr();
                        #endregion
                        var res = service.SendEmail(req);
                        if (!res.resp.Successful)
                        {
                            string err =
                                string.Format(
                                    "Faild to send email for EmailTemplId={0} FileId={1} BorrowerContactId={2} ",
                                    templateEmail.TemplEmailId, LoanId, BorrowerContactID);
                        }
                    }
                }
                catch (System.ServiceModel.EndpointNotFoundException)
                {
                    string sExMsg = string.Format("Failed to send email, reason: Email Manager is not running.");
                }
                catch (Exception ex)
                {
                    string sExMsg = string.Format("Failed to send email, error: {0}", ex.Message);
                }
            }
        }
Ejemplo n.º 2
0
 public LP2.Service.Common.SendEmailResponse SendEmail(LP2.Service.Common.SendEmailRequest req)
 {
     return(base.Channel.SendEmail(req));
 }