Exemplo n.º 1
0
 protected override void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             if (this.PaginaSegura)
             {
                 if ((Contexto.Seguranca == null) || (!Contexto.Seguranca.Ler(Page.GetType().BaseType.Name)))
                 {
                     Response.Redirect("AcessoNegado.aspx");
                 }
             }
             //PopularGridView();
             SetarModoPagina(ModosPagina.Listar);
             DefinirCamposBusca();
             ProTextBox txtBusca = (ProTextBox)this.LocalizarControle("txtBusca", this.Controls);
             Focus(txtBusca);
             //base.Page_Load(sender, e);
         }
     }
     catch (Exception ex)
     {
         ExibirExcecao(ex);
     }
 }
Exemplo n.º 2
0
 protected override void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             if (PaginaSegura)
             {
                 if (!Contexto.Seguranca.Ler(this.GetType().BaseType.Name))
                 {
                     ProPanel pnlConsulta = (ProPanel)this.LocalizarControle("pnlConsultaUC", this.Controls);
                     if (pnlConsulta != null)
                     {
                         pnlConsulta.Visible = false;
                     }
                     return;
                 }
             }
             PopularGridView();
             SetarModoPagina(ModosPagina.Listar);
             ProTextBox txtBusca = (ProTextBox)this.LocalizarControle("txtBusca", this.Controls);
             if (txtBusca != null)
             {
                 Focus(txtBusca);
             }
         }
     }
     catch (Exception ex)
     {
         ExibirExcecao(ex);
     }
 }
Exemplo n.º 3
0
 protected virtual void PopularGridView()
 {
     try
     {
         Label           lblBusca    = (Label)this.LocalizarControle("lblBusca", this.Controls);
         ProTextBox      txtBusca    = (ProTextBox)this.LocalizarControle("txtBusca", this.Controls);
         ProPanel        pnlConsulta = (ProPanel)this.LocalizarControle("pnlConsulta", this.Controls);
         ProGridView     grdListagem = (ProGridView)this.LocalizarControle("grdListagem", this.Controls);
         ProDropDownList ddlCampoBusca;
         grdListagem.SelectedIndex = -1;
         if (this.LocalizarControle("ddlCampoBusca", this.Controls) != null)
         {
             ddlCampoBusca = (ProDropDownList)this.LocalizarControle("ddlCampoBusca", this.Controls);
             if ((ddlCampoBusca.SelectedIndex != -1) && (ddlCampoBusca.Visible))
             {
                 txtBusca.DataField = ddlCampoBusca.SelectedItem.Value;
             }
         }
         else
         {
             lblBusca.Text      = grdListagem.Columns[grdListagem.SortColumnIndex].HeaderText + " : ";
             txtBusca.DataField = grdListagem.SortColumnName;
         }
         grdListagem.DataBind(this.Controladora.Consultar(pnlConsulta.GetFormData(), grdListagem.SortByDirection.ToString(), grdListagem.SortColumnName));
     }
     catch (Exception ex)
     {
         ExibirExcecao(ex);
     }
 }
Exemplo n.º 4
0
        protected void PreencherIdPaiManutencao()
        {
            ProTextBox txtIdPaiManutencao = (ProTextBox)this.LocalizarControle("txtIdPaiManutencao", this.Controls);

            if ((txtIdPaiManutencao != null) && (IdPai != null))
            {
                txtIdPaiManutencao.Text = this.IdPai.ToString();
            }
            else
            {
                txtIdPaiManutencao.Text = string.Empty;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Seta os métodos dos botões e controles da página de cadastro
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void Page_Init(object sender, EventArgs e)
        {
            try
            {
                Button btnExcluir = (Button)this.LocalizarControle("btnExcluirUC", this.Controls);
                btnExcluir.OnClientClick = "messageBox(this,'PERGUNTA','SIMNAO','Confirmação de exclusão','Deseja realmente excluir este item ?',''); return false;";
                btnExcluir.Click        += new EventHandler(btnExcluir_Click);

                Button btnSalvar = (Button)this.LocalizarControle("btnSalvarUC", this.Controls);
                btnSalvar.Click += new EventHandler(btnSalvar_Click);

                Button btnListagem = (Button)this.LocalizarControle("btnListagemUC", this.Controls);
                if (btnListagem != null)
                {
                    btnListagem.Click += new EventHandler(btnListagem_Click);
                }

                Button btnNovo = (Button)this.LocalizarControle("btnNovoUC", this.Controls);
                btnNovo.Click += new EventHandler(btnNovo_Click);

                Button btnNovoCadastro = (Button)this.LocalizarControle("btnNovoCadastroUC", this.Controls);
                if (btnNovoCadastro != null)
                {
                    btnNovoCadastro.Click += new EventHandler(btnNovo_Click);
                }

                Button btnBuscar = (Button)this.LocalizarControle("btnBuscarUC", this.Controls);
                if (btnBuscar != null)
                {
                    btnBuscar.Click += new EventHandler(btnBuscar_Click);
                }

                ProTextBox txtBusca = (ProTextBox)this.LocalizarControle("txtBuscaUC", this.Controls);
                if (txtBusca != null)
                {
                    txtBusca.Attributes.Add("onkeypress", "if(event.which || event.keyCode){if((event.which == 13) || (event.keyCode == 13)){event.keyCode=0; document.getElementById('" + btnBuscar.ClientID + "').click();return false;}else{return true;}}");
                }

                ProGridView grdListagem = (ProGridView)this.LocalizarControle("grdListagemUC", this.Controls);
                grdListagem.SelectedIndexChanged += new EventHandler(grdListagem_SelectedIndexChanged);
                grdListagem.PageIndexChanging    += new GridViewPageEventHandler(grdListagem_PageIndexChanging);
                grdListagem.RowEditing           += new GridViewEditEventHandler(grdListagem_RowEditing);
                grdListagem.RowCommand           += new GridViewCommandEventHandler(grdListagem_RowCommand);
                grdListagem.RowDeleting          += new GridViewDeleteEventHandler(grdListagem_RowDeleting);
                grdListagem.Sorting += new GridViewSortEventHandler(grdListagem_Sorting);
            }
            catch (Exception ex)
            {
                ExibirExcecao(ex);
            }
        }
Exemplo n.º 6
0
        protected void BotaoNovoAtivo()
        {
            ProTextBox txtIdPaiConsulta = (ProTextBox)this.LocalizarControle("txtIdPaiConsulta", this.Controls);
            Button     btnNovoUC        = (Button)this.LocalizarControle("btnNovoUC", this.Controls);

            if (txtIdPaiConsulta != null)
            {
                if (btnNovoUC != null)
                {
                    btnNovoUC.Enabled = IdPai != null;
                }
            }
            else
            {
                txtIdPaiConsulta.Text = string.Empty;
            }
        }
Exemplo n.º 7
0
 protected virtual void PopularGridView()
 {
     try
     {
         Label       lblBusca    = (Label)this.LocalizarControle("lblBusca", this.Controls);
         ProTextBox  txtBusca    = (ProTextBox)this.LocalizarControle("txtBusca", this.Controls);
         ProPanel    pnlConsulta = (ProPanel)this.LocalizarControle("pnlConsulta", this.Controls);
         ProGridView grdListagem = (ProGridView)this.LocalizarControle("grdListagem", this.Controls);
         grdListagem.SelectedIndex = -1;
         lblBusca.Text             = grdListagem.Columns[grdListagem.SortColumnIndex].HeaderText + " : ";
         txtBusca.DataField        = grdListagem.SortColumnName;
         grdListagem.DataBind(this.Controladora.Consultar(pnlConsulta.GetFormData(), grdListagem.SortByDirection.ToString()));
     }
     catch (Exception ex)
     {
         ExibirExcecao(ex);
     }
 }
Exemplo n.º 8
0
 protected override void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             PopularGridView();
             SetarModoPagina(ModosPagina.Listar);
             ProTextBox txtBusca = (ProTextBox)this.LocalizarControle("txtBusca", this.Controls);
             if (txtBusca != null)
             {
                 Focus(txtBusca);
             }
         }
     }
     catch (Exception ex)
     {
         ExibirExcecao(ex);
     }
 }
Exemplo n.º 9
0
        protected void PreencherIdPaiConsulta()
        {
            ProTextBox txtIdPaiConsulta = (ProTextBox)this.LocalizarControle("txtIdPaiConsulta", this.Controls);

            if (txtIdPaiConsulta != null)
            {
                if (IdPai != null)
                {
                    txtIdPaiConsulta.Text = this.IdPai.ToString();
                }
                else
                {
                    txtIdPaiConsulta.Text = "0";
                }
            }
            else
            {
                txtIdPaiConsulta.Text = string.Empty;
            }
        }
Exemplo n.º 10
0
 protected override void PopularGridView()
 {
     try
     {
         Label       lblBusca    = (Label)this.LocalizarControle("lblBusca", this.Controls);
         ProTextBox  txtBusca    = (ProTextBox)this.LocalizarControle("txtBusca", this.Controls);
         ProPanel    pnlConsulta = (ProPanel)this.LocalizarControle("pnlConsulta", this.Controls);
         ProGridView grdListagem = (ProGridView)this.LocalizarControle("grdListagem", this.Controls);
         grdListagem.SelectedIndex = -1;
         lblBusca.Text             = grdListagem.Columns[grdListagem.SortColumnIndex].HeaderText + " : ";
         txtBusca.DataField        = grdListagem.SortColumnName;
         Dictionary <string, object> dct = pnlConsulta.GetFormData();
         foreach (KeyValuePair <string, int> kvp in this.Filtros)
         {
             dct.Add(kvp.Key, kvp.Value);
         }
         grdListagem.DataBind(this.Controladora.Consultar(dct, grdListagem.SortByDirection.ToString()));
     }
     catch (Exception ex)
     {
         ExibirExcecao(ex);
     }
 }