[chronojump/77] Now it compiles no use it, remains db conversion and tests



commit 2c7717190414966397e26b22eaf9674946ef6729
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Mar 2 21:22:33 2010 +0800

    Now it compiles
    no use it, remains db conversion and tests

 Makefile.win32                                     |    9 +++-
 chronojump_server/ChronojumpServer.cs              |   22 +++-----
 chronojump_server/Makefile.am                      |    2 +
 chronojump_server/bin/chronojumpServer.dll         |  Bin 275456 -> 278016 bytes
 chronojump_server/chronojumpServerCSharp.cs        |    2 +-
 src/Makefile.am                                    |    4 ++
 src/constants.cs                                   |    5 ++
 src/event.cs                                       |    2 +-
 src/execute/run.cs                                 |    4 +-
 src/exportSession.cs                               |   55 +++++++++++++------
 src/gui/chronojump.cs                              |   51 ++++++++++--------
 src/gui/event.cs                                   |   11 +++-
 src/gui/jump.cs                                    |   10 ++--
 src/gui/person.cs                                  |   36 ++++++-------
 src/gui/stats.cs                                   |    9 +++-
 src/oldCodeNeedToDBConvert/person.cs               |    4 +-
 src/oldCodeNeedToDBConvert/personSession.cs        |    2 +-
 src/oldCodeNeedToDBConvert/sqlite/personSession.cs |   21 ++++++++
 src/oldCodeNeedToDBConvert/sqlite/session.cs       |    2 +-
 src/person.cs                                      |   15 +++++-
 src/personSession.cs                               |   45 +++++++++++++++-
 src/report.cs                                      |   36 +------------
 src/server.cs                                      |    5 +-
 src/sqlite/main.cs                                 |    2 +-
 src/sqlite/person.cs                               |   32 +++++++++++-
 src/sqlite/personSession.cs                        |   21 ++++---
 src/treeViewPerson.cs                              |   11 +---
 27 files changed, 266 insertions(+), 152 deletions(-)
---
diff --git a/Makefile.win32 b/Makefile.win32
index 46e08c9..36d02d2 100644
--- a/Makefile.win32
+++ b/Makefile.win32
@@ -81,7 +81,6 @@ CHRONOJUMP_FILES = \
 	stats/graphs/rjAVGSD.cs\
 	sqlite/main.cs\
  	sqlite/preferences.cs\
- 	sqlite/person.cs\
  	sqlite/session.cs\
  	sqlite/jump.cs\
  	sqlite/jumpRj.cs\
@@ -89,6 +88,7 @@ CHRONOJUMP_FILES = \
  	sqlite/run.cs\
  	sqlite/runInterval.cs\
  	sqlite/runType.cs\
+ 	sqlite/person.cs\
  	sqlite/personSession.cs\
  	sqlite/personSessionNotUpload.cs\
  	sqlite/stat.cs\
@@ -145,7 +145,12 @@ CHRONOJUMP_FILES = \
  	serverPing.cs\
  	serverEvaluator.cs\
  	server.cs\
-	chronopic.cs
+	chronopic.cs\
+ 	oldCodeNeedToDBConvert/person.cs\
+ 	oldCodeNeedToDBConvert/personSession.cs\
+ 	oldCodeNeedToDBConvert/sqlite/person.cs\
+ 	oldCodeNeedToDBConvert/sqlite/personSession.cs\
+ 	oldCodeNeedToDBConvert/sqlite/session.cs
 
 CHRONOJUMP_RESOURCES =  \
 	-resource:../glade/chronojump.glade\
diff --git a/chronojump_server/ChronojumpServer.cs b/chronojump_server/ChronojumpServer.cs
index 17494a1..9bf14d5 100644
--- a/chronojump_server/ChronojumpServer.cs
+++ b/chronojump_server/ChronojumpServer.cs
@@ -719,19 +719,15 @@ public class ChronojumpServer : System.Web.Services.Protocols.SoapHttpClientProt
 ///Upload person session if needed
 ///</remarks>
     [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://server.chronojump.org/UploadPersonSessionIfNeeded";, RequestNamespace="http://server.chronojump.org/";, ResponseNamespace="http://server.chronojump.org/";, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)]
-    public int UploadPersonSessionIfNeeded(int personServerID, int sessionServerID, double weight) {
+    public int UploadPersonSessionIfNeeded(PersonSession ps) {
         object[] results = this.Invoke("UploadPersonSessionIfNeeded", new object[] {
-                    personServerID,
-                    sessionServerID,
-                    weight});
+                    ps});
         return ((int)(results[0]));
     }
     
-    public System.IAsyncResult BeginUploadPersonSessionIfNeeded(int personServerID, int sessionServerID, double weight, System.AsyncCallback callback, object asyncState) {
+    public System.IAsyncResult BeginUploadPersonSessionIfNeeded(PersonSession ps, System.AsyncCallback callback, object asyncState) {
         return this.BeginInvoke("UploadPersonSessionIfNeeded", new object[] {
-                    personServerID,
-                    sessionServerID,
-                    weight}, callback, asyncState);
+                    ps}, callback, asyncState);
     }
     
     public int EndUploadPersonSessionIfNeeded(System.IAsyncResult asyncResult) {
@@ -739,18 +735,16 @@ public class ChronojumpServer : System.Web.Services.Protocols.SoapHttpClientProt
         return ((int)(results[0]));
     }
     
-    public void UploadPersonSessionIfNeededAsync(int personServerID, int sessionServerID, double weight) {
-        this.UploadPersonSessionIfNeededAsync(personServerID, sessionServerID, weight, null);
+    public void UploadPersonSessionIfNeededAsync(PersonSession ps) {
+        this.UploadPersonSessionIfNeededAsync(ps, null);
     }
     
-    public void UploadPersonSessionIfNeededAsync(int personServerID, int sessionServerID, double weight, object userState) {
+    public void UploadPersonSessionIfNeededAsync(PersonSession ps, object userState) {
         if ((this.UploadPersonSessionIfNeededOperationCompleted == null)) {
             this.UploadPersonSessionIfNeededOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUploadPersonSessionIfNeededCompleted);
         }
         this.InvokeAsync("UploadPersonSessionIfNeeded", new object[] {
-                    personServerID,
-                    sessionServerID,
-                    weight}, this.UploadPersonSessionIfNeededOperationCompleted, userState);
+                    ps}, this.UploadPersonSessionIfNeededOperationCompleted, userState);
     }
     
     private void OnUploadPersonSessionIfNeededCompleted(object arg) {
diff --git a/chronojump_server/Makefile.am b/chronojump_server/Makefile.am
index 823d3dc..419dc95 100644
--- a/chronojump_server/Makefile.am
+++ b/chronojump_server/Makefile.am
@@ -27,6 +27,8 @@ FILES = \
 	../src/event.cs\
 	../src/jump.cs\
 	../src/run.cs\
+	../src/person.cs\
+	../src/personSession.cs\
 	../src/pulse.cs\
 	../src/reactionTime.cs\
 	../src/session.cs\
diff --git a/chronojump_server/bin/chronojumpServer.dll b/chronojump_server/bin/chronojumpServer.dll
index d00d019..bac624c 100755
Binary files a/chronojump_server/bin/chronojumpServer.dll and b/chronojump_server/bin/chronojumpServer.dll differ
diff --git a/chronojump_server/chronojumpServerCSharp.cs b/chronojump_server/chronojumpServerCSharp.cs
index 777c54c..9afc6bd 100755
--- a/chronojump_server/chronojumpServerCSharp.cs
+++ b/chronojump_server/chronojumpServerCSharp.cs
@@ -295,7 +295,7 @@ public class ChronojumpServer {
 	{
 		if(!SqlitePersonSession.PersonSelectExistsInSession(ps.PersonID, ps.SessionID)) {
 			Console.WriteLine("personSession needed");
-			ps.InsertAtDB(false, Constants.PersonSession);
+			ps.InsertAtDB(false, Constants.PersonSessionTable);
 			Console.WriteLine("done");
 			return 1; //unused
 		} else 
diff --git a/src/Makefile.am b/src/Makefile.am
index 65c35cb..6650e67 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -127,6 +127,8 @@ FILES = \
  	sqlite/run.cs\
  	sqlite/runInterval.cs\
  	sqlite/runType.cs\
+ 	sqlite/person.cs\
+ 	sqlite/personSession.cs\
  	sqlite/personSessionNotUpload.cs\
  	sqlite/stat.cs\
  	sqlite/pulse.cs\
@@ -151,6 +153,8 @@ FILES = \
  	eventType.cs\
  	jump.cs\
  	jumpType.cs\
+	person.cs\
+	personSession.cs\
 	run.cs\
  	runType.cs\
  	pulse.cs\
diff --git a/src/constants.cs b/src/constants.cs
index aa833c3..d1eaa32 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -108,6 +108,11 @@ public class Constants
 	public const int MaleID = 1;
 	public const int FemaleID = 0;
 
+	//person & personSession stuff
+	public const string Name = "name";
+	public const string Height = "height";
+	public const string Weight = "weight";
+
 	//server	
 	public const string ServerPingTable = "SPing"; 
 	public const string ServerEvaluatorTable = "SEvaluator"; 
diff --git a/src/event.cs b/src/event.cs
index a33281b..e282600 100644
--- a/src/event.cs
+++ b/src/event.cs
@@ -86,7 +86,7 @@ public partial class Event
 	public string PersonName
 	{
 		//get { return personName; }
-		get { return SqlitePerson.SelectJumperName(personID); }
+		get { return SqlitePerson.SelectAttribute(personID, Constants.Name); }
 	}
 	
 	
diff --git a/src/execute/run.cs b/src/execute/run.cs
index bda2b19..8fd60f2 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -296,7 +296,7 @@ Log.WriteLine("MANAGE(3)!!!!");
 			// P = W * 9.8 * D / t   
 			// W: person weight
 			// D: distance between 3d and 9th stair
-			double weight = SqlitePersonSession.SelectPersonWeight(personID, sessionID);
+			double weight = SqlitePersonSession.SelectAttribute(personID, sessionID, Constants.Weight);
 			double distanceMeters = distance / 1000;
 			description = "P = " + Util.TrimDecimals ( (weight * 9.8 * distanceMeters / time).ToString(), pDN) + " (Watts)";
 		} else if(type == "Gesell-DBT") 
@@ -325,7 +325,7 @@ Log.WriteLine("MANAGE(3)!!!!");
 	
 	public string RunnerName
 	{
-		get { return SqlitePerson.SelectJumperName(personID); }
+		get { return SqlitePerson.SelectAttribute(personID, Constants.Name); }
 	}
 
 	~RunExecute() {}
diff --git a/src/exportSession.cs b/src/exportSession.cs
index a899614..be2c541 100644
--- a/src/exportSession.cs
+++ b/src/exportSession.cs
@@ -28,7 +28,7 @@ using Mono.Unix;
 
 public class ExportSession
 {
-	protected string [] myPersons;
+	protected ArrayList myPersons;
 	protected string [] myJumps;
 	protected string [] myJumpsRj;
 	protected string [] myRuns;
@@ -163,7 +163,8 @@ public class ExportSession
 	
 	protected virtual void getData() 
 	{
-		myPersons = SqlitePersonSession.SelectCurrentSession(mySession.UniqueID, false, false); //not onlyIDAndName, not reversed
+		//myPersons = SqlitePersonSession.SelectCurrentSession(mySession.UniqueID, false, false); //not onlyIDAndName, not reversed
+		ArrayList myPersons = SqlitePersonSession.SelectCurrentSessionPersons(mySession.UniqueID);
 		myJumps= SqliteJump.SelectJumps(mySession.UniqueID, -1, "", "");
 		myJumpsRj = SqliteJumpRj.SelectJumps(mySession.UniqueID, -1, "", "");
 		myRuns= SqliteRun.SelectRuns(mySession.UniqueID, -1, "");
@@ -184,7 +185,7 @@ public class ExportSession
 		printSessionInfo();
 		
 		printTitles(Catalog.GetString("Persons"));
-		printJumpers();
+		printPersons();
 		
 		printJumps(Catalog.GetString("Simple jumps"));
 		
@@ -227,25 +228,41 @@ public class ExportSession
 		writeData("VERTICAL-SPACE");
 	}
 
-	protected virtual void printJumpers()
+	protected void printPersons()
 	{
+		//PERSON STUFF
 		ArrayList myData = new ArrayList(1);
 		myData.Add ( "\n" + Catalog.GetString ("ID") + ":" + Catalog.GetString ("Name") + ":" +
 				Catalog.GetString ("Sex") + ":" + Catalog.GetString ("Date of Birth") + ":" +
-				Catalog.GetString ("Height") + ":" + Catalog.GetString("Weight") + ":" +
+				Catalog.GetString ("Description")
+			   );
+		
+		foreach (Person p in myPersons) {
+			myData.Add(
+					p.UniqueID.ToString() + ":" + p.Name + ":" +
+					p.Sex + ":" + p.DateBorn.ToShortDateString() + ":" +
+					p.CountryID + ":" + Util.RemoveNewLine(p.Description)
+				  );
+		}
+		writeData(myData);
+		writeData("VERTICAL-SPACE");
+		
+		//PERSONSESSION STUFF
+		myData = new ArrayList(1);
+		myData.Add ( "\n" + Catalog.GetString ("Height") + ":" + Catalog.GetString("Weight") + ":" +
 				Catalog.GetString ("Sport") + ":" + Catalog.GetString("Speciallity") + ":" +
-				Catalog.GetString ("Level") + ":" + Catalog.GetString ("Description")
+				Catalog.GetString ("Level") + ":" + Catalog.GetString ("Comments")
 			   );
 		
-		foreach (string jumperString in myPersons) {
-			string [] myStr = jumperString.Split(new char[] {':'});
-			
+		foreach (Person p in myPersons) {
+			PersonSession ps = SqlitePersonSession.Select(p.UniqueID, mySession.UniqueID);
+			string sportName = (SqliteSport.Select(ps.SportID)).Name;
+			string speciallityName = SqliteSpeciallity.Select(ps.SpeciallityID);
 			myData.Add(
-					myStr[0] + ":" + myStr[1] + ":" + 	//person.id, person.name 
-					myStr[2] + ":" + myStr[3] + ":" + //sex, dateborn
-					myStr[4] + ":" + myStr[5] + ":" + //height, weight
-					myStr[6] + ":" + myStr[7] + ":" + //sportName, speciallityName
-					myStr[8] + ":" + Util.RemoveNewLine(myStr[9]) //practiceLevel, desc
+					ps.Height + ":" + ps.Weight + ":" + 
+					sportName + ":" + speciallityName + ":" +
+					Util.FindLevelName(ps.Practice) + ":" +
+					Util.RemoveNewLine(ps.Comments)
 				  );
 		}
 		writeData(myData);
@@ -292,9 +309,10 @@ public class ExportSession
 				else
 					myWeight = Util.WeightFromPercentToKg(
 							Convert.ToDouble(myStr[8]), 
-							SqlitePersonSession.SelectPersonWeight(
+							SqlitePersonSession.SelectAttribute(
 								Convert.ToInt32(myStr[2]),
-								Convert.ToInt32(myStr[3])
+								Convert.ToInt32(myStr[3]),
+								Constants.Weight
 							)).ToString();
 		
 				double tc = Convert.ToDouble(myStr[6]);
@@ -380,9 +398,10 @@ public class ExportSession
 			else
 				myWeight = Util.WeightFromPercentToKg(
 						Convert.ToDouble(myStr[8]), 
-						SqlitePersonSession.SelectPersonWeight(
+						SqlitePersonSession.SelectAttribute(
 							Convert.ToInt32(myStr[2]),
-							Convert.ToInt32(myStr[3])
+							Convert.ToInt32(myStr[3]),
+							Constants.Weight
 							)
 						).ToString();
 			myData.Add ( 
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 8d4a8d1..326da71 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -282,6 +282,7 @@ public class ChronoJumpWindow
 
 	private static Person currentPerson;
 	private static Session currentSession;
+	private static PersonSession currentPersonSession;
 	private static bool definedSession;
 	private static Jump currentJump;
 	private static JumpRj currentJumpRj;
@@ -721,9 +722,9 @@ public class ChronoJumpWindow
 	}
 
 	private void fillTreeView_persons () {
-		string [] myPersons = SqlitePersonSession.SelectCurrentSession(currentSession.UniqueID, true, false); //onlyIDAndName, not reversed
+		ArrayList myPersons = SqlitePersonSession.SelectCurrentSessionPersons(currentSession.UniqueID); 
 
-		if(myPersons.Length > 0) {
+		if(myPersons.Count > 0) {
 			//fill treeview
 			myTreeViewPersons.Fill(myPersons);
 		}
@@ -745,8 +746,8 @@ public class ChronoJumpWindow
 		TreeIter iter;
 		if (tv.Selection.GetSelected (out model, out iter)) {
 			string selectedID = (string) model.GetValue (iter, 0); //ID, Name
-			currentPerson = SqlitePersonSession.PersonSelect(Convert.ToInt32(selectedID), currentSession.UniqueID);
-			Log.WriteLine(string.Format("CurrentPerson: id:{0}, name:{1}", currentPerson.UniqueID, currentPerson.Name));
+			currentPerson = SqlitePerson.Select(Convert.ToInt32(selectedID));
+			currentPersonSession = SqlitePersonSession.Select(Convert.ToInt32(selectedID), currentSession.UniqueID);
 			return true;
 		} else {
 			return false;
@@ -767,8 +768,8 @@ public class ChronoJumpWindow
 		if (((TreeSelection)o).GetSelected(out model, out iter)) {
 			string selectedID = (string) model.GetValue (iter, 0); //ID, Name
 		
-			currentPerson = SqlitePersonSession.PersonSelect(Convert.ToInt32(selectedID), currentSession.UniqueID);
-			Log.WriteLine(string.Format("CurrentPerson: id:{0}, name:{1}", currentPerson.UniqueID, currentPerson.Name));
+			currentPerson = SqlitePerson.Select(Convert.ToInt32(selectedID));
+			currentPersonSession = SqlitePersonSession.Select(Convert.ToInt32(selectedID), currentSession.UniqueID);
 		}
 	}
 
@@ -934,12 +935,14 @@ public class ChronoJumpWindow
 		ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(currentSession.UniqueID);
 		foreach (Person person in persons) 
 		{
-			if(! Util.FoundInArrayList(notToUpload, person.UniqueID.ToString())) {
-				if(person.Weight <= 10 || person.Weight >= 300)
+			if(! Util.FoundInArrayList(notToUpload, person.UniqueID.ToString())) 
+			{
+				PersonSession ps = SqlitePersonSession.Select(person.UniqueID, currentSession.UniqueID);
+				if(ps.Weight <= 10 || ps.Weight >= 300)
 					impossibleWeight.Add(person);
 				if(person.CountryID == Constants.CountryUndefinedID)
 					undefinedCountry.Add(person);
-				if(person.SportID == Constants.SportUndefinedID)
+				if(ps.SportID == Constants.SportUndefinedID)
 					undefinedSport.Add(person);
 				//speciallity and level not required, because person gui obligates to select them when sport is selected
 			}
@@ -956,7 +959,7 @@ public class ChronoJumpWindow
 			string separator = "";
 			int count=0;
 			foreach(Person person in impossibleWeight) {
-				weightString += separator + person.Name + " (" + person.Weight + "Kg.)";
+				weightString += separator + person.Name;
 				separator = ", ";
 				if(++count >= maxPeopleFail) {
 					weightString += "...";
@@ -1989,6 +1992,7 @@ public class ChronoJumpWindow
 
 	private void on_recuperate_person_accepted (object o, EventArgs args) {
 		currentPerson = personRecuperateWin.CurrentPerson;
+		currentPersonSession = SqlitePersonSession.Select(currentPerson.UniqueID, currentSession.UniqueID);
 		
 		myTreeViewPersons.Add(currentPerson.UniqueID.ToString(), currentPerson.Name);
 
@@ -2003,12 +2007,13 @@ public class ChronoJumpWindow
 		
 	private void on_recuperate_persons_from_session_activate (object o, EventArgs args) {
 		Log.WriteLine("recuperate persons from other session");
-		personsRecuperateFromOtherSessionWin = PersonsRecuperateFromOtherSessionWindow.Show(app1, currentSession.);
+		personsRecuperateFromOtherSessionWin = PersonsRecuperateFromOtherSessionWindow.Show(app1, currentSession);
 		personsRecuperateFromOtherSessionWin.Button_recuperate.Clicked += new EventHandler(on_recuperate_persons_from_session_accepted);
 	}
 	
 	private void on_recuperate_persons_from_session_accepted (object o, EventArgs args) {
 		currentPerson = personsRecuperateFromOtherSessionWin.CurrentPerson;
+		currentPersonSession = SqlitePersonSession.Select(currentPerson.UniqueID, currentSession.UniqueID);
 		treeview_persons_storeReset();
 		fillTreeView_persons();
 		int rowToSelect = findRowOfCurrentPerson(treeview_persons, treeview_persons_store, currentPerson);
@@ -2034,6 +2039,7 @@ public class ChronoJumpWindow
 		if (personAddModifyWin.CurrentPerson != null)
 		{
 			currentPerson = personAddModifyWin.CurrentPerson;
+			currentPersonSession = SqlitePersonSession.Select(currentPerson.UniqueID, currentSession.UniqueID);
 			myTreeViewPersons.Add(currentPerson.UniqueID.ToString(), currentPerson.Name);
 			
 			int rowToSelect = findRowOfCurrentPerson(treeview_persons, treeview_persons_store, currentPerson);
@@ -2064,6 +2070,7 @@ public class ChronoJumpWindow
 		if (personAddMultipleWin.CurrentPerson != null)
 		{
 			currentPerson = personAddMultipleWin.CurrentPerson;
+			currentPersonSession = SqlitePersonSession.Select(currentPerson.UniqueID, currentSession.UniqueID);
 			treeview_persons_storeReset();
 			fillTreeView_persons();
 			int rowToSelect = findRowOfCurrentPerson(treeview_persons, treeview_persons_store, currentPerson);
@@ -2091,6 +2098,7 @@ public class ChronoJumpWindow
 		if (personAddModifyWin.CurrentPerson != null)
 		{
 			currentPerson = personAddModifyWin.CurrentPerson;
+			currentPersonSession = SqlitePersonSession.Select(currentPerson.UniqueID, currentSession.UniqueID);
 			treeview_persons_storeReset();
 			fillTreeView_persons();
 			
@@ -2888,12 +2896,10 @@ Console.WriteLine("X");
 			
 		double jumpWeight = 0;
 		if(currentJumpType.HasWeight) {
-			if(jumpExtraWin.Option == "%") {
+			if(jumpExtraWin.Option == "%") 
 				jumpWeight = jumpExtraWin.Weight;
-			} else {
-				//(double) jumpExtraWin.Weight *100 / (double) currentPerson.Weight;
-				jumpWeight = Util.WeightFromKgToPercent(jumpExtraWin.Weight, currentPerson.Weight);
-			}
+			else 
+				jumpWeight = Util.WeightFromKgToPercent(jumpExtraWin.Weight, currentPersonSession.Weight);
 		}
 		double myFall = 0;
 		bool arms = false;
@@ -2970,7 +2976,7 @@ Console.WriteLine("X");
 			else {
 				Jump myJump = new Jump();
 				myJump = currentJump;
-				myJump.Weight = Util.WeightFromPercentToKg(currentJump.Weight, currentPerson.Weight);
+				myJump.Weight = Util.WeightFromPercentToKg(currentJump.Weight, currentPersonSession.Weight);
 				myTreeViewJumps.Add(currentPerson.Name, myJump);
 			}
 			
@@ -3096,8 +3102,7 @@ Console.WriteLine("X");
 			if(jumpExtraWin.Option == "%") {
 				jumpWeight = jumpExtraWin.Weight;
 			} else {
-				//jumpWeight = (double) jumpExtraWin.Weight *100 / (double) currentPerson.Weight;
-				jumpWeight = Util.WeightFromKgToPercent(jumpExtraWin.Weight, currentPerson.Weight);
+				jumpWeight = Util.WeightFromKgToPercent(jumpExtraWin.Weight, currentPersonSession.Weight);
 			}
 		}
 		double myFall = 0;
@@ -3176,7 +3181,7 @@ Console.WriteLine("X");
 			else {
 				JumpRj myJump = new JumpRj();
 				myJump = currentJumpRj;
-				myJump.Weight = Util.WeightFromPercentToKg(currentJumpRj.Weight, currentPerson.Weight);
+				myJump.Weight = Util.WeightFromPercentToKg(currentJumpRj.Weight, currentPersonSession.Weight);
 				myTreeViewJumpsRj.Add(currentPerson.Name, myJump);
 			}
 			
@@ -4150,7 +4155,8 @@ Console.WriteLine("X");
 		//if person changed, fill treeview again, if not, only update it's line
 		if(eventOldPerson == myJump.PersonID) {
 			if(! weightPercentPreferred) {
-				double personWeight = SqlitePersonSession.SelectPersonWeight(myJump.PersonID, currentSession.UniqueID);
+				double personWeight = SqlitePersonSession.SelectAttribute(
+						myJump.PersonID, currentSession.UniqueID, Constants.Weight);
 				myJump.Weight = Util.WeightFromPercentToKg(myJump.Weight, personWeight);
 			}
 			myTreeViewJumps.Update(myJump);
@@ -4172,7 +4178,8 @@ Console.WriteLine("X");
 		//if person changed, fill treeview again, if not, only update it's line
 		if(eventOldPerson == myJump.PersonID) {
 			if(! weightPercentPreferred) {
-				double personWeight = SqlitePersonSession.SelectPersonWeight(myJump.PersonID, currentSession.UniqueID);
+				double personWeight = SqlitePersonSession.SelectAttribute(
+						myJump.PersonID, currentSession.UniqueID, Constants.Weight);
 				myJump.Weight = Util.WeightFromPercentToKg(myJump.Weight, personWeight);
 			}
 			myTreeViewJumpsRj.Update(myJump);
diff --git a/src/gui/event.cs b/src/gui/event.cs
index 1499b39..97da545 100644
--- a/src/gui/event.cs
+++ b/src/gui/event.cs
@@ -241,10 +241,15 @@ public class EditEventWindow
 			combo_eventType.Hide();
 		}
 
-		string [] persons = SqlitePersonSession.SelectCurrentSession(myEvent.SessionID, true, false); //onlyIDAndName, not reversed
+		ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(myEvent.SessionID);
+		string [] personsStrings = new String[persons.Count];
+		int i=0;
+		foreach (Person person in persons) 
+			personsStrings[i++] = person.IDAndName(":");
+
 		combo_persons = ComboBox.NewText();
-		UtilGtk.ComboUpdate(combo_persons, persons, "");
-		combo_persons.Active = UtilGtk.ComboMakeActive(persons, myEvent.PersonID + ":" + myEvent.PersonName);
+		UtilGtk.ComboUpdate(combo_persons, personsStrings, "");
+		combo_persons.Active = UtilGtk.ComboMakeActive(personsStrings, myEvent.PersonID + ":" + myEvent.PersonName);
 		
 		oldPersonID = myEvent.PersonID;
 			
diff --git a/src/gui/jump.cs b/src/gui/jump.cs
index 2c32d27..1feac5e 100644
--- a/src/gui/jump.cs
+++ b/src/gui/jump.cs
@@ -62,9 +62,10 @@ public class EditJumpWindow : EditEventWindow
 		}	
 
 		EditJumpWindowBox.weightPercentPreferred = weightPercentPreferred;
-		EditJumpWindowBox.personWeight = SqlitePersonSession.SelectPersonWeight(
+		EditJumpWindowBox.personWeight = SqlitePersonSession.SelectAttribute(
 				Convert.ToInt32(myEvent.PersonID),
-				Convert.ToInt32(myEvent.SessionID)); 
+				Convert.ToInt32(myEvent.SessionID),
+				Constants.Weight); 
 
 		EditJumpWindowBox.pDN = pDN;
 		
@@ -248,7 +249,7 @@ public class EditJumpWindow : EditEventWindow
 			else
 				jumpWeightInKg = Convert.ToDouble(entryWeight);
 			
-			double newPersonWeight = SqlitePersonSession.SelectPersonWeight(personID, mySessionID); 
+			double newPersonWeight = SqlitePersonSession.SelectAttribute(personID, mySessionID, Constants.Weight); 
 			//jumpPercentWeightForNewPerson = jumpWeightInKg * 100 / newPersonWeight; 
 			jumpPercentWeightForNewPerson = Util.WeightFromKgToPercent(jumpWeightInKg, newPersonWeight); 
 			Log.WriteLine(string.Format("oldPW: {0}, jWinKg {1}, newPW{2}, jWin%NewP{3}",
@@ -288,7 +289,8 @@ public class EditJumpRjWindow : EditJumpWindow
 		}
 
 		EditJumpRjWindowBox.weightPercentPreferred = weightPercentPreferred;
-		EditJumpRjWindowBox.personWeight = SqlitePersonSession.SelectPersonWeight(myEvent.PersonID, myEvent.SessionID); 
+		EditJumpRjWindowBox.personWeight = SqlitePersonSession.SelectAttribute(
+				myEvent.PersonID, myEvent.SessionID, Constants.Weight); 
 
 		EditJumpRjWindowBox.pDN = pDN;
 		
diff --git a/src/gui/person.cs b/src/gui/person.cs
index 1c4c80a..1dd22b7 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -37,7 +37,6 @@ public class PersonRecuperateWindow {
 	
 	protected TreeStore store;
 	protected string selected;
-	//private string selectedWeight;
 	[Widget] protected Gtk.TreeView treeview_person_recuperate;
 	[Widget] protected Gtk.Button button_recuperate;
 	[Widget] protected Gtk.Statusbar statusbar1;
@@ -48,7 +47,7 @@ public class PersonRecuperateWindow {
 	[Widget] protected Gtk.Box hbox_search_filter_hide; //used in person recuperateWindow (hided in inherited class)
 	
 	static PersonRecuperateWindow PersonRecuperateWindowBox;
-	PersonAddModifyWindow personAddModifyWin; 
+	protected PersonAddModifyWindow personAddModifyWin; 
 
 	protected Gtk.Window parent;
 	
@@ -57,7 +56,7 @@ public class PersonRecuperateWindow {
 
 	protected int columnId = 0;
 	protected int firstColumn = 0;
-	int pDN;
+	protected int pDN;
 
 	protected PersonRecuperateWindow () {
 	}
@@ -205,10 +204,8 @@ public class PersonRecuperateWindow {
 		if (((TreeSelection)o).GetSelected(out model, out iter))
 		{
 			selected = (string)model.GetValue (iter, 0);
-			//selectedWeight = (string)model.GetValue (iter, 4);
 			button_recuperate.Sensitive = true;
 		}
-		Log.WriteLine (selected + ":" + selectedWeight);
 	}
 
 	
@@ -232,7 +229,6 @@ public class PersonRecuperateWindow {
 
 		if (tv.Selection.GetSelected (out model, out iter)) {
 			selected = (string) model.GetValue (iter, 0);
-			//selectedWeight = (string) model.GetValue (iter, 4);
 			
 			//activate on_button_recuperate_clicked()
 			button_recuperate.Activate();
@@ -251,7 +247,7 @@ public class PersonRecuperateWindow {
 		}
 	}
 	
-	private virtual void on_edit_current_person_accepted (object o, EventArgs args) {
+	protected virtual void on_edit_current_person_accepted (object o, EventArgs args) {
 		personAddModifyWin.FakeButtonAccept.Clicked -= new EventHandler(on_edit_current_person_accepted);
 		if (personAddModifyWin.CurrentPerson != null)
 		{
@@ -597,7 +593,7 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
 		}
 	}
 	
-	protected override void on_edit_current_person_cancelled (object o, EventArgs args) {
+	private void on_edit_current_person_cancelled (object o, EventArgs args) {
 		personAddModifyWin.FakeButtonCancel.Clicked -= new EventHandler(on_edit_current_person_cancelled);
 		if (personAddModifyWin.CurrentPerson != null)
 		{
@@ -619,6 +615,7 @@ public class PersonNotUploadWindow : PersonsRecuperateFromOtherSessionWindow
 	[Widget] Gtk.Button button_go_forward;
 	[Widget] Gtk.Button button_close;
 
+	private int sessionID;
 	public Gtk.Button fakeButtonDone;
 	
 	PersonNotUploadWindow (Gtk.Window parent, int sessionID) {
@@ -699,7 +696,7 @@ public class PersonNotUploadWindow : PersonsRecuperateFromOtherSessionWindow
 
 		foreach (Person person in myPersons) {
 			store.AppendValues (
-					! Util.FoundInArrayList(initiallyUnchecked, person.UniqueID), 
+					! Util.FoundInArrayList(initiallyUnchecked, person.UniqueID.ToString()), 
 					person.UniqueID, 
 					person.Name, 
 					getCorrectSex(person.Sex), 
@@ -1127,6 +1124,7 @@ public class PersonAddModifyWindow
 						Catalog.GetString(countryString[1]));
 			}
 
+			TextBuffer tb = new TextBuffer (new TextTagTable());
 			tb.Text = currentPerson.Description;
 			textview_description.Buffer = tb;
 			
@@ -1147,9 +1145,8 @@ public class PersonAddModifyWindow
 			mySpeciallityID = myPS.SpeciallityID;
 			myLevelID = myPS.Practice;
 
-			TextBuffer tb = new TextBuffer (new TextTagTable());
 			tb.Text = myPS.Comments;
-			textview_comments.Buffer = tb;
+			textview_ps_comments.Buffer = tb;
 
 		}
 			
@@ -1463,7 +1460,7 @@ public class PersonAddModifyWindow
 					sport.UniqueID, 
 					Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_speciallities), speciallities)),
 					Util.FetchID(UtilGtk.ComboGetActive(combo_levels)),
-					textview_comments.Buffer.Text);
+					textview_ps_comments.Buffer.Text);
 		} else {
 			//here we update rows in the database
 			currentPerson = new Person (personID, entry1.Text, sex, dateTime, 
@@ -1485,14 +1482,14 @@ public class PersonAddModifyWindow
 						sport.UniqueID, 
 						Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_speciallities), speciallities)),
 						Util.FetchID(UtilGtk.ComboGetActive(combo_levels)),
-						textview_comments.Buffer.Text);
+						textview_ps_comments.Buffer.Text);
 			else {
 				//don't come from recuperate
 				//we only need to update personSession
 				//1.- search uniqueID
 				PersonSession ps = SqlitePersonSession.Select(personID, currentSession.UniqueID);
 
-				//2.- create new instance with data from gui
+				//2.- create new instance
 				currentPersonSession = new PersonSession (
 						ps.UniqueID,
 						currentPerson.UniqueID, currentSession.UniqueID, 
@@ -1500,7 +1497,7 @@ public class PersonAddModifyWindow
 						sport.UniqueID, 
 						Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_speciallities), speciallities)),
 						Util.FetchID(UtilGtk.ComboGetActive(combo_levels)),
-						textview_comments.Buffer.Text);
+						textview_ps_comments.Buffer.Text);
 
 				//3.- update in database
 				SqlitePersonSession.Update (currentPersonSession); 
@@ -1790,7 +1787,7 @@ public class PersonAddMultipleWindow {
 				currentSession.PersonsSportID,
 				currentSession.PersonsSpeciallityID,
 				currentSession.PersonsPractice,
-				""); 			//description
+				""); 			//comments
 
 		personsCreatedCount ++;
 	}
@@ -1881,10 +1878,9 @@ public class PersonShowAllEventsWindow {
 		//put only id and name in combo
 		string [] myPersonsIDName = new string[myPersons.Count];
 		int count = 0;
-		foreach (Person person in myPersons)
-			string [] myStr = person.Split(new char[] {':'});
-			myPersonsIDName[count++] = person.UniqueID + ":" + person.Name;
-		}
+		foreach (Person person in myPersons) 
+			myPersonsIDName[count++] = person.IDAndName(":");
+		
 		UtilGtk.ComboUpdate(combo_persons, myPersonsIDName, "");
 		combo_persons.Active = UtilGtk.ComboMakeActive(myPersonsIDName, personID + ":" + personName);
 
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index 61c0254..7d4763b 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -526,8 +526,13 @@ public class StatsWindow {
 			UtilGtk.ComboUpdate(combo_stats_stat_subtype, nullOptions, "");
 			combo_stats_stat_subtype.Sensitive = false;
 			
-			UtilGtk.ComboUpdate(combo_stats_stat_apply_to,  
-				SqlitePersonSession.SelectCurrentSession(currentSession.UniqueID, true, false), ""); //onlyIDAndName, not reversed
+			ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(currentSession.UniqueID);
+			string [] personsStrings = new String[persons.Count];
+			int i=0;
+			foreach (Person person in persons) 
+				personsStrings[i++] = person.IDAndName(":");
+
+			UtilGtk.ComboUpdate(combo_stats_stat_apply_to, personsStrings, "");
 			combo_stats_stat_apply_to.Sensitive = true;
 			combo_stats_stat_apply_to.Active = 0;
 		} 
diff --git a/src/oldCodeNeedToDBConvert/person.cs b/src/oldCodeNeedToDBConvert/person.cs
index 3227056..4ea2a0d 100644
--- a/src/oldCodeNeedToDBConvert/person.cs
+++ b/src/oldCodeNeedToDBConvert/person.cs
@@ -103,7 +103,7 @@ public partial class PersonOld {
 		Log.WriteLine(this.ToString());
 
 		//insert in the personSession table (fast way of knowing who was in each session)
-		SqlitePersonSession.Insert (false, Constants.PersonSessionOldWeightTable, "-1", uniqueID, sessionID, weight);
+		SqlitePersonSessionOld.Insert (false, Constants.PersonSessionOldWeightTable, "-1", uniqueID, sessionID, weight);
 	}
 	
 	//used to select a person at Sqlite.convertTables
@@ -125,7 +125,7 @@ public partial class PersonOld {
 	}
 
 	public int InsertAtDB (bool dbconOpened, string tableName) {
-		int myID = SqlitePerson.Insert(dbconOpened, tableName, 
+		int myID = SqlitePersonOld.Insert(dbconOpened, tableName, 
 				uniqueID.ToString(), name,
 				sex, dateBorn, height, -1, //person weight is '-1', weight is in personSessionWeight table
 				sportID, speciallityID, practice,
diff --git a/src/oldCodeNeedToDBConvert/personSession.cs b/src/oldCodeNeedToDBConvert/personSession.cs
index 923f829..d89b159 100644
--- a/src/oldCodeNeedToDBConvert/personSession.cs
+++ b/src/oldCodeNeedToDBConvert/personSession.cs
@@ -71,7 +71,7 @@ public partial class PersonSessionOld {
 	}
 
 	public int InsertAtDB (bool dbconOpened, string tableName) {
-		int myID = SqlitePersonSession.Insert(dbconOpened, tableName, 
+		int myID = SqlitePersonSessionOld.Insert(dbconOpened, tableName, 
 				uniqueID.ToString(),
 				personID, sessionID, weight);
 		return myID;
diff --git a/src/oldCodeNeedToDBConvert/sqlite/personSession.cs b/src/oldCodeNeedToDBConvert/sqlite/personSession.cs
index be926c5..ea21341 100644
--- a/src/oldCodeNeedToDBConvert/sqlite/personSession.cs
+++ b/src/oldCodeNeedToDBConvert/sqlite/personSession.cs
@@ -106,6 +106,27 @@ class SqlitePersonSessionOld : Sqlite
 		}
 	}
 	
+	public static bool PersonExistsInPS(int personID)
+	{
+		dbcmd.CommandText = "SELECT * FROM " + Constants.PersonSessionOldTable + 
+			" WHERE personID == " + personID;
+		//Log.WriteLine(dbcmd.CommandText.ToString());
+		
+		SqliteDataReader reader;
+		reader = dbcmd.ExecuteReader();
+	
+		bool exists = new bool();
+		exists = false;
+		
+		if (reader.Read()) {
+			exists = true;
+		}
+
+		reader.Close();
+		return exists;
+	}
+
+	
 	/* 
 	 * conversion from database 0.52 to 0.53 (add weight into personSession)
 	 * now weight of a person can change every session
diff --git a/src/oldCodeNeedToDBConvert/sqlite/session.cs b/src/oldCodeNeedToDBConvert/sqlite/session.cs
index f3c3b18..2c2ab42 100644
--- a/src/oldCodeNeedToDBConvert/sqlite/session.cs
+++ b/src/oldCodeNeedToDBConvert/sqlite/session.cs
@@ -45,7 +45,7 @@ class SqliteSessionOld : Sqlite
 
 		//1st create a temp table
 		//createTable(Constants.ConvertTempTable);
-		SqliteSession sqliteSessionObject = new SqliteSession();
+		SqliteSessionOld sqliteSessionObject = new SqliteSessionOld();
 		sqliteSessionObject.createTable(Constants.ConvertTempTable);
 			
 		//2nd copy all data from session table to temp table
diff --git a/src/person.cs b/src/person.cs
index 023dadd..12f8420 100644
--- a/src/person.cs
+++ b/src/person.cs
@@ -97,12 +97,23 @@ public partial class Person {
 	}
 	
 	public int InsertAtDB (bool dbconOpened, string tableName) {
-		int myID = SqlitePerson.Insert(dbconOpened, tableName, 
+		int myID = SqlitePerson.Insert(dbconOpened,  
 				uniqueID.ToString(), name, sex, dateBorn, race, countryID,
 				description, serverUniqueID);
 		return myID;
 	}
 	
+	public string IDAndName (string sep) {
+		return uniqueID.ToString() + sep + name;
+	}
+	
+	public string [] IDAndName () {
+		string [] str = new String [2];
+		str[0] = uniqueID.ToString();
+		str[1] = name;
+		return str;
+	}
+	
 
 	public override string ToString()
 	{
@@ -159,7 +170,7 @@ public partial class Person {
 		get { return uniqueID; }
 		set { uniqueID = value; }
 	}
-	
+
 	public string DateLong {
 		get { return dateBorn.ToLongDateString(); }
 	}
diff --git a/src/personSession.cs b/src/personSession.cs
index 83570ed..20b2855 100644
--- a/src/personSession.cs
+++ b/src/personSession.cs
@@ -86,9 +86,9 @@ public partial class PersonSession {
 	}
 	
 	public int InsertAtDB (bool dbconOpened, string tableName) {
-		int myID = SqlitePersonSession.Insert(dbconOpened, tableName, 
+		int myID = SqlitePersonSession.Insert(dbconOpened,  
 				uniqueID.ToString(),
-				personID, sessionID, height, weight
+				personID, sessionID, height, weight,
 				sportID, speciallityID,
 				practice, comments);
 		return myID;
@@ -100,7 +100,48 @@ public partial class PersonSession {
 		return "";
 		//return "[uniqueID: " + uniqueID + "]" + name + ", " + ", " + sex + ", " + dateBorn.ToShortDateString() + ", " + description;
 	}
+
+
+	public int UniqueID {
+		get { return uniqueID; }
+	}
+	
+	public int PersonID {
+		get { return personID; }
+		set { personID = value; }
+	}
+
+	public int SessionID {
+		get { return sessionID; }
+		set { sessionID = value; }
+	}
+
+	public double Height {
+		get { return height; }
+	}
+	
+	public double Weight {
+		get { return weight; }
+	}
+	
+	public int SportID {
+		get { return sportID; }
+		set { sportID = value; }
+	}
+	
+	public int SpeciallityID {
+		get { return speciallityID; }
+	}
 	
+	public int Practice {
+		get { return practice; }
+	}
+
+	public string Comments {
+		get { return comments; }
+	}
+
+
 	~PersonSession() {}
 	   
 }
diff --git a/src/report.cs b/src/report.cs
index 62d2f54..a528ff2 100644
--- a/src/report.cs
+++ b/src/report.cs
@@ -117,7 +117,7 @@ public class Report : ExportSession
 		}
 
 		if(ShowCurrentSessionJumpers) {
-			myPersons = SqlitePersonSession.SelectCurrentSession(sessionID, false, false); //not onlyIDAndName, not reversed
+			myPersons = SqlitePersonSession.SelectCurrentSessionPersons(sessionID);
 		}
 		if(ShowSimpleJumps) {
 			myJumps= SqliteJump.SelectJumps(sessionID, -1, "", "");
@@ -156,7 +156,7 @@ public class Report : ExportSession
 
 		if(ShowCurrentSessionJumpers) {
 			printTitles(Catalog.GetString("Persons"));
-			printJumpers();
+			printPersons();
 		}
 
 		if(ShowSimpleJumps) 
@@ -249,38 +249,6 @@ public class Report : ExportSession
 		writeData("VERTICAL-SPACE");
 	}
 
-	protected override void printJumpers()
-	{
-		ArrayList myData = new ArrayList(1);
-	
-		myData.Add ("\n" + 
-				Catalog.GetString ("ID") + ":" + Catalog.GetString ("Name") + ":" +
-				Catalog.GetString ("Sex") + ":" + Catalog.GetString ("Date of Birth") + ":" +
-				Catalog.GetString ("Height") + ":" + Catalog.GetString("Weight") + ":" +
-				Catalog.GetString ("Sport") + ":" + Catalog.GetString("Speciallity") + ":" +
-				Catalog.GetString ("Level") + ":" + Catalog.GetString ("Description")
-			   );
-		
-		string myLine = "";
-		int count = 0;
-	
-		foreach (string jumperString in myPersons) {
-			string [] myStr = jumperString.Split(new char[] {':'});
-
-			myData.Add(myStr[0] + ":" + myStr[1] + ":" + 	//person.id, person.name 
-					myStr[2] + ":" + myStr[3] + ":" + //sex, dateborn
-					myStr[4] + ":" + myStr[5] + ":" + //height, weight
-					myStr[6] + ":" + myStr[7] + ":" + //sportName, speciallityName
-					myStr[8] + ":" + myStr[9] //practiceLevel, desc
-				  );
-
-		}
-		
-		writeData(myData);
-		writeData("VERTICAL-SPACE");
-	}
-
-
 	protected override void writeData (ArrayList exportData) {
 		writer.WriteLine( "<table cellpadding=2 cellspacing=2>" );
 		string iniCell = "<th align=\"left\">";
diff --git a/src/server.cs b/src/server.cs
index 038f589..fbc736d 100644
--- a/src/server.cs
+++ b/src/server.cs
@@ -193,9 +193,10 @@ public class Server
 			ArrayList notToUpload = SqlitePersonSessionNotUpload.SelectAll(currentSession.UniqueID);
 			
 			//store in variable for updating progressBar from other thread
-			progressBarPersonsNum = myPersons.Length - notToUpload.Count;
+			progressBarPersonsNum = persons.Count - notToUpload.Count;
 
-			foreach(Person person in persons) {
+			foreach(Person p in persons) {
+				Person person = p;
 
 				//do not continue with this person if has been banned to upload
 				if(Util.FoundInArrayList(notToUpload, person.UniqueID.ToString()))
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index bf02fe8..cf0eb3a 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -1531,7 +1531,7 @@ Console.WriteLine("1" + tableName);
 
 		if(tableName == Constants.PersonOldTable) {	
 			foreach (PersonOld myPerson in myArray) {
-				myPersonOld.InsertAtDB(true, Constants.ConvertTempTable);
+				myPerson.InsertAtDB(true, Constants.ConvertTempTable);
 				conversionSubRate ++;
 			}
 		} else if(tableName == Constants.SessionTable) {	
diff --git a/src/sqlite/person.cs b/src/sqlite/person.cs
index f1e381b..1721320 100644
--- a/src/sqlite/person.cs
+++ b/src/sqlite/person.cs
@@ -77,6 +77,36 @@ class SqlitePerson : Sqlite
 		return myReturn;
 	}
 
+	//This is like SqlitePersonSession.Selectbut this returns a Person
+	public static Person Select(int uniqueID)
+	{
+		dbcon.Open();
+
+		dbcmd.CommandText = "SELECT * FROM " + Constants.PersonTable + " WHERE uniqueID == " + uniqueID;
+		
+		Log.WriteLine(dbcmd.CommandText.ToString());
+		dbcmd.ExecuteNonQuery();
+
+		SqliteDataReader reader;
+		reader = dbcmd.ExecuteReader();
+		
+		Person p = new Person(-1);
+		if(reader.Read()) {
+			p = new Person(
+					Convert.ToInt32(reader[0].ToString()), //uniqueID
+					reader[1].ToString(), 			//name
+					reader[2].ToString(), 			//sex
+					UtilDate.FromSql(reader[3].ToString()),//dateBorn
+					Convert.ToInt32(reader[4].ToString()), //race
+					Convert.ToInt32(reader[5].ToString()), //countryID
+					reader[6].ToString(), 			//description
+					Convert.ToInt32(reader[9].ToString()) //serverUniqueID
+					);
+		}
+		dbcon.Close();
+		return p;
+	}
+		
 	//public static string SelectJumperName(int uniqueID)
 	//select strings
 	public static string SelectAttribute(int uniqueID, string attribute)
@@ -209,7 +239,7 @@ finishForeach:
 						Convert.ToInt32(reader2[5].ToString()), //countryID
 						reader2[6].ToString(), 			//description
 						Convert.ToInt32(reader2[9].ToString()) //serverUniqueID
-						)
+						);
 				arrayReturn.Add(p);
 			}
 		}
diff --git a/src/sqlite/personSession.cs b/src/sqlite/personSession.cs
index cb208ba..f4924ed 100644
--- a/src/sqlite/personSession.cs
+++ b/src/sqlite/personSession.cs
@@ -52,7 +52,7 @@ class SqlitePersonSession : Sqlite
 	 }
 
 	public static int Insert(bool dbconOpened, string uniqueID, int personID, int sessionID, 
-			double height, double weight, int sportID, int speciallityID, int practice
+			double height, double weight, int sportID, int speciallityID, int practice,
 			string comments) 
 	{
 		if(!dbconOpened)
@@ -67,8 +67,8 @@ class SqlitePersonSession : Sqlite
 		        " VALUES ("
 			+ uniqueID + ", " + personID + ", " + sessionID + ", " + 
 			Util.ConvertToPoint(height) + ", " + Util.ConvertToPoint(weight) + ", " +
-			+ sportID + ", " + speciallityID + ", " + practice + ", '" + 
-			+ comments + "', '', '')"; 
+			sportID + ", " + speciallityID + ", " + practice + ", '" + 
+			comments + "', '', '')"; 
 		dbcmd.ExecuteNonQuery();
 		int myReturn = dbcon.LastInsertRowId;
 		if(!dbconOpened)
@@ -76,9 +76,9 @@ class SqlitePersonSession : Sqlite
 		return myReturn;
 	}
 	
-	//we know session
+	//we KNOW session
 	//select doubles
-	public static double SelectAtribute(int personID, int sessionID, string attribute)
+	public static double SelectAttribute(int personID, int sessionID, string attribute)
 	{
 		dbcon.Open();
 
@@ -101,7 +101,7 @@ class SqlitePersonSession : Sqlite
 		return myReturn;
 	}
 
-	//when a session is not know, then select atrribute of last session
+	//when a session is NOT KNOWN, then select atrribute of last session
 	//select doubles
 	public static double SelectAttribute(int personID, string attribute)
 	{
@@ -184,6 +184,8 @@ class SqlitePersonSession : Sqlite
 	//then we search data in last sessionID
 	//this is used to know personSession attributes
 	//in a newly created person	
+
+	//This is like SqlitePerson.Selectbut this returns a PersonSession
 	public static PersonSession Select(int personID, int sessionID)
 	{
 		string tps = Constants.PersonSessionTable;
@@ -195,7 +197,7 @@ class SqlitePersonSession : Sqlite
 
 		dbcon.Open();
 		dbcmd.CommandText = "SELECT * FROM " + tps +
-			" WHERE uniqueID == " + uniqueID + 
+			" WHERE personID == " + personID + 
 			sessionIDString;
 		
 		Log.WriteLine(dbcmd.CommandText.ToString());
@@ -205,8 +207,9 @@ class SqlitePersonSession : Sqlite
 	
 		string [] values = new string[12];
 
+		PersonSession ps = new PersonSession();
 		while(reader.Read()) {
-			PersonSession ps = new PersonSession(
+			ps = new PersonSession(
 					Convert.ToInt32(reader[0].ToString()), 	//uniqueID
 					personID,				//personID
 					sessionID, 				//sessionID
@@ -363,7 +366,7 @@ class SqlitePersonSession : Sqlite
 		//delete normal runs
 		dbcmd.CommandText = "Delete FROM run WHERE sessionID == " + sessionID +
 			" AND personID == " + personID;
-			
+		
 		dbcmd.ExecuteNonQuery();
 		
 		//delete intervallic runs
diff --git a/src/treeViewPerson.cs b/src/treeViewPerson.cs
index e44bffe..0087301 100644
--- a/src/treeViewPerson.cs
+++ b/src/treeViewPerson.cs
@@ -83,15 +83,10 @@ public class TreeViewPersons
 		}
 	}
 
-	public void Fill(string [] myPersons)
+	public void Fill(ArrayList myPersons)
 	{
-		foreach (string person in myPersons) {
-			string [] myStringFull = person.Split(new char[] {':'});
-			string [] myData = new String [2];
-			//first ID, then Name
-			myData[0] = myStringFull[0].ToString();
-			myData[1] = myStringFull[1].ToString();
-			store.AppendValues (myData);
+		foreach (Person person in myPersons) {
+			store.AppendValues (person.IDAndName());
 		}
 		//show sorted by column name	
 		store.SetSortColumnId(1, Gtk.SortType.Ascending);



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