public static void NotifySupervisor(Audit audit) { if (audit.Type == Audit5sAdministration || audit.Type == Audit5sLpaProduction) { var supervisorLogin = GetTargetSupervisorLogin(audit.Type, audit.Target); var fileName = $"Audit_ID{audit.Id}_{DateTime.Now.ToString("yyyyMMdd")}.pdf"; var subject = $"Ended audit {audit.TypeName} | {audit.Target}"; var body = ""; var email = AppUser.GetUserMail(supervisorLogin); if (email == null) { throw new Exception("You can not send an e-mail with the report - no e-mail in the system / wrong format!"); } var report = GetXtraReport(audit, Languages.Default); using (MemoryStream stream = new MemoryStream()) { report.ExportToPdf(stream); stream.Position = 0; var attach = new Attachment(stream, fileName, "application/pdf"); MailUtils.SendEmail(subject, body, new List <string> { email }, new List <Attachment> { attach }); } } }
public void SendEmailWithPdf(string lang) { var fileName = $"Audit_ID{this.Id}_{DateTime.Now.ToString("yyyyMMdd")}.pdf"; var subject = $"Printout {this.TypeName} | {this.Target}"; var body = ""; var email = AppUser.GetUserMail(this.AuditorLogin); if (email == null) { throw new Exception("You can not send an e-mail with the report - no e-mail in the system / wrong format!"); } var report = AuditTypes.GetXtraReport(this, lang); using (MemoryStream stream = new MemoryStream()) { report.ExportToPdf(stream); stream.Position = 0; var attach = new Attachment(stream, fileName, "application/pdf"); MailUtils.SendEmail(subject, body, new List <string> { email }, new List <Attachment> { attach }); } throw new Exception("An email with a PDF printout has been sent! Check your inbox!"); }
private static void SendChangePasswordNotification(string username, string password) { var subject = $"Account {username.ToUpper()} password reseted!"; var body = $"Your new password: {password}"; var email = AppUser.GetUserMail(username); MailUtils.SendEmail(subject, body, new List <string> { email }); }
private static void SendUnlockNotification(string username) { var subject = $"Account {username.ToUpper()} unlocked!"; var body = string.Empty; var email = AppUser.GetUserMail(username); MailUtils.SendEmail(subject, body, new List <string> { email }); }
private static void SendRegisterNotification(string username, string password) { var subject = $"Account {username.ToUpper()} creation!"; var body = $"Your password: {password}"; var email = AppUser.GetUserMail(username); MailUtils.SendEmail(subject, body, new List <string> { email }); }