Esempio n. 1
0
 internal static void DeleteNewsletter(Newsletters newsletter)
 {
     try
     {
         using (Vicdude_NewsletterEntities db = new Vicdude_NewsletterEntities())
         {
             newsletter.IsDeleted       = true;
             db.Entry(newsletter).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         LogHelper.LogError(string.Format("Error delete newsletter: {0}", newsletter.Id), ex, 0);
     }
 }
Esempio n. 2
0
        internal static void SaveNewsletter(Newsletters newsletter)
        {
            using (Vicdude_NewsletterEntities db = new Vicdude_NewsletterEntities())
            {
                if (newsletter.Id > 0)
                {
                    db.Entry(newsletter).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    newsletter.CreatedDate = DateTime.Now;
                    db.Newsletters.Add(newsletter);
                }

                db.SaveChanges();
            }
        }
Esempio n. 3
0
        internal static int CreateNewsletterSend(Newsletters newsletter, AccountSessionEntity accountSession)
        {
            using (Vicdude_NewsletterEntities db = new Vicdude_NewsletterEntities())
            {
                Newsletter_Send newsletterSend = new Newsletter_Send()
                {
                    ClubId             = accountSession.ClubId,
                    UserSendId         = accountSession.AccountId,
                    NewsletterContent  = newsletter.Content,
                    NewsletterId       = newsletter.Id,
                    NewsletterName     = newsletter.Name,
                    NewsletterSendGUID = Guid.NewGuid().ToString(),
                    SendDate           = DateTime.Now
                };

                db.Newsletter_Send.Add(newsletterSend);
                db.SaveChanges();
                return(newsletterSend.Id);
            }
        }