예제 #1
0
        //public static string AddressToForm(Contacts.Address a, string prefix, int tabIndexStart)
        //{
        //    StringBuilder sb = new StringBuilder();

        //    sb.Append("<table>");

        //    // Country
        //    sb.Append("<tr><td class=\"formfield\">Country:</td><td class=\"forminput\">");
        //    sb.Append("<select id=\"" + prefix + "countryname\" name=\"" + prefix + "countryname\"");
        //    sb.Append(" tabindex=\"" + (tabIndexStart + 1).ToString() + "\" >");
        //    foreach (MerchantTribe.Web.Geography.Country c in RequestContext.GetCurrentRequestContext().CurrentStore.Settings.FindActiveCountries())
        //    {
        //        sb.Append("<option value=\"" + c.Bvin + "\"");
        //        if (c.Bvin == a.CountyBvin)
        //        {
        //            sb.Append(" selected ");
        //        }
        //        sb.Append(">" + c.DisplayName + "</option>");
        //    }
        //    sb.Append("</select>");
        //    sb.Append("</td></tr>");

        //    // First Name
        //    sb.Append("<tr><td class=\"formfield\">First Name:</td><td class=\"forminput\">");
        //    sb.Append("<input type=\"text\" id=\"" + prefix + "firstname\" name=\"" + prefix + "firstname\"");
        //    sb.Append(" value=\"" + a.FirstName + "\" tabindex=\"" + (tabIndexStart + 2).ToString() + "\" />");
        //    sb.Append("</td></tr>");

        //    sb.Append("</table>");
        //    return sb.ToString();
        //}

        public static string ShippingRatesToRadioButtons(SortableCollection <Shipping.ShippingRateDisplay> rates, int tabIndex, string selectedMethodUniqueKey)
        {
            StringBuilder sb = new StringBuilder();

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

            // Tab Index Settings
            int tabOffSet = 0;

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

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

            return(sb.ToString());
        }
예제 #2
0
        public static SortableCollection <T> FromXml(string data)
        {
            SortableCollection <T> result = new SortableCollection <T>();

            if (!string.IsNullOrEmpty(data))
            {
                try {
                    StringReader  tr = new StringReader(data);
                    XmlSerializer 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);
        }
예제 #3
0
 public virtual void AddRange(SortableCollection <T> collection)
 {
     this.InnerList.AddRange(collection);
 }