// asp code Generated by Basic Processor
// Original Page Name: C:\gmTestBed\FMStocks\src\FMSWeb\ASP\SellStock.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 partial class _SellStock : System.Web.UI.Page
{
   public FMSWeb._t_head _t_head1 = null;
   public FMSWeb._t_begin _t_begin1 = null;
   public FMSWeb._t_end _t_end1 = null;

   protected void Page_Load(object sender, EventArgs e)
   {
      _t_head1 = new FMSWeb._t_head();
      _t_begin1 = new FMSWeb._t_begin();
      _t_end1 = new FMSWeb._t_end();
      _t_begin1.Include_Load(_t_head1);
      _t_end1.Include_Load(_t_head1);
   }
   private FMStocks_Bus.Account obj = new FMStocks_Bus.Account();
   public string MainPrompt = "";
   public void EmitSellList()
   {
      gmRTL.Core.ErrorHandling.ResumeNext(() =>
      {
         gmRTL.DataLib.SqlClient.Recordset rs = null;
         int i = 0;
         if (gmRTL.Core.GlobalException.Instance.Number != 0)
         {
            HttpContext.Current.Response.Write("<span class=error>" + FMSWeb._strings.CREATE_OBJECT_FAILED + "</span>");
            _t_head1.BuildErrorMessage();
            return;
         }
         rs = obj.ListPositionsForSale(_t_head1.g_AccountID.ToInt());
         if (gmRTL.Core.GlobalException.Instance.Number != 0)
         {
            HttpContext.Current.Response.Write("<span class=error>" + FMSWeb._strings.DATABASE_ERROR + "</span>");
            _t_head1.BuildErrorMessage();
            return;
         }
         if (!(rs == null))
         {
            if (!rs.EOF)
            {
                    //  don't emit the table header if there are no rows
               HttpContext.Current.Response.Write("<table cellpadding='2' cellspacing='2' bordercolor='Gray' bgcolor='White' border='2' cols='2' rules='ALL'>" + "\n");
               HttpContext.Current.Response.Write("<tr><td class='ColumnHeader' width='120'>Ticker" + "\n");
               HttpContext.Current.Response.Write("	<td class='ColumnHeader' align='Right' width='80'>Total Shares" + "\n");
               HttpContext.Current.Response.Write("	<td class='ColumnHeader' align='Right' width='80'>Current Price" + "\n");
               HttpContext.Current.Response.Write("</tr>" + "\n");
            }
            i = 0;
            while (!(rs.EOF))
            {
               i = i + 1;
               HttpContext.Current.Response.Write("<tr>" + "\n");
               HttpContext.Current.Response.Write("	<td>" + "\n");
               HttpContext.Current.Response.Write("		<span style='cursor:hand'>" + "\n");
               HttpContext.Current.Response.Write("		<input onclick='ticker_click()' type='radio' value='" + rs.Fields["ticker"].Value + "' id='" + "symbol" + i + "' name='symbol'>" + "\n");
               HttpContext.Current.Response.Write("		<label for='" + "symbol" + i + "'>" + "\n");
               HttpContext.Current.Response.Write("		" + rs.Fields["ticker"].Value);
               HttpContext.Current.Response.Write("		</label>" + "\n");
               HttpContext.Current.Response.Write("		</span>" + "\n");
               HttpContext.Current.Response.Write("	<td align='right'>" + rs.Fields["shares"].Value);
               HttpContext.Current.Response.Write("	<td align='right'>$" + rs.Fields["price"].Value);
               HttpContext.Current.Response.Write("</tr>" + "\n");
               rs.MoveNext();
            }
            rs.Close();
         }
         rs = null;
         HttpContext.Current.Response.Write("</table>" + "\n");
      });
   }
}
}
