コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                UCComboSistemas1._ShowSelectMessage = true;
                UCComboSistemas1.Inicialize("Sistema *");
                UCComboSistemas1._Load();
                UCComboVisao1._ShowSelectMessage = true;
                UCComboVisao1.Inicialize("Visão *");

                UCComboGrupo1._ShowSelectMessage = true;
                UCComboGrupo1.Inicialize("Copiar permissões de outro grupo?");
                UCComboGrupo1._EnableValidator     = false;
                UCComboGrupo1._SelecionaAutomatico = false;
                UCComboGrupo1._Load(-1, -1);

                UCComboGrupo2._ShowSelectMessage = true;
                UCComboGrupo2.Inicialize("Associar usuários de outro grupo?");
                UCComboGrupo2._EnableValidator     = false;
                UCComboGrupo2._SelecionaAutomatico = false;
                UCComboGrupo2._Load(-1, -1);

                UCComboGrupo1._Combo.Enabled = false;
                UCComboGrupo2._Combo.Enabled = false;
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
            }

            if ((PreviousPage != null) && (PreviousPage.IsCrossPagePostBack))
            {
                _LoadFromEntity(PreviousPage.EditItem);
                _chkBloqueado.Visible = true;
            }
            else
            {
                _chkBloqueado.Visible   = false;
                _chkBloqueado.Checked   = false;
                this._btnSalvar.Visible = __SessionWEB.__UsuarioWEB.GrupoPermissao.grp_inserir;
            }

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

        UCComboSistemas1.OnSelectedIndexChange = UCComboSistemas1__IndexChanged;
        UCComboVisao1.OnSelectedIndexChange    = UCComboVisao1__IndexChanged;
    }
コード例 #2
0
    private void UCComboVisao1__IndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (UCComboSistemas1._Combo.SelectedValue != "-1" && UCComboVisao1._Combo.SelectedValue != "-1")
            {
                UCComboGrupo1._Combo.Items.Clear();
                UCComboGrupo1._ShowSelectMessage   = true;
                UCComboGrupo1._Combo.Enabled       = true;
                UCComboGrupo1._SelecionaAutomatico = false;
                UCComboGrupo1._Load(Convert.ToInt32(UCComboSistemas1._Combo.SelectedValue), Convert.ToInt32(UCComboVisao1._Combo.SelectedValue));
            }
            else
            {
                UCComboGrupo1._Combo.SelectedValue = Guid.Empty.ToString();
                UCComboGrupo1._Combo.Enabled       = false;
            }

            if (UCComboVisao1._Combo.SelectedValue != "-1")
            {
                UCComboGrupo2._Combo.Items.Clear();
                UCComboGrupo2._ShowSelectMessage   = true;
                UCComboGrupo2._Combo.Enabled       = true;
                UCComboGrupo2._SelecionaAutomatico = false;
                UCComboGrupo2._Load(-1, Convert.ToInt32(UCComboVisao1._Combo.SelectedValue));
            }
            else
            {
                UCComboGrupo2._Combo.SelectedValue = Guid.Empty.ToString();
                UCComboGrupo2._Combo.Enabled       = false;
            }
        }
        catch (Exception ex)
        {
            ApplicationWEB._GravaErro(ex);
            _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
        }
        finally
        {
            _updGrupos.Update();
        }
    }