Imports Nozama.BusinessLogic
Imports Nozama.DataAccess
Imports Nozama.General
Public Class Order
Inherits System.Web.UI.Page
Protected WithEvents lblCustomerName As System.Web.UI.WebControls.Label
Protected WithEvents lblAddress As System.Web.UI.WebControls.Label
Protected WithEvents lblCreditCardNumber As System.Web.UI.WebControls.Label
Protected WithEvents lblTotal As System.Web.UI.WebControls.Label
Protected WithEvents grdOrderDetail As System.Web.UI.WebControls.DataGrid
Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink
Protected WithEvents lblOrderDate As System.Web.UI.WebControls.Label
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
Dim orderDetail As DataTable
Dim cart As Cart = GetShoppingCart()
orderDetail = cart.OrderDetail
grdOrderDetail.DataSource = orderDetail
grdOrderDetail.DataBind()
Dim order As OrderData = GetShoppingCart().Order
With order.Tables(OrderData.ORDERS_TABLE).Rows(0)
lblCustomerName.Text = .Item(OrderData.CUSTOMER_NAME)
lblAddress.Text = .Item(OrderData.ADDRESS)
lblOrderDate.Text = .Item(OrderData.ORDER_DATE)
lblTotal.Text = .Item(OrderData.TOTAL_PRICE)
lblCreditCardNumber.Text = .Item(OrderData.CREDIT_CARD_NUMBER)
End With
Dim blOrder As New OrderLogic()
blOrder.AddOrder(order)
cart.ClearOrder()
End Sub
Private Function GetShoppingCart() As Cart
Dim cart As Cart = CType(Session().Item(Settings.ShoppingCart), Cart)
If cart Is Nothing Then
cart = New Cart()
Session().Item(Settings.ShoppingCart) = cart
End If
Return cart
End Function
End Class