'' asp code Generated by Basic Processor
'' Original Page Name: C:\gmTestBed\FMStocks\src\FMSWeb\ASP\t_begin_cart.asp

Imports System.Web
NameSpace FMSWeb
Public Class _t_begin_cart
   Public _t_head1 As FMSWeb._t_head
   Public _t_begin1 As FMSWeb._t_begin

   Public Sub Include_Load(_t_head_Page As FMSWeb._t_head, _t_begin_Page As FMSWeb._t_begin )

      _t_head1 = _t_head_Page
      _t_begin1 = _t_begin_Page
   End Sub
   Public cart As New FMSStore_Bus.ShoppingCart
   Public Sub Author_Markup()
      _t_begin1.Author_Markup()
      HttpContext.Current.Response.Write("<table border='0' width='100%'>" & vbCrLf)
      HttpContext.Current.Response.Write("<tr>" & vbCrLf)
      If (Strings.Right(HttpContext.Current.Request.ServerVariables("URL"),9) <> "store.aspx") Then
         HttpContext.Current.Response.Write("		<td><a href='store.aspx'>Back to store</a>" & vbCrLf)
         If (Strings.Right(HttpContext.Current.Request.ServerVariables("URL"),10) <> "browse.aspx") Then
            HttpContext.Current.Response.Write("			-- <a href='browse.aspx'>all products</a>" & vbCrLf)
         End If
      End If
      HttpContext.Current.Response.Write("	<td align='RIGHT'>" & vbCrLf)
      ShowShoppingCart()
      HttpContext.Current.Response.Write("	<td width='30'>&nbsp" & vbCrLf)
      HttpContext.Current.Response.Write("</table>" & vbCrLf)
   End Sub
   Public Sub ShowShoppingCart()
      Dim rs As gmRTL.DataLib.SqlClient.Recordset = Nothing
      Dim quantity As Integer = 0
      If (Strings.Right(HttpContext.Current.Request.ServerVariables("URL"),12) = "checkout.aspx") Then
         HttpContext.Current.Response.Write("		<a title='View your shopping cart' href='cart.aspx'>Back to shopping cart</a>" & vbCrLf)
         Exit Sub
      End If
      rs = cart.TotalByAccount(CInt(_t_head1.g_AccountID))
      If (rs.EOF) Then
         quantity = 0
      Else
         quantity = gmRTL.Core.ConversionHelper.DBNullToValue(Of Integer)(rs.Fields("Quantity").Value)
         If (Convert.IsDBNull(quantity)) Then
            quantity = 0
         End If
      End If
      If (quantity = 0) Then
         HttpContext.Current.Response.Write("	<img src='images/grey_cart.gif' width='22' height='17'> Your shopping cart is empty" & vbCrLf)
      Else
         HttpContext.Current.Response.Write("	<img src='images/red_cart.gif' width='22' height='17'>&nbsp<br><a" & vbCrLf)
         HttpContext.Current.Response.Write(" title='View your shopping cart' href='cart.aspx'>You have " & quantity & " item" & vbCrLf)
         If (quantity <> 1) Then
            _t_head1.rw("s")
         End If
         HttpContext.Current.Response.Write("			totaling " & Strings.FormatCurrency(rs.Fields("Total").Value,-1,TriState.UseDefault,TriState.UseDefault,TriState.UseDefault) & "</a>" & vbCrLf)
      End If
   End Sub
End Class
End Namespace
