Esempio n. 1
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);
        }
Esempio n. 2
0
        public void GETZYFLJSON(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            var    query = new FT_FolderB().GetEntities(d => d.ComId == UserInfo.User.ComId.Value);
            JArray arr   = new JArray();

            foreach (var item in query.Where(d => d.PFolderID == 1).OrderBy(d => d.CRDate))
            {
                JObject jsonitem =
                    new JObject(
                        new JProperty("name", item.Name),
                        new JProperty("sort", "1"),
                        new JProperty("id", item.ID),
                        new JProperty("pid", item.PFolderID),
                        new JProperty("kcflitem",
                                      new JArray(
                                          from p in query.Where(d => d.PFolderID == item.ID)
                                          orderby p.CRDate
                                          select new JObject(
                                              new JProperty("name", p.Name),
                                              new JProperty("id", p.ID),
                                              new JProperty("pid", p.PFolderID),
                                              new JProperty("sort", "1")))));

                arr.Add(jsonitem);
            }

            msg.Result = arr;
        }
Esempio n. 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(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;
        }
Esempio n. 4
0
        /// <summary>
        /// 获取内部共享来源
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void GETNBGXLY(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            string    strSQL  = " SELECT DISTINCT  FT_File_UserAuth.CRUser,JH_Auth_User.UserRealName FROM FT_File_UserAuth LEFT JOIN  JH_Auth_User ON FT_File_UserAuth.CRUser=JH_Auth_User.UserName  WHERE    " + SqlHelp.concat("','+AuthUser+','") + "   like '%," + UserInfo.User.UserName + ",%'";
            DataTable dtUserS = new FT_FolderB().GetDTByCommand(strSQL);

            msg.Result = dtUserS;
        }
Esempio n. 5
0
        /// <summary>
        /// 移动剪切-粘贴
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void PASTEITEM(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            int    PID          = int.Parse(P1);
            JArray PASTEITEMS   = (JArray)JsonConvert.DeserializeObject(P2);
            string strPASTEtype = context.Request("PASTETYPE");

            if (strPASTEtype == "copy")
            {
                foreach (var item in PASTEITEMS)
                {
                    int itemid = int.Parse(item["ID"].ToString());
                    if (item["type"].ToString() == "file")
                    {
                        FT_File Model = new FT_FileB().GetEntity(d => d.ID == itemid);
                        Model.FolderID = PID;
                        new FT_FileB().Insert(Model);
                    }
                    else
                    {
                        new FT_FolderB().CopyFloderTree(itemid, PID, UserInfo.User.ComId.Value);
                    }
                }
            }
            else
            {
                foreach (var item in PASTEITEMS)
                {
                    int itemid = int.Parse(item["ID"].ToString());

                    if (item["type"].ToString() == "file")
                    {
                        FT_File Model = new FT_FileB().GetEntity(d => d.ID == itemid);
                        Model.FolderID = PID;
                        new FT_FileB().Update(Model);
                    }
                    else
                    {
                        FT_Folder PModel = new FT_FolderB().GetEntity(d => d.ID == PID);
                        FT_Folder Model  = new FT_FolderB().GetEntity(d => d.ID == itemid);
                        Model.PFolderID = PID;
                        Model.Remark    = PModel.Remark + "-" + Model.ID;
                        new FT_FolderB().Update(Model);

                        //子文件夹路径修改
                        new FT_FolderB().ExsSql("  UPDATE  FT_Folder set Remark= '" + PModel.Remark + "'+SUBSTRING(Remark, CHARINDEX('-" + Model.ID + "-',Remark), 2000) WHERE ComId=" + UserInfo.User.ComId + " AND  Remark LIKE '" + Model.Remark + "-%' ");
                    }
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 判断用户是否有当前文件件的管理权限
        /// </summary>
        /// <param name="FloderID"></param>
        /// <param name="strUserName"></param>
        /// <returns></returns>
        public string isHasManage(string FloderID, string strUserName)
        {
            string    strReturn = "N";
            FT_Folder Model     = new FT_FolderB().GetEntities("ID=" + FloderID).SingleOrDefault();

            if (!string.IsNullOrEmpty(Model.Remark))
            {
                string    str = Model.Remark.ToFormatLike();
                DataTable dt  = new FT_FolderB().GetDTByCommand("SELECT ID FROM FT_Folder WHERE ','+UploadaAuthUsers+','  like '%," + strUserName + ",%'  AND ID IN ('" + Model.Remark.ToFormatLike('-') + "')");
                if (dt.Rows.Count > 0)
                {
                    strReturn = "Y";
                }
            }
            return(strReturn);
        }
Esempio n. 7
0
        /// <summary>
        /// 获取文档ITEM
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void GETWDITEM(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            int ID = int.Parse(P2);

            if (P1 == "file")//
            {
                FT_File Model = new FT_FileB().GetEntity(d => d.ID == ID);
                List <FT_File_Vesion> ListVer = new FT_File_VesionB().GetEntities(D => D.ComId == UserInfo.User.ComId && D.RFileID == Model.ID).ToList();
                msg.Result  = Model;
                msg.Result1 = ListVer;
            }
            else
            {
                FT_Folder Model = new FT_FolderB().GetEntity(d => d.ID == ID);
                msg.Result = Model;
            }
        }
Esempio n. 8
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;
        }
Esempio n. 9
0
        /// <summary>
        /// 获取能够查看的内部人员共享目录
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void GETNBSHARELIST(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            string strUser = P1;
            string strSQL  = "SELECT FT_Folder.* FROM FT_File_UserAuth LEFT JOIN FT_Folder on  FT_File_UserAuth.RefID=FT_Folder.ID WHERE  " + SqlHelp.concat("','+AuthUser+','") + "  like '%," + UserInfo.User.UserName + ",%' and FT_File_UserAuth.RefType='0'";

            if (strUser != "")
            {
                strSQL = strSQL + "  AND FT_File_UserAuth.CRUser='******'  ";
            }

            string strSQLFile = "SELECT FT_File.* FROM FT_File_UserAuth LEFT JOIN FT_File on  FT_File_UserAuth.RefID=FT_File.ID  WHERE  " + SqlHelp.concat("','+AuthUser+','") + "   like '%," + UserInfo.User.UserName + ",%' and FT_File_UserAuth.RefType='1'";

            if (strUser != "")
            {
                strSQLFile = strSQLFile + "  AND FT_File_UserAuth.CRUser='******'  ";
            }
            DataTable dtFLODER = new FT_FolderB().GetDTByCommand(strSQL);
            DataTable dtFile   = new FT_FileB().GetDTByCommand(strSQLFile);

            msg.Result  = dtFLODER;
            msg.Result1 = dtFile;
        }
Esempio n. 10
0
        /// <summary>
        /// 复制树状结构
        /// </summary>
        /// <param name="FloderID"></param>
        /// <param name="PID"></param>
        public void CopyFloderTree(int FloderID, int PID, int comId)
        {
            List <FoldFileItem> ListID = new List <FoldFileItem>();
            FoldFile            Model  = new FT_FolderB().GetWDTREE(FloderID, ref ListID, comId);
            FT_Folder           Folder = new FT_FolderB().GetEntity(d => d.ID == Model.FolderID && d.ComId == comId);

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

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

            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, comId);
        }
Esempio n. 11
0
        /// <summary>
        /// 根据父ID创建树装结构文档
        /// </summary>
        /// <param name="ListFoldFile"></param>
        private void GreateWDTree(List <FoldFile> ListFoldFile, int newfolderid, int comId)
        {
            foreach (FoldFile item in ListFoldFile)
            {
                FT_Folder PModel = new FT_FolderB().GetEntity(d => d.ID == item.FolderID && d.ComId == comId);
                PModel.PFolderID = newfolderid;
                new FT_FolderB().Insert(PModel);

                //更新文件夹路径Code
                FT_Folder PFolder = new FT_FolderB().GetEntity(d => d.ID == newfolderid && d.ComId == comId);
                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, comId);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 取消收藏
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void CANCOLLECTITEM(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            int DataID = int.Parse(P2);

            if (P1 == "file")//
            {
                FT_File Model = new FT_FileB().GetEntity(d => d.ID == DataID);
                if (Model.CollectUser.SplitTOList(',').Contains(UserInfo.User.UserName))
                {
                    Model.CollectUser = Model.CollectUser.Replace(UserInfo.User.UserName, ",").Replace(",,", ",").TrimEnd(',');
                    new FT_FileB().Update(Model);
                }
            }
            else
            {
                FT_Folder Model = new FT_FolderB().GetEntity(d => d.ID == DataID);
                if (Model.CollectUser.SplitTOList(',').Contains(UserInfo.User.UserName))
                {
                    Model.CollectUser = Model.CollectUser.Replace(UserInfo.User.UserName, ",").Replace(",,", ",").TrimEnd(',');
                    new FT_FolderB().Update(Model);
                }
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 收藏目录或文档
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void COLLECTITEM(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            int DataID = int.Parse(P2);

            if (P1 == "file")//
            {
                FT_File Model = new FT_FileB().GetEntity(d => d.ID == DataID);
                if (string.IsNullOrEmpty(Model.CollectUser) || !Model.CollectUser.SplitTOList(',').Contains(UserInfo.User.UserName))
                {
                    Model.CollectUser = (string.IsNullOrEmpty(Model.CollectUser) ? "" : Model.CollectUser.TrimEnd(',') + ",") + UserInfo.User.UserName;
                    new FT_FileB().Update(Model);
                }
            }
            else
            {
                FT_Folder Model = new FT_FolderB().GetEntity(d => d.ID == DataID);
                if (string.IsNullOrEmpty(Model.CollectUser) || !Model.CollectUser.SplitTOList(',').Contains(UserInfo.User.UserName))
                {
                    Model.CollectUser = (string.IsNullOrEmpty(Model.CollectUser) ? "" : Model.CollectUser.TrimEnd(',') + ",") + UserInfo.User.UserName;
                    new FT_FolderB().Update(Model);
                }
            }
        }
Esempio n. 14
0
        /// <summary>
        /// 获取文件数据
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1">文件夹类型</param>
        /// <param name="P2">上级文件夹ID</param>
        /// <param name="UserInfo"></param>
        public void GETLISTDATA(JObject context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            //默认找出企业文件夹查看属性为空或者包含当前用户的数据

            string itemtype = context.Request("itemtype") ?? ""; //文件或文件夹类型(1:企业文件夹,2:个人文件夹)

            if (itemtype == "1")                                 //企业文件夹
            {
                int FolderID = int.Parse(P1);                    //
                //默认找出企业文件夹查看属性为空或者包含当前用户的数据
                if (P2 == "Y")                                   //如果是后台查看企业文件夹
                {
                    //msg.Result = new FT_FolderB().GetEntities(" ComId=" + UserInfo.User.ComId + " AND  PFolderID=" + FolderID);
                    //msg.Result1 = new FT_FileB().GetEntities("ComId=" + UserInfo.User.ComId + " AND  FolderID=" + FolderID);

                    string strSQL = string.Format("SELECT FT_Folder.*,ISNULL(FT_File_UserAuth.AuthUser, '') as AuthUser from FT_Folder LEFT JOIN  FT_File_UserAuth  on FT_Folder.ID= FT_File_UserAuth.RefID  and FT_File_UserAuth.RefType='0' where FT_Folder.ComId='{0}' and FT_Folder.PFolderID='{1}' ", UserInfo.User.ComId, FolderID.ToString());
                    msg.Result = new FT_FolderB().GetDTByCommand(strSQL);

                    string strSQLFile = string.Format("SELECT FT_File.*,ISNULL(FT_File_UserAuth.AuthUser, '') as AuthUser from FT_File LEFT JOIN  FT_File_UserAuth  on FT_File.ID= FT_File_UserAuth.RefID  and FT_File_UserAuth.RefType='1' where FT_File.ComId='{0}' and FT_File.FolderID='{1}' ", UserInfo.User.ComId, FolderID.ToString());
                    msg.Result1 = new FT_FileB().GetDTByCommand(strSQLFile);
                    return;
                }
                else
                {
                    string strSQL = string.Format("SELECT FT_Folder.*,ISNULL(FT_File_UserAuth.AuthUser, '') as AuthUser from FT_Folder LEFT JOIN  FT_File_UserAuth  on FT_Folder.ID= FT_File_UserAuth.RefID  and FT_File_UserAuth.RefType='0' where FT_Folder.ComId='{0}' and FT_Folder.PFolderID='{1}'   and (  AuthUser is NULL OR  ',' + AuthUser  + ',' like '%,{2},%' )", UserInfo.User.ComId, FolderID.ToString(), UserInfo.User.UserName);
                    msg.Result = new FT_FolderB().GetDTByCommand(strSQL);

                    string strSQLFile = string.Format("SELECT FT_File.*,ISNULL(FT_File_UserAuth.AuthUser, '') as AuthUser from FT_File LEFT JOIN  FT_File_UserAuth  on FT_File.ID= FT_File_UserAuth.RefID  and FT_File_UserAuth.RefType='1' where FT_File.ComId='{0}' and FT_File.FolderID='{1}' ", UserInfo.User.ComId, FolderID.ToString());
                    msg.Result1 = new FT_FileB().GetDTByCommand(strSQLFile);
                    return;
                }
            }
            if (itemtype == "2")                 //个人文件夹
            {
                int    FolderID = int.Parse(P1); //
                string strSQL   = string.Format("SELECT FT_Folder.*,ISNULL(FT_File_UserAuth.AuthUser, '') as AuthUser from FT_Folder LEFT JOIN  FT_File_UserAuth  on FT_Folder.ID= FT_File_UserAuth.RefID  and FT_File_UserAuth.RefType='0' where FT_Folder.ComId='{0}' and FT_Folder.PFolderID='{1}' and  FT_Folder.CRUser='******'", UserInfo.User.ComId, FolderID.ToString(), UserInfo.User.UserName);
                msg.Result = new FT_FolderB().GetDTByCommand(strSQL);

                string strSQLFile = string.Format("SELECT FT_File.*,ISNULL(FT_File_UserAuth.AuthUser, '') as AuthUser from FT_File LEFT JOIN  FT_File_UserAuth  on FT_File.ID= FT_File_UserAuth.RefID  and FT_File_UserAuth.RefType='1' where FT_File.ComId='{0}' and FT_File.FolderID='{1}' and  FT_File.CRUser='******' ", UserInfo.User.ComId, FolderID.ToString(), UserInfo.User.UserName);
                msg.Result1 = new FT_FileB().GetDTByCommand(strSQLFile);
                return;
            }
            if (itemtype == "4")              //共享文档
            {
                int FolderID = int.Parse(P1); //
                msg.Result  = new FT_FolderB().GetEntities(d => d.ComId == UserInfo.User.ComId && d.PFolderID == FolderID);
                msg.Result1 = new FT_FileB().GetEntities(d => d.ComId == UserInfo.User.ComId && d.FolderID == FolderID);
                return;
            }
            if (itemtype == "3")//我的收藏
            {
                string strWhere  = string.Format(SqlHelp.concat("','+CollectUser+','") + "  like '%," + UserInfo.User.UserName + ",%'");
                string strWhere1 = strWhere;
                if (!string.IsNullOrEmpty(P1))
                {
                    strWhere1 = string.Format("  PFolderID=" + P1);
                }
                string    strSQLFLODER = string.Format(@"select * from FT_Folder  where ComId=" + UserInfo.User.ComId + " and  {0}   order by CRDate desc  ", strWhere1);
                DataTable dtFLODER     = new FT_FolderB().GetDTByCommand(strSQLFLODER);

                string strWhere2 = strWhere;
                if (!string.IsNullOrEmpty(P1))
                {
                    strWhere2 = string.Format("  FolderID=" + P1);
                }
                string    strSQLFILE = string.Format(@"select  *  from FT_File  where  ComId=" + UserInfo.User.ComId + "   and  {0}   order by CRDate desc  ", strWhere2);
                DataTable dtFILE     = new FT_FileB().GetDTByCommand(strSQLFILE);
                msg.Result  = dtFLODER;
                msg.Result1 = dtFILE;

                return;
            }
        }