Пример #1
0
        /// <summary>
        /// 取得所有类别列表(已经排序好)
        /// </summary>
        /// <param name="parent_id">父ID</param>
        /// <param name="nav_type">导航类别</param>
        /// <param name="isAgent">是否为代理商</param>
        /// <returns>DataTable</returns>
        public DataTable GetList(int parent_id, string nav_type, bool isAgent, ISystemConfigRepository wxSystemConfigRepository)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,nav_type,name,title,sub_title,link_url,sort_id,is_lock,remark,parent_id,class_list,class_layer,channel_id,action_type,is_sys");
            strSql.Append(" FROM " + databaseprefix + "navigation");
            strSql.Append(" where nav_type='" + nav_type + "' ");
            if (isAgent)
            {
                string notinStr = wxSystemConfigRepository.GetConfigValue("agentxx");
                strSql.Append(" and is_lock=0 and id not in (" + notinStr + ") ");
            }
            strSql.Append(" order by sort_id asc,id asc");
            DataSet   ds      = DbHelperSQL.Query(strSql.ToString());
            DataTable oldData = ds.Tables[0] as DataTable;

            if (oldData == null)
            {
                return(null);
            }
            //复制结构
            DataTable newData = oldData.Clone();

            //调用迭代组合成DAGATABLE
            GetChilds(oldData, newData, parent_id);
            return(newData);
        }
Пример #2
0
        /// <summary>
        /// 取得所有类别列表(已经排序好)
        /// </summary>
        /// <param name="parent_id">父ID</param>
        /// <param name="nav_type">导航类别</param>
        /// <param name="isAgent">是否为代理商</param>
        /// <returns>DataTable</returns>
        public DataTable GetList(int parent_id, string nav_type, bool isAgent, ISystemConfigRepository wxSystemConfigRepository)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id,nav_type,name,title,sub_title,link_url,sort_id,is_lock,remark,parent_id,class_list,class_layer,channel_id,action_type,is_sys");
            strSql.Append(" FROM " + databaseprefix + "navigation");
            strSql.Append(" where nav_type='" + nav_type + "' ");
            if (isAgent)
            {

                string notinStr = wxSystemConfigRepository.GetConfigValue("agentxx");
                strSql.Append(" and is_lock=0 and id not in (" + notinStr + ") ");
            }
            strSql.Append(" order by sort_id asc,id asc");
            DataSet ds = DbHelperSQL.Query(strSql.ToString());
            DataTable oldData = ds.Tables[0] as DataTable;
            if (oldData == null)
            {
                return null;
            }
            //复制结构
            DataTable newData = oldData.Clone();
            //调用迭代组合成DAGATABLE
            GetChilds(oldData, newData, parent_id);
            return newData;
        }