📄 item.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 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -