Exemple #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);
                }
            }
        }
        private bool UpdatePoint(int fileId, out string err)
        {
            bool success = false;

            err = string.Empty;
            FocusIT.Pulse.ServiceManager sm = new FocusIT.Pulse.ServiceManager();
            using (PostLeadWeb.LP2Service.LP2ServiceClient client = sm.StartServiceClient())
            {
                PostLeadWeb.LP2Service.UpdateLockInfoRequest req = new PostLeadWeb.LP2Service.UpdateLockInfoRequest();
                req.hdr    = new PostLeadWeb.LP2Service.ReqHdr();
                req.FileId = fileId;
                PostLeadWeb.LP2Service.UpdateLockInfoResponse resp = client.UpdateLoanProfitability(req);
                if (resp != null && resp.hdr != null)
                {
                    if (!resp.hdr.Successful)
                    {
                        err = resp.hdr.StatusInfo;
                    }

                    success = resp.hdr.Successful;
                }
            }
            return(success);
        }