Exemplo n.º 1
0
 public void EmailAutomation()
 {
     using (var context = new SidejobEntities())
     {
         var message = (from c in context.AutomatedMessages
                        select c).ToList();
         if (message.Count != 0)
         {
             foreach (var e in message)
             {
                 try
                 {
                     SendEmail(e.EmailAddress, e.Title, e.MessageID.ToString(CultureInfo.InvariantCulture), Server.MapPath("~/EmailTemplates/AutomatedMessage.aspx"), Message.Automated);
                 }
                 catch (Exception emailexception)
                 {
                     var emailProblem = new AutomationEmailProblem
                                            {
                                                MessageID = e.MessageID,
                                                EmailAddress = e.EmailAddress,
                                                Title = e.Title,
                                                Message = e.Message
                                            };
                     context.AddToAutomationEmailProblems(emailProblem);
                 }
             }
         }
         context.DeleteObject(message);
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void CatchMessage(SidejobEntities context, AutomatedMessage m)
 {
     var messageProblem = new AutomationEmailProblem
     {
         MessageID = m.MessageID,
         EmailAddress = m.EmailAddress,
         Title = m.Title,
         Message = m.Message
     };
     context.AddToAutomationEmailProblems(messageProblem);
     context.SaveChanges();
 }
Exemplo n.º 3
0
 public void CatchMessage(string id)
 {
     using (var context = new SidejobEntities())
     {
         var messageProblem = new AutomationEmailProblem
                                  {
                                      MessageID = GetMessageID(context),
                                      EmailAddress = "From Sending Message",
                                      Title = "Go Find It",
                                      Message ="Check AutomatedMessageTable"
                                  };
         context.AddToAutomationEmailProblems(messageProblem);
         context.SaveChanges();
     }
 }