bizobject.cs

来自「asp.net技术内幕的书配源码」· CS 代码 · 共 23 行

CS
23
字号
using System;

namespace myComponents {
	public class BizObject {
		public void CheckOrder(string customer, string product, double unitPrice, int quantity, string state) {
			if ( quantity <= 0 || quantity > 100 ) {
				throw new ArgumentException( "Invalid Quantity!" );
			}

			if ( state == "California" && product == "Hair Dryer" ) {
				throw new ArgumentException( "Californians cannot own Hair Dryers!" );
			} 

			if ( state == "Washington" ) {
				unitPrice += unitPrice * .06;
			}
			
			DataObject  myDataObject = new DataObject();
			myDataObject.SaveOrder( customer, product, unitPrice, quantity, state );
		}
	}
}

⌨️ 快捷键说明

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