Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Init header actions
        HeaderActions actions = CurrentMaster.HeaderActions;

        actions.ActionPerformed += HeaderActions_ActionPerformed;

        string newElementName;

        if (IsMultiStoreConfiguration)
        {
            newElementName = "new.configuration.globaltaxclass";
            CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "Tools.Ecommerce.TaxClasses");
        }
        else
        {
            newElementName = "new.configuration.taxclass";
            CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "Configuration.TaxClasses");
        }

        // Prepare the new tax class header element
        actions.ActionsList.Add(new HeaderAction
        {
            Text        = GetString("TaxClass_List.NewItemCaption"),
            RedirectUrl = GetRedirectURL(newElementName),
        });

        // Show copy from global link when not configuring global tax classes
        if (ConfiguredSiteID != 0)
        {
            // Show "Copy from global" link only if there is at least one global tax class
            DataSet ds = TaxClassInfoProvider.GetTaxClasses().TopN(1).OnSite(0).Column("TaxClassID");
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                actions.ActionsList.Add(new HeaderAction
                {
                    Text          = GetString("general.copyfromglobal"),
                    OnClientClick = "return ConfirmCopyFromGlobal();",
                    CommandName   = "copyFromGlobal",
                    ButtonStyle   = ButtonStyle.Default
                });

                // Register javascript to confirm action
                string script = "function ConfirmCopyFromGlobal() {return confirm(" + ScriptHelper.GetString(GetString("com.ConfirmTaxClassFromGlobal")) + ");}";
                ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ConfirmCopyFromGlobal", ScriptHelper.GetScript(script));
            }
        }

        // Show information about usage of global objects when used on site
        HandleGlobalObjectInformation(UniGrid.ObjectType);

        // Filter records by site
        UniGrid.WhereCondition = "ISNULL(TaxClassSiteID, 0) = " + ConfiguredSiteID;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Init header actions
        HeaderActions actions = CurrentMaster.HeaderActions;

        actions.ActionPerformed += new CommandEventHandler(HeaderActions_ActionPerformed);

        // Prepare the new tax class header element
        actions.ActionsList.Add(new HeaderAction()
        {
            Text        = GetString("TaxClass_List.NewItemCaption"),
            RedirectUrl = ResolveUrl("TaxClass_New.aspx?siteId=" + SiteID),
            ImageUrl    = GetImageUrl("Objects/Ecommerce_TaxClass/add.png"),
            ControlType = HeaderActionTypeEnum.Hyperlink
        });

        // Show copy from global link when not configuring global tax classes
        if (ConfiguredSiteID != 0)
        {
            // Show "Copy from global" link only if there is at least one global tax class
            DataSet ds = TaxClassInfoProvider.GetTaxClasses("TaxClassSiteID IS NULL", null, 1, "TaxClassID");
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                actions.ActionsList.Add(new HeaderAction()
                {
                    Text          = GetString("general.copyfromglobal"),
                    OnClientClick = "return ConfirmCopyFromGlobal();",
                    ImageUrl      = GetImageUrl("Objects/Ecommerce_TaxClass/fromglobal.png"),
                    CommandName   = "copyFromGlobal",
                    ControlType   = HeaderActionTypeEnum.LinkButton
                });

                // Register javascript to confirm action
                string script = "function ConfirmCopyFromGlobal() {return confirm(" + ScriptHelper.GetString(GetString("com.ConfirmTaxClassFromGlobal")) + ");}";
                ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ConfirmCopyFromGlobal", ScriptHelper.GetScript(script));
            }
        }

        UniGrid.OnAction    += new OnActionEventHandler(uniGrid_OnAction);
        UniGrid.ZeroRowsText = GetString("general.nodatafound");

        // Configuring global records from specific site
        if ((ConfiguredSiteID == 0) && (SiteID != 0))
        {
            ShowInformation(GetString("com.UsingGlobalSettings"));
        }

        // Filter records by site
        UniGrid.WhereCondition = "ISNULL(TaxClassSiteID, 0) = " + ConfiguredSiteID;
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.CurrentMaster.Title.TitleText     = GetString("TaxClass_List.HeaderCaption");
        this.CurrentMaster.Title.TitleImage    = GetImageUrl("Objects/Ecommerce_TaxClass/object.png");
        this.CurrentMaster.Title.HelpTopicName = "tax_classes_list";
        this.CurrentMaster.Title.HelpName      = "helpTopic";

        // Prepare the new payment option header element
        string[,] actions = new string[2, 9];
        actions[0, 0]     = "HyperLink";
        actions[0, 1]     = GetString("TaxClass_List.NewItemCaption");
        actions[0, 3]     = "~/CMSModules/Ecommerce/Pages/Tools/Configuration/TaxClasses/TaxClass_New.aspx?siteId=" + SiteID;
        actions[0, 5]     = GetImageUrl("Objects/Ecommerce_TaxClass/add.png");

        // Show copy from global link when not configuring global tax classes
        if (ConfiguredSiteID != 0)
        {
            // Show "Copy from global" link only if there is at least one global tax class
            DataSet ds = TaxClassInfoProvider.GetTaxClasses("TaxClassSiteID IS NULL", null, 1, "TaxClassID");
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                actions[1, 0] = HeaderActions.TYPE_SAVEBUTTON;
                actions[1, 1] = GetString("general.copyfromglobal");
                actions[1, 2] = "return ConfirmCopyFromGlobal();";
                actions[1, 3] = null;
                actions[1, 4] = null;
                actions[1, 5] = GetImageUrl("Objects/Ecommerce_TaxClass/fromglobal.png");
                actions[1, 6] = "copyFromGlobal";
                actions[1, 7] = String.Empty;
                actions[1, 8] = true.ToString();

                // Register javascript to confirm action
                string script = "function ConfirmCopyFromGlobal() {return confirm(" + ScriptHelper.GetString(GetString("com.ConfirmTaxClassFromGlobal")) + ");}";
                ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ConfirmCopyFromGlobal", ScriptHelper.GetScript(script));
            }
        }

        this.CurrentMaster.HeaderActions.Actions          = actions;
        this.CurrentMaster.HeaderActions.ActionPerformed += new CommandEventHandler(HeaderActions_ActionPerformed);

        UniGrid.OnAction    += new OnActionEventHandler(uniGrid_OnAction);
        UniGrid.ZeroRowsText = GetString("general.nodatafound");

        // Configuring global records
        if (ConfiguredSiteID == 0)
        {
            // Select only global records
            UniGrid.WhereCondition = "TaxClassSiteID IS NULL";
            // Show "using global settings" info message only if showing global store settings
            if (SiteID != 0)
            {
                lblGlobalInfo.Visible = true;
                lblGlobalInfo.Text    = GetString("com.UsingGlobalSettings");
            }
        }
        else
        {
            // Select only site-specific records
            UniGrid.WhereCondition = "TaxClassSiteID = " + ConfiguredSiteID;
        }
    }