Пример #1
0
 public void RemoveAll()
 {
     using (var conn = Database.Open())
     {
         conn.Execute(DirectorySql.RemoveAll());
     }
 }
Пример #2
0
 public Model.Directory FindBy(int key)
 {
     using (var conn = Database.Open())
     {
         return(conn.Query <Model.Directory>(DirectorySql.FindById(key)).FirstOrDefault());
     }
 }
Пример #3
0
 public void Remove(Model.Directory item)
 {
     using (var conn = Database.Open())
     {
         conn.Execute(DirectorySql.Remove(item.Id));
     }
 }
Пример #4
0
 public IList <Model.Directory> FindAll()
 {
     using (var conn = Database.Open())
     {
         return(conn.Query <Model.Directory>(DirectorySql.FindAll()).ToArray());
     }
 }
Пример #5
0
 public void Update(Model.Directory item)
 {
     using (var conn = Database.Open())
     {
         var tuple = DirectorySql.Update(item);
         conn.Execute(tuple.Item1, (object)tuple.Item2);
     }
 }
Пример #6
0
 public IEnumerable <Model.Directory> Select(Model.DirectoryType directoryType)
 {
     using (var conn = Database.Open())
     {
         string sql = DirectorySql.SelectDirectoryType(directoryType);
         return(conn.Query <Model.Directory>(sql));
     }
 }
Пример #7
0
 public bool DirectoryIsExists(Model.Directory d)
 {
     using (var conn = Database.Open())
     {
         var tuple = DirectorySql.DirectoryIsExists(d.Name, d.Id);
         return(conn.ExecuteScalar <int>(tuple.Item1, (object)tuple.Item2) > 0);
     }
 }
Пример #8
0
 public Model.Directory FindBy(string name)
 {
     using (var conn = Database.Open())
     {
         var tuple = DirectorySql.FindByName(name);
         return(conn.Query <Model.Directory>(tuple.Item1, (object)tuple.Item2).FirstOrDefault());
     }
 }
Пример #9
0
 public void UpdateProviderNodeCount(int directoryId, int providerNodeCount)
 {
     using (var conn = Database.Open())
     {
         string sql = DirectorySql.UpdateProviderNodeCount(directoryId, providerNodeCount);
         conn.Execute(sql);
     }
 }
Пример #10
0
 public void UpdateServiceApiMd5(int directoryId, string serviceApiMd5)
 {
     using (var conn = Database.Open())
     {
         string sql = DirectorySql.UpdateServiceApiMd5(directoryId, serviceApiMd5);
         conn.Execute(sql);
     }
 }
Пример #11
0
        public IEnumerable <Model.Directory> FindBy(string[] names)
        {
            using (var conn = Database.Open())
            {
                var sql = DirectorySql.FindByNames(names);

                return(conn.Query <Model.Directory>(sql));
            }
        }
Пример #12
0
        public void Add(Model.Directory item)
        {
            using (var conn = Database.Open())
            {
                var tuple = DirectorySql.Add(item);

                int id = conn.ExecuteScalar <int>(tuple.Item1, (object)tuple.Item2);
                propertyHelper.SetValue <int>(m => m.Id, item, id);
            }
        }