public override List <ProductCategory> GetProductCategoryList() { List <ProductCategory> list = new List <ProductCategory>(); using (SqlConnection connection = this.GetSqlConnection()) { string cmdText = "select * from SuCommerce_Categories"; SqlCommand command = new SqlCommand(cmdText, connection) { CommandType = CommandType.Text }; connection.Open(); using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection)) { ProductCategory category = null; while (reader.Read()) { category = new ProductCategory(); CommerceDataProvider.PopulateProductCategoryList(reader, category); list.Add(category); } reader.Close(); connection.Close(); } } return(list); }
public override List <ProductCategory> GetCategoriesByParentID(int parentcategoryID) { List <ProductCategory> list = new List <ProductCategory>(); using (SqlConnection connection = this.GetSqlConnection()) { using (SqlCommand command = new SqlCommand("SuCommerce_CategoriesByParentID_Get", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@parentcategoryID", SqlDbType.Int, 4).Value = parentcategoryID; connection.Open(); using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection)) { ProductCategory category = null; while (reader.Read()) { category = new ProductCategory(); CommerceDataProvider.PopulateProductCategoryList(reader, category); list.Add(category); } reader.Close(); connection.Close(); } return(list); } } }