Пример #1
0
    /// <summary>
    /// Event is raised when the "Update" Button is clicked.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        AccountService accountService = new AccountService();
        Account _account = UserAccount;
        ZNodeUserAccount _userAccount = new ZNodeUserAccount();

        if (_account.AccountID  == 0)
        {
            _userAccount.PortalID = ZNodeConfigManager.SiteConfig.PortalID;
            _userAccount.BillingAddress = BillingAddress;
            _userAccount.ShippingAddress = ShippingAddress;
            _userAccount.AddUserAccount();

            int accountID = _userAccount.AccountID;
            _account = accountService.GetByAccountID(accountID);

            UserAccount = _account;

            //
            ZNode.Libraries.Admin.ProfileAdmin profileAdmin = new ZNode.Libraries.Admin.ProfileAdmin();

            HttpContext.Current.Session["ProfileCache"] = profileAdmin.GetByProfileID(_account.ProfileID.Value);
        }
        else
        {

            //Billing Address
            _account.BillingFirstName = BillingAddress.FirstName;
            _account.BillingLastName = BillingAddress.LastName;
            _account.BillingCompanyName = BillingAddress.CompanyName;
            _account.BillingStreet = BillingAddress.Street1;
            _account.BillingStreet1 = BillingAddress.Street2;
            _account.BillingCity = BillingAddress.City;
            _account.BillingPostalCode = BillingAddress.PostalCode;
            _account.BillingStateCode = BillingAddress.StateCode;
            _account.BillingCountryCode = BillingAddress.CountryCode;
            _account.BillingEmailID = BillingAddress.EmailId;
            _account.BillingPhoneNumber = BillingAddress.PhoneNumber;

            //Shipping Address
            _account.ShipFirstName = ShippingAddress.FirstName;
            _account.ShipLastName = ShippingAddress.LastName;
            _account.ShipCompanyName = ShippingAddress.CompanyName;
            _account.ShipStreet = ShippingAddress.Street1;
            _account.ShipStreet1 = ShippingAddress.Street2;
            _account.ShipCity = ShippingAddress.City;
            _account.ShipPostalCode = ShippingAddress.PostalCode;
            _account.ShipStateCode = ShippingAddress.StateCode;
            _account.ShipCountryCode = ShippingAddress.CountryCode;
            _account.ShipEmailID = ShippingAddress.EmailId;
            _account.ShipPhoneNumber = ShippingAddress.PhoneNumber;

            //Update account
            accountService.Update(_account);

            //Set account object to cache object
            UserAccount = _account;

            if (_account.UserID.HasValue)
            {
                MembershipUser user = Membership.GetUser(_account.UserID.Value);

                if (user != null)
                {
                    user.Email = _account.BillingEmailID;
                    Membership.UpdateUser(user);
                }
            }
        }

        //Triggers parent control event
        if (ButtonClick != null)
        {
            this.ButtonClick(sender, e);
        }
    }
Пример #2
0
    /// <summary>
    /// This method get data from user controls(payment and shippping info)
    /// </summary>
    /// <param name="_userAccount"></param>
    protected void GetControlData(ZNodeUserAccount _userAccount)
    {
        // Get objects from session
        _checkout = new ZNodeCheckout();

        // Set payment data in checkout object
        _checkout.ShoppingCart.Payment = uxPayment.Payment;
        _checkout.ShoppingCart.Payment.BillingAddress = BillingAddress;
        _checkout.ShoppingCart.Payment.ShippingAddress = ShippingAddress;
        _checkout.UserAccount = new ZNodeUserAccount();
        _checkout.UserAccount.BillingAddress = BillingAddress;
        _checkout.UserAccount.ShippingAddress = ShippingAddress;
        _checkout.PaymentSettingID = uxPayment.PaymentSettingID;
        _checkout.UpdateUserInfo = false;
        _checkout.PurchaseOrderNumber = uxPayment.PurchaseOrderNumber;
        _checkout.AdditionalInstructions = uxPayment.AdditionalInstructions;
        uxPayment.CalculateShipping();
    }