Exemple #1
0
    private void GetTextBoxMultiLine(HtmlGenericControl row, CustomOption customOption, IList <EvaluatedCustomOptions> evlist)
    {
        var title = new HtmlGenericControl("div");

        title.Attributes.Add("class", "param-name");
        var l = new Label {
            Text = customOption.Title + ":"
        };

        title.Controls.Add(l);

        var value = new HtmlGenericControl("div");

        value.Attributes.Add("class", "param-value");

        var ctrl = new TextBox {
            TextMode = TextBoxMode.MultiLine, ID = customOption.Title
        };

        if (evlist != null)
        {
            EvaluatedCustomOptions ev = evlist.WithCustomOptionId(customOption.CustomOptionsId);
            if (ev != null)
            {
                ctrl.Text = ev.OptionTitle;
            }
        }
        value.Controls.Add(ctrl);
        _controls.Add(ctrl);

        row.Controls.Add(title);
        row.Controls.Add(value);
    }
Exemple #2
0
    //****** Private controls set
    private void GetTextBoxSingleLine(HtmlGenericControl row, CustomOption customOption, IList <EvaluatedCustomOptions> evlist)
    {
        var title = new HtmlGenericControl("div");

        title.Attributes.Add("class", "param-name");
        var l = new Label {
            Text = customOption.Title + ":"
        };

        title.Controls.Add(l);

        var value = new HtmlGenericControl("div");

        value.Attributes.Add("class", "param-value");

        var subDiv = new HtmlGenericControl("div");

        subDiv.Attributes.Add("style", "width:200px;float:left");


        var ctrl = new TextBox {
            ID = (customOption.ID + customOption.Title).GetHashCode().ToString()
        };

        ctrl.Attributes.Add("style", "width:170px;");
        if (ShowValidation)
        {
            ctrl.Attributes.Add("class", "valid-required group-cOptions");
        }

        if (evlist != null)
        {
            EvaluatedCustomOptions ev = evlist.WithCustomOptionId(customOption.CustomOptionsId);
            if (ev != null)
            {
                ctrl.Text = ev.OptionTitle;
            }
        }
        subDiv.Controls.Add(ctrl);
        value.Controls.Add(subDiv);
        _controls.Add(ctrl);


        var lbApply = new LinkButton()
        {
            ID = (customOption.ID + customOption.Title + "lb").GetHashCode().ToString(), Text = Resource.Client_Details_Apply
        };

        lbApply.Attributes.Add("style", "float:right");
        lbApply.Attributes.Add("class", "group-cOptions");
        lbApply.OnClientClick = "if(!$('form').valid('cOptions')){return false;}";
        value.Controls.Add(lbApply);
        _controls.Add(lbApply);

        row.Controls.Add(title);
        row.Controls.Add(value);
    }
Exemple #3
0
    private void GetCheckBox(HtmlGenericControl row, CustomOption customOption, IList <EvaluatedCustomOptions> evlist)
    {
        var title = new HtmlGenericControl("div");

        title.Attributes.Add("class", "param-name");
        var l = new Label {
            Text = customOption.Title + ":"
        };

        title.Controls.Add(l);

        var value = new HtmlGenericControl("div");

        value.Attributes.Add("class", "param-value");

        var price = customOption.Options[0].PriceBc;
        var ctrl  = new CheckBox {
            ID = (customOption.ID + customOption.Title).GetHashCode().ToString(), AutoPostBack = true
        };

        if (price != 0)
        {
            var prefix = (price > 0) ? " +" : " ";

            switch (customOption.Options[0].PriceType)
            {
            case OptionPriceType.Fixed:
                price     = GetPrice(price);
                ctrl.Text = prefix + CatalogService.GetStringPrice(price);
                break;

            case OptionPriceType.Percent:
                ctrl.Text = prefix + price.ToString("#,0.##") + @"%";
                break;
            }
        }
        else
        {
            ctrl.Text = string.Empty;
        }

        if (evlist != null)
        {
            EvaluatedCustomOptions ev = evlist.WithCustomOptionId(customOption.CustomOptionsId);
            if (ev != null)
            {
                ctrl.Checked = ev.OptionId > 0;
            }
        }

        value.Controls.Add(ctrl);
        _controls.Add(ctrl);

        row.Controls.Add(title);
        row.Controls.Add(value);
    }
Exemple #4
0
    private void GetDropDownList(HtmlGenericControl row, CustomOption customOption, IList <EvaluatedCustomOptions> evlist)
    {
        var title = new HtmlGenericControl("div");

        title.Attributes.Add("class", "param-name");
        var l = new Label {
            Text = customOption.Title + ":"
        };

        title.Controls.Add(l);

        var value = new HtmlGenericControl("div");

        value.Attributes.Add("class", "param-value");

        var ctrl = new DropDownList
        {
            Width        = 210,
            ID           = (customOption.ID + customOption.Title).GetHashCode().ToString(),
            AutoPostBack = true
        };

        if (!customOption.IsRequired)
        {
            var item = new ListItem {
                Value = @"-1", Text = Resource.Client_UserControls_CustomOptions_None
            };
            ctrl.Items.Add(item);
        }
        foreach (var opt in customOption.Options)
        {
            var price = opt.PriceBc;
            var item  = new ListItem {
                Value = opt.OptionId.ToString()
            };

            if (price != 0)
            {
                var prefix = price > 0 ? " +" : " ";

                switch (opt.PriceType)
                {
                case OptionPriceType.Fixed:
                    price     = GetPrice(price);
                    item.Text = opt.Title + prefix + CatalogService.GetStringPrice(price);
                    break;

                case OptionPriceType.Percent:
                    item.Text = opt.Title + prefix + price.ToString("#,0.##") + @"%";
                    break;
                }
            }
            else
            {
                item.Text = opt.Title;
            }
            ctrl.Items.Add(item);
        }

        if (evlist != null)
        {
            EvaluatedCustomOptions ev = evlist.WithCustomOptionId(customOption.CustomOptionsId);
            if (ev != null)
            {
                ctrl.SelectedValue = ev.OptionId.ToString();
            }
        }
        value.Controls.Add(ctrl);
        _controls.Add(ctrl);

        row.Controls.Add(title);
        row.Controls.Add(value);
    }