orderread.cs

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

CS
37
字号
using System;

//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 the retrieval of orders
	/// Creation of an order requires a distributed transaction, however
	/// reading the order does not, so the the component has been split into 2 parts
	/// By splitting the component into 2 we avoid the overhead of Enterprise Services
	/// </summary>
	public class OrderRead{

		/// <summary>
		/// A method to read an order from the system
		/// </summary>
		/// <param name="orderId">Unique identifier for an order</param>
		/// <returns></returns>
		public OrderInfo GetOrder(int orderId) {

			// Validate input
			if (orderId < 1)
				return null;

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

			// Return the order from the DAL
			return dal.GetOrder(orderId);
		}
	}
}

⌨️ 快捷键说明

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