Add: Clear 6 months data out of the archive table on generate report.

This commit is contained in:
kougyoku 2019-10-31 09:25:43 -07:00
parent 7783443480
commit ffcf4fc413
1 changed files with 6 additions and 1 deletions

View File

@ -33,6 +33,7 @@ namespace QueueSys
public int id { get; set; }
public string customer_name { get; set; }
}
public class StatusModel
{
public string status { get; set; }
@ -121,7 +122,11 @@ namespace QueueSys
{
using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
{
string strQuery = "SELECT *,Cast ((JulianDay(end_time) - JulianDay(start_time)) * 24 * 60 As Integer) as time_elapsed from archive";
//Clear old customers from the archive table.
string strQuery = "DELETE FROM archive WHERE julianday(end_time) < julianday('now','-6 months')";
cnn.Execute(strQuery);
strQuery = "SELECT *,Cast ((JulianDay(end_time) - JulianDay(start_time)) * 24 * 60 As Integer) as time_elapsed from archive";
var output = cnn.Query<ReportView>(strQuery, new DynamicParameters());
return output.ToList();