コード例 #1
0
ファイル: DbFolder.cs プロジェクト: 1269085759/up6-asp.net
        /// <summary>
        /// 取同名目录信息
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="nameLoc"></param>
        /// <returns></returns>
        public JObject read(string pid, string nameLoc)
        {
            DBConfig cfg = new DBConfig();
            SqlExec  se  = cfg.se();
            string   sql = string.Format(@"select f_id,f_pathRel from up6_files where f_pid='{0}' and f_nameLoc='{1}'", pid, nameLoc);

            if (string.IsNullOrEmpty(pid))
            {
                pid = " ";
            }
            if (cfg.m_isOracle)
            {
                sql = string.Format(@"select f_id,f_pathRel from up6_files where nvl(f_pid,' ')='{0}' and f_nameLoc='{1}'", pid, nameLoc);
            }

            var data = (JArray)se.exec("up6_files", sql, "f_id,f_pathRel");

            if (data.Count < 1)
            {
                return(null);
            }

            var o = JObject.FromObject(data[0]);

            return(o);
        }
コード例 #2
0
ファイル: DbFolder.cs プロジェクト: 1269085759/up6-asp.net
        public bool exist_same_folder(string name, string pid)
        {
            DBConfig      cfg = new DBConfig();
            SqlWhereMerge swm = new SqlWhereMerge();

            swm.equal("f_nameLoc", name.Trim());
            swm.equal("f_deleted", 0);
            if (cfg.m_isOracle)
            {
                if (string.IsNullOrEmpty(pid))
                {
                    pid = " ";
                }
                swm.equal("nvl(f_pid,' ')", pid);
            }
            else
            {
                swm.equal("LTRIM (f_pid)", pid.Trim());
            }

            string sql = string.Format("select f_id from up6_files where {0} " +
                                       " union select f_id from up6_folders where {0}", swm.to_sql());

            SqlExec se  = cfg.se();
            var     fid = (JArray)se.exec("up6_files", sql, "f_id", string.Empty);

            return(fid.Count > 0);
        }
コード例 #3
0
ファイル: DbFolder.cs プロジェクト: 1269085759/up6-asp.net
        /// <summary>
        /// 将所有目录转换成关联数组
        /// </summary>
        /// <param name="id">文件夹ID</param>
        /// <param name="pid"></param>
        /// <returns></returns>
        public Dictionary <String, JToken> foldersToDic(string pidRoot)
        {
            //默认加载根目录
            string sql = string.Format("select f_id,f_nameLoc,f_pid,f_pidRoot from up6_folders where f_pidRoot='{0}'", pidRoot);

            DBConfig cfg     = new DBConfig();
            SqlExec  se      = cfg.se();
            var      folders = se.exec("up6_folders", sql, "f_id,f_nameLoc,f_pid,f_pidRoot");

            return(this.toDic(ref folders));
        }
コード例 #4
0
ファイル: DbFolder.cs プロジェクト: 1269085759/up6-asp.net
        public bool exist_same_file(string name, string pid)
        {
            SqlWhereMerge swm = new SqlWhereMerge();

            swm.equal("f_nameLoc", name.Trim());
            swm.equal("f_pid", pid.Trim());
            swm.equal("f_deleted", 0);

            string sql = string.Format("select f_id from up6_files where {0} ", swm.to_sql());

            DBConfig cfg = new DBConfig();
            SqlExec  se  = cfg.se();
            var      arr = (JArray)se.exec("up6_files", sql, "f_id", string.Empty);

            return(arr.Count > 0);
        }
コード例 #5
0
ファイル: DbFolder.cs プロジェクト: 1269085759/up6-asp.net
        /// <summary>
        /// 获取根目录或子目录信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public FileInf read(string id)
        {
            DBConfig cfg  = new DBConfig();
            SqlExec  se   = cfg.se();
            string   sql  = string.Format("select f_pid,f_pidRoot,f_pathSvr,f_pathRel from up6_files where f_id='{0}' union select f_pid,f_pidRoot,f_pathSvr,f_pathRel from up6_folders where f_id='{0}'", id);
            var      data = (JArray)se.exec("up6_files", sql, "f_pid,f_pidRoot,f_pathSvr,f_pathRel");
            var      o    = JObject.FromObject(data[0]);

            FileInf file = new FileInf();

            file.id      = id;
            file.pid     = o["f_pid"].ToString().Trim();
            file.pidRoot = o["f_pidRoot"].ToString().Trim();
            file.pathSvr = o["f_pathSvr"].ToString().Trim();
            file.pathRel = o["f_pathRel"].ToString().Trim();
            return(file);
        }
コード例 #6
0
ファイル: DbFolder.cs プロジェクト: 1269085759/up6-asp.net
        /// <summary>
        /// 取同名目录信息
        /// </summary>
        /// <param name="pathRel"></param>
        /// <param name="pid"></param>
        /// <returns></returns>
        public FileInf read(string pathRel, string pid, string id)
        {
            DBConfig cfg = new DBConfig();
            SqlExec  se  = cfg.se();
            string   sql = string.Format(@"select f_id,f_pid,f_pidRoot,f_pathSvr,f_pathRel 
from up6_files 
where f_pid='{0}' and f_pathRel='{1}' and f_deleted=0 and f_id!='{2}'
union select f_id,f_pid,f_pidRoot,f_pathSvr,f_pathRel 
    from up6_folders where f_pid='{0}' and f_pathRel='{1}' and f_deleted=0 and f_id!='{2}'", pid, pathRel, id);

            if (string.IsNullOrEmpty(pid))
            {
                pid = " ";
            }
            if (cfg.m_isOracle)
            {
                sql = string.Format(@"select f_id,f_pid,f_pidRoot,f_pathSvr,f_pathRel 
from up6_files 
where nvl(f_pid,' ')='{0}' and f_pathRel='{1}' and f_deleted=0 and f_id!='{2}'
union select f_id,f_pid,f_pidRoot,f_pathSvr,f_pathRel 
    from up6_folders where nvl(f_pid,' ')='{0}' and f_pathRel='{1}' and f_deleted=0 and f_id!='{2}'", pid, pathRel, id);
            }

            var data = (JArray)se.exec("up6_files", sql, "f_id,f_pid,f_pidRoot,f_pathSvr,f_pathRel");

            if (data.Count < 1)
            {
                return(null);
            }

            var o = JObject.FromObject(data[0]);

            FileInf file = new FileInf();

            file.id      = o["f_id"].ToString().Trim();
            file.pid     = o["f_pid"].ToString().Trim();
            file.pidRoot = o["f_pidRoot"].ToString().Trim();
            file.pathSvr = o["f_pathSvr"].ToString().Trim();
            file.pathRel = o["f_pathRel"].ToString().Trim();
            return(file);
        }