⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 product.cs

📁 ASP.net网站开发四“酷”全书:新闻、论坛、电子商城、博客_源码
💻 CS
字号:
using System.Collections;

//References to PetShop specific libraries
//PetShop busines entity library
using BookShop.Model;
//PetShop DAL interfaces
using BookShop.IDAL;

namespace BookShop.BLL {

	/// <summary>
	/// A business component to manage products
	/// </summary>
	public class Product {

		/// <summary>
		/// A method to search products by category name
		/// </summary>
		/// <param name="category">The category name to search by</param>
		/// <returns>An interface to an arraylist of the search results</returns>
		public IList GetProductsByCategory(string category) {

			// Return null if the string is empty
			if (category.Trim() == string.Empty) 
				return null;

			// Get an instance of the Product DAL using the DALFactory
			IProduct dal = BookShop.DALFactory.Product.Create();

			// Run a search against the data store
			return dal.GetProductsByCategory(category);
		}

		/// <summary>
		/// A method to search products by keywords
		/// </summary>
		/// <param name="text">A list keywords delimited by a space</param>
		/// <returns>An interface to an arraylist of the search results</returns>
		public IList GetProductsBySearch(string text) {

			// Return null if the string is empty
			if (text.Trim() == string.Empty) 
					return null;

			// Split the input text into individual words
			string[] keywords = text.Split();

			// Get an instance of the Product DAL using the DALFactory
			IProduct dal = BookShop.DALFactory.Product.Create();

			// Run a search against the data store
			return dal.GetProductsBySearch(keywords);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -