Esempio n. 1
0
 /// <summary>
 /// 根据文件夹名查询文件夹
 /// </summary>
 /// <param name="FolderName"></param>
 /// <returns></returns>
 public Model.Folder GetFolder(string FolderName)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         return(db.Set <Model.Folder>().FirstOrDefault(x => x.Folder_Name == FolderName));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 验证文件夹是否重复
 /// </summary>
 /// <param name="FolderName"></param>
 /// <returns></returns>
 public Model.Folder YanZhenFolderByName(string FolderName, int FatherFolderID, int UserId)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         return(db.Set <Model.Folder>().FirstOrDefault(x => x.Folder_Name == FolderName && x.FatherFolderID == FatherFolderID && x.FounderID == UserId));
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 根据用户id查询用户信息
 /// </summary>
 /// <param name="UserID"></param>
 /// <returns></returns>
 public Model.User GetUserByID(int UserID)
 {
     using (Model.ZKJSkyDriveEntities db = new Model.ZKJSkyDriveEntities())
     {
         return(db.Set <Model.User>().Find(UserID));
     }
 }
Esempio n. 4
0
 /// <summary>
 /// 根据文件名查询文件
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Model.Store_data GetFile(string FileName, int id)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         return(db.Set <Model.Store_data>().FirstOrDefault(x => x.Real_FileName == FileName && x.User_ID == id));
     }
 }
Esempio n. 5
0
 /// <summary>
 /// 用户注册
 /// </summary>
 /// <param name="User"></param>
 /// <returns></returns>
 public int InsertUser(Model.User User)
 {
     using (var db = new  Model.ZKJSkyDriveEntities()){
         db.Entry <Model.User>(User).State = System.Data.Entity.EntityState.Added;
         return(db.SaveChanges());
     }
 }
Esempio n. 6
0
 /// <summary>
 /// 根据文件id查询文件
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Model.Store_data GetFile(int id)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         return(db.Set <Model.Store_data>().Find(id));
     }
 }
Esempio n. 7
0
 /// <summary>
 /// 查询其他文件
 /// </summary>
 /// <param name="Uid"></param>
 /// <param name="SuffixName"></param>
 /// <returns></returns>
 public List <Model.Store_data> GetStore_dataBySuffixName(int Uid)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         return(db.Set <Model.Store_data>().Where(x => x.SuffixName == "weizhi.png" && x.User_ID == Uid).ToList());
     }
 }
Esempio n. 8
0
 /// <summary>
 /// 用户登录
 /// </summary>
 /// <param name="User"></param>
 /// <returns></returns>
 public Model.User Login(Model.User User)
 {
     using (var db = new Model.ZKJSkyDriveEntities()){
         return(db.Set <Model.User>()
                .FirstOrDefault(x => x.User_Name == User.User_Name && x.User_Password == User.User_Password));
     }
 }
Esempio n. 9
0
 /// <summary>
 /// 回收站文件
 /// </summary>
 /// <param name="Uid"></param>
 /// <param name="SuffixName"></param>
 /// <returns></returns>
 public List <Model.Store_data> recovery(int Uid)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         return(db.Set <Model.Store_data>().Where(x => x.DeleteState == 1 && x.User_ID == Uid).ToList());
     }
 }
Esempio n. 10
0
 public int GetNewFolderId(int UserId)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         return(db.Set <Model.Folder>().Where(x => x.FounderID == UserId).Max(x => x.Folder_ID));
     }
 }
Esempio n. 11
0
 /// <summary>
 /// 根据文件id查询文件夹
 /// </summary>
 /// <param name="FolderName"></param>
 /// <returns></returns>
 public Model.Folder GetFolderByID(int FolderID, int UserId)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         return(db.Set <Model.Folder>().FirstOrDefault(x => x.Folder_ID == FolderID && x.FounderID == UserId && x.DeleteState == 0));
     }
 }
Esempio n. 12
0
 /// <summary>
 /// 上传文件
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public int Insert(Model.Store_data data)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         db.Entry <Model.Store_data>(data).State = System.Data.Entity.EntityState.Added;
         return(db.SaveChanges());
     }
 }
Esempio n. 13
0
 /// <summary>
 /// 彻底删除
 /// </summary>
 /// <param name="FileID"></param>
 /// <returns></returns>
 public int DeleteFile(int FileID)
 {
     using (var db = new Model.ZKJSkyDriveEntities()) {
         Model.Store_data store = db.Set <Model.Store_data>().Find(FileID);
         db.Entry <Model.Store_data>(store).State = System.Data.Entity.EntityState.Deleted;
         return(db.SaveChanges());
     }
 }
Esempio n. 14
0
 /// <summary>
 /// 清除重复的旧文件
 /// </summary>
 /// <param name="FileID"></param>
 /// <returns></returns>
 public bool DeleteOldFile(int FileID)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         db.Database.ExecuteSqlCommand("delete from Store_data  where Store_data_ID  =  '" + FileID + "'");
         return(db.SaveChanges() > 0);
     }
 }
Esempio n. 15
0
        /// <summary>
        /// 根据父ID查询文件夹
        /// </summary>
        /// <param name="Folder"></param>
        /// <returns></returns>
        public List <Model.Folder> GetFolderByID(int FolderID)
        {
            var db = new Model.ZKJSkyDriveEntities();

            return(db.Set <Model.Folder>()
                   .Where(x => x.FatherFolderID == FolderID && x.DeleteState == 0)
                   .OrderByDescending(x => x.EstablishTime)
                   .ToList());
        }
Esempio n. 16
0
 /// <summary>
 /// 修改密码
 /// </summary>
 /// <param name="NewPwd"></param>
 /// <param name="user"></param>
 /// <returns></returns>
 public int UpdatePwd(string NewPwd, Model.User user)
 {
     using (var db = new Model.ZKJSkyDriveEntities()) {
         Model.User odduser = db.Set <Model.User>().FirstOrDefault(x => x.User_Name == user.User_Name && x.User_Password == user.User_Password);
         odduser.User_Password = NewPwd;
         db.Entry <Model.User>(odduser).State = System.Data.Entity.EntityState.Modified;
         return(db.SaveChanges());
     }
 }
Esempio n. 17
0
 /// <summary>
 /// 查询用户所有文件
 /// </summary>
 /// <param name="UserID"></param>
 /// <returns></returns>
 public List <Model.Store_data> GetAll(int UserID)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         return(db.Set <Model.Store_data>()
                .Where(x => x.User_ID == UserID && x.Folder_ID == 0 && x.DeleteState == 0)
                .OrderByDescending(x => x.EstablishTime)
                .ToList());
     }
 }
Esempio n. 18
0
 /// <summary>
 /// 查询用户所有文件夹
 /// </summary>
 /// <param name="UserId"></param>
 /// <returns></returns>
 public List <Model.Folder> GetFolderList(int UserId)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         return(db.Set <Model.Folder>()
                .Where(x => x.FounderID == UserId && x.FatherFolderID == 0 && x.DeleteState == 0)
                .OrderByDescending(x => x.EstablishTime)
                .ToList());
     }
 }
Esempio n. 19
0
 /// <summary>
 /// 还原文件
 /// </summary>
 /// <param name="FileID"></param>
 /// <returns></returns>
 public int UpdateFile2(int FileID)
 {
     using (var db = new Model.ZKJSkyDriveEntities())
     {
         Model.Store_data store = db.Set <Model.Store_data>().Find(FileID);
         store.DeleteState   = 0;
         store.EstablishTime = DateTime.Now;
         db.Entry <Model.Store_data>(store).State = System.Data.Entity.EntityState.Modified;
         return(db.SaveChanges());
     }
 }
Esempio n. 20
0
 /// <summary>
 /// 根据后缀查询文件
 /// </summary>
 /// <param name="Uid"></param>
 /// <param name="SuffixName"></param>
 /// <returns></returns>
 public List <Model.Store_data> GetStore_dataBySuffixName(int Uid, string SuffixName)
 {
     using (var db = new  Model.ZKJSkyDriveEntities()){
         return(db.Set <Model.Store_data>().Where(x => x.SuffixName == SuffixName && x.User_ID == Uid && x.DeleteState == 0).ToList());
     }
 }