item.cs

来自「ASP.net网站开发四“酷”全书:新闻、论坛、电子商城、博客_源码」· CS 代码 · 共 54 行

CS
54
字号
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 product items
	/// </summary>
	public class Item {

		/// <summary>
		/// A method to list items by productId
		/// Every item is associated with a parent product
		/// </summary>
		/// <param name="productId">The productId to search by</param>
		/// <param name="productName">Name of the product associated with the product</param>
		/// <returns>An interface to an arraylist</returns>
		public IList GetItemsByProduct(string productId) {

			// Validate input
			if (productId.Trim() == string.Empty)
				return null;

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

			// Use the dal to search by productId
			return dal.GetItemsByProduct(productId);
		}

		/// <summary>
		/// Search for an item given it's unique identifier
		/// </summary>
		/// <param name="itemId">Unique identifier for an item</param>
		/// <returns>An Item business entity</returns>
		public ItemInfo GetItem(string itemId) {

			// Validate input
			if (itemId.Trim() == string.Empty)
				return null;

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

			// Use the dal to search by ItemId
			return dal.GetItem(itemId);
		}
	}
}

⌨️ 快捷键说明

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