/// <summary>
        /// Loads data (SKU options) to the selection control.
        /// </summary>
        private void LoadSKUOptions()
        {
            // Only for none-text types
            if (SelectionControl != null)
            {
                if (SelectionControl is TextBoxWithLabel)
                {
                    if (!DataHelper.DataSourceIsEmpty(ProductOptionsData))
                    {
                        DataRow dr = ProductOptionsData.Tables[0].Rows[0];
                        TextOptionSKUID = ValidationHelper.GetInteger(ProductOptionsData.Tables[0].Rows[0]["SKUID"], 0);

                        if (OptionCategory.CategoryDisplayPrice)
                        {
                            TextBoxWithLabel tb = SelectionControl as TextBoxWithLabel;
                            tb.LabelText = GetPrice(dr);
                        }
                    }
                }
                else if (SelectionControl is ListControl)
                {
                    ((ListControl)SelectionControl).DataSource = ProductOptionsData;
                    SelectionControl.DataBind();

                    // Add '(none)' record when it is allowed
                    if ((OptionCategory != null) && (OptionCategory.CategoryDefaultRecord != ""))
                    {
                        ListItem noneRecord = new ListItem(OptionCategory.CategoryDefaultRecord, "0");
                        ((ListControl)SelectionControl).Items.Insert(0, noneRecord);
                    }
                }
            }
        }
        /// <summary>
        /// Sets category default options as 'Selected' in selection control.
        /// </summary>
        private void SetDefaultSKUOptions()
        {
            if ((SelectionControl != null) && (OptionCategory != null))
            {
                // Dropdown list - single selection
                // Radiobutton list - single selection
                if ((SelectionControl is LocalizedDropDownList) ||
                    (SelectionControl is LocalizedRadioButtonList))
                {
                    try
                    {
                        ((ListControl)SelectionControl).SelectedValue = OptionCategory.CategoryDefaultOptions;
                    }
                    catch
                    {
                    }
                }
                // Checkbox list - multiple selection
                else if (SelectionControl is LocalizedCheckBoxList)
                {
                    try
                    {
                        if (OptionCategory.CategoryDefaultOptions != "")
                        {
                            foreach (string skuId in OptionCategory.CategoryDefaultOptions.Split(','))
                            {
                                // Ensure value is not empty
                                string value = (skuId != "") ? skuId : "0";

                                ListItem item = ((CheckBoxList)SelectionControl).Items.FindByValue(value);
                                if (item != null)
                                {
                                    item.Selected = true;
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                // Text type
                else if (SelectionControl is TextBoxWithLabel)
                {
                    TextBoxWithLabel tb = SelectionControl as TextBoxWithLabel;
                    tb.Text = OptionCategory.CategoryDefaultOptions;
                }
                // Form control
                else if (SelectionControl is FormEngineUserControl)
                {
                    ((FormEngineUserControl)SelectionControl).Value = OptionCategory.CategoryDefaultOptions;
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Loads data (SKU options) to the selection control.
        /// </summary>
        private void LoadSKUOptions()
        {
            // Only for none-text types
            if (this.SelectionControl != null)
            {
                // Bind data
                DataSet ds = SKUInfoProvider.GetSKUOptions(this.OptionCategoryId, true);

                if (this.SelectionControl is TextBoxWithLabel)
                {
                    if (!DataHelper.DataSourceIsEmpty(ds))
                    {
                        DataRow dr = ds.Tables[0].Rows[0];
                        TextOptionSKUID = ValidationHelper.GetInteger(ds.Tables[0].Rows[0]["SKUID"], 0);

                        if (this.OptionCategory.CategoryDisplayPrice)
                        {
                            TextBoxWithLabel tb = this.SelectionControl as TextBoxWithLabel;
                            tb.LabelText = GetPrice(dr);
                        }
                    }
                }
                else
                {
                    ((ListControl)this.SelectionControl).DataSource = ds;
                    this.SelectionControl.DataBind();

                    // Add '(none)' record when it is allowed
                    if ((this.OptionCategory != null) && (this.OptionCategory.CategoryDefaultRecord != ""))
                    {
                        ListItem noneRecord = new ListItem(this.OptionCategory.CategoryDefaultRecord, "0");
                        ((ListControl)this.SelectionControl).Items.Insert(0, noneRecord);
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Returns initialized selection control according to the specified selection type.
        /// </summary>
        private Control GetSelectionControl()
        {
            if (this.OptionCategory != null)
            {
                switch (this.OptionCategory.CategorySelectionType)
                {
                    // Dropdownlist
                    case OptionCategorySelectionTypeEnum.Dropdownlist:

                        LocalizedDropDownList dropDown = new LocalizedDropDownList();
                        dropDown.ID = "dropdown";
                        dropDown.DataTextField = "SKUName";
                        dropDown.DataValueField = "SKUID";
                        dropDown.DataBound += new EventHandler(SelectionControl_DataBound);
                        return dropDown;

                    // Checkbox list with horizontal direction
                    case OptionCategorySelectionTypeEnum.CheckBoxesHorizontal:

                        LocalizedCheckBoxList boxListHorizontal = new LocalizedCheckBoxList();
                        boxListHorizontal.ID = "chkHorizontal";
                        boxListHorizontal.RepeatDirection = RepeatDirection.Horizontal;
                        boxListHorizontal.DataTextField = "SKUName";
                        boxListHorizontal.DataValueField = "SKUID";
                        boxListHorizontal.DataBound += new EventHandler(SelectionControl_DataBound);
                        return boxListHorizontal;

                    // Checkbox list with vertical direction
                    case OptionCategorySelectionTypeEnum.CheckBoxesVertical:

                        LocalizedCheckBoxList boxListVertical = new LocalizedCheckBoxList();
                        boxListVertical.ID = "chkVertical";
                        boxListVertical.RepeatDirection = RepeatDirection.Vertical;
                        boxListVertical.DataTextField = "SKUName";
                        boxListVertical.DataValueField = "SKUID";
                        boxListVertical.DataBound += new EventHandler(SelectionControl_DataBound);
                        return boxListVertical;

                    // Radiobuton list with horizontal direction
                    case OptionCategorySelectionTypeEnum.RadioButtonsHorizontal:

                        LocalizedRadioButtonList buttonListHorizontal = new LocalizedRadioButtonList();
                        buttonListHorizontal.ID = "radHorizontal";
                        buttonListHorizontal.RepeatDirection = RepeatDirection.Horizontal;
                        buttonListHorizontal.DataTextField = "SKUName";
                        buttonListHorizontal.DataValueField = "SKUID";
                        buttonListHorizontal.DataBound += new EventHandler(SelectionControl_DataBound);
                        return buttonListHorizontal;

                    // Radiobuton list with vertical direction
                    case OptionCategorySelectionTypeEnum.RadioButtonsVertical:

                        LocalizedRadioButtonList buttonListVertical = new LocalizedRadioButtonList();
                        buttonListVertical.ID = "radVertical";
                        buttonListVertical.RepeatDirection = RepeatDirection.Vertical;
                        buttonListVertical.DataTextField = "SKUName";
                        buttonListVertical.DataValueField = "SKUID";
                        buttonListVertical.DataBound += new EventHandler(SelectionControl_DataBound);
                        return buttonListVertical;

                    // Text box
                    case OptionCategorySelectionTypeEnum.TextBox:

                        TextBox text = new TextBoxWithLabel();
                        text.ID = "txtText";
                        text.CssClass = "TextBoxField";
                        return text;

                    // Text area
                    case OptionCategorySelectionTypeEnum.TextArea:

                        TextBox textarea = new TextBoxWithLabel();
                        textarea.ID = "txtArea";
                        textarea.CssClass = "TextAreaField";
                        textarea.TextMode = TextBoxMode.MultiLine;
                        return textarea;
                }
            }

            return null;
        }
예제 #5
0
        /// <summary>
        /// Returns initialized selection control according to the specified selection type.
        /// </summary>
        private Control GetSelectionControl()
        {
            if (this.OptionCategory != null)
            {
                switch (this.OptionCategory.CategorySelectionType)
                {
                    // Dropdownlist
                    case OptionCategorySelectionTypeEnum.Dropdownlist:

                        LocalizedDropDownList dropDown = new LocalizedDropDownList();
                        dropDown.ID = "dropdown";
                        dropDown.DataTextField = "SKUName";
                        dropDown.DataValueField = "SKUID";
                        dropDown.DataBound += new EventHandler(SelectionControl_DataBound);
                        return dropDown;

                    // Checkbox list with horizontal direction
                    case OptionCategorySelectionTypeEnum.CheckBoxesHorizontal:

                        LocalizedCheckBoxList boxListHorizontal = new LocalizedCheckBoxList();
                        boxListHorizontal.ID = "chkHorizontal";
                        boxListHorizontal.RepeatDirection = RepeatDirection.Horizontal;
                        boxListHorizontal.DataTextField = "SKUName";
                        boxListHorizontal.DataValueField = "SKUID";
                        boxListHorizontal.DataBound += new EventHandler(SelectionControl_DataBound);
                        return boxListHorizontal;

                    // Checkbox list with vertical direction
                    case OptionCategorySelectionTypeEnum.CheckBoxesVertical:

                        LocalizedCheckBoxList boxListVertical = new LocalizedCheckBoxList();
                        boxListVertical.ID = "chkVertical";
                        boxListVertical.RepeatDirection = RepeatDirection.Vertical;
                        boxListVertical.DataTextField = "SKUName";
                        boxListVertical.DataValueField = "SKUID";
                        boxListVertical.DataBound += new EventHandler(SelectionControl_DataBound);
                        return boxListVertical;

                    // Radiobuton list with horizontal direction
                    case OptionCategorySelectionTypeEnum.RadioButtonsHorizontal:

                        LocalizedRadioButtonList buttonListHorizontal = new LocalizedRadioButtonList();
                        buttonListHorizontal.ID = "radHorizontal";
                        buttonListHorizontal.RepeatDirection = RepeatDirection.Horizontal;
                        buttonListHorizontal.DataTextField = "SKUName";
                        buttonListHorizontal.DataValueField = "SKUID";
                        buttonListHorizontal.DataBound += new EventHandler(SelectionControl_DataBound);
                        return buttonListHorizontal;

                    // Radiobuton list with vertical direction
                    case OptionCategorySelectionTypeEnum.RadioButtonsVertical:

                        LocalizedRadioButtonList buttonListVertical = new LocalizedRadioButtonList();
                        buttonListVertical.ID = "radVertical";
                        buttonListVertical.RepeatDirection = RepeatDirection.Vertical;
                        buttonListVertical.DataTextField = "SKUName";
                        buttonListVertical.DataValueField = "SKUID";
                        buttonListVertical.DataBound += new EventHandler(SelectionControl_DataBound);
                        return buttonListVertical;

                    // Text box
                    case OptionCategorySelectionTypeEnum.TextBox:

                        TextBox text = new TextBoxWithLabel();
                        text.ID = "txtText";
                        text.CssClass = "TextBoxField";
                        return text;

                    // Text area
                    case OptionCategorySelectionTypeEnum.TextArea:

                        TextBox textarea = new TextBoxWithLabel();
                        textarea.ID = "txtArea";
                        textarea.CssClass = "TextAreaField";
                        textarea.TextMode = TextBoxMode.MultiLine;
                        return textarea;
                }
            }

            return null;
        }
        /// <summary>
        /// Returns initialized selection control according to the specified selection type.
        /// </summary>
        private Control GetSelectionControl()
        {
            if (OptionCategory != null)
            {
                switch (OptionCategory.CategorySelectionType)
                {
                // Dropdownlist
                case OptionCategorySelectionTypeEnum.Dropdownlist:

                    LocalizedDropDownList dropDown = new LocalizedDropDownList();
                    dropDown.ID             = "dropdown";
                    dropDown.CssClass       = "DropDownField";
                    dropDown.DataTextField  = "SKUName";
                    dropDown.DataValueField = "SKUID";
                    dropDown.DataBound     += new EventHandler(SelectionControl_DataBound);

                    return(dropDown);

                // Checkbox list with horizontal direction
                case OptionCategorySelectionTypeEnum.CheckBoxesHorizontal:

                    LocalizedCheckBoxList boxListHorizontal = new LocalizedCheckBoxList();
                    boxListHorizontal.ID = "chkHorizontal";
                    boxListHorizontal.RepeatDirection = RepeatDirection.Horizontal;
                    boxListHorizontal.DataTextField   = "SKUName";
                    boxListHorizontal.DataValueField  = "SKUID";
                    boxListHorizontal.DataBound      += new EventHandler(SelectionControl_DataBound);

                    return(boxListHorizontal);

                // Checkbox list with vertical direction
                case OptionCategorySelectionTypeEnum.CheckBoxesVertical:

                    LocalizedCheckBoxList boxListVertical = new LocalizedCheckBoxList();
                    boxListVertical.ID = "chkVertical";
                    boxListVertical.RepeatDirection = RepeatDirection.Vertical;
                    boxListVertical.DataTextField   = "SKUName";
                    boxListVertical.DataValueField  = "SKUID";
                    boxListVertical.DataBound      += new EventHandler(SelectionControl_DataBound);

                    return(boxListVertical);

                // Radiobuton list with horizontal direction
                case OptionCategorySelectionTypeEnum.RadioButtonsHorizontal:

                    LocalizedRadioButtonList buttonListHorizontal = new LocalizedRadioButtonList();
                    buttonListHorizontal.ID = "radHorizontal";
                    buttonListHorizontal.RepeatDirection = RepeatDirection.Horizontal;
                    buttonListHorizontal.DataTextField   = "SKUName";
                    buttonListHorizontal.DataValueField  = "SKUID";
                    buttonListHorizontal.DataBound      += new EventHandler(SelectionControl_DataBound);

                    return(buttonListHorizontal);

                // Radiobuton list with vertical direction
                case OptionCategorySelectionTypeEnum.RadioButtonsVertical:

                    LocalizedRadioButtonList buttonListVertical = new LocalizedRadioButtonList();
                    buttonListVertical.ID = "radVertical";
                    buttonListVertical.RepeatDirection = RepeatDirection.Vertical;
                    buttonListVertical.DataTextField   = "SKUName";
                    buttonListVertical.DataValueField  = "SKUID";
                    buttonListVertical.DataBound      += new EventHandler(SelectionControl_DataBound);

                    return(buttonListVertical);

                // Text box
                case OptionCategorySelectionTypeEnum.TextBox:

                    TextBox text = new TextBoxWithLabel();
                    text.ID       = "txtText";
                    text.CssClass = "TextBoxField";

                    return(text);

                // Text area
                case OptionCategorySelectionTypeEnum.TextArea:

                    TextBox textarea = new TextBoxWithLabel();
                    textarea.ID       = "txtArea";
                    textarea.CssClass = "TextAreaField";
                    textarea.TextMode = TextBoxMode.MultiLine;

                    return(textarea);

                // Form control
                case OptionCategorySelectionTypeEnum.FormControl:
                    if (!string.IsNullOrEmpty(OptionCategory.CategoryFormControlName))
                    {
                        FormUserControlInfo fui = FormUserControlInfoProvider.GetFormUserControlInfo(OptionCategory.CategoryFormControlName);
                        if (fui != null)
                        {
                            // Load control
                            FormEngineUserControl fc = (FormEngineUserControl)Page.LoadUserControl(FormUserControlInfoProvider.GetFormUserControlUrl(fui));
                            if (fc != null)
                            {
                                fc.ID = "FormControlField";

                                return(fc);
                            }
                        }
                    }

                    return(null);
                }
            }

            return(null);
        }
        /// <summary>
        /// Returns initialized selection control according to the specified selection type.
        /// </summary>
        private Control GetSelectionControl()
        {
            if (OptionCategory != null)
            {
                switch (OptionCategory.CategorySelectionType)
                {
                    // Dropdownlist
                    case OptionCategorySelectionTypeEnum.Dropdownlist:

                        LocalizedDropDownList dropDown = new LocalizedDropDownList();
                        dropDown.ID = "dropdown";
                        dropDown.CssClass = "DropDownField";
                        dropDown.DataTextField = "SKUName";
                        dropDown.DataValueField = "SKUID";
                        dropDown.DataBound += new EventHandler(SelectionControl_DataBound);

                        return dropDown;

                    // Checkbox list with horizontal direction
                    case OptionCategorySelectionTypeEnum.CheckBoxesHorizontal:

                        LocalizedCheckBoxList boxListHorizontal = new LocalizedCheckBoxList();
                        boxListHorizontal.ID = "chkHorizontal";
                        boxListHorizontal.RepeatDirection = RepeatDirection.Horizontal;
                        boxListHorizontal.DataTextField = "SKUName";
                        boxListHorizontal.DataValueField = "SKUID";
                        boxListHorizontal.DataBound += new EventHandler(SelectionControl_DataBound);

                        return boxListHorizontal;

                    // Checkbox list with vertical direction
                    case OptionCategorySelectionTypeEnum.CheckBoxesVertical:

                        LocalizedCheckBoxList boxListVertical = new LocalizedCheckBoxList();
                        boxListVertical.ID = "chkVertical";
                        boxListVertical.RepeatDirection = RepeatDirection.Vertical;
                        boxListVertical.DataTextField = "SKUName";
                        boxListVertical.DataValueField = "SKUID";
                        boxListVertical.DataBound += new EventHandler(SelectionControl_DataBound);

                        return boxListVertical;

                    // Radiobuton list with horizontal direction
                    case OptionCategorySelectionTypeEnum.RadioButtonsHorizontal:

                        LocalizedRadioButtonList buttonListHorizontal = new LocalizedRadioButtonList();
                        buttonListHorizontal.ID = "radHorizontal";
                        buttonListHorizontal.RepeatDirection = RepeatDirection.Horizontal;
                        buttonListHorizontal.DataTextField = "SKUName";
                        buttonListHorizontal.DataValueField = "SKUID";
                        buttonListHorizontal.DataBound += new EventHandler(SelectionControl_DataBound);

                        return buttonListHorizontal;

                    // Radiobuton list with vertical direction
                    case OptionCategorySelectionTypeEnum.RadioButtonsVertical:

                        LocalizedRadioButtonList buttonListVertical = new LocalizedRadioButtonList();
                        buttonListVertical.ID = "radVertical";
                        buttonListVertical.RepeatDirection = RepeatDirection.Vertical;
                        buttonListVertical.DataTextField = "SKUName";
                        buttonListVertical.DataValueField = "SKUID";
                        buttonListVertical.DataBound += new EventHandler(SelectionControl_DataBound);

                        return buttonListVertical;

                    // Text box
                    case OptionCategorySelectionTypeEnum.TextBox:

                        TextBox text = new TextBoxWithLabel();
                        text.ID = "txtText";
                        text.CssClass = "TextBoxField";

                        return text;

                    // Text area
                    case OptionCategorySelectionTypeEnum.TextArea:

                        TextBox textarea = new TextBoxWithLabel();
                        textarea.ID = "txtArea";
                        textarea.CssClass = "TextAreaField";
                        textarea.TextMode = TextBoxMode.MultiLine;

                        return textarea;

                    // Form control
                    case OptionCategorySelectionTypeEnum.FormControl:
                        if (!string.IsNullOrEmpty(OptionCategory.CategoryFormControlName))
                        {
                            FormUserControlInfo fui = FormUserControlInfoProvider.GetFormUserControlInfo(OptionCategory.CategoryFormControlName);
                            if (fui != null)
                            {
                                // Load control
                                FormEngineUserControl fc = (FormEngineUserControl)Page.LoadUserControl(FormUserControlInfoProvider.GetFormUserControlUrl(fui));
                                if (fc != null)
                                {
                                    fc.ID = "FormControlField";

                                    return fc;
                                }
                            }
                        }

                        return null;
                }
            }

            return null;
        }