Exemple #1
0
        /// <summary>
        /// Controle do rowcommand da grid e tratamentos necessarios.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridViewCommandEventArgs"/> instance containing the event data.</param>
        protected void grvObservacoes_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Deletar")
            {
                try
                {
                    int index  = int.Parse(e.CommandArgument.ToString());
                    int obb_id = Convert.ToInt32(grvObservacoes.DataKeys[index].Values[0]);

                    CFG_ObservacaoBoletim entity = new CFG_ObservacaoBoletim {
                        obb_id = obb_id,
                        ent_id = __SessionWEB.__UsuarioWEB.Usuario.ent_id
                    };

                    if (CFG_ObservacaoBoletimBO.Delete(entity))
                    {
                        grvObservacoes.PageIndex = 0;
                        grvObservacoes.DataBind();
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Delete, "obb_id: " + obb_id);
                        lblMessage.Text = UtilBO.GetErroMessage("Observação do boletim 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 excluir observação do boletim.", UtilBO.TipoMensagem.Erro);
                }
            }
        }