public static void Send(Data.Notification n, User u) { var ni = new Data.NotificationInstance() { Archived = false, NotificationID = n.ID.Value, Read = null, UserID = u.ID.Value }; ni.Save(); Email.SendNotification(n, u); }
public static void Send(Data.Notification n, User u, string template = null) { if( n == null || n.ID == null || u == null || u.ID == null ) return; var ni = new Data.NotificationInstance() { Archived = false, NotificationID = n.ID.Value, Read = null, UserID = u.ID.Value }; ni.Save(); UserPreferences pref = UserPreferences.FindByUser(u); /* if((pref != null && pref.EmailNotifications) && !String.IsNullOrEmpty(u.Email)) { Dictionary<string, object> data = new Dictionary<string,object>(); data.Add("Message", n.Message); data.Add("Year", DateTime.Now.Year.ToString(CultureInfo.InvariantCulture)); data.Add("EmailAddress", u.Email ?? ""); Framework.Email.SendTemplate(template ?? Templates.Generic, data, new Framework.Email.TemplateOverrides { To = new List<MailAddress>{new MailAddress(u.Email, "place holder")} //To = new List<MailAddress>{new MailAddress("*****@*****.**", "Mike Lindegarde")} }); } */ }