Example #1
0
        public static SortableCollection <T> FromXml(string data)
        {
            var result = new SortableCollection <T>();

            if (!string.IsNullOrEmpty(data))
            {
                try
                {
                    var tr = new StringReader(data);
                    var xs = new XmlSerializer(result.GetType());
                    result = (SortableCollection <T>)xs.Deserialize(tr);
                    if (result == null)
                    {
                        result = new SortableCollection <T>();
                    }
                }
                catch (Exception ex)
                {
                    EventLog.LogEvent(ex);
                    result = new SortableCollection <T>();
                }
            }

            return(result);
        }
Example #2
0
        public static string ShippingRatesToRadioButtons(SortableCollection <ShippingRateDisplay> rates, int tabIndex,
                                                         string selectedMethodUniqueKey)
        {
            var sb = new StringBuilder();

            if (rates == null)
            {
                return(string.Empty);
            }

            // Tab Index Settings
            var tabOffSet = 0;

            if (tabIndex > 0)
            {
                tabOffSet = tabIndex;
            }

            foreach (ShippingRateDisplay r in rates)
            {
                if (r.Rate >= 0)
                {
                    sb.Append("<label><input type=\"radio\" name=\"shippingrate\" value=\"" + r.UniqueKey +
                              "\" style=\"display: inline !important;\"");
                    sb.Append(" class=\"shippingratequote\" ");
                    if (r.UniqueKey == selectedMethodUniqueKey)
                    {
                        sb.Append(" checked=\"checked\" ");
                    }
                    sb.Append("/>" + r.RateAndNameForDisplay + "</label><br />");
                }
            }

            return(sb.ToString());
        }
Example #3
0
 public virtual void AddRange(SortableCollection <T> collection)
 {
     InnerList.AddRange(collection);
 }