Beispiel #1
0
    private Control GetTableRadioButton(ShippingListItem shippingListItem)
    {
        var tr = new HtmlTableRow();
        var td = new HtmlTableCell();

        if (divScripts.Visible == false)
        {
            divScripts.Visible = shippingListItem.Ext != null && shippingListItem.Ext.Type == ExtendedType.Pickpoint;
        }

        var radioButton = new RadioButton
        {
            GroupName = "ShippingRateGroup",
            ID        = PefiksId + shippingListItem.Id                //+ "|" + shippingListItem.Rate
        };

        if (String.IsNullOrEmpty(_selectedID.Value.Replace(PefiksId, string.Empty)))
        {
            _selectedID.Value = radioButton.ID;
        }

        radioButton.Checked = radioButton.ID == _selectedID.Value;
        radioButton.Attributes.Add("onclick", "setValue(this)");

        string strShippingPrice = CatalogService.GetStringPrice(shippingListItem.Rate,
                                                                Currency.Value,
                                                                Currency.Iso3);

        radioButton.Text = string.Format("{0} <span class='price'>{1}</span>",
                                         shippingListItem.MethodNameRate, strShippingPrice);

        if (shippingListItem.Ext != null && shippingListItem.Ext.Type == ExtendedType.Pickpoint)
        {
            string temp;
            if (shippingListItem.Ext.Pickpointmap.IsNotEmpty())
            {
                temp = string.Format(",{{city:'{0}', ids:null}}", shippingListItem.Ext.Pickpointmap);
            }
            else
            {
                temp = string.Empty;
            }
            radioButton.Text +=
                string.Format(
                    "<br/><div id=\"address\">{0}</div><a href=\"#\" onclick=\"PickPoint.open(SetPickPointAnswer{1});return false\">" +
                    "{2}</a><input type=\"hidden\" name=\"pickpoint_id\" id=\"pickpoint_id\" value=\"\" /><br />",
                    pickAddress.Value, temp, Resources.Resource.Client_OrderConfirmation_Select);
        }
        using (var img = new Image {
            ImageUrl = ShippingIcons.GetShippingIcon(shippingListItem.Type, shippingListItem.IconName, shippingListItem.MethodNameRate)
        })
        {
            td.Controls.Add(img);
        }

        td.Controls.Add(radioButton);
        tr.Controls.Add(td);

        return(tr);
    }
        private Control GetTableRadioButton(ShippingItem shippingListItem)
        {
            var tr = new HtmlTableRow();
            var td = new HtmlTableCell();

            if (divScripts.Visible == false)
            {
                divScripts.Visible = shippingListItem.Ext != null && shippingListItem.Ext.Type == ExtendedType.Pickpoint;
            }

            var radioButton = new RadioButton
            {
                GroupName = "ShippingRateGroup",
                ID        = PefiksId + shippingListItem.Id, //+ "|" + shippingListItem.Rate
                CssClass  = "radio-shipping"
            };

            if (String.IsNullOrEmpty(_selectedID.Value.Replace(PefiksId, string.Empty)))
            {
                _selectedID.Value = radioButton.ID;
            }

            radioButton.Checked = radioButton.ID == _selectedID.Value;

            string strShippingPrice = shippingListItem.Rate != 0 ? CatalogService.GetStringPrice(shippingListItem.Rate, Currency.Value, Currency.Iso3) : shippingListItem.ZeroPriceMessage;

            radioButton.Text = string.Format("{0} <span class='price'>{1}</span>",
                                             shippingListItem.MethodNameRate, strShippingPrice);

            //if (shippingListItem.Ext != null && shippingListItem.Ext.Type == ExtendedType.Pickpoint)
            //{
            //    string temp;
            //    if (shippingListItem.Ext.Pickpointmap.IsNotEmpty())
            //        temp = string.Format(",{{city:'{0}', ids:null}}", shippingListItem.Ext.Pickpointmap);
            //    else
            //        temp = string.Empty;
            //    radioButton.Text +=
            //        string.Format(
            //            "<br/><div id=\"address\">{0}</div><a href=\"#\" onclick=\"PickPoint.open(SetPickPointAnswerAdmin{1});return false\">" +
            //            "{2}</a><input type=\"hidden\" name=\"pickpoint_id\" id=\"pickpoint_id\" value=\"\" /><br />",
            //            pickAddress.Value, temp, Resources.Resource.Client_OrderConfirmation_Select);
            //}

            radioButton.Text += ShippingMethodService.RenderExtend(shippingListItem, 0, pickAddress.Value, false);

            var panel = new Panel {
                CssClass = "inline-b"
            };

            using (var img = new Image {
                ImageUrl = SettingsGeneral.AbsoluteUrl + "/" + ShippingIcons.GetShippingIcon(shippingListItem.Type, shippingListItem.IconName, shippingListItem.MethodNameRate)
            })
            {
                panel.Controls.Add(img);
                td.Controls.Add(panel);
            }

            var panel2 = new Panel {
                CssClass = "inline-b"
            };

            panel2.Controls.Add(radioButton);

            td.Controls.Add(panel2);
            tr.Controls.Add(td);

            return(tr);
        }