Exemplo n.º 1
0
 /// <summary>
 /// 栏目是否有下属分类
 /// </summary>
 /// <param name="categoryID">分类ID</param>
 /// <returns></returns>
 public bool HasSubCategory(int channelItemID)
 {
     CategoryExt bllCategory = new CategoryExt();
     DataSet ds = bllCategory.GetList("ChannelItemID=" + channelItemID.ToString());
     if (ds != null && ds.Tables != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
     {
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
        public List<Model.Info> GetAllInfoByCategoryID(int categoryID, List<Model.Info> infoList)
        {
            List<Model.Info> modelListBlank = new List<Model.Info>();
            try
            {
                List<Model.Info> il = this.GetModelList("categoryID=" + categoryID.ToString());
                foreach (Model.Info m_temp in il)
                {
                    infoList.Add(m_temp);
                }

                CategoryExt bllCategory = new CategoryExt();
                List<Model.Category> subCategoryList = bllCategory.GetSubCategory(categoryID);
                foreach (Model.Category subCategory in subCategoryList)
                {
                    GetAllInfoByCategoryID(subCategory.CategoryID, infoList);
                }

                if (infoList != null && infoList.Count > 0)
                {
                    infoList.Sort(delegate(Model.Info m1, Model.Info m2) { return m2.InfoID.CompareTo(m1.InfoID); });
                    return infoList;
                }
                else
                {
                    return modelListBlank;
                }
            }
            catch
            {
                return modelListBlank;
            }
            finally
            {
                infoList = null;
            }
        }