Пример #1
0
    private static void populateDropDowns(
        bool visible,
        NiceApiLibrary.UpdateInfo.UpdateInfoSection infoSection,
        int selectedIndex,
        DropDownList dropDownList,
        System.Web.UI.HtmlControls.HtmlGenericControl div1,
        System.Web.UI.HtmlControls.HtmlGenericControl div2)
    {
        if (infoSection == null)
        {
            div1.Visible = false;
            div2.Visible = false;
            return;
        }

        div1.Visible   = visible ? infoSection.Active : false;
        div1.InnerText = infoSection.PromptText;
        div2.Visible   = visible ? infoSection.Active : false;

        if (infoSection.Active)
        {
            dropDownList.Items.Clear();
            dropDownList.Items.Add("Please Select...");
            if (infoSection.Options != null)
            {
                foreach (UpdateInfo.UpdateInfoOption entry in infoSection.Options)
                {
                    dropDownList.Items.Add(new ListItem(entry.Text, entry.Factor.ToString()));
                }
            }
            dropDownList.SelectedIndex = selectedIndex;
        }
    }
Пример #2
0
 private static decimal GetPrice(NiceApiLibrary.UpdateInfo.UpdateInfoSection infoSection)
 {
     if (infoSection == null)
     {
         return(0M);
     }
     return(infoSection.CostPerUnit);
 }