예제 #1
0
 public void SendDigest(int userId)
 {
     try
     {
         var user = _db.Users.Find(userId);
         if (user.TsMailDigest.AddDays(user.DigestDaysSpan) < DateTime.UtcNow)
         {
             var services = new List<IDigestService>
             {
                 new NewsSrv(),
                 new DiscussionSrv(),
                 //new BlogSrv(),
                 new EventSrv(),
                 //new JobSrv(),
                 //new MentorSrv(),
                 //new MessageSrv(),
             };
             var userSrv = new UserDigest(userId, services);
             MailSrv.SendNewsletterAsync(user, userSrv.GetDigest(), "NITCAA Newsletter", null);
             //user.TsMailDigest = DateTime.UtcNow;
             //UpdateUser(user);
         }
     }
     catch (Exception ex)
     {
         AddLog(userId + "#SendDigest-Failure#"  + ex.Message, LogTypes.Error, "Server");
     }
 }
예제 #2
0
 public void SendDigest(int userId)
 {
     try
     {
         var user = _db.Users.Find(userId);
         if (user.TsMailDigest.AddDays(user.DigestDaysSpan) < DateTime.UtcNow)
         {
             var services = new List <IDigestService>
             {
                 new NewsSrv(),
                 new DiscussionSrv(),
                 //new BlogSrv(),
                 new EventSrv(),
                 //new JobSrv(),
                 //new MentorSrv(),
                 //new MessageSrv(),
             };
             var userSrv = new UserDigest(userId, services);
             MailSrv.SendNewsletterAsync(user, userSrv.GetDigest(), "NITCAA Newsletter", null);
             //user.TsMailDigest = DateTime.UtcNow;
             //UpdateUser(user);
         }
     }
     catch (Exception ex)
     {
         AddLog(userId + "#SendDigest-Failure#" + ex.Message, LogTypes.Error, "Server");
     }
 }