示例#1
0
        /// <summary>
        /// 向服务器发送压缩目录命令
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1">目录ID</param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void COMPRESSFOLDER(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            string strCode = P1;

            FT_FolderB.FoldFile Mode = new FT_FolderB.FoldFile();
            Mode.FolderID  = -1;
            Mode.Name      = "压缩文件";
            Mode.SubFileS  = new List <FT_File>();
            Mode.SubFolder = new List <FT_FolderB.FoldFile>();
            foreach (string item in P1.SplitTOList(','))
            {
                int    FileID  = int.Parse(item.Split('|')[0].ToString());
                string strType = item.Split('|')[1].ToString();
                if (item.Split('|')[1].ToString() == "file")
                {
                    FT_File file = new FT_FileB().GetEntity(d => d.ID == FileID);
                    file.YLUrl = "";
                    Mode.SubFileS.Add(file);
                }
                else
                {
                    List <FT_FolderB.FoldFileItem> ListID = new List <FT_FolderB.FoldFileItem>();
                    FT_FolderB.FoldFile            obj    = new FT_FolderB().GetWDTREE(FileID, ref ListID, UserInfo.User.ComId.Value);
                    Mode.SubFolder.Add(obj);
                }
            }
            IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();

            timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            string Result  = JsonConvert.SerializeObject(Mode, Formatting.Indented, timeConverter).Replace("null", "\"\"");
            string strData = new FileHelp().CompressZip(Result, UserInfo.QYinfo);

            msg.Result = strData;
        }
示例#2
0
        public FoldFile GetWDTREE(int FolderID, ref List <FoldFileItem> ListID, int comId, string strUserName = "")
        {
            List <FT_Folder> ListAll = new FT_FolderB().GetEntities(d => d.ComId == comId).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 && d.ComId == comId).ToList();
            }
            else
            {
                Model.SubFileS = new FT_FileB().GetEntities(d => d.FolderID == Folder.ID && d.ComId == comId).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, comId, strUserName);
            return(Model);
        }
示例#3
0
        /// <summary>
        /// 向服务器发送压缩目录命令
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1">目录ID</param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void COMPRESSFOLDER(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            string strCode = P1;
            int    ComId   = int.Parse(P2);

            FT_FolderB.FoldFile Mode = new FT_FolderB.FoldFile();
            Mode.FolderID  = -1;
            Mode.Name      = "压缩文件";
            Mode.SubFileS  = new List <FT_File>();
            Mode.SubFolder = new List <FT_FolderB.FoldFile>();
            foreach (string item in P1.SplitTOList(','))
            {
                int    FileID  = int.Parse(item.Split('|')[0].ToString());
                string strType = item.Split('|')[1].ToString();
                if (item.Split('|')[1].ToString() == "file")
                {
                    FT_File file = new FT_FileB().GetEntity(d => d.ID == FileID);
                    file.YLUrl = "";
                    Mode.SubFileS.Add(file);
                }
                else
                {
                    List <FT_FolderB.FoldFileItem> ListID = new List <FT_FolderB.FoldFileItem>();
                    FT_FolderB.FoldFile            obj    = new FT_FolderB().GetWDTREE(FileID, ref ListID, ComId);
                    Mode.SubFolder.Add(obj);
                }
            }
            IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();

            timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            string     Result  = JsonConvert.SerializeObject(Mode, Newtonsoft.Json.Formatting.Indented, timeConverter).Replace("null", "\"\"");
            JH_Auth_QY qymodel = new JH_Auth_QYB().GetEntity(d => d.ComId == ComId);
            //压缩文件
            Dictionary <String, String> DATA = new Dictionary <String, String>();

            DATA.Add("data", Result);
            HttpWebResponse ResponseData = CommonHelp.CreatePostHttpResponse(qymodel.FileServerUrl + "zipfolder", DATA, 0, "", null);
            string          strData      = CommonHelp.GetResponseString(ResponseData);

            msg.Result = strData;
        }