public override DBCategoryCollection GetEverythingCategories() { var result = new DBCategoryCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_CategoryLoadEverything"); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetCategoryFromReader(dataReader); result.Add(item); } } return(result); }
/// <summary> /// Gets all categories displayed on the home page /// </summary> /// <param name="showHidden">A value indicating whether to show hidden records</param> /// <param name="languageId">Language identifier</param> /// <returns>Category collection</returns> public override DBCategoryCollection GetAllCategoriesDisplayedOnHomePage(bool showHidden, int languageId) { var result = new DBCategoryCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_CategoryLoadDisplayedOnHomePage"); db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetCategoryFromReader(dataReader); result.Add(item); } } return(result); }
/// <summary> /// Gets all categories /// </summary> /// <param name="ParentCategoryID">Parent category identifier</param> /// <param name="showHidden">A value indicating whether to show hidden records</param> /// <returns>Category collection</returns> public override DBCategoryCollection GetAllCategories(int ParentCategoryID, bool showHidden) { DBCategoryCollection categoryCollection = new DBCategoryCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_CategoryLoadAll"); db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden); db.AddInParameter(dbCommand, "ParentCategoryID", DbType.Int32, ParentCategoryID); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBCategory category = GetCategoryFromReader(dataReader); categoryCollection.Add(category); } } return(categoryCollection); }