Example #1
0
 public void insertServerConfig(MailServer e)
 {
     using (MailServerDaoSQLDb dao = new MailServerDaoSQLDb())
     {
         dao.Insert(e);
         Config.Add(e);
     }
 }
Example #2
0
 public void deleteServerConfig(decimal id)
 {
     using (MailServerDaoSQLDb dao = new MailServerDaoSQLDb())
     {
         dao.Delete(id);
         MailServer m = Config.Single(delegate(MailServer p) { return(p.Id == id); });
         Config.Remove(m);
     }
 }
Example #3
0
        public IList <MailServer> GetAll()
        {
            if (Config.Count == 0)
            {
                using (MailServerDaoSQLDb dao = new MailServerDaoSQLDb())
                {
                    Config = (List <MailServer>)dao.GetAll();
                }
            }

            return(Config);
        }
Example #4
0
        public MailServer LoadServerConfigById(decimal id)
        {
            MailServer m = Config.Single(delegate(MailServer p) { return(p.Id == id); });

            if (m == null)
            {
                using (MailServerDaoSQLDb dao = new MailServerDaoSQLDb())
                {
                    Config.Add(dao.GetById(id));
                    m = Config.Single(delegate(MailServer p) { return(p.Id == id); });
                }
            }
            return(m);
        }
Example #5
0
        public void updateServerConfig(MailServer e)
        {
            MailServer m = Config.SingleOrDefault(x => x.Id == e.Id);

            if (m == null)
            {
                //TASK: Allineamento log - Ciro
                ManagedException mEx = new ManagedException("Record cancellato da un'altro utente", "ERR_SM001", string.Empty,
                                                            string.Empty, null);
                ErrorLogInfo err = new ErrorLogInfo(mEx);
                //err.loggingAppCode = "SEND_MAIL";
                //err.objectID = System.Threading.Thread.CurrentContext.ContextID.ToString();
                _log.Error(mEx);
                throw mEx;
                //throw new ManagedException("Record cancellato da un'altro utente", "", "", "", "", "", "", null);
            }
            using (MailServerDaoSQLDb dao = new MailServerDaoSQLDb())
            {
                dao.Update(e);
                Config.Remove(m);
                Config.Add(e);
            }
        }