Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Page.Form.DefaultFocus = FullName.ClientID;
     if (!(Request["action"] == null) && !Input.InputText(Request["action"], StockTraderUtility.EXPRESSION_NAME_13))
         logout();
     userid = HttpContext.Current.User.Identity.Name;
     
     if (userid == null)
         logout();
     action = Request["action"];
     if (!IsPostBack)
     {
         // Create the delegate.
         caller1 = new GetCustomerProfileAsync(GetCustomerProfile);
         // Initiate the asychronous call.
         result1 = caller1.BeginInvoke(null,null);
         // Repeat
         caller2 = new GetCustomerAsync(GetCustomer);
         // Initiate the asychronous call.
         result2 = caller2.BeginInvoke(null, null);
     }
     else
     {
         customerprofile = (AccountProfileDataUI)ViewState["custprofile"];
         customer = (AccountDataUI)ViewState["cust"];
     }
 }
Пример #2
0
 protected void Page_PreRenderComplete(object sender, EventArgs e)
 {
     totalHoldings = caller1.EndInvoke(result1);
     customer = caller2.EndInvoke(result2);
     decimal gain = (decimal)0.00;
     decimal percentGain = (decimal)0.00;
     Name.Text = customer.profileID + "!";
     AccountID.Text = customer.accountID.ToString();
     CreationDate.Text = customer.creationDate.ToString();
     LoginCount.Text = customer.loginCount.ToString();
     OpenBalance.Text = string.Format("{0:C}", customer.openBalance);
     Balance.Text = string.Format("{0:C}", customer.balance);
     NumHoldings.Text = totalHoldings.holdings.Count.ToString();
     HoldingsTotal.Text = string.Format("{0:C}", totalHoldings.marketValue);
     decimal totalcashandholdings = totalHoldings.marketValue + customer.balance;
     SumOfCashHoldings.Text = string.Format("{0:C}", totalcashandholdings);
     gain = totalcashandholdings - customer.openBalance;
     string percentGainString = "";
     if (customer.openBalance != 0)
         percentGain = gain / customer.openBalance * 100;
     else
         percentGain = 0;
     if (gain > 0)
     {
         percentGainString = string.Format("{0:N}%" + Settings.UPARROWLINK, percentGain);
         Gain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#43A12B");
         PercentGain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#43A12B");
     }
     else
         if (gain < 0)
         {
             percentGainString = string.Format("{0:N}%" + Settings.DOWNARROWLINK, percentGain);
             Gain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#A40707");
             PercentGain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#A40707");
         }
         else
         {
             percentGainString = string.Format("{0:N}%", percentGain);
         }
     Gain.Text = string.Format("{0:C}", gain);
     PercentGain.Text = percentGainString;
 }
Пример #3
0
 /// <summary>
 /// Converts from service data contract model class to a UI Model class for quick HTML display in ASPX pages.
 /// </summary>
 private AccountDataModel convertAccountDataFromUI(AccountDataUI customer)
 {
     AccountDataModel serviceLayerCustomer = new AccountDataModel();
     serviceLayerCustomer.accountID = (int)customer.accountID;
     serviceLayerCustomer.balance = customer.balance;
     serviceLayerCustomer.creationDate = customer.creationDate;
     serviceLayerCustomer.lastLogin = customer.lastLogin;
     serviceLayerCustomer.logoutCount = customer.logoutCount;
     serviceLayerCustomer.openBalance = customer.openBalance;
     serviceLayerCustomer.profileID = customer.profileID;
     return serviceLayerCustomer;
 }
Пример #4
0
        protected void Page_PreRenderComplete(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // Call EndInvoke to wait for the asynchronous calls to complete
                customerprofile = caller1.EndInvoke(result1);
                customer = caller2.EndInvoke(result2);
                ViewState["custprofile"] = customerprofile;
                ViewState["cust"] = customer;
                UpdateMessage.Text = "Account: " + customerprofile.userID;
            }
            if (action == "showtoporders" && (Settings.ACCESS_MODE == StockTraderUtility.BSL_SOAP))
            {
                NumOrdersShown.Text = AccountOrdersControl.totalOrders.ToString();
                WASLimit.Text = "<div style=\"font-size:8pt;color:#A40707\">WebSphere and Oracle Implementations Return a Maximum of 5 Orders!</div>";
            }
            else
                NumOrdersShown.Text = AccountOrdersControl.totalOrders.ToString();

            if (AccountOrdersControl.ordersRequested == Settings.MAX_DISPLAY_ORDERS)
            {
                orderLink.Text = "Show Top <b>" + Settings.MAX_DISPLAY_TOP_ORDERS.ToString() + "</b> Orders";
                orderLink.PostBackUrl = Settings.PAGE_ACCOUNT + "?action=showtoporders";
            }
            else
            {
                orderLink.Text = "Show Top <b>" + Settings.MAX_DISPLAY_ORDERS.ToString() + "</b> Orders";
                orderLink.PostBackUrl = Settings.PAGE_ACCOUNT;
            }

            Name.Text = customer.profileID;
            AccountID.Text = customer.accountID.ToString();
            CreationDate.Text = customer.creationDate.ToString("f");
            LoginCount.Text = customer.loginCount.ToString();
            OpenBalance.Text = string.Format("{0:C}", customer.openBalance);
            if (customer.balance > 0)
                Balance.ForeColor = System.Drawing.ColorTranslator.FromHtml("#43A12B");
            else
                Balance.ForeColor = System.Drawing.ColorTranslator.FromHtml("#A40707");
            Balance.Text = string.Format("{0:C}", customer.balance);
            TotalLogout.Text = customer.logoutCount.ToString();
            LastLogin.Text = customer.lastLogin.ToString("f");
            Email.Text = customerprofile.email;
            FullName.Text = customerprofile.fullName;
            Address.Text = customerprofile.address;
            CreditCard.Text = customerprofile.creditCard;
        }
Пример #5
0
 protected void UpdateButton_Click(object sender, EventArgs e)
 {
     string userid = HttpContext.Current.User.Identity.Name;
     if (userid == null)
         logout();
     customerprofile = (AccountProfileDataUI)ViewState["custprofile"];
     customer = (AccountDataUI)ViewState["cust"];
     submitData(customerprofile);
 }