Example #1
0
        protected void grvDados_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Deletar")
            {
                try
                {
                    int index  = int.Parse(e.CommandArgument.ToString());
                    int gra_id = Convert.ToInt32(grvDados.DataKeys[index].Value.ToString());

                    REL_GraficoAtendimento entity = new REL_GraficoAtendimento {
                        gra_id = gra_id
                    };
                    REL_GraficoAtendimentoBO.GetEntity(entity);

                    if (REL_GraficoAtendimentoBO.Delete(entity))
                    {
                        grvDados.PageIndex = 0;
                        Pesquisar();
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Delete, "gra_id: " + gra_id);
                        lblMessage.Text = UtilBO.GetErroMessage("Gráfico excluído com sucesso.", UtilBO.TipoMensagem.Sucesso);
                    }
                }
                catch (ValidationException ex)
                {
                    lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
                }
                catch (Exception ex)
                {
                    ApplicationWEB._GravaErro(ex);
                    lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar excluir o gráfico.", UtilBO.TipoMensagem.Erro);
                }
            }
        }