CPE_learningsite
This repository has no backups
This repository's network speed is throttled to 100KB/sec
Upgrade your account to fix these warnings, or use backups.vc for automated backups
feature/Change_Message_notification
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
using System; using System.Configuration; using System.IO; using System.Web; using System.Web.Hosting; namespace CPE.Utilities { public static class Email { public static string EmailBody { get { string filePath = $"{ConfigurationManager.AppSettings["CertificateEmailBody"]}"; return File.ReadAllText(filePath); } } public static string WebcastEmailBody { get { string filePath = $"{ConfigurationManager.AppSettings["WebcastCertificateEmailBody"]}"; return File.ReadAllText(filePath); } } public static string FailEmailBody { get { string filePath = $"{ConfigurationManager.AppSettings["WebcastFailEmailBody"]}"; return File.ReadAllText(filePath); } } public static string RenderEmail(string contentUrl, DateTime? certificateDate, string ticket) { if(!certificateDate.HasValue) return string.Empty; var emailBody = EmailBody; var certLink = ConfigurationManager.AppSettings["CertLink"]; var certURl = string.Format(certLink, contentUrl, certificateDate.Value.ToString("yyyyMMdd"), ticket); return emailBody.Replace("certUrl", certURl); } public static string RenderWebcastEmail(string certURl) { var emailBody = WebcastEmailBody; return emailBody.Replace("certUrl", certURl); } public static string RenderCertLink(int meetingSco, DateTime purchaseDate, string ticket) { var meetingUrl = meetingSco.ToString(); var certLink = ConfigurationManager.AppSettings["CertLink"]; var certURl = string.Format(certLink, meetingUrl, purchaseDate.ToString("yyyyMMdd"), ticket); return certURl; } public static string RenderFailEmail() { var emailBody = FailEmailBody; return emailBody; } private static string MapServerPath(string path) { string returnValue = null; if(HttpContext.Current != null) { returnValue = HttpContext.Current.Server.MapPath(path); } else { returnValue = HostingEnvironment.MapPath(path); } return returnValue; } } } |
Commits for CPE_learningsite/CPE/CPE.Utilities/Email.cs
Revision | Author | Commited | Message |
---|---|---|---|
4cd176 ... | v.shishlov | Fri 27 Aug, 2021 14:33:17 +0000 | initial commit |