/// <summary> /// If error send a mail to the configured mail id's. /// </summary> /// <param name="exceptionMessage"></param> /// <param name="insuredCode"></param> /// <param name="insuranceType"></param> /// <param name="agency"></param> /// <param name="isOracle"></param> public void SendMailLogError(string exceptionMessage, string insuredCode, string insuranceType, string agency, bool isOracle) { MailMessageResponse mailResponseMessage = new MailMessageResponse(); MailSendRequestWithoutCCAndBcc newRequest = new MailSendRequestWithoutCCAndBcc(); EmailMessageAudit emailMessageAudit = new EmailMessageAudit(); if (!isOracle) { mailResponseMessage = GetMessageByKey(BKIC.SellingPoint.DL.Constants.MailMessageKey.PolicyInsertFailed); emailMessageAudit.MessageKey = BKIC.SellingPoint.DL.Constants.MailMessageKey.PolicyInsertFailed; } else { mailResponseMessage = GetMessageByKey(BKIC.SellingPoint.DL.Constants.MailMessageKey.OraclePolicyInsertFailed); emailMessageAudit.MessageKey = BKIC.SellingPoint.DL.Constants.MailMessageKey.OraclePolicyInsertFailed; } newRequest.Subject = mailResponseMessage.Subject.Replace("{{Site_name}}", /*Constants.MailMessageKey.SiteName*/ ""); newRequest.Personalizations = new List <Personalization>() { new Personalization() { ToRecipient = new List <MailRecipientDetails>() { new MailRecipientDetails() { Email = mailResponseMessage.Email } } } }; newRequest.Contents = new List <ContentDetail>() { new ContentDetail() { Value = mailResponseMessage.Message } }; new Task(() => { sendWithOutAttachementMail(newRequest); }).Start(); emailMessageAudit.InsuranceType = insuranceType; emailMessageAudit.InsuredCode = insuredCode; emailMessageAudit.Message = exceptionMessage; emailMessageAudit.Agency = agency; new Task(() => { InsertEmailMessageAudit(emailMessageAudit); }).Start(); }
/// <summary> /// Email audit. /// </summary> /// <param name="emailMessage"></param> public void InsertEmailMessageAudit(EmailMessageAudit emailMessage) { try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@MessageKey", emailMessage.MessageKey), new SqlParameter("@Message", emailMessage.Message), new SqlParameter("@InsuredCode", emailMessage.InsuredCode ?? ""), new SqlParameter("@PolicyNo", emailMessage.PolicyNo ?? ""), new SqlParameter("@LinkId", emailMessage.LinkNo ?? ""), new SqlParameter("@InsuredType", emailMessage.InsuranceType), new SqlParameter("@Subject", emailMessage.Subject ?? ""), new SqlParameter("@Agency", emailMessage.Agency ?? "") }; DataSet result = BKICSQL.eds(StoredProcedures.PortalSP.InsertEmailMessage, para); } catch (Exception exc) { var message = exc.Message; } }