public void insertServerConfig(MailServer e) { using (MailServerDaoSQLDb dao = new MailServerDaoSQLDb()) { dao.Insert(e); Config.Add(e); } }
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); } }
public IList <MailServer> GetAll() { if (Config.Count == 0) { using (MailServerDaoSQLDb dao = new MailServerDaoSQLDb()) { Config = (List <MailServer>)dao.GetAll(); } } return(Config); }
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); }
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); } }