Beispiel #1
0
        public ActionResult _PreviewEmail(string NextDateRemindPreview, CRM_RemiderModel model, List <CRMRemiderEmailParameterMappingViewModel> detail)
        {
            var ContentEmail = _context.CRM_EmailTemplateModel
                               .Where(p => p.EmailTemplateId == model.EmailTemplateId)
                               .Select(p => p.EmailContent)
                               .FirstOrDefault();

            if (detail != null)
            {
                foreach (var item in detail)
                {
                    switch (item.Value)
                    {
                    case ConstantRemiderAUTOType.ExpDATE:
                        ContentEmail = ContentEmail.Replace(item.EmailParameterName, model.ExpiryDate.Value.ToString("dd/MM/yyyy"));
                        break;

                    case ConstantRemiderAUTOType.SerCONTENT:
                        ContentEmail = ContentEmail.Replace(item.EmailParameterName, model.ServiceContent);
                        break;

                    case ConstantRemiderAUTOType.SerPRICE:
                        ContentEmail = ContentEmail.Replace(item.EmailParameterName, model.Price.Value.ToString("n0"));
                        break;

                    default:
                        ContentEmail = ContentEmail.Replace(item.EmailParameterName, item.Value);
                        break;
                    }
                }
            }
            var modelPreview = new CRMPreviewViewModel()
            {
                Tile = _context.CRM_EmailTemplateModel
                       .Where(p => p.EmailTemplateId == model.EmailTemplateId)
                       .Select(p => p.EmailTitle)
                       .FirstOrDefault(),
                Content = ContentEmail,
                NextDateRemindPreview = NextDateRemindPreview
            };

            return(PartialView(modelPreview));
        }
Beispiel #2
0
        public ActionResult _PreviewSMS(string NextDateRemindPreview, CRM_RemiderModel model, List <CRMRemiderSMSParameterMappingViewModel> SMSPara)
        {
            var ContentSMS = _context.CRM_SMSTemplateModel
                             .Where(p => p.SMSTemplateId == model.SMSTemplateId)
                             .Select(p => p.SMSContent)
                             .FirstOrDefault();

            if (SMSPara != null)
            {
                foreach (var item in SMSPara)
                {
                    switch (item.Value)
                    {
                    case ConstantRemiderAUTOType.ExpDATE:
                        ContentSMS = ContentSMS.Replace(item.SMSParameterName, model.ExpiryDate.Value.ToString("dd/MM/yyyy"));
                        break;

                    case ConstantRemiderAUTOType.SerCONTENT:
                        ContentSMS = ContentSMS.Replace(item.SMSParameterName, model.ServiceContent);
                        break;

                    case ConstantRemiderAUTOType.SerPRICE:
                        ContentSMS = ContentSMS.Replace(item.SMSParameterName, model.Price.Value.ToString("n0"));
                        break;

                    default:
                        ContentSMS = ContentSMS.Replace(item.SMSParameterName, item.Value);
                        break;
                    }
                }
            }
            var modelPreview = new CRMPreviewViewModel()
            {
                Content = ContentSMS,
                NextDateRemindPreview = NextDateRemindPreview
            };

            return(PartialView(modelPreview));
        }