[chronojump] Method to select RunsInterval as a List<T>
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Method to select RunsInterval as a List<T>
- Date: Tue, 23 Mar 2021 15:43:13 +0000 (UTC)
commit 897c8e9bbc010c4c438cd1603fe0a6a833717260
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Mar 23 16:42:59 2021 +0100
Method to select RunsInterval as a List<T>
src/exportFiles/sprint.cs | 5 +++++
src/sqlite/runInterval.cs | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+)
---
diff --git a/src/exportFiles/sprint.cs b/src/exportFiles/sprint.cs
index 23b8ebd2..2cf4c129 100644
--- a/src/exportFiles/sprint.cs
+++ b/src/exportFiles/sprint.cs
@@ -27,6 +27,8 @@ using System.Threading;
public class SprintExport : ExportFiles
{
+ private List<RunInterval> ri_l;
+
//constructor
public SprintExport (
Gtk.Notebook notebook,
@@ -54,11 +56,14 @@ public class SprintExport : ExportFiles
protected override void createOrEmptyDirs()
{
+ createOrEmptyDir(getTempProgressDir());
createOrEmptyDir(getTempGraphsDir());
}
protected override bool getData ()
{
+ ri_l = SqliteRunInterval.SelectRuns (false, sessionID, personID, "");
+
}
}
diff --git a/src/sqlite/runInterval.cs b/src/sqlite/runInterval.cs
index 69cde62d..45d6b7df 100644
--- a/src/sqlite/runInterval.cs
+++ b/src/sqlite/runInterval.cs
@@ -22,6 +22,7 @@ using System;
using System.Data;
using System.IO;
using System.Collections; //ArrayList
+using System.Collections.Generic; //List
using Mono.Data.Sqlite;
@@ -116,6 +117,48 @@ class SqliteRunInterval : SqliteRun
" ORDER BY upper(" + tp + ".name), runInterval.uniqueID";
}
+ //like SelectRunsSA below method but much better: return list of RunInterval
+ public static List<RunInterval> SelectRuns (bool dbconOpened, int sessionID, int personID, string
filterType)
+ {
+ if(!dbconOpened)
+ Sqlite.Open();
+
+ dbcmd.CommandText = selectRunsIntervalCreateSelection (sessionID, personID, filterType);
+
+ LogB.SQL(dbcmd.CommandText.ToString());
+ dbcmd.ExecuteNonQuery();
+
+ SqliteDataReader reader;
+ reader = dbcmd.ExecuteReader();
+
+ List<RunInterval> ri_l = new List<RunInterval>();
+
+ while(reader.Read())
+ ri_l.Add(new RunInterval(
+ Convert.ToInt32(reader[1].ToString()), //runInterval.uniqueID
+ Convert.ToInt32(reader[2].ToString()), //runInterval.personID
+ Convert.ToInt32(reader[3].ToString()), //runInterval.sessionID
+ reader[4].ToString(), //runInterval.type
+ Convert.ToDouble(Util.ChangeDecimalSeparator(reader[5].ToString())),
//distanceTotal
+ Convert.ToDouble(Util.ChangeDecimalSeparator(reader[6].ToString())),
//timeTotal
+ Convert.ToDouble(Util.ChangeDecimalSeparator(reader[7].ToString())),
//distanceInterval
+ Util.ChangeDecimalSeparator(reader[8].ToString()),
//intervalTimesString
+ Convert.ToDouble(Util.ChangeDecimalSeparator(reader[9].ToString())),
//tracks
+ reader[10].ToString(), //description
+ reader[11].ToString(), //limited
+ Convert.ToInt32(reader[12].ToString()), //simulated
+ Util.IntToBool(Convert.ToInt32(reader[13])), //initialSpeed
+ reader[14].ToString() //datetime
+ ));
+
+ reader.Close();
+
+ if(!dbconOpened)
+ Sqlite.Close();
+
+ return ri_l;
+ }
+
//method that retruns an string array
public static string[] SelectRunsSA (bool dbconOpened, int sessionID, int personID, string filterType)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]