예제 #1
0
        public FoldFile GetWDTREE(int FolderID, ref List <FoldFileItem> ListID, string strUserName = "")
        {
            List <FT_Folder> ListAll = new FT_FolderB().GetALLEntities().ToList();
            FT_Folder        Folder  = new FT_FolderB().GetEntity(d => d.ID == FolderID);

            FT_FolderB.FoldFile Model = new FT_FolderB.FoldFile();
            Model.Name      = Folder.Name;
            Model.FolderID  = Folder.ID;
            Model.CRUser    = Folder.CRUser;
            Model.PFolderID = Folder.PFolderID.Value;
            ListID.Add(new FoldFileItem()
            {
                ID = Folder.ID, Type = "folder"
            });
            if (strUserName != "")
            {
                Model.SubFileS = new FT_FileB().GetEntities(d => d.FolderID == Folder.ID && d.CRUser == strUserName).ToList();
            }
            else
            {
                Model.SubFileS = new FT_FileB().GetEntities(d => d.FolderID == Folder.ID).ToList();
            }
            foreach (var item in Model.SubFileS)
            {
                ListID.Add(new FoldFileItem()
                {
                    ID = item.ID, Type = "file"
                });
            }
            Model.SubFolder = new FT_FolderB().GETNEXTFLODER(Folder.ID, ListAll, ref ListID, strUserName);
            return(Model);
        }
예제 #2
0
        /// <summary>
        /// 根据父ID创建树装结构文档
        /// </summary>
        /// <param name="ListFoldFile"></param>
        private void GreateWDTree(List <FoldFile> ListFoldFile, int newfolderid)
        {
            foreach (FoldFile item in ListFoldFile)
            {
                FT_Folder PModel = new FT_FolderB().GetEntity(d => d.ID == item.FolderID);
                PModel.PFolderID = newfolderid;
                new FT_FolderB().Insert(PModel);

                //更新文件夹路径Code
                FT_Folder PFolder = new FT_FolderB().GetEntity(d => d.ID == newfolderid);
                PModel.Remark = PFolder.Remark + "-" + PModel.ID;
                new FT_FolderB().Update(PModel);

                foreach (FT_File file in item.SubFileS)
                {
                    file.FolderID = PModel.ID;
                    new FT_FileB().Insert(file);
                }

                GreateWDTree(item.SubFolder, PModel.ID);
            }
        }
예제 #3
0
        /// <summary>
        /// 复制树状结构
        /// </summary>
        /// <param name="FloderID"></param>
        /// <param name="PID"></param>
        public void CopyFloderTree(int FloderID, int PID)
        {
            List <FoldFileItem> ListID = new List <FoldFileItem>();
            FoldFile            Model  = new FT_FolderB().GetWDTREE(FloderID, ref ListID);
            FT_Folder           Folder = new FT_FolderB().GetEntity(d => d.ID == Model.FolderID);

            Folder.PFolderID = PID;
            new FT_FolderB().Insert(Folder);

            //更新文件夹路径Code
            FT_Folder PFolder = new FT_FolderB().GetEntity(d => d.ID == PID);

            Folder.Remark = PFolder.Remark + "-" + Folder.ID;
            new FT_FolderB().Update(Folder);

            foreach (FT_File file in Model.SubFileS)
            {
                file.FolderID = Folder.ID;
                new FT_FileB().Insert(file);
            }
            GreateWDTree(Model.SubFolder, Folder.ID);
        }