Ejemplo n.º 1
0
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        var addressObj = EditedObject as AddressInfo;

        // Object is created
        if (addressObj == null)
        {
            EditForm.OnAfterDataLoad += EditForm_OnAfterDataLoad;
        }

        // Check customer and his site binding
        var customer = EditedObjectParent as CustomerInfo;

        if ((customer == null) || (!ECommerceContext.CheckCustomerSiteID(customer)) ||
            ((addressObj != null) && (addressObj.AddressCustomerID != customer.CustomerID)))
        {
            EditedObject = null;
        }

        EditForm.OnBeforeSave       += EditForm_OnBeforeSave;
        EditForm.OnItemValidation   += EditForm_OnItemValidation;
        EditForm.OnCheckPermissions += EditForm_OnCheckPermissions;
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        Save += btnOK_Click;

        CustomerID = QueryHelper.GetInteger("customerId", 0);
        AddressSelectorClientID = QueryHelper.GetString("selectorid", string.Empty);

        // Register check permissions
        EditForm.OnCheckPermissions += EditForm_OnCheckPermissions;

        // Before save event
        EditForm.OnBeforeSave += EditForm_OnBeforeSave;

        // On item validation event
        EditForm.OnItemValidation += EditForm_OnItemValidation;

        // Check edited objects site id
        CustomerInfo customerInfo = EditedObjectParent as CustomerInfo;

        if (customerInfo != null)
        {
            if (!ECommerceContext.CheckCustomerSiteID(customerInfo))
            {
                EditedObject = null;
            }
        }

        // Check 'EcommerceRead' permission
        if (!ECommerceContext.IsUserAuthorizedForPermission("ReadCustomers"))
        {
            RedirectToAccessDenied("CMS.Ecommerce", "EcommerceRead OR ReadCustomers");
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!ECommerceContext.CheckCustomerSiteID(Customer))
        {
            EditedObject = null;
            return;
        }

        // Show info/error message after redirect.
        if (!RequestHelper.IsPostBack() && QueryHelper.GetBoolean("saved", false))
        {
            if (QueryHelper.GetBoolean("error", false))
            {
                ShowConfirmation(GetString("com.customer.logincreated"));
                ShowError(GetString("com.customer.notificationemailnotsent"));
            }
            else
            {
                ShowConfirmation(GetString("com.customer.logincreated") + " " + GetString("com.customer.notificationsent"));
            }
        }

        if (Customer.CustomerIsRegistered)
        {
            passStrength.PlaceholderText = "mem.general.changepassword";

            txtUserName.Text = HTMLHelper.HTMLEncode(Functions.GetFormattedUserName(Customer.CustomerUser.UserName));

            HeaderActions.AddHeaderAction(new SaveAction());
            HeaderActions.AddHeaderAction(new HeaderAction
            {
                Text          = GetString("com.customer.generatepassword"),
                CommandName   = "generate",
                ButtonStyle   = ButtonStyle.Default,
                OnClientClick = "return confirm(" + ScriptHelper.GetLocalizedString("com.customer.passwordchange") + ");"
            });
        }
        else
        {
            txtUserName.Text    = Customer.CustomerEmail;
            pnlPassword.Visible = false;
            lblRegistrationNotification.ResourceString = GetString("com.customer.registrednotificationgenerate");

            HeaderActions.AddHeaderAction(new HeaderAction
            {
                Text        = GetString("com.customer.createlogin"),
                CommandName = "create"
            });
        }

        HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!ECommerceContext.CheckCustomerSiteID(Customer))
        {
            EditedObject = null;
            return;
        }

        // Show info/error message after redirect.
        if (!RequestHelper.IsPostBack() && QueryHelper.GetBoolean("saved", false))
        {
            if (QueryHelper.GetBoolean("error", false))
            {
                ShowConfirmation(GetString("com.customer.logincreated"));
                ShowError(GetString("com.customer.notificationemailnotsent"));
            }
            else
            {
                ShowConfirmation(GetString("com.customer.logincreated") + " " + GetString("com.customer.notificationsent"));
            }
        }

        if (Customer.CustomerIsRegistered)
        {
            // Fill password text boxes with password hidden value
            passStrength.TextBoxAttributes.Add("value", HIDDEN_PASSWORD);
            txtPassword2.Attributes.Add("value", HIDDEN_PASSWORD);

            txtUserName.Text = Customer.CustomerUser.UserName;

            HeaderActions.AddHeaderAction(new SaveAction(PageHelper.CurrentPage));
            HeaderActions.AddHeaderAction(new HeaderAction
            {
                Text          = GetString("com.customer.generatepassword"),
                CommandName   = "generate",
                ButtonStyle   = ButtonStyle.Default,
                OnClientClick = "return confirm(" + ScriptHelper.GetLocalizedString("com.customer.passwordchange") + ");"
            });
        }
        else
        {
            txtUserName.Text = Customer.CustomerEmail;

            HeaderActions.AddHeaderAction(new HeaderAction
            {
                Text        = GetString("com.customer.createlogin"),
                CommandName = "create"
            });
        }

        HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
    }
Ejemplo n.º 5
0
    protected override void OnPreInit(EventArgs e)
    {
        customerId = QueryHelper.GetInteger("customerid", 0);

        if (customerId > 0)
        {
            if (!ECommerceContext.CheckCustomerSiteID(CustomerInfoProvider.GetCustomerInfo(customerId)))
            {
                customerId = 0;
            }
        }
        base.OnPreInit(e);
    }