📄 header.ascx.vb
字号:
Public MustInherit Class header
Inherits System.Web.UI.UserControl
Protected WithEvents lbtnSignInOut As System.Web.UI.WebControls.LinkButton
Protected WithEvents lblItemsCount As System.Web.UI.WebControls.Label
Protected WithEvents lblBasketSubTotal As System.Web.UI.WebControls.Label
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
'实例化一个新的购物车
Private myCart As New StoreCommon.Services.ShoppingCart()
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
'更新购物车中的总数
UpdateBasketSummary()
End Sub
Protected Sub lnkLoginLogout_Click(ByVal Sender As System.Object, _
ByVal e As System.EventArgs)
'将页面重新设置到首页
Response.Redirect("/Store/login.aspx")
End Sub
Public Sub UpdateBasketSummary()
'获取当前购物车的消费客户的名称
Dim strCartID As String = myCart.GetCartID
'获取当前购物车中的商品总数
Dim Count As Integer = myCart.ItemsCount(strCartID)
Dim SubTotal As Double
'获取全部商品的实际价格之和
SubTotal = CDbl(myCart.SubTotal(strCartID).ToString)
'实例化其他费用
Dim TaxTotal As Double = Count * 4.99
Dim ShippingTotal As Double = Count * 8.99
Dim GrandTotal As Double = SubTotal + ShippingTotal + TaxTotal
'在购物车的信息中显示商品数量和消费总额
Me.lblItemsCount.Text = Count
Me.lblBasketSubTotal.Text = String.Format("{0:C}", GrandTotal)
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -