()添加如下代码创建一个购物车商品对象称为CartItem
Imports MicrosoftVisualBasic
Imports SystemData
Imports SystemDataSqlClient
Imports SystemCollectionsGeneric
Namespace WroxCommerce
<Serializable()> _
Public Class CartItem
Private _productID As Integer
Private _productName As String
Private _productImageUrl As String
Private _quantity As Integer
Private _price As Double
Private _lineTotal As Double
Public Sub New()
End Sub
Public Sub New(ByVal ProductID As Integer ByVal ProductName As String ByVal ProductImageUrl As String ByVal Quantity As Integer ByVal Price As Double)
_productID = ProductID
_productName = ProductName
_productImageUrl = ProductImageUrl
_quantity = Quantity
_price = Price
_lineTotal = Quantity * Price
End Sub
Public Property ProductID() As Integer
Get
Return _productID
End Get
Set(ByVal value As Integer)
_productID = value
End Set
End Property
Public Property ProductName() As String
Get
Return _productName
End Get
Set(ByVal value As String)
_productName = value
End Set
End Property
Public Property ProductImageUrl() As String
Get
Return _productImageUrl
End Get
Set(ByVal value As String)
_productImageUrl = value
End Set
End Property
Public Property Quantity() As Integer
Get
Return _quantity
End Get
Set(ByVal value As Integer)
_quantity = value
End Set
End Property
Public Property Price() As Double
Get
Return _price
End Get
Set(ByVal value As Double)
_price = value
End Set
End Property
Public ReadOnly Property LineTotal() As Double
Get
Return _quantity * _price
End Get
End Property
End Class
[] [] [] [] [] [] [] [] []