protected override void OnLoad(EventArgs e)
 {
     //Thread.Sleep(10000);
     string userid = HttpContext.Current.User.Identity.Name;
     if (userid != null)
     {
         string action = Request["action"];
         if (!(Request["action"] == null) && !Input.InputText(Request["action"], StockTraderUtility.EXPRESSION_NAME_13))
         {
             FormsAuthentication.SignOut();
             Response.Redirect(Settings.PAGE_LOGIN, true);
         }
         else
         {
             BSLClient businessServicesClient = new BSLClient();
             if (action == "showtoporders" && (Settings.ACCESS_MODE != StockTraderUtility.BSL_SOAP))
             {
                 ordersRequested = Settings.MAX_DISPLAY_TOP_ORDERS;
                 orderData = businessServicesClient.getTopOrders(userid);
             }
             else
             {
                 ordersRequested = Settings.MAX_DISPLAY_ORDERS;
                 orderData = businessServicesClient.getOrders(userid);
             }
             if (orderData.orders.Count != 0)
             {
                 AccountOrdersRepeater.DataSource = orderData.orders;
                 AccountOrdersRepeater.DataBind();
             }
             totalOrders = orderData.orders.Count;
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Gets specific top n orders for a user.  Transforms data from DataContract to model UI class for HTML display.
 /// </summary>
 /// <param name="userID">User id to retrieve data for.</param>
 public TotalOrdersUI getTopOrders(string userID)
 {
     try
     {
         List<OrderDataModel> orders = BSL.getTopOrders(userID);
         List<OrderDataUI> ordersUI = new List<OrderDataUI>();
         decimal subtotalSell = 0;
         decimal subtotalBuy = 0;
         decimal subtotalTxnFee = 0;
         for (int i = 0; i < orders.Count; i++)
         {
             subtotalTxnFee += orders[i].orderFee;
             if (orders[i].orderType == StockTraderUtility.ORDER_TYPE_SELL)
             {
                 subtotalSell += orders[i].price * (decimal)orders[i].quantity - orders[i].orderFee;
             }
             else
             {
                 subtotalBuy += orders[i].price * (decimal)orders[i].quantity + orders[i].orderFee;
             }
             ordersUI.Add((convertOrderToUI(orders[i])));
         }
         TotalOrdersUI totalOrders = new TotalOrdersUI(ordersUI, subtotalSell, subtotalBuy, subtotalTxnFee);
         return totalOrders;
     }
     catch (Exception e)
     {
         ConfigUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getTopOrders Error: " + e.ToString(), EventLogEntryType.Error, true, new Settings());
         throw;
     }
 }