예제 #1
0
        public void IndexNewEmails(List <Email> emails)
        {
            using (var ctx = new CollaboratorContext())
            {
                searchCriterias = ctx.SearchCriterias;

                foreach (var searchCriteria in searchCriterias)
                {
                    foreach (var email in emails)
                    {
                        if (email != null || searchCriteria != null)
                        {
                            CheckForNormalCase(email, searchCriteria);
                            CheckForLowerCase(email, searchCriteria);
                            CheckForUpperCase(email, searchCriteria);
                        }
                        else
                        {
                            Debug.WriteLine("Email or searchcriteria = null");
                        }
                        ctx.Emails.Add(email);
                    }
                }
                ctx.SaveChanges();
            }
        }
예제 #2
0
 public void SaveEmails(List <Email> emails)
 {
     using (var ctx = new CollaboratorContext())
     {
         if (emails.Count() != 0 && emails != null)
         {
             foreach (var email in emails)
             {
                 ctx.Emails.Add(email);
             }
             try
             {
                 ctx.SaveChanges();
             }
             catch (DbEntityValidationException dbEx)
             {
                 foreach (var validationErrors in dbEx.EntityValidationErrors)
                 {
                     foreach (var validationError in validationErrors.ValidationErrors)
                     {
                         Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                     }
                 }
             }
         }
     }
 }
 public void Edit(SearchCriteria entity)
 {
     using (CollaboratorContext db = new CollaboratorContext())
     {
         db.Entry(entity).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
 public void Edit(EmailAccount entity)
 {
     using (CollaboratorContext db = new CollaboratorContext())
     {
         db.Entry(entity).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
 public void Remove(int id)
 {
     using (CollaboratorContext db = new CollaboratorContext())
     {
         var sc = db.SearchCriterias.Find(id);
         db.SearchCriterias.Remove(sc);
         db.SaveChanges();
     }
 }
 public void Remove(int id)
 {
     using (CollaboratorContext db = new CollaboratorContext())
     {
         var account = db.EmailAccounts.Find(id);
         db.EmailAccounts.Remove(account);
         db.SaveChanges();
     }
 }
예제 #7
0
 public void Remove(int id)
 {
     using (CollaboratorContext db = new CollaboratorContext())
     {
         var theme = db.Emails.Find(id);
         db.Emails.Remove(theme);
         db.SaveChanges();
     }
 }
 public SearchCriteria Add(SearchCriteria entity)
 {
     using (CollaboratorContext db = new CollaboratorContext())
     {
         if (entity == null)
         {
             throw new ArgumentNullException("SearchCriteria");
         }
         var scAdded = db.SearchCriterias.Add(entity);
         db.SaveChanges();
         return(scAdded);
     }
 }
 public EmailAccount Add(EmailAccount entity)
 {
     using (CollaboratorContext db = new CollaboratorContext())
     {
         if (entity == null)
         {
             throw new ArgumentNullException("Email");
         }
         var accountAdded = db.EmailAccounts.Add(entity);
         db.SaveChanges();
         return(accountAdded);
     }
 }
예제 #10
0
 public Theme Add(Theme entity)
 {
     using (CollaboratorContext db = new CollaboratorContext())
     {
         if (entity == null)
         {
             throw new ArgumentNullException("Email");
         }
         var theme = db.Themes.Add(entity);
         db.SaveChanges();
         return(theme);
     }
 }
예제 #11
0
        public void IndexAllEmails()
        {
            emails          = db.Emails;
            searchCriterias = db.SearchCriterias;


            foreach (var searchCriteria in searchCriterias)
            {
                foreach (var email in emails)
                {
                    CheckForNormalCase(email, searchCriteria);
                    CheckForLowerCase(email, searchCriteria);
                    CheckForUpperCase(email, searchCriteria);
                }
            }
            db.SaveChanges();

            //debug();
        }
예제 #12
0
 public void SaveChanges()
 {
     _context.SaveChanges();
 }