private void LoadCurrentUser()
 {
     UserIdField.Value        = CurrentOrder.UserID;
     EmailAddressTextBox.Text = CurrentOrder.UserEmail;
     BillToAddress.LoadFromAddress(CurrentOrder.BillingAddress);
     ShipToAddress.LoadFromAddress(CurrentOrder.ShippingAddress);
 }
        private void SaveInfoToOrder(bool savePaymentData)
        {
            if (chkBillToSame.Checked)
            {
                BillToAddress.LoadFromAddress(ShipToAddress.GetAsAddress());
            }

            // Save Information to Cart in Case Save as Order Fails
            CurrentOrder.BillingAddress  = BillToAddress.GetAsAddress();
            CurrentOrder.ShippingAddress = ShipToAddress.GetAsAddress();
            TagOrderWithUser();

            CurrentOrder.UserEmail    = EmailAddressTextBox.Text;
            CurrentOrder.Instructions = txtInstructions.Text.Trim();

            // Save Shipping Selection
            var r = FindSelectedRate(ShippingRatesList.SelectedValue, CurrentOrder);

            if (r != null)
            {
                HccApp.OrderServices.OrdersRequestShippingMethodByUniqueKey(r.UniqueKey, CurrentOrder);
            }

            if (savePaymentData)
            {
                // Save Payment Information
                SavePaymentInfo();
            }

            HccApp.CalculateOrderAndSave(CurrentOrder);
        }
 protected void chkBillToSame_CheckedChanged(object sender, EventArgs e)
 {
     if (chkBillToSame.Checked)
     {
         BillToAddress.LoadFromAddress(ShipToAddress.GetAsAddress());
         pnlBillTo.Visible = false;
     }
     else
     {
         pnlBillTo.Visible = true;
     }
     LoadShippingMethods();
 }
        protected void UserSelected(UserSelectedEventArgs args)
        {
            if (args.UserAccount == null)
            {
                return;
            }

            UserIdField.Value = args.UserAccount.Bvin;

            CurrentOrder.UserID = args.UserAccount.Bvin;

            HccApp.OrderServices.Orders.Update(CurrentOrder);

            BillToAddress.LoadFromAddress(args.UserAccount.BillingAddress);
            ShipToAddress.LoadFromAddress(args.UserAccount.ShippingAddress);
            if (BillToAddress.FirstName == string.Empty)
            {
                BillToAddress.FirstName = args.UserAccount.FirstName;
            }
            if (BillToAddress.LastName == string.Empty)
            {
                BillToAddress.LastName = args.UserAccount.LastName;
            }
            if (ShipToAddress.FirstName == string.Empty)
            {
                ShipToAddress.FirstName = args.UserAccount.FirstName;
            }
            if (ShipToAddress.LastName == string.Empty)
            {
                ShipToAddress.LastName = args.UserAccount.LastName;
            }

            EmailAddressTextBox.Text = args.UserAccount.Email;


            LoadShippingMethods();

            CurrentOrder.UserEmail       = EmailAddressTextBox.Text;
            CurrentOrder.BillingAddress  = BillToAddress.GetAsAddress();
            CurrentOrder.ShippingAddress = ShipToAddress.GetAsAddress();
            HccApp.OrderServices.Orders.Update(CurrentOrder);
        }