Пример #1
0
    /// <summary>
    /// Verifica se tem busca salva na sessão e realiza automaticamente, caso positivo.
    /// </summary>
    private void VerificaBusca()
    {
        if (__SessionWEB.BuscaRealizada.PaginaBusca == Pagina.AreaAdm_ManutencaoCidade)
        {
            // Recuperar busca realizada e pesquisar automaticamente
            string valor;

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("pai_id", out valor);
            if (!string.IsNullOrEmpty(valor) && valor != Guid.Empty.ToString())
            {
                UCComboPais.SetaEventoSource();
                UCComboPais._Combo.DataBind();
                UCComboPais._Combo.SelectedValue = valor;
            }

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("unf_id", out valor);
            if (!string.IsNullOrEmpty(valor) && valor != Guid.Empty.ToString())
            {
                UCComboUnidadeFederativa._Combo.Enabled = true;
                UCComboUnidadeFederativa.SetaEventoSource();
                UCComboUnidadeFederativa._Combo.DataBind();
                UCComboUnidadeFederativa._Combo.SelectedValue = valor;
            }

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("cid_nome", out valor);
            _txtCidade.Text = valor;

            _Pesquisar();
        }
        else
        {
            fdsResultados.Visible = false;
        }
    }
Пример #2
0
    void UCComboPais__IndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (UCComboPais._Combo.SelectedIndex > 0)
            {
                UCComboUnidadeFederativa._Combo.Enabled = true;

                UCComboUnidadeFederativa._Combo.Items.Clear();
                UCComboUnidadeFederativa._Load(new Guid(UCComboPais._Combo.SelectedValue), 0);
                UCComboUnidadeFederativa.CancelarBinding = false;
                UCComboUnidadeFederativa._Combo.DataBind();
                if (UCComboUnidadeFederativa._Combo.Items.FindByValue(new Guid().ToString()) == null)
                {
                    UCComboUnidadeFederativa._Combo.Items.Insert(0, new ListItem("-- Selecione uma opção --", new Guid().ToString()));
                }
            }
            else
            {
                UCComboUnidadeFederativa._Combo.Enabled = false;
            }

            UCComboUnidadeFederativa._Combo.SelectedValue = Guid.Empty.ToString();
        }
        catch (Exception ex)
        {
            ApplicationWEB._GravaErro(ex);
            _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptManager sm = ScriptManager.GetCurrent(this);

        if (sm != null)
        {
            sm.Scripts.Add(new ScriptReference(ArquivoJS.JQueryValidation));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.JqueryMask));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.MascarasCampos));
        }

        if (!IsPostBack)
        {
            if (Session["ManutencaoCidade_dtAssociacaoCidades"] != null)
            {
                _VS_AssociacaoCidades = (DataTable)(Session["ManutencaoCidade_dtAssociacaoCidades"]);
                Session.Remove("ManutencaoCidade_dtAssociacaoCidades");
            }
            try
            {
                UCComboPais.Inicialize("País *");
                UCComboPais._EnableValidator = true;
                UCComboPais._ValidationGroup = "vlgPais";
                UCComboPais._Load(0);

                UCComboUnidadeFederativa.Inicialize("Estado", false);
                UCComboUnidadeFederativa._EnableValidator = false;
                UCComboUnidadeFederativa._ValidationGroup = "vlgPais";
                UCComboUnidadeFederativa._Load(Guid.Empty, 0);
                UCComboUnidadeFederativa._Combo.Enabled = false;

                UCComboPais._Combo.Enabled = false;
                _txtDDD.Enabled            = false;
                _txtCidade.Enabled         = false;

                _Limpar();
                _lblMessage.Visible = false;

                _CarregarGridAssociacaoCidades();
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o endereço.", UtilBO.TipoMensagem.Erro);
            }

            Page.Form.DefaultFocus  = UCComboPais._Combo.ClientID;
            Page.Form.DefaultButton = _btnConfimarAssociacao.UniqueID;
        }

        UCComboPais.OnSelectedIndexChange = UCComboPais__IndexChanged;
    }
Пример #4
0
    private void _ChangeComboPais()
    {
        try
        {
            // Carrega o estado de acodo com o país selecionado
            if (!string.IsNullOrEmpty(UCComboPais._Combo.SelectedValue) && UCComboPais._Combo.SelectedValue != new Guid().ToString())
            {
                Guid pai_id = new Guid();

                if (!string.IsNullOrEmpty(UCComboPais._Combo.SelectedValue))
                {
                    pai_id = new Guid(UCComboPais._Combo.SelectedValue);
                }

                UCComboUnidadeFederativa._Combo.Items.Clear();
                UCComboUnidadeFederativa._Load(pai_id, 0);
                UCComboUnidadeFederativa._Combo.Enabled  = true;
                UCComboUnidadeFederativa.CancelarBinding = false;
                UCComboUnidadeFederativa._Combo.DataBind();

                if (UCComboUnidadeFederativa._Combo.Items.FindByValue(new Guid().ToString()) == null)
                {
                    UCComboUnidadeFederativa._Combo.Items.Insert(0, new ListItem("-- Selecione uma opção --", new Guid().ToString()));
                }
            }
            else
            {
                UCComboUnidadeFederativa._Combo.Enabled       = false;
                UCComboUnidadeFederativa._Combo.SelectedValue = Guid.Empty.ToString();
            }

            // Estado só é obrigatório quando o país selecionado, é o país definido como padrão "Brasil"
            if (UCComboPais._Combo.SelectedValue == SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.PAIS_PADRAO_BRASIL))
            {
                UCComboUnidadeFederativa._Label.Text      = "Estado *";
                UCComboUnidadeFederativa._EnableValidator = true;
            }
            else
            {
                UCComboUnidadeFederativa._Label.Text      = "Estado";
                UCComboUnidadeFederativa._EnableValidator = false;
            }
        }
        catch (Exception ex)
        {
            ApplicationWEB._GravaErro(ex);
            _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
        }
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptManager sm = ScriptManager.GetCurrent(this);

        if (sm != null)
        {
            sm.Scripts.Add(new ScriptReference(ArquivoJS.JQueryValidation));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.JqueryMask));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.MascarasCampos));
        }

        if (!IsPostBack)
        {
            try
            {
                UCComboPais.Inicialize("País *");
                UCComboPais._EnableValidator = true;
                UCComboPais._ValidationGroup = "vlgPais";
                UCComboPais._Load(0);

                UCComboUnidadeFederativa.Inicialize("Estado", false);
                UCComboUnidadeFederativa._EnableValidator = false;
                UCComboUnidadeFederativa._ValidationGroup = "vlgPais";
                UCComboUnidadeFederativa._Load(Guid.Empty, 0);
                UCComboUnidadeFederativa._Combo.Enabled = false;
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
            }

            _Limpar();

            if ((PreviousPage != null) && (PreviousPage.IsCrossPagePostBack))
            {
                _Carregar(PreviousPage.EditItem);
            }
            else
            {
                _btnSalvar.Visible = __SessionWEB.__UsuarioWEB.GrupoPermissao.grp_inserir;
            }

            Page.Form.DefaultFocus  = UCComboPais._Combo.ClientID;
            Page.Form.DefaultButton = _btnSalvar.UniqueID;
        }

        UCComboPais.OnSelectedIndexChange = UCComboPais__IndexChanged;
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptManager sm = ScriptManager.GetCurrent(this);

        if (sm != null)
        {
            sm.Scripts.Add(new ScriptReference(ArquivoJS.MsgConfirmExclusao));
        }

        if (!IsPostBack)
        {
            string message = __SessionWEB.PostMessages;
            if (!String.IsNullOrEmpty(message))
            {
                _lblMessage.Text = message;
            }
            _grvCidade.PageSize = ApplicationWEB._Paginacao;

            try
            {
                UCComboPais.Inicialize("País");
                UCComboPais._EnableValidator = false;
                UCComboPais._Load(0);

                UCComboUnidadeFederativa.Inicialize("Estado");
                UCComboUnidadeFederativa._EnableValidator = false;

                string pais_padrao = SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.PAIS_PADRAO_BRASIL);

                if (!string.IsNullOrEmpty(pais_padrao))
                {
                    UCComboPais.SetaEventoSource();
                    UCComboPais._Combo.DataBind();
                    UCComboPais._Combo.SelectedValue = pais_padrao;

                    UCComboUnidadeFederativa._Load(new Guid(pais_padrao), 0);
                    UCComboUnidadeFederativa._Combo.Enabled = true;
                }
                else
                {
                    UCComboUnidadeFederativa._Load(Guid.Empty, 0);
                    UCComboUnidadeFederativa._Combo.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
            }

            VerificaBusca();

            Page.Form.DefaultButton = _btnPesquisar.UniqueID;
            Page.Form.DefaultFocus  = UCComboPais._Combo.ClientID;

            _divPesquisa.Visible  = __SessionWEB.__UsuarioWEB.GrupoPermissao.grp_consultar;
            _btnPesquisar.Visible = __SessionWEB.__UsuarioWEB.GrupoPermissao.grp_consultar;
        }

        UCComboPais.OnSelectedIndexChange = UCComboPais__IndexChanged;
    }