[chronojump] Person stores clubID
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Person stores clubID
- Date: Thu, 12 Dec 2019 10:06:36 +0000 (UTC)
commit d4ad97c93abffbff8a4323bbaf9fd39e2070cddd
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Dec 12 11:04:30 2019 +0100
Person stores clubID
src/gui/person.cs | 8 +++++---
src/person.cs | 24 +++++++++++++++++-------
src/sqlite/forceSensor.cs | 2 +-
src/sqlite/main.cs | 2 +-
src/sqlite/person.cs | 11 +++++++----
5 files changed, 31 insertions(+), 16 deletions(-)
---
diff --git a/src/gui/person.cs b/src/gui/person.cs
index 97b1c5a0..6ce9c3bc 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -1845,7 +1845,8 @@ public class PersonAddModifyWindow
currentPerson = new Person (personName, sex, dateTime,
Constants.RaceUndefinedID,
Convert.ToInt32(Util.FindOnArray(':', 2, 0,
UtilGtk.ComboGetActive(combo_countries), countries)),
- textview_description.Buffer.Text, "", //future1: rfid
+ textview_description.Buffer.Text,
+ "", "", //future1: rfid; future2: clubID
Constants.ServerUndefinedID, false); //dbconOpened
LogB.Information("Going to insert personSession");
@@ -1881,7 +1882,8 @@ public class PersonAddModifyWindow
currentPerson = new Person (currentPerson.UniqueID, personName, sex, dateTime,
Constants.RaceUndefinedID,
Convert.ToInt32(Util.FindOnArray(':', 2, 0,
UtilGtk.ComboGetActive(combo_countries), countries)),
- textview_description.Buffer.Text, "", //future1: rfid
+ textview_description.Buffer.Text,
+ "", "", //future1: rfid; future2: clubID
serverUniqueID);
SqlitePerson.Update (currentPerson);
@@ -2515,7 +2517,7 @@ public class PersonAddMultipleWindow {
dateTime,
Constants.RaceUndefinedID,
Constants.CountryUndefinedID,
- "", "",
//description, future1: rfid
+ "", "", "", //description, future1: rfid,
future2: clubID
Constants.ServerUndefinedID
);
diff --git a/src/person.cs b/src/person.cs
index 7d5bad22..e99eb080 100644
--- a/src/person.cs
+++ b/src/person.cs
@@ -34,6 +34,7 @@ public class Person {
private int countryID;
private string description;
private string future1; //rfid
+ private string future2; //club ID, is an integer
private int serverUniqueID; //not on server
public Person() {
@@ -45,7 +46,7 @@ public class Person {
}
//coming from compujump server
- public Person(bool insertPerson, int uniqueID, string name, string rfid)
+ public Person(bool insertPerson, int uniqueID, string name, string rfid) //TODO:, string clubID)
{
this.uniqueID = uniqueID;
this.name = name;
@@ -55,6 +56,7 @@ public class Person {
this.countryID = Constants.CountryUndefinedID; //1
this.description = "";
this.future1 = rfid;
+ //TODO: this.future2 = clubID;
this.serverUniqueID = Constants.ServerUndefinedID;
/*
@@ -64,14 +66,14 @@ public class Person {
if(insertPerson)
SqlitePerson.Insert(false,
uniqueID.ToString(), name, sex, dateBorn, race, countryID,
- description, future1, serverUniqueID);
+ description, future1, future2, serverUniqueID);
}
//suitable when we load a person from the database for being the current Person
//we know uniqueID
//used also in class PersonSessionTransaction where we define the uniqueID
public Person(int uniqueID, string name, string sex, DateTime dateBorn,
- int race, int countryID, string description, string future1, int serverUniqueID)
+ int race, int countryID, string description, string future1, string future2, int
serverUniqueID)
{
//needed by the return of gui/personAddModifyWindow
name = Util.RemoveTildeAndColon(name);
@@ -85,14 +87,15 @@ public class Person {
this.countryID = countryID;
this.description = description;
this.future1 = future1;
+ this.future2 = future2;
this.serverUniqueID = serverUniqueID; //remember don't do this on server
}
//typical constructor
//used when we create new person
//we don't know uniqueID
- public Person(string name, string sex, DateTime dateBorn, int race, int countryID, string
description, string future1,
- int serverUniqueID, bool dbconOpened)
+ public Person(string name, string sex, DateTime dateBorn, int race, int countryID, string description,
+ string future1, string future2, int serverUniqueID, bool dbconOpened)
{
name = Util.RemoveTildeAndColon(name);
description = Util.RemoveTildeAndColon(description);
@@ -104,6 +107,7 @@ public class Person {
this.countryID = countryID;
this.description = description;
this.future1 = future1;
+ this.future2 = future2;
this.serverUniqueID = serverUniqueID; //remember don't do this on server
//insert in the person table
@@ -120,7 +124,7 @@ public class Person {
public int InsertAtDB (bool dbconOpened, string tableName) {
int myID = SqlitePerson.Insert(dbconOpened,
uniqueID.ToString(), name, sex, dateBorn, race, countryID,
- description, future1, serverUniqueID);
+ description, future1, future2, serverUniqueID);
return myID;
}
@@ -145,7 +149,7 @@ public class Person {
{
return uniqueID.ToString() + ", '" + name + "', '" + sex + "', '" +
UtilDate.ToSql(dateBorn) + "', " + race + ", " + countryID + ", '" +
- description + "', '" + future1 + "', '', " + //future1, future2
+ description + "', '" + future1 + "', '" + future2 + "', " +
serverUniqueID;
}
@@ -198,6 +202,12 @@ public class Person {
set { future1 = value; }
}
+ //clubID
+ public string Future2 {
+ get { return future2; }
+ set { future2 = value; }
+ }
+
public int ServerUniqueID {
get { return serverUniqueID; }
set { serverUniqueID = value; }
diff --git a/src/sqlite/forceSensor.cs b/src/sqlite/forceSensor.cs
index 29700a20..59781f99 100644
--- a/src/sqlite/forceSensor.cs
+++ b/src/sqlite/forceSensor.cs
@@ -318,7 +318,7 @@ class SqliteForceSensor : Sqlite
Person pUnknown = new Person (Catalog.GetString("Unknown"),
"M", DateTime.Now,
Constants.RaceUndefinedID,
Constants.CountryUndefinedID,
- "", "", //future1: rfid
+ "", "", "", //description; future1: rfid;
future2: clubID
Constants.ServerUndefinedID, true);
//dbconOpened
unknownPersonID = pUnknown.UniqueID;
}
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index b1d0ccbf..4502f9d7 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -3129,7 +3129,7 @@ class Sqlite
pOld.Race,
pOld.CountryID,
pOld.Description,
- "", //future1: rfid
+ "", "", //future1: rfid; future2: clubID
pOld.ServerUniqueID
);
p.InsertAtDB(true, Constants.PersonTable);
diff --git a/src/sqlite/person.cs b/src/sqlite/person.cs
index 10823164..7d1a2403 100644
--- a/src/sqlite/person.cs
+++ b/src/sqlite/person.cs
@@ -47,13 +47,13 @@ class SqlitePerson : Sqlite
"countryID INT, " +
"description TEXT, " +
"future1 TEXT, " + //rfid
- "future2 TEXT, " +
+ "future2 TEXT, " + //clubID
"serverUniqueID INT ) ";
dbcmd.ExecuteNonQuery();
}
public static int Insert(bool dbconOpened, string uniqueID, string name, string sex, DateTime
dateBorn,
- int race, int countryID, string description, string future1, int serverUniqueID)
+ int race, int countryID, string description, string future1, string future2, int
serverUniqueID)
{
LogB.SQL("going to insert");
if(! dbconOpened)
@@ -68,7 +68,7 @@ class SqlitePerson : Sqlite
string myString = "INSERT INTO " + Constants.PersonTable +
" (uniqueID, name, sex, dateBorn, race, countryID, description, future1, future2,
serverUniqueID) VALUES (" + uniqueID + ", \"" +
name + "\", \"" + sex + "\", \"" + UtilDate.ToSql(dateBorn) + "\", " +
- race + ", " + countryID + ", \"" + description + "\", \"" + future1 + "\", \"\", " +
serverUniqueID + ")";
+ race + ", " + countryID + ", \"" + description + "\", \"" + future1 + "\", \"" +
future2 + "\", " + serverUniqueID + ")";
dbcmd.CommandText = myString;
LogB.SQL(dbcmd.CommandText.ToString());
@@ -124,6 +124,7 @@ class SqlitePerson : Sqlite
Convert.ToInt32(reader[5].ToString()), //countryID
reader[6].ToString(), //description
reader[7].ToString(), //future1: rfid
+ reader[8].ToString(), //future2: clubID
Convert.ToInt32(reader[9].ToString()) //serverUniqueID
);
}
@@ -268,6 +269,7 @@ finishForeach:
Convert.ToInt32(reader2[5].ToString()), //countryID
reader2[6].ToString(), //description
reader2[7].ToString(), //future1: rfid
+ reader2[8].ToString(), //future2: clubID
Convert.ToInt32(reader2[9].ToString()) //serverUniqueID
);
arrayReturn.Add(p);
@@ -630,7 +632,8 @@ finishForeach:
"\", race = " + myPerson.Race +
", countryID = " + myPerson.CountryID +
", description = \"" + myPerson.Description +
- "\", future1 = \"" + myPerson.Future1 + //rfid
+ "\", future1 = \"" + myPerson.Future1 + //rfid
+ "\", future2 = \"" + myPerson.Future2 + //clubID
"\", serverUniqueID = " + myPerson.ServerUniqueID +
" WHERE uniqueID == " + myPerson.UniqueID;
LogB.SQL(dbcmd.CommandText.ToString());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]