Ejemplo n.º 1
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);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
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();
            }
        }
 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();
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 11
0
 public DataManager(CollaboratorContext context)
 {
     _context = context;
 }