<%--
   asp code Generated by Basic Processor
   Original Page Name: C:\gmTestBed\FMStocks\src\FMSWeb\ASP\SellStockAction.asp
--%>

<%@ Page language="C#" explicit="true" CodeBehind="SellStockAction.aspx.cs" Inherits="FMSWeb._SellStockAction" %>

<%
   HttpContext.Current.Response.Buffer = true;
%>

<html>
<head>
<% _t_head1.Author_Markup(); %>

	<title>Sell Receipt</title>
</head>
<body>
<% _t_begin1.Author_Markup(); %>

<p class="section">Sell Receipt</p><br>
<%
   gmRTL.Core.ErrorHandling.ResumeNext(() =>
   {
      shares = (HttpContext.Current.Request["shares"].TrimB()).ToInt();
      ticker = HttpContext.Current.Request["symbol"].TrimB();
      TxID = objBroker.SellStock(_t_head1.g_AccountID.ToInt(),ticker,shares);
      if (TxID == 0)
      {
         MainPrompt = "You tried to sell more shares than you own.";
      }
      else if (gmRTL.Core.GlobalException.Instance.Number != 0)
      {
         MainPrompt = FMSWeb._strings.SELLSTOCK_FAILED;
         _t_head1.BuildErrorMessage();
         TxID = 0;
      }
      if (TxID > 0)
      {
      %>
      <p><b>Order summary</b><br>
      Symbol: <%=ticker%><br>
      Shares: <%=shares%><br>
      </p>
      <p>Your order number is <%=TxID%>.</p>
      <%
      }
      else
      {
      %>
      <p>Unable to place order.</p>
      <p><%=MainPrompt%></p>
      <%
      }
   });
%>
<p><a href="SellStock.aspx">Sell another stock.</a></p>
<p><a href="Portfolio.aspx">View portfolio.</a></p>
<% _t_end1.Author_Markup(); %>

</body>
</html>
