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

namespace FMSWeb
{
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using VBNET=Microsoft.VisualBasic;
using gmRTL.Core;

public class _t_begin_cart
{
   public FMSWeb._t_head _t_head1 = null;
   public FMSWeb._t_begin _t_begin1 = null;

   public void Include_Load(FMSWeb._t_head _t_head_Page, FMSWeb._t_begin _t_begin_Page )
   {
      _t_head1 = _t_head_Page;
      _t_begin1 = _t_begin_Page;
   }
   public FMSStore_Bus.ShoppingCart cart = new FMSStore_Bus.ShoppingCart();
   public void Author_Markup()
   {
      _t_begin1.Author_Markup();
      HttpContext.Current.Response.Write("<table border='0' width='100%'>" + "\n");
      HttpContext.Current.Response.Write("<tr>" + "\n");
      if (HttpContext.Current.Request.ServerVariables["URL"].Right(9) != "store.aspx")
      {
         HttpContext.Current.Response.Write("		<td><a href='store.aspx'>Back to store</a>" + "\n");
         if (HttpContext.Current.Request.ServerVariables["URL"].Right(10) != "browse.aspx")
         {
            HttpContext.Current.Response.Write("			-- <a href='browse.aspx'>all products</a>" + "\n");
         }
      }
      HttpContext.Current.Response.Write("	<td align='RIGHT'>" + "\n");
      ShowShoppingCart();
      HttpContext.Current.Response.Write("	<td width='30'>&nbsp" + "\n");
      HttpContext.Current.Response.Write("</table>" + "\n");
   }
   public void ShowShoppingCart()
   {
      gmRTL.DataLib.SqlClient.Recordset rs = null;
      int quantity = 0;
      if (HttpContext.Current.Request.ServerVariables["URL"].Right(12) == "checkout.aspx")
      {
         HttpContext.Current.Response.Write("		<a title='View your shopping cart' href='cart.aspx'>Back to shopping cart</a>" + "\n");
         return;
      }
      rs = cart.TotalByAccount(_t_head1.g_AccountID.ToInt());
      if (rs.EOF)
      {
         quantity = 0;
      }
      else
      {
         quantity = gmRTL.Core.ConversionHelper.DBNullToValue<int>(rs.Fields["Quantity"].Value);
         if (Convert.IsDBNull(quantity))
         {
            quantity = 0;
         }
      }
      if (quantity == 0)
      {
         HttpContext.Current.Response.Write("	<img src='images/grey_cart.gif' width='22' height='17'> Your shopping cart is empty" + "\n");
      }
      else
      {
         HttpContext.Current.Response.Write("	<img src='images/red_cart.gif' width='22' height='17'>&nbsp<br><a" + "\n");
         HttpContext.Current.Response.Write(" title='View your shopping cart' href='cart.aspx'>You have " + quantity + " item" + "\n");
         if (quantity != 1)
         {
            _t_head1.rw("s");
         }
         HttpContext.Current.Response.Write("			totaling " + gmRTL.Core.FormatHelper.FormatCurrency(rs.Fields["Total"].Value,-1,gmRTL.Core.Enums.TriState.UseDefault,gmRTL.Core.Enums.TriState.UseDefault,gmRTL.Core.Enums.TriState.UseDefault) + "</a>" + "\n");
      }
   }
}
}
