51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SQLite;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EFCDesk.Classes
|
|
{
|
|
internal class ErrorLog
|
|
{
|
|
public int Id { get; set; }
|
|
public string LineaError { get; set; }
|
|
public string Error { get; set; }
|
|
public string Comentarios { get; set; }
|
|
public string Fecha { get; set; }
|
|
|
|
public List<ErrorLog> GetRegistrosErrorLog(SQLiteHelper sqliteHelper)
|
|
{
|
|
var lista = new List<ErrorLog>();
|
|
|
|
using (var connection = sqliteHelper.GetConnection())
|
|
{
|
|
connection.Open();
|
|
string query = "SELECT Id, LineaError, Error, Comentario, Fecha FROM ErrorLog;";
|
|
|
|
using (var command = new SQLiteCommand(query, connection))
|
|
{
|
|
using (var reader = command.ExecuteReader())
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
lista.Add(new ErrorLog
|
|
{
|
|
Id = reader.GetInt32(0),
|
|
LineaError = reader.IsDBNull(1) ? "" : reader.GetString(1),
|
|
Error = reader.IsDBNull(2) ? "" : reader.GetString(2),
|
|
Comentarios = reader.IsDBNull(3) ? "" : reader.GetString(3),
|
|
Fecha = reader.IsDBNull(4) ? "" : reader.GetString(4)
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return lista;
|
|
}
|
|
|
|
|
|
}
|
|
}
|