private string SendLSREmail(int ContactID, string ContactEmail, string ContactName, int UserID, string UserEmail, string UserName, bool External, Dictionary <string, byte[]> Attachments) { string ReturnMessage = string.Empty; ServiceManager sm = new ServiceManager(); LPWeb.BLL.Loans _bLoan = new LPWeb.BLL.Loans(); using (LP2ServiceClient service = sm.StartServiceClient()) { SendLSRRequest req = new SendLSRRequest(); req.hdr = new ReqHdr(); req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data req.hdr.UserId = this.CurrUser.iUserID; req.FileId = iLoanID; req.TemplReportId = GetTemplReportId(); req.External = External; req.Attachments = Attachments; if (ContactID > 0) { req.ToContactId = ContactID; req.ToContactEmail = ContactEmail; req.ToContactUserName = ContactName; } if (UserID > 0) { req.ToUserId = UserID; req.ToUserEmail = UserEmail; req.ToUserUserName = UserName; } req.LoanAutoEmailid = SaveLoanAutoEmailid(req.FileId, req.TemplReportId, req.ToContactId, req.ToUserId, req.External); SendLSRResponse respone = null; try { respone = service.SendLSR(req); if (respone.hdr.Successful) { ReturnMessage = string.Empty; } else { ReturnMessage = respone.hdr.StatusInfo; } } catch (System.ServiceModel.EndpointNotFoundException) { string sExMsg = string.Format("Failed to send email, reason: Email Manager is not running."); LPLog.LogMessage(LogType.Logerror, sExMsg); ReturnMessage = sExMsg; } catch (Exception ex) { string sExMsg = string.Format("Failed to send email, error: {0}", ex.Message); LPLog.LogMessage(LogType.Logerror, sExMsg); ReturnMessage = sExMsg; } return(ReturnMessage); } }