Example #1
0
        public bool Send(List <string> toEmail, string fromEmail, List <string> CC, string emailTemplate, string subject, Dictionary <string, dynamic> modelData)
        {
            var emailTemplateData = _dbService.FirstOrDefault(CommonConst.Collection.EMAIL_TEMPLATE, CommonConst.CommonField.DATA_KEY, emailTemplate);

            if (emailTemplateData != null && emailTemplateData[CommonConst.CommonField.BODY] != null)
            {
                ServerPageModelHelper.AddBaseData(modelData);
                var emailBody = _viewEngine.Compile(emailTemplateData[CommonConst.CommonField.BODY].ToString(), emailTemplate, modelData);
                return(Send(toEmail, fromEmail, CC, emailBody, subject));
            }
            else
            {
                _logger.Error(string.Format("Error Unable to find Email template {0}", emailTemplate));
                return(false);
            }
        }
Example #2
0
        public bool Send(string toNumber, string textTemplate, Dictionary <string, dynamic> modelData, bool putInQueue = true)
        {
            var smsTemplateData = _dbService.FirstOrDefault(CommonConst.Collection.SMS_TEMPLATE, CommonConst.CommonField.DATA_KEY, textTemplate);

            if (smsTemplateData != null && smsTemplateData[CommonConst.CommonField.BODY] != null)
            {
                ServerPageModelHelper.AddBaseData(modelData);
                modelData[CommonConst.CommonField.PHONE] = toNumber;
                var textSMSData = _viewEngine.Compile(smsTemplateData[CommonConst.CommonField.BODY].ToString(), textTemplate, modelData);
                return(Send(toNumber, textSMSData, putInQueue));
            }
            else
            {
                _logger.Error(string.Format("Error Unable to find SMS template {0}", textTemplate));
                return(false);
            }
        }