Beispiel #1
0
    protected void _dgvLogs_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton btnAlterar = (LinkButton)e.Row.FindControl("_btnAlterar");
            if (btnAlterar != null)
            {
                btnAlterar.CommandArgument = e.Row.RowIndex.ToString();

                Guid      err_id = new Guid(_dgvLogs.DataKeys[e.Row.RowIndex].Value.ToString());
                LOG_Erros entity = new LOG_Erros
                {
                    err_id = err_id
                };
                LOG_ErrosBO.GetEntity(entity);

                string descricao = entity.err_descricao;
                descricao = descricao.Replace("\r\n", "\\n");
                descricao = descricao.Replace("\\", "\\\\");
                descricao = descricao.Replace("\\\\n", "\\n");
                descricao = descricao.Replace("'", "\"");

                btnAlterar.OnClientClick = "javascript:ExibirDescricao(this, '" + descricao + "'); return false;";
            }
        }
    }
Beispiel #2
0
 protected void _dgvLogs_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("Download"))
     {
         try
         {
             Guid      guid   = new Guid(e.CommandArgument.ToString());
             LOG_Erros entity = new LOG_Erros
             {
                 err_id = guid
             };
             LOG_ErrosBO.GetEntity(entity);
             string fileName = String.Format("Log_{0}_{1}_{2}.txt"
                                             , entity.err_dataHora.Year
                                             , entity.err_dataHora.Month
                                             , entity.err_dataHora.Day);
             List <LOG_Erros> lt = new List <LOG_Erros>();
             lt.Add(entity);
             _Exportar_ArquivoTXT(lt, fileName);
         }
         catch (ThreadAbortException)
         {
         }
         catch (Exception err)
         {
             ApplicationWEB._GravaErro(err);
             _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar baixar o log de erros.", UtilBO.TipoMensagem.Alerta);
         }
     }
 }