Exemple #1
0
        public bool Delete(int id)
        {
            var bll = new DataBaseNameBll();
            var db  = new DataBaseName();

            dataBaseNames.TryRemove(id, out db);
            return(bll.Delete(id));
        }
Exemple #2
0
        public bool Add(DataBaseName dataBaseName)
        {
            var bll = new DataBaseNameBll();
            int id  = bll.AddDataBaseName(dataBaseName);

            if (id > 0)
            {
                dataBaseName.ID = id;
                this.dataBaseNames.TryAdd(id, dataBaseName);
                return(true);
            }
            return(false);
        }
Exemple #3
0
 private DataBaseNameDic()
 {
     if (null == dataBaseNames)
     {
         this.dataBaseNames = new ConcurrentDictionary <int, DataBaseName>();
         var bll = new DataBaseNameBll();
         List <DataBaseName> list = bll.SelectList().ToList();
         foreach (DataBaseName dataBaseName in list)
         {
             dataBaseNames.TryAdd(Convert.ToInt32(dataBaseName.ID), dataBaseName);
         }
     }
 }