// .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) { Date.Text = DateTime.Now.ToString("f"); string action = Input.InputText(Request["action"],20); if (action =="showtoporders" && Settings.interfaceMode == StockTraderUtility.ACCESS_WebService_WSHttp_WSO2) { NumOrdersShown.Text = AccountOrdersControl.totalOrders.ToString() ; WASLimit.Text = "
WebSphere Trade 6.1 Returns a Maximum of 5 Orders!
"; } else NumOrdersShown.Text = AccountOrdersControl.totalOrders.ToString(); string userid = HttpContext.Current.User.Identity.Name; 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("f"); LoginCount.Text = customer.loginCount.ToString(); OpenBalance.Text = string.Format("{0:C}", customer.openBalance); if (customer.balance > 0) Balance.ForeColor = System.Drawing.Color.Green; else Balance.ForeColor = System.Drawing.Color.Red; Balance.Text = string.Format("{0:C}", customer.balance); TotalLogout.Text = customer.logoutCount.ToString(); LastLogin.Text = customer.lastLogin.ToString("f"); 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"; } } } }