Exemplo n.º 1
0
 public static void PopulaDropDownList(DropDownList DropDownList, EnumType.TipoDropDownList TipoControl, String ValorPadrao = null)
 {
     WebUtils.PopulaDropDownList(DropDownList, TipoControl, false, ValorPadrao);
 }
Exemplo n.º 2
0
        public static void PopulaDropDownList(ComboBox comboBox, EnumType.TipoDropDownList TipoControl, String ValorPadrao = null)
        {
            switch (TipoControl)
            {
            case EnumType.TipoDropDownList.Categoria:
                comboBox.Items.Clear();
                comboBox.DataSource = new BllCategoria().ObterTodos(true);
                comboBox.DataBind();

                if ((!StringUtils.IsEmpty(ValorPadrao)) || (ValorPadrao != null))
                {
                    comboBox.Items.Insert(0, new ListItem(ValorPadrao, "0"));
                    comboBox.SelectedIndex = 0;
                }
                break;

            case EnumType.TipoDropDownList.Faturamento:
                comboBox.Items.Clear();
                comboBox.DataSource = new BllFaturamento().ObterPorIdTipoFaturamento(4);
                comboBox.DataBind();

                if ((!StringUtils.IsEmpty(ValorPadrao)) || (ValorPadrao != null))
                {
                    comboBox.Items.Insert(0, new ListItem(ValorPadrao, "0"));
                    comboBox.SelectedIndex = 0;
                }
                break;

            case EnumType.TipoDropDownList.Escolaridade:
                comboBox.Items.Clear();
                comboBox.DataSource = new BllContatoNivelEscolaridade().ObterTodos();
                comboBox.DataBind();

                if ((!StringUtils.IsEmpty(ValorPadrao)) || (ValorPadrao != null))
                {
                    comboBox.Items.Insert(0, new ListItem(ValorPadrao, "0"));
                    comboBox.SelectedIndex = 0;
                }
                break;

            case EnumType.TipoDropDownList.TipoEmpresa:
                comboBox.Items.Clear();
                comboBox.DataSource = new BllTipoEmpresa().ObterTodos();
                comboBox.DataBind();

                if ((!StringUtils.IsEmpty(ValorPadrao)) || (ValorPadrao != null))
                {
                    comboBox.Items.Insert(0, new ListItem(ValorPadrao, "0"));
                    comboBox.SelectedIndex = 0;
                }
                break;

            case EnumType.TipoDropDownList.FaixaEtaria:
                comboBox.Items.Clear();
                comboBox.DataSource = new BllContatoFaixaEtaria().ObterTodos();
                comboBox.DataBind();

                if ((!StringUtils.IsEmpty(ValorPadrao)) || (ValorPadrao != null))
                {
                    comboBox.Items.Insert(0, new ListItem(ValorPadrao, "0"));
                    comboBox.SelectedIndex = 0;
                }
                break;

            case EnumType.TipoDropDownList.Cargo:
                comboBox.Items.Clear();
                comboBox.DataSource = new BllCargo().ObterTodos();
                comboBox.DataBind();

                if ((!StringUtils.IsEmpty(ValorPadrao)) || (ValorPadrao != null))
                {
                    comboBox.Items.Insert(0, new ListItem(ValorPadrao, "0"));
                    comboBox.SelectedIndex = 0;
                }
                break;

            case EnumType.TipoDropDownList.AtividadeEconomica:
                comboBox.Items.Clear();
                comboBox.DataSource = new BllAtividadeEconomica().ObterTodos();
                comboBox.DataBind();

                if ((!StringUtils.IsEmpty(ValorPadrao)) || (ValorPadrao != null))
                {
                    comboBox.Items.Insert(0, new ListItem(ValorPadrao, "0"));
                    comboBox.SelectedIndex = 0;
                }
                break;
            }
        }