/// <summary>
    /// Verifica se tem busca salva na sessão e realiza automaticamente, caso positivo.
    /// </summary>
    private void VerificaBusca()
    {
        if (__SessionWEB.BuscaRealizada.PaginaBusca == Pagina.AreaAdm_Usuario)
        {
            // Recuperar busca realizada e pesquisar automaticamente
            string valor;

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("ent_id", out valor);

            if (!string.IsNullOrEmpty(valor) && valor != Guid.Empty.ToString())
            {
                UCComboEntidade1.SetaEventoSource();
                UCComboEntidade1._Combo.DataBind();
                UCComboEntidade1._Combo.SelectedValue = valor;
            }

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("login", out valor);
            _txtLogin.Text = valor;

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("email", out valor);
            _txtEmail.Text = valor;

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("bloqueado", out valor);
            _ddlSituacao.SelectedValue = valor;

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("pessoa", out valor);
            _txtPessoa.Text = valor;

            _Pesquisar();
        }
        else
        {
            fdsResultado.Visible = false;
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool exibeComboEntidade = true;

            if (param.ContainsKey("ent_idVisible"))
            {
                exibeComboEntidade = Convert.ToBoolean(param["ent_idVisible"].ToString());
            }
            UCComboEntidade1.Visible = exibeComboEntidade;

            if (!IsPostBack)
            {
                fdsResultados.Visible = false;

                try
                {
                    UCComboEntidade1.Inicialize("Entidade");
                    UCComboEntidade1._Load(Guid.Empty, 1);
                    UCComboEntidade1._EnableValidator = false;
                }
                catch (Exception err)
                {
                    if (SetLogErro != null)
                    {
                        SetLogErro(err);
                    }
                    else
                    {
                        throw;
                    }
                }
            }
        }
Exemple #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string message = __SessionWEB.PostMessages;
            if (!String.IsNullOrEmpty(message))
            {
                _lblMessage.Text = message;
            }
            _uppCadastroSistema.Update();

            try
            {
                UCComboEntidade1.Inicialize("Entidade *");
                UCComboEntidade1._EnableValidator = true;
                UCComboEntidade1._Load(Guid.Empty, 0);
                UCComboEntidade1._ValidationGroup = "_vgCadastroSistemaEntidades";
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
                _uppCadastroSistema.Update();
            }

            if ((PreviousPage != null) && (PreviousPage.IsCrossPagePostBack))
            {
                //_txtsisnome.Enabled = false;
                _VS_sis_id = PreviousPage.EditItem_sis_id;
                _Carregar_dados();
            }
            else
            {
                _lblMessage.Text          = UtilBO.GetErroMessage("É necessário selecionar um sistema.", UtilBO.TipoMensagem.Alerta);
                _txtsisnome.Enabled       = false;
                _txtsiscaminho.Enabled    = false;
                _txturlintegracao.Enabled = false;

                _btnSalvar.Visible      = false;
                _btnAddEntidade.Enabled = false;

                _dgvSistemaEntidade.DataSource = new DataTable();
                _dgvSistemaEntidade.DataBind();
                _uppCadastroSistema.Update();

                this._btnSalvar.Visible = __SessionWEB.__UsuarioWEB.GrupoPermissao.grp_inserir;
            }
            Page.Form.DefaultButton = _btnSalvar.UniqueID;
        }
        ScriptManager sm = ScriptManager.GetCurrent(this);

        if (sm != null)
        {
            sm.Scripts.Add(new ScriptReference(ArquivoJS.MsgConfirmExclusao));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.PastaScriptRaiz + "Telas/jsEntidadesLigadas.js"));
        }
    }
    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;
            }
            _dgvUsuario.PageSize = ApplicationWEB._Paginacao;

            try
            {
                string ent_padrao = __SessionWEB.__UsuarioWEB.Usuario.ent_id.ToString();
                if (!string.IsNullOrEmpty(ent_padrao))
                {
                    UCComboEntidade1._Combo.SelectedValue = ent_padrao;
                }

                UCComboEntidade1.Inicialize("Entidade");
                UCComboEntidade1._Load(Guid.Empty, 1);
                UCComboEntidade1._EnableValidator = false;
                if (__SessionWEB.__UsuarioWEB.Grupo.vis_id == SysVisaoID.Administracao)
                {
                    UCComboEntidade1._Load(Guid.Empty, 0);
                }
                else
                {
                    UCComboEntidade1._LoadBy_UsuarioGrupoUA(Guid.Empty, __SessionWEB.__UsuarioWEB.Grupo.gru_id, __SessionWEB.__UsuarioWEB.Usuario.usu_id, 0);
                }
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
            }

            VerificaBusca();

            _divConsulta.Visible = __SessionWEB.__UsuarioWEB.GrupoPermissao.grp_consultar;
            _btnPesquisa.Visible = __SessionWEB.__UsuarioWEB.GrupoPermissao.grp_consultar;
            _btnNovo.Visible     = __SessionWEB.__UsuarioWEB.GrupoPermissao.grp_inserir;

            Page.Form.DefaultButton = _btnPesquisa.UniqueID;
            Page.Form.DefaultFocus  = UCComboEntidade1._Combo.ClientID;
        }
    }
Exemple #5
0
 public void _CarregarComboEntidade(bool MostraSelecione)
 {
     UCComboEntidade1.Inicialize(true
                                 , "Entidade"
                                 , String.Format("Entidade é obrigatório.")
                                 , "*"
                                 , String.Empty
                                 , true
                                 , new UCComboSelectItemMessage("-- Selecione uma entidade --", "-1")
                                 , true
                                 , new UCComboItemNotFoundMessage("-- Selecione uma entidade --", "-1"));
     UCComboEntidade1._EnableValidator = true;
     UCComboEntidade1._ValidationGroup = "OrgaoSupervisao";
     UCComboEntidade1._Load(Guid.Empty, 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_UA)
        {
            // Recuperar busca realizada e pesquisar automaticamente
            string valor;

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("tua_id", out valor);

            if (!string.IsNullOrEmpty(valor) && valor != Guid.Empty.ToString())
            {
                UCComboTipoUnidadeAdministrativa1.SetaEventoSource();
                UCComboTipoUnidadeAdministrativa1._Combo.DataBind();
                UCComboTipoUnidadeAdministrativa1._Combo.SelectedValue = valor;
            }

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("ent_id", out valor);

            if (!string.IsNullOrEmpty(valor) && valor != Guid.Empty.ToString())
            {
                UCComboEntidade1.SetaEventoSource();
                UCComboEntidade1._Combo.DataBind();
                UCComboEntidade1._Combo.SelectedValue = valor;
            }

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("uad_nome", out valor);
            _txtNome.Text = valor;

            __SessionWEB.BuscaRealizada.Filtros.TryGetValue("uad_codigo", out valor);
            _txtCodigo.Text = valor;

            _Pesquisar();
        }
        else
        {
            fdsResultados.Visible = false;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.fdsResultados.Visible = false;

            UCComboEntidade1.Inicialize("Entidade");
            UCComboEntidade1._EnableValidator   = false;
            UCComboEntidade1._ShowSelectMessage = true;
            UCComboEntidade1._Load(Guid.Empty, 0);

            this.UCComboTipoUnidadeAdministrativa1._ShowSelectMessage = true;
            this.UCComboTipoUnidadeAdministrativa1._Load(new Guid(), 0);

            this._dgvUA.PageSize = ApplicationWEB._Paginacao;

            if (!string.IsNullOrEmpty(this.Request.QueryString["ent_idObrigatorio"]))
            {
                if (new Guid(this.Request.QueryString["ent_idObrigatorio"]) == Guid.Empty)
                {
                    this._lblMessage.Text = UtilBO.GetErroMessage("Selecione uma entidade na tela principal.", UtilBO.TipoMensagem.Alerta);
                    _btnPesquisar.Visible = false;
                }
                else
                {
                    UCComboEntidade1._Combo.SelectedValue = this.Request.QueryString["ent_idObrigatorio"];
                    _btnPesquisar.Visible = true;
                }

                UCComboEntidade1._Label.CssClass = "hide";
                UCComboEntidade1._Combo.CssClass = "hide";
            }

            if (this.Request["ent_id"] != null)
            {
                UCComboEntidade1._Combo.SelectedValue = this.Request["ent_id"].ToString();
            }

            if (this.Request["entEnabled"] != null)
            {
                if (!Convert.ToBoolean(this.Request["entEnabled"].ToString()))
                {
                    UCComboEntidade1._Label.CssClass = "hide"; // Visible = Convert.ToBoolean(this.Request["entEnabled"].ToString());
                    UCComboEntidade1._Combo.CssClass = "hide"; // Visible = Convert.ToBoolean(this.Request["entEnabled"].ToString());
                }
            }

            if (this.Request["tua_id"] != null)
            {
                UCComboTipoUnidadeAdministrativa1._Combo.SelectedValue = this.Request["tua_id"].ToString();
            }

            if (this.Request["tuaEnabled"] != null)
            {
                if (!Convert.ToBoolean(this.Request["tuaEnabled"].ToString()))
                {
                    UCComboTipoUnidadeAdministrativa1._Label.CssClass = "hide"; // Visible = Convert.ToBoolean(this.Request["entEnabled"].ToString());
                    UCComboTipoUnidadeAdministrativa1._Combo.CssClass = "hide"; // Visible = Convert.ToBoolean(this.Request["entEnabled"].ToString());
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptManager sm = ScriptManager.GetCurrent(this);

        if (sm != null)
        {
            sm.Scripts.Add(new ScriptReference(ArquivoJS.CamposData));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.JqueryMask));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.MascarasCampos));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.JQueryValidation));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.PastaScriptRaiz + "Telas/jsLogin.js"));

            if (__SessionWEB.TemaPadraoLogado.tep_tipoLogin == (byte)CFG_TemaPadrao.eTipoLogin.SobrescreveLabel)
            {
                sm.Scripts.Add(new ScriptReference(ArquivoJS.PastaScriptRaiz + "Telas/jsLoginRio.js"));
            }

            if (__SessionWEB.TemaPadraoLogado.tep_tipoLogin == (byte)CFG_TemaPadrao.eTipoLogin.CorrigeLayout)
            {
                sm.Scripts.Add(new ScriptReference(ArquivoJS.PastaScriptRaiz + "Telas/jsLoginIntranetSme.js"));
            }
        }

        fdsMensagem.Visible = false;
        fdsLogin.Attributes.Remove("style");

        if (!IsPostBack)
        {
            try
            {
                if (!String.IsNullOrEmpty((SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.MENSAGEM_ALERTA_PRELOGIN))))
                {
                    spnMensagemUsuario.InnerHtml = HttpUtility.HtmlDecode(SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.MENSAGEM_ALERTA_PRELOGIN));
                    fdsMensagem.Visible          = true;
                    fdsLogin.Attributes["style"] = "display:none;";
                    btnFechar.OnClientClick      = "$('.fdsMensagem').hide();" +
                                                   "$('#" + fdsLogin.ClientID + "').show();" +
                                                   "$('#login').find('select,input').first().focus();" +
                                                   "return false;";
                    btnFechar.Focus();
                }
                else
                {
                    Page.Form.DefaultButton = _btnEntrar.UniqueID;
                    fdsMensagem.Visible     = false;
                }

                UCComboEntidade1.Inicialize("Entidade *");
                UCComboEntidade1._EnableValidator = true;
                UCComboEntidade1._ValidationGroup = "Login";
                UCComboEntidade1._LoadBy_SistemaEntidade(Guid.Empty, 1);

                UCComboEntidade2.Inicialize("Entidade *");
                UCComboEntidade2._EnableValidator = true;
                UCComboEntidade2._ValidationGroup = "EsqueciSenha";
                UCComboEntidade2._LoadBy_SistemaEntidade(Guid.Empty, 1);

                if (UserIsAuthenticated())
                {
                    RedirecionarLogin(__SessionWEB.__UsuarioWEB.Usuario.usu_id);
                }
            }
            catch (Exception ex)
            {
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);

                ApplicationWEB._GravaErro(ex);
            }
        }

        UtilBO.RegistraGATC(this.Page);
    }
Exemple #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool exibeComboEntidade = true;

            if (param.ContainsKey("ent_idVisible"))
            {
                exibeComboEntidade = Convert.ToBoolean(param["ent_idVisible"].ToString());
            }
            UCComboEntidade1.Visible = exibeComboEntidade;

            bool exibeComboTipoUA = true;

            if (param.ContainsKey("tua_idVisible"))
            {
                exibeComboTipoUA = Convert.ToBoolean(param["tua_idVisible"].ToString());
            }
            UCComboTipoUnidadeAdministrativa1.Visible = exibeComboTipoUA;

            if (param.ContainsKey("gru_id") && param.ContainsKey("vis_id") && param.ContainsKey("usu_id"))
            {
                int vis_id = Convert.ToInt32(param["vis_id"].ToString());

                if (vis_id != SysVisaoID.Administracao)
                {
                    odsUA.SelectMethod = "GetSelectBy_PermissaoUsuario";
                }
            }

            if (!IsPostBack)
            {
                try
                {
                    fdsResultados.Visible = false;

                    UCComboEntidade1._EnableValidator   = false;
                    UCComboEntidade1._ShowSelectMessage = true;
                    UCComboEntidade1._Load(Guid.Empty, 0);

                    UCComboTipoUnidadeAdministrativa1._EnableValidator   = false;
                    UCComboTipoUnidadeAdministrativa1._ShowSelectMessage = true;
                    UCComboTipoUnidadeAdministrativa1._Load(Guid.Empty, 0);
                }
                catch (Exception err)
                {
                    if (SetLogErro != null)
                    {
                        SetLogErro(err);
                    }
                    else
                    {
                        throw;
                    }
                }
            }

            if (exibeComboEntidade)
            {
                Page.Form.DefaultFocus = UCComboEntidade1._Combo.ClientID;
            }
            else if (exibeComboTipoUA)
            {
                Page.Form.DefaultFocus = UCComboTipoUnidadeAdministrativa1._Combo.ClientID;
            }
            else
            {
                Page.Form.DefaultFocus = _txtNome.ClientID;
            }

            Page.Form.DefaultButton = _btnPesquisar.UniqueID;
        }
Exemple #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ScriptManager sm = ScriptManager.GetCurrent(this);

            if (sm != null)
            {
                sm.Scripts.Add(new ScriptReference("~/includes/jsLogin.js"));
            }

            // Limpa a mensagem caso seja postback.
            fdsMensagem.Visible = false;
            fdsLogin.Attributes.Remove("style");

            if (!IsPostBack)
            {
                try
                {
                    // Setar a mensagem na frente do login.
                    if (!String.IsNullOrEmpty((SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.MENSAGEM_ALERTA_PRELOGIN))))
                    {
                        spnMensagemUsuario.InnerHtml = HttpUtility.HtmlDecode(SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.MENSAGEM_ALERTA_PRELOGIN));
                        fdsMensagem.Visible          = true;
                        fdsLogin.Attributes["style"] = "display:none;";
                        btnFechar.OnClientClick      = "$('.fdsMensagem').hide();" +
                                                       "$('#" + fdsLogin.ClientID + "').show();" +
                                                       "$('#login').find('select,input').first().focus();" +
                                                       "return false;";
                        btnFechar.Focus();
                    }
                    else
                    {
                        Page.Form.DefaultButton = btnEntrar.UniqueID;
                        fdsMensagem.Visible     = false;
                    }

                    UCComboEntidade1.ValidationGroup = "Login";
                    UCComboEntidade1.Obrigatorio     = true;
                    UCComboEntidade1.CarregarPorEntidadeSituacao(Guid.Empty, 1);
                    UCComboEntidade1.Visible = UCComboEntidade1.MostrarCombo;

                    UCComboEntidade2.ValidationGroup = "EsqueciSenha";
                    UCComboEntidade2.Obrigatorio     = true;
                    UCComboEntidade2.CarregarPorEntidadeSituacao(Guid.Empty, 1);
                    UCComboEntidade2.Visible = UCComboEntidade2.MostrarCombo;

                    VerificaAcessoInfantil();

                    // Verifica se usuário está autenticado, caso esteja redireciona para o sistema
                    if (UserIsAuthenticated())
                    {
                        RedirecionarLogin(false);
                    }
                }
                catch (Exception ex)
                {
                    lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);

                    ApplicationWEB._GravaErro(ex);
                }

                // Configuração utilizando o parâmetro "Expressão regular para validar o tamanho da senha do usuário"
                revSenhaTamanho.ValidationExpression = SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.TAMANHO_SENHA_USUARIO);
                revSenhaTamanho.ErrorMessage         = String.Format(revSenhaTamanho.ErrorMessage, UtilBO.GetMessageTamanhoByRegex(revSenhaTamanho.ValidationExpression));
            }

            // Registra o GATC para a página de Login.
            UtilBO.RegistraGATC(this.Page);
        }
    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));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.PastaScriptRaiz + "Telas/jsUCCadastroContato.js"));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.PastaScriptRaiz + "Telas/jsUCCadastroEndereco.js"));
            sm.Services.Add(new ServiceReference("~/WSServicos.asmx"));
        }

        UCComboTemaPadrao.IndexChanged += UCComboTemaPadrao_IndexChanged;

        if (!IsPostBack)
        {
            try
            {
                // Validação para utilização de múltiplos endereços para a entidade
                bool permitirMultiplosEnderecos = SYS_ParametroBO.ParametroValorBooleano(SYS_ParametroBO.eChave.PERMITIR_MULTIPLOS_ENDERECOS_ENTIDADE);
                UCEnderecos1.Inicializar(false, !permitirMultiplosEnderecos, "Entidade");

                UCComboTipoEntidade1.Inicialize("Tipo de entidade *");
                UCComboTipoEntidade1._EnableValidator = true;
                UCComboTipoEntidade1._ValidationGroup = "Endereco";
                UCComboTipoEntidade1._Load(0);

                UCComboTemaPadrao.Carregar();
                UCComboTemaPadrao_IndexChanged();

                if ((PreviousPage != null) && (PreviousPage.IsCrossPagePostBack))
                {
                    _VS_ent_id = PreviousPage.EditItem;

                    _LoadFromEntity();

                    _chkBloqueado.Visible  = true;
                    Page.Form.DefaultFocus = _txtRazaoSocial.ClientID;
                }
                else
                {
                    UCGridContato1._CarregarContato();

                    _chkBloqueado.Visible = false;
                    _chkBloqueado.Checked = false;

                    _VS_IsNew_end_id = true;

                    Page.Form.DefaultFocus  = UCComboTipoEntidade1._Combo.ClientID;
                    this._btnSalvar.Visible = __SessionWEB.__UsuarioWEB.GrupoPermissao.grp_inserir;
                }

                UCComboEntidade1.Inicialize("Entidade superior");
                UCComboEntidade1._EnableValidator = false;
                UCComboEntidade1._Load(_VS_ent_id, 0);

                Page.Form.DefaultButton = _btnSalvar.UniqueID;
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptManager sm = ScriptManager.GetCurrent(this);

        if (sm != null)
        {
            sm.Scripts.Add(new ScriptReference(ArquivoJS.PastaScriptRaiz + "Telas/jsUCCadastroContato.js"));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.PastaScriptRaiz + "Telas/jsUCCadastroEndereco.js"));
            sm.Services.Add(new ServiceReference("~/WSServicos.asmx"));
        }

        if (!IsPostBack)
        {
            string ent_padrao = __SessionWEB.__UsuarioWEB.Usuario.ent_id.ToString();
            SetFocus(UCComboTipoUnidadeAdministrativa1);
            try
            {
                // Validação para utilização de múltiplos endereços para a unidade administrativa
                bool permitirMultiplosEnderecos = SYS_ParametroBO.ParametroValorBooleano(SYS_ParametroBO.eChave.PERMITIR_MULTIPLOS_ENDERECOS_UA);
                UCEnderecos1.Inicializar(false, !permitirMultiplosEnderecos, string.Empty);

                if (!string.IsNullOrEmpty(ent_padrao))
                {
                    _VS_ent_id = new Guid(ent_padrao);
                }

                UCComboEntidade1._ShowSelectMessage = true;
                if (__SessionWEB.__UsuarioWEB.Grupo.vis_id == SysVisaoID.Administracao)
                {
                    UCComboEntidade1._Load(Guid.Empty, 0);
                }
                else
                {
                    UCComboEntidade1._LoadBy_UsuarioGrupoUA(Guid.Empty, __SessionWEB.__UsuarioWEB.Grupo.gru_id, __SessionWEB.__UsuarioWEB.Usuario.usu_id, 0);
                }

                UCComboEntidade1.Inicialize("Entidade *");

                UCComboEntidade1._Combo.SelectedValue = string.IsNullOrEmpty(ent_padrao) ? Guid.Empty.ToString() : ent_padrao;

                UCComboTipoUnidadeAdministrativa1._ShowSelectMessage = true;
                UCComboTipoUnidadeAdministrativa1._Load(Guid.Empty, 0);
                UCComboTipoUnidadeAdministrativa1.Inicialize("Tipo de unidade administrativa *");

                if ((PreviousPage != null) && PreviousPage.IsCrossPagePostBack)
                {
                    _VS_ent_id = PreviousPage.EditItem_ent_id;
                    _VS_uad_id = PreviousPage.EditItem_uad_id;

                    _LoadFromEntity();

                    _chkBloqueado.Visible = true;

                    Page.Form.DefaultFocus = _txtNome.ClientID;
                }
                else
                {
                    UCGridContato1._CarregarContato();

                    _chkBloqueado.Visible = false;
                    _chkBloqueado.Checked = false;

                    _VS_IsNew_end_id = true;

                    Page.Form.DefaultFocus = UCComboEntidade1._Combo.ClientID;

                    this._btnSalvar.Visible = __SessionWEB.__UsuarioWEB.GrupoPermissao.grp_inserir;
                }

                UCUASuperior.VsGruId = __SessionWEB.__UsuarioWEB.Grupo.gru_id;
                UCUASuperior.VsUsuId = __SessionWEB.__UsuarioWEB.Usuario.usu_id;
                UCUASuperior.VsVisId = __SessionWEB.__UsuarioWEB.Grupo.vis_id;

                Page.Form.DefaultButton = _btnSalvar.UniqueID;
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
            }
        }

        if (__SessionWEB.__UsuarioWEB.Grupo.vis_id == SysVisaoID.UnidadeAdministrativa)
        {
            UCComboEntidade1._Combo.Enabled = false;
        }

        Delegates();

        UCComboEntidade1.OnSelectedIndexChange += UCComboEntidade1__IndexChanged;
    }