// // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // .NET StockTrader Sample WCF Application for Benchmarking, Performance Analysis and Design Considerations for Service-Oriented Applications using System; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using Trade.StockTraderWebApplicationSettings; using Trade.StockTraderWebApplicationModelClasses; using Trade.StockTraderWebApplicationServiceClient; using Trade.Utility; namespace Trade.Web { /// /// Displays the Account Summary information by querying Business Services. /// public partial class Account : System.Web.UI.Page { BSLClient businessServicesClient = new BSLClient(); // protected override void OnPreRender(EventArgs e) { string userid = HttpContext.Current.User.Identity.Name; string action = Request.QueryString["action"] ?? string.Empty; if (action.Equals("showtoporders", StringComparison.InvariantCultureIgnoreCase) && (Settings.interfaceMode == StockTraderUtility.ACCESS_PHP_Http_WebService || Settings.interfaceMode == StockTraderUtility.ACCESS_WSAS_Http_WebService)) { NumOrdersShown.Text = AccountOrdersControl.totalOrders.ToString(); WASLimit.Text = "
WebSphere Trade 6.1 Returns a Maximum of 5 Orders!
"; } else NumOrdersShown.Text = AccountOrdersControl.totalOrders.ToString(); if (AccountOrdersControl.ordersRequested==Settings.MAX_DISPLAY_ORDERS) orderLink.Text = "Show Top " + Settings.MAX_DISPLAY_TOP_ORDERS.ToString() + " Orders"; else orderLink.Text = "Show Top " + Settings.MAX_DISPLAY_ORDERS.ToString() + " Orders "; AccountDataUI customer = null; AccountProfileDataUI customerprofile = businessServicesClient.getAccountProfileData(userid); if (IsPostBack) { submitData(customerprofile); } else UpdateMessage.Text = UpdateMessage.Text + customerprofile.userID; customer = businessServicesClient.getAccountData(userid); Name.Text = customer.profileID; AccountID.Text = customer.accountID.ToString(); CreationDate.Text = customer.creationDate.ToString("g"); LoginCount.Text = customer.loginCount.ToString(); OpenBalance.Text = string.Format("{0:C}", customer.openBalance); if (customer.balance > 0) Balance.CssClass = Settings.GAINSTYLECSS; else Balance.CssClass = Settings.LOSSSTYLECSS; Balance.Text = string.Format("{0:C}", customer.balance); TotalLogout.Text = customer.logoutCount.ToString(); LastLogin.Text = customer.lastLogin.ToString("g"); Password.Attributes.Add("value", customerprofile.password); ConfirmPassword.Attributes.Add("value", customerprofile.password); Email.Text = customerprofile.email; FullName.Text = customerprofile.fullName; Address.Text = customerprofile.address; CreditCard.Text = customerprofile.creditCard; } private void submitData(AccountProfileDataUI customerprofile) { Page.Validate(); if (Page.IsValid) { customerprofile.address = Input.InputText(Address.Text, StockTraderUtility.ADDRESS_MAX_LENGTH); customerprofile.creditCard = Input.InputText(CreditCard.Text, StockTraderUtility.CREDITCARD_MAX_LENGTH); customerprofile.email = Input.InputText(Email.Text, StockTraderUtility.EMAIL_MAX_LENGTH); customerprofile.fullName = Input.InputText(FullName.Text, StockTraderUtility.FULLNAME_MAX_LENGTH); customerprofile.password = Input.InputText(Password.Text, StockTraderUtility.PASSWORD_MAX_LENGTH); businessServicesClient.updateAccountProfile(customerprofile); UpdateMessage.Text = "Account Updated"; } } } }