private bool HandleAutoRegistration(ShoppingCartInfo currentShoppingCart)
    {
        registrationBanned = string.Empty;
        var customer = currentShoppingCart.Customer;

        if ((customer == null) || customer.CustomerIsRegistered)
        {
            return(true);
        }

        if (ECommerceSettings.AutomaticCustomerRegistration(currentShoppingCart.ShoppingCartSiteID) || currentShoppingCart.RegisterAfterCheckout)
        {
            // Ban IP addresses which are blocked for registration
            var registrationBan  = !BannedIPInfoProvider.IsAllowed(currentShoppingCart.SiteName, BanControlEnum.Registration);
            var allUserActionBan = !BannedIPInfoProvider.IsAllowed(currentShoppingCart.SiteName, BanControlEnum.AllNonComplete);

            if (registrationBan || allUserActionBan)
            {
                registrationBanned = GetString("banip.ipisbannedregistration");
                LogError(registrationBanned, EVENT_CODE_VALIDATION);
                return(false);
            }
            // Auto-register user and send mail notification
            CustomerInfoProvider.RegisterAndNotify(customer, currentShoppingCart.RegisterAfterCheckoutTemplate);
        }

        return(true);
    }
    /// <summary>
    /// Sets up the control.
    /// </summary>
    public void SetupControl()
    {
        if (StopProcessing)
        {
            return;
        }

        // Do not use webpart settings if e-commerce setting AutomaticCustomerRegistration is true
        if (ECommerceSettings.AutomaticCustomerRegistration(SiteContext.CurrentSiteID))
        {
            // Show error message only on Page and Design tabs
            if ((PortalContext.ViewMode == ViewModeEnum.Design) || (PortalContext.ViewMode == ViewModeEnum.Edit))
            {
                pnlCheckBox.Visible = false;
                pnlError.Visible    = true;
                lblError.Text       = GetString("com.checkout.registeraftercheckouterror");
            }
            else
            {
                IsVisible = false;
            }
        }
        else if (CurrentUser.IsPublic())
        {
            // Show the control
            chkRegister.Text    = GetStringValue("Text", "");
            chkRegister.Checked = ValidationHelper.GetBoolean(GetValue("Checked"), false);

            // Use webpart settings, not e-commerce settings
            useWebpartSettings = true;
        }
        else
        {
            IsVisible = false;
        }
    }