Example #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"];
     }
 }
Example #2
0
 /// <summary>
 /// Converts from service data contract model class to a UI Model class for quick HTML display in ASPX pages.
 /// </summary>
 private AccountProfileDataModel convertCustProfileFromUI(AccountProfileDataUI customerprofile)
 {
     AccountProfileDataModel serviceLayerCustomerProfile = new AccountProfileDataModel();
     serviceLayerCustomerProfile.password = customerprofile.password;
     serviceLayerCustomerProfile.address = customerprofile.address;
     serviceLayerCustomerProfile.creditCard = customerprofile.creditCard;
     serviceLayerCustomerProfile.email = customerprofile.email;
     serviceLayerCustomerProfile.fullName = customerprofile.fullName;
     serviceLayerCustomerProfile.userID = customerprofile.userID;
     return serviceLayerCustomerProfile;
 }
Example #3
0
 /// <summary>
 /// Updates account profile data for a user. 
 /// </summary>
 /// <param name="customerprofile">Profile data model class with updated info.</param>
 public AccountProfileDataUI updateAccountProfile(AccountProfileDataUI customerprofile)
 {
     try
     {
         AccountProfileDataModel serviceLayerCustomerProfile = convertCustProfileFromUI(customerprofile);
         serviceLayerCustomerProfile = BSL.updateAccountProfile(serviceLayerCustomerProfile);
         return new AccountProfileDataUI(serviceLayerCustomerProfile.userID, serviceLayerCustomerProfile.password, serviceLayerCustomerProfile.fullName, serviceLayerCustomerProfile.address, serviceLayerCustomerProfile.email, serviceLayerCustomerProfile.creditCard);
     }
     catch (Exception e)
     {
         ConfigUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.updateAccountProfile Error: " + e.ToString(), EventLogEntryType.Error, true, new Settings());
         throw;
     }
 }
Example #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;
        }
Example #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);
 }
Example #6
0
        private void submitData(AccountProfileDataUI customerprofile)
        {
            if (userid.ToLower().Equals("demouser"))
            {
                UpdateMessage.Text = "Demouser cannot be changed.";
                return;
            }
            Page.Validate();
            if (Page.IsValid)
            {

                customerprofile.address = Address.Text;
                customerprofile.creditCard = CreditCard.Text;
                customerprofile.email = Email.Text;
                customerprofile.fullName = FullName.Text;
                customerprofile.password = Password.Text;
                BSLClient businessServicesClient = new BSLClient();
                customerprofile = businessServicesClient.updateAccountProfile(customerprofile);
                ViewState["custprofile"] = customerprofile;
                UpdateMessage.Text = "Account Updated";
            }
        }