using System;namespace PetShop.Model { /// <summary>
/// Business entity used to model an order
/// </summary>
[Serializable]
public class OrderInfo { // Internal member variables
private int orderId;
private DateTime date;
private string userId;
private CreditCardInfo creditCard;
private AddressInfo billingAddress;
private AddressInfo shippingAddress;
private decimal orderTotal;
private LineItemInfo[] lineItems;
private Nullable<int> authorizationNumber; /// <summary>
/// Default constructor
/// This is required by web services serialization mechanism
/// </summary>
public OrderInfo() { } 为什么OrderInfo()这里是空的,而在下面再写内容呢,为什么不一起写 /// <summary>
/// Constructor with specified initial values
/// </summary>
/// <param name="orderId">Unique identifier</param>
/// <param name="date">Order date</param>
/// <param name="userId">User placing order</param>
/// <param name="creditCard">Credit card used for order</param>
/// <param name="billing">Billing address for the order</param>
/// <param name="shipping">Shipping address for the order</param>
/// <param name="total">Order total value</param>
/// <param name="line">Ordered items</param>
/// <param name="authorization">Credit card authorization number</param>
public OrderInfo(int orderId, DateTime date, string userId, CreditCardInfo creditCard, AddressInfo billing, AddressInfo shipping, decimal total, LineItemInfo[] line, Nullable<int> authorization) {
this.orderId = orderId;
this.date = date;
this.userId = userId;
this.creditCard = creditCard;
this.billingAddress = billing;
this.shippingAddress = shipping;
this.orderTotal = total;
this.lineItems = line;
this.authorizationNumber = authorization;
} // Properties
public int OrderId {
get { return orderId; }
set { orderId = value; }
} public DateTime Date {
get { return date; }
set { date = value; }
} public string UserId {
get { return userId; }
set { userId = value; }
} public CreditCardInfo CreditCard { 这句又是什么意思,
get { return creditCard; }
set { creditCard = value; }
} public AddressInfo BillingAddress {
get { return billingAddress; }
set { billingAddress = value; }
} public AddressInfo ShippingAddress {
get { return shippingAddress; }
set { shippingAddress = value; }
} public decimal OrderTotal {
get { return orderTotal; }
set { orderTotal = value; }
} public LineItemInfo[] LineItems { 这句我也看不懂
get { return lineItems; }
set { lineItems = value; }
} public Nullable<int> AuthorizationNumber { <int> 是强致转换吗?
get {return authorizationNumber;}
set {authorizationNumber = value;}
}
}
}
/// Business entity used to model an order
/// </summary>
[Serializable]
public class OrderInfo { // Internal member variables
private int orderId;
private DateTime date;
private string userId;
private CreditCardInfo creditCard;
private AddressInfo billingAddress;
private AddressInfo shippingAddress;
private decimal orderTotal;
private LineItemInfo[] lineItems;
private Nullable<int> authorizationNumber; /// <summary>
/// Default constructor
/// This is required by web services serialization mechanism
/// </summary>
public OrderInfo() { } 为什么OrderInfo()这里是空的,而在下面再写内容呢,为什么不一起写 /// <summary>
/// Constructor with specified initial values
/// </summary>
/// <param name="orderId">Unique identifier</param>
/// <param name="date">Order date</param>
/// <param name="userId">User placing order</param>
/// <param name="creditCard">Credit card used for order</param>
/// <param name="billing">Billing address for the order</param>
/// <param name="shipping">Shipping address for the order</param>
/// <param name="total">Order total value</param>
/// <param name="line">Ordered items</param>
/// <param name="authorization">Credit card authorization number</param>
public OrderInfo(int orderId, DateTime date, string userId, CreditCardInfo creditCard, AddressInfo billing, AddressInfo shipping, decimal total, LineItemInfo[] line, Nullable<int> authorization) {
this.orderId = orderId;
this.date = date;
this.userId = userId;
this.creditCard = creditCard;
this.billingAddress = billing;
this.shippingAddress = shipping;
this.orderTotal = total;
this.lineItems = line;
this.authorizationNumber = authorization;
} // Properties
public int OrderId {
get { return orderId; }
set { orderId = value; }
} public DateTime Date {
get { return date; }
set { date = value; }
} public string UserId {
get { return userId; }
set { userId = value; }
} public CreditCardInfo CreditCard { 这句又是什么意思,
get { return creditCard; }
set { creditCard = value; }
} public AddressInfo BillingAddress {
get { return billingAddress; }
set { billingAddress = value; }
} public AddressInfo ShippingAddress {
get { return shippingAddress; }
set { shippingAddress = value; }
} public decimal OrderTotal {
get { return orderTotal; }
set { orderTotal = value; }
} public LineItemInfo[] LineItems { 这句我也看不懂
get { return lineItems; }
set { lineItems = value; }
} public Nullable<int> AuthorizationNumber { <int> 是强致转换吗?
get {return authorizationNumber;}
set {authorizationNumber = value;}
}
}
}
解决方案 »
- Unity3D 游戏制作
- 我创建了一张背景图片Size很大, 目的是要转TIF CCITT4编法(黑白图) ,速度超级慢
- 关于把含有unicode字符的字符串转为gb2312编码问题
- 又是一个面试题
- 疑问:如果这样引用,C#还会懂得自动垃圾回收吗?
- c#注册表添加到右键
- VS 2005(.net 2.0)的编译 csc.exe问题
- 怎么开发同时支持access和sql server数据库的程序.
- C#串口通信
- 怎么判断程序所在的当前路径
- 求一个vs2008 英文版的下载地址(不要试用版的,无msdn最好,电脑上已经有msdn了是vs2005的) !
- 我的系统进程里出现了netsend.exe进程
public CreditCardInfo CreditCard---------返回CreditCardInfo 类型
public LineItemInfo[] LineItems ---------返回LineItemInfo[]数组
Nullable <int> ----------------泛型??
/// Default constructor
/// This is required by web services serialization mechanism
/// </summary>
public OrderInfo() { } 为什么OrderInfo()这里是空的,而在下面再写内容呢,为什么不一起写 注释写的很清楚了。这个是web services serialization mechanism需要的,流程需要的是下面带参数的构造函数
public CreditCardInfo CreditCard {
public LineItemInfo[] LineItems { 两个属性,返回CreditCardInfo和LineItemInfo[]类型Nullable <int>空属类型,也可以用int?代替,具体看msdn吧
http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx