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); } } }
/// <summary> /// Carrega dados do relatório /// </summary> /// <param name="rea_id">ID do relatório</param> private void _LoadFromEntity(int gra_id) { try { VS_gra_id = gra_id; REL_GraficoAtendimento gra = new REL_GraficoAtendimento { gra_id = VS_gra_id }; REL_GraficoAtendimentoBO.GetEntity(gra); txtTitulo.Text = gra.gra_titulo; ddlTipo.Enabled = false; VS_rea_id = gra.rea_id; CLS_RelatorioAtendimento rea = new CLS_RelatorioAtendimento { rea_id = gra.rea_id }; CLS_RelatorioAtendimentoBO.GetEntity(rea); ddlTipo.SelectedValue = rea.rea_tipo.ToString(); ddlTipo_SelectedIndexChanged(null, null); UCComboRelatorioAtendimento.Valor = gra.rea_id; UCComboRelatorioAtendimento_SelectedIndexChanged(); UCComboRelatorioAtendimento.PermiteEditar = false; ddlTipoGrafico.SelectedValue = gra.gra_tipo.ToString(); ddlTipoGrafico.Enabled = false; ddlEixoAgrupamento.SelectedValue = gra.gra_eixo.ToString(); ddlEixoAgrupamento.Enabled = false; CarregaFiltrosFixos(); CarregaQuestionarios(); updFiltro.Update(); } catch (Exception ex) { ApplicationWEB._GravaErro(ex); ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "ScrollToTop", "setTimeout('window.scrollTo(0,0);', 0);", true); lblMessage.Text = UtilBO.GetErroMessage(GetGlobalResourceObject("Configuracao", "RelatorioAtendimento.Cadastro.ErroCarregarRelatorio").ToString(), UtilBO.TipoMensagem.Erro); } }