[chronojump] Sqlite selection for jump DJa



commit df1a4602456a102b2a0f1abf7b4f50662a488097
Author: JordiRodeiro <jordirodeiro gmail com>
Date:   Thu Dec 5 14:33:51 2019 +0100

    Sqlite selection for jump DJa

 src/gui/chronojump.cs |  2 ++
 src/sqlite/jump.cs    | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 2cc0802c..6a5c2070 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -6985,6 +6985,8 @@ LogB.Debug("mc finished 5");
        
        private void on_button_carles_clicked (object o, EventArgs args)
        {
+               if (currentPerson == null || currentSession == null) return;
+               SqliteJump.SelectDJa (currentPerson.UniqueID, currentSession.UniqueID);
                /*
                bool showInWindow = true;
 
diff --git a/src/sqlite/jump.cs b/src/sqlite/jump.cs
index 8ac3afdb..725ab481 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -302,6 +302,64 @@ class SqliteJump : Sqlite
                return l;
        }
 
+       private static List<Jump> DataReaderToJump (SqliteDataReader reader)
+       {
+         List<Jump> jmp_l = new List<Jump>();
+         Jump jmp;
+
+               LogB.Information("Imprimire Jumps:");
+         while(reader.Read()) {
+           jmp = new Jump (
+               Convert.ToInt32(reader[0].ToString()),              //uniqueID
+               Convert.ToInt32(reader[1].ToString()),              //personID
+               Convert.ToInt32(reader[2].ToString()),              //sessionID
+               reader[3].ToString(),                               //type
+               Convert.ToDouble(Util.ChangeDecimalSeparator(
+                   reader[4].ToString())),                         //tv
+               Convert.ToDouble(Util.ChangeDecimalSeparator(
+                   reader[5].ToString())),                          //tc
+               Convert.ToDouble(Util.ChangeDecimalSeparator(
+                   reader[6].ToString())),                          //fall
+                                       Convert.ToDouble(Util.ChangeDecimalSeparator(
+                                 reader[6].ToString())),                        //weight
+               reader[8].ToString(),                                // description
+               Convert.ToDouble(Util.ChangeDecimalSeparator(
+                   reader[9].ToString())),                          //angle
+               Convert.ToInt32(reader[10].ToString()));              //simulated
+
+           jmp_l.Add(jmp);
+                       LogB.Information(jmp.ToString());
+         }
+         return jmp_l;
+       }
+
+       public static List<Jump> SelectDJa (int pID, int sID)
+       {
+         string personID = pID.ToString();
+         string sessionID = sID.ToString();
+         string tps = Constants.PersonSessionTable;
+
+         Sqlite.Open();
+
+         // Selecciona les dades de tots els salts
+         dbcmd.CommandText = "SELECT " + "jump.*" +
+         " FROM " + "jump, " + tps +
+         " WHERE " + tps + ".personID = " + personID + " AND " + tps + 
+         ".sessionID = " + sessionID  +  " AND jump.type = \"DJa\" ";
+
+         LogB.SQL(dbcmd.CommandText.ToString());
+         dbcmd.ExecuteNonQuery();
+
+         SqliteDataReader reader;
+         reader = dbcmd.ExecuteReader();
+
+         List<Jump> jmp_l = DataReaderToJump (reader);
+
+         reader.Close();
+         Sqlite.Close();
+
+         return jmp_l;
+       }
 
        public static void Update(int jumpID, string type, string tv, string tc, string fall, int personID, 
double weight, string description, double angle)
        {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]