private Person personDeserialize(string strPerson) { JsonValue jsonPerson = JsonValue.Parse(strPerson); Int32 id = jsonPerson ["id"]; string player = jsonPerson ["name"]; double weight = jsonPerson ["weight"]; double height = jsonPerson ["height"]; string rfid = jsonPerson ["rfid"]; string image = jsonPerson ["imageName"]; LastPersonByRFIDHeight = height; LastPersonByRFIDWeight = weight; LastPersonByRFIDImageURL = image; Person personTemp = SqlitePerson.Select(false, id); /* * if personTemp == -1, need to insert this person * LastPersonWasInserted will be used: * to insert person at person.cs * to know if (it's new person or RFID changed) at gui/networks.cs */ LastPersonWasInserted = (personTemp.UniqueID == -1); return(new Person(LastPersonWasInserted, id, player, rfid)); }
public int InsertAtDB(bool dbconOpened, string tableName) { int myID = SqlitePerson.Insert(dbconOpened, uniqueID.ToString(), name, sex, dateBorn, race, countryID, description, future1, serverUniqueID); return(myID); }
//upload a person private static Person serverUploadPerson(ChronojumpServer myServer, Person person, int serverSessionID) { int idAtServer = myServer.UploadPerson(person, serverSessionID); //update person (serverUniqueID) on client database person.ServerUniqueID = idAtServer; SqlitePerson.Update(person); return(person); }
//coming from compujump server public Person(bool insertPerson, int uniqueID, string name, string rfid) { this.uniqueID = uniqueID; this.name = name; this.sex = "M"; this.dateBorn = DateTime.Now; this.race = Constants.RaceUndefinedID; this.countryID = Constants.CountryUndefinedID; //1 this.description = ""; this.future1 = rfid; this.serverUniqueID = Constants.ServerUndefinedID; /* * Before insertion check that uniqueID exists locally * can happen when there are rfid changes on server */ if (insertPerson) { SqlitePerson.Insert(false, uniqueID.ToString(), name, sex, dateBorn, race, countryID, description, future1, serverUniqueID); } }
protected static void convertPersonAndPersonSessionTo77() { //create person77 SqlitePerson sqlitePersonObject = new SqlitePerson(); sqlitePersonObject.createTable(Constants.PersonTable); //create personSession77 SqlitePersonSession sqlitePersonSessionObject = new SqlitePersonSession(); sqlitePersonSessionObject.createTable(Constants.PersonSessionTable); //select all personOld data SqlitePersonOld sqlitePersonOldObject = new SqlitePersonOld(); ArrayList personsOld = sqlitePersonOldObject.SelectAllPersons(); conversionRateTotal = personsOld.Count; conversionRate = 1; foreach (PersonOld pOld in personsOld) { Person p = new Person( pOld.UniqueID, pOld.Name, pOld.Sex, pOld.DateBorn, pOld.Race, pOld.CountryID, pOld.Description, pOld.ServerUniqueID ); p.InsertAtDB(true, Constants.PersonTable); //select all personSessionOld data of this person SqlitePersonSessionOld sqlitePersonSessionOldObject = new SqlitePersonSessionOld(); ArrayList personSessionsOld = sqlitePersonSessionOldObject.SelectAllPersonSessionsOfAPerson(p.UniqueID); conversionSubRateTotal = personSessionsOld.Count; conversionSubRate = 1; foreach (PersonSessionOld psOld in personSessionsOld) { PersonSession ps = new PersonSession( psOld.UniqueID, psOld.PersonID, psOld.SessionID, pOld.Height, psOld.Weight, pOld.SportID, pOld.SpeciallityID, pOld.Practice, "" //comments ); ps.InsertAtDB(true, Constants.PersonSessionTable); conversionSubRate ++; } conversionRate ++; } //drop old tables Sqlite.dropTable(Constants.PersonOldTable); Sqlite.dropTable(Constants.PersonSessionOldWeightTable); }
public static void CreateTables(bool server) { Sqlite.Open(); creationTotal = 14; creationRate = 1; SqliteServer sqliteServerObject = new SqliteServer(); //user has also an evaluator table with a row (it's row) sqliteServerObject.CreateEvaluatorTable(); if(server) { sqliteServerObject.CreatePingTable(); SqliteServerSession sqliteSessionObject = new SqliteServerSession(); sqliteSessionObject.createTable(Constants.SessionTable); } else { SqliteSession sqliteSessionObject = new SqliteSession(); sqliteSessionObject.createTable(Constants.SessionTable); //add SIMULATED session if doesn't exists. Unique session where tests can be simulated. SqliteSession.insertSimulatedSession(); SqlitePersonSessionNotUpload.CreateTable(); creationRate ++; } SqlitePerson sqlitePersonObject = new SqlitePerson(); sqlitePersonObject.createTable(Constants.PersonTable); //graphLinkTable SqliteEvent.createGraphLinkTable(); creationRate ++; //jumps SqliteJump sqliteJumpObject = new SqliteJump(); SqliteJumpRj sqliteJumpRjObject = new SqliteJumpRj(); sqliteJumpObject.createTable(Constants.JumpTable); sqliteJumpRjObject.createTable(Constants.JumpRjTable); sqliteJumpRjObject.createTable(Constants.TempJumpRjTable); //jump Types creationRate ++; SqliteJumpType.createTableJumpType(); SqliteJumpType.createTableJumpRjType(); SqliteJumpType.initializeTableJumpType(); SqliteJumpType.initializeTableJumpRjType(); //runs creationRate ++; SqliteRun sqliteRunObject = new SqliteRun(); SqliteRunInterval sqliteRunIntervalObject = new SqliteRunInterval(); sqliteRunObject.createTable(Constants.RunTable); sqliteRunIntervalObject.createTable(Constants.RunIntervalTable); sqliteRunIntervalObject.createTable(Constants.TempRunIntervalTable); //run Types creationRate ++; SqliteRunType sqliteRunTypeObject = new SqliteRunType(); sqliteRunTypeObject.createTable(Constants.RunTypeTable); SqliteRunType.initializeTable(); SqliteRunIntervalType sqliteRunIntervalTypeObject = new SqliteRunIntervalType(); sqliteRunIntervalTypeObject.createTable(Constants.RunIntervalTypeTable); SqliteRunIntervalType.initializeTable(); //reactionTimes creationRate ++; SqliteReactionTime sqliteReactionTimeObject = new SqliteReactionTime(); sqliteReactionTimeObject.createTable(Constants.ReactionTimeTable); //pulses and pulseTypes creationRate ++; SqlitePulse sqlitePulseObject = new SqlitePulse(); sqlitePulseObject.createTable(Constants.PulseTable); SqlitePulseType.createTablePulseType(); SqlitePulseType.initializeTablePulseType(); //multiChronopic tests creationRate ++; SqliteMultiChronopic sqliteMultiChronopicObject = new SqliteMultiChronopic(); sqliteMultiChronopicObject.createTable(Constants.MultiChronopicTable); //encoder creationRate ++; SqliteEncoder.createTableEncoder(); SqliteEncoder.createTableEncoderSignalCurve(); SqliteEncoder.createTableEncoderExercise(); SqliteEncoder.initializeTableEncoderExercise(); SqliteEncoder.createTable1RM(); //sports creationRate ++; SqliteSport.createTable(); SqliteSport.initialize(); SqliteSpeciallity.createTable(); SqliteSpeciallity.initialize(); SqliteSpeciallity.InsertUndefined(true); creationRate ++; SqlitePersonSession sqlitePersonSessionObject = new SqlitePersonSession(); sqlitePersonSessionObject.createTable(Constants.PersonSessionTable); creationRate ++; SqlitePreferences.createTable(); SqlitePreferences.initializeTable(lastChronojumpDatabaseVersion, creatingBlankDatabase); creationRate ++; SqliteCountry.createTable(); SqliteCountry.initialize(); SqliteExecuteAuto.createTableExecuteAuto(); SqliteExecuteAuto.addChronojumpProfileAndBilateral(); SqliteChronopicRegister.createTableChronopicRegister(); //changes [from - to - desc] //1.33 - 1.34 Converted DB to 1.34 Added thresholdJumps, thresholdRuns, thresholdOther to preferences //1.32 - 1.33 Converted DB to 1.33 Added chronopicRegister table //1.31 - 1.32 Converted DB to 1.32 encoderCaptureOptionsWin -> preferences //1.30 - 1.31 Converted DB to 1.31 Insert encoderCaptureCheckFullyExtended and ...Value at preferences //1.29 - 1.30 Converted DB to 1.30 Added SIMULATED session //1.28 - 1.29 Converted DB to 1.29 Changed reaction time rows have reactionTime as default value //1.27 - 1.28 Converted DB to 1.28 Changed encoderAutoSaveCurve BESTMEANPOWER to BEST //1.26 - 1.27 Converted DB to 1.27 Changing runDoubleContactsMS and runIDoubleContactsMS from 1000ms to 300ms //1.25 - 1.26 Converted DB to 1.26 Changed Inclinated to Inclined //1.24 - 1.25 Converted DB to 1.25 Language defaults to (empty string), means detected //1.23 - 1.24 Converted DB to 1.24 Delete runISpeedStartArrival and add 4 double contacts configs //1.22 - 1.23 Converted DB to 1.23 Added encoder configuration //1.21 - 1.22 Converted DB to 1.22 Encoder laterality in english again //1.20 - 1.21 Converted DB to 1.21 Fixing loosing of encoder videoURL after recalculate //1.19 - 1.20 Converted DB to 1.20 Preferences: added user email //1.18 - 1.19 Converted DB to 1.19 Preferences deleted showHeight, added showStiffness //1.17 - 1.18 Converted DB to 1.18 deleted Negative runInterval runs (bug from last version) //1.16 - 1.17 Converted DB to 1.17 Deleted Max jump (we already have "Free") //1.15 - 1.16 Converted DB to 1.16 Cyprus moved to Europe //1.14 - 1.15 Converted DB to 1.15 added Chronojump profile and bilateral profile //1.13 - 1.14 Converted DB to 1.14 slCMJ -> slCMJleft, slCMJright //1.12 - 1.13 Converted DB to 1.13 Added ExecuteAuto table //1.11 - 1.12 Converted DB to 1.12 URLs from absolute to relative //1.10 - 1.11 Converted DB to 1.11 Added option on autosave curves on capture (all/bestmeanpower/none) //1.09 - 1.10 Converted DB to 1.10 Added RSA RAST on runType //1.08 - 1.09 Converted DB to 1.09 Added option on preferences to useHeightsOnJumpIndexes (default) or not //1.07 - 1.08 Converted DB to 1.08 Added translate statistics graph option to preferences //1.06 - 1.07 Converted DB to 1.07 Added jump_dj_a.png //1.05 - 1.06 Converted DB to 1.06 Curves are now linked to signals //1.04 - 1.05 Converted DB to 1.05 Removed inertial curves, because sign was not checked on 1.04 when saving curves //1.03 - 1.04 Converted DB to 1.04 Encoder table improved //1.02 - 1.03 Converted DB to 1.03 Updated encoder exercise, angle is now on encoder configuration //1.01 - 1.02 Converted DB to 1.02 Added Agility Tests: Agility-T-Test, Agility-3L3R //1.00 - 1.01 Converted DB to 1.01 Added export to CSV configuration on preferences //0.99 - 1.00 Converted DB to 1.00 Encoder added Free and Inclined Exercises //0.98 - 0.99 Converted DB to 0.99 Encoder table improved //0.97 - 0.98 Converted DB to 0.98 Fixed encoder laterality //0.96 - 0.97 Converted DB to 0.97 Added inertialmomentum in preferences //0.95 - 0.96 Converted DB to 0.96 Encoder signal future3 three modes //0.94 - 0.95 Converted DB to 0.95 Added encoder1RMMethod //0.93 - 0.94 Converted DB to 0.94 Added encoder1RM table //0.92 - 0.93 Converted DB to 0.93 Added speed1RM on encoder exercise //0.91 - 0.92 Converted DB to 0.92 Added videoDevice to preferences //0.90 - 0.91 Converted DB to 0.91 Encoder Squat 75% -> 100% //0.89 - 0.90 Converted DB to 0.90 Preferences added propulsive and encoder smooth //0.88 - 0.89 Converted DB to 0.89 Added encoder exercise: Free //0.87 - 0.88 Converted DB to 0.88 Deleted fake RSA test and added known RSA tests //0.86 - 0.87 Converted DB to 0.87 Added run speed start preferences on sqlite //0.85 - 0.86 Converted DB to 0.86 videoOn: TRUE //0.84 - 0.85 Converted DB to 0.85 Added slCMJ jump //0.83 - 0.84 Converted DB to 0.84 Added first RSA test //0.82 - 0.83 Converted DB to 0.83 Created encoder table //0.81 - 0.82 Converted DB to 0.82 Added videoOn //0.80 - 0.81 Converted DB to 0.81 Added tempRunInterval initial speed //0.79 - 0.80 Converted DB to 0.80 Added run and runInterval initial speed (if not done in 0.56 conversion) //0.78 - 0.79 Converted DB to 0.79 (Added multimediaStorage structure id) //0.77 - 0.78 Converted DB to 0.78 (Added machineID to preferences, takeOffWeight has no weight in db conversions since 0.66) //0.76 - 0.77 Converted DB to 0.77 (person77, personSession77) //0.75 - 0.76 Converted DB to 0.76 (jump & jumpRj falls as double) //0.74 - 0.75 Converted DB to 0.75 (person, and personSessionWeight have height and weight as double) //0.73 - 0.74 Converted DB to 0.74 (All DJ converted to DJna) //0.72 - 0.73 Converted DB to 0.73 (deleted orphaned persons (in person table but not in personSessionWeight table)) //0.71 - 0.72 dates to YYYY-MM-DD //0.70 - 0.71 created personNotUploadTable on client //0.69 - 0.70 added showPower to preferences //0.68 - 0.69 added Gesell-DBT test //0.67 - 0.68 added multiChronopic tests table //0.66 - 0.67 added TakeOff jumps //0.65 - 0.66 added done nothing //0.64 - 0.65 added Sevaluator on client //0.63 - 0.64 added margaria test //0.62 - 0.63 added 'versionAvailable' to preferences //0.61 - 0.62 added hexagon (jumpRj test) //0.60 - 0.61 added RunIntervalType distancesString (now we van have interval tests with different distances of tracks). Added MTGUG //0.59 - 0.60 added volumeOn and evaluatorServerID to preferences. Session has now serverUniqueID. Simulated now are -1, because 0 is real and positive is serverUniqueID //0.58 - 0.59 Added 'showAngle' to preferences, changed angle on jump to double //0.57 - 0.58 Countries without kingdom or republic (except when needed) //0.56 - 0.57 Added simulated column to each event table on client. person: race, country, serverID. Convert to sport related done here if needed. Added also run and runInterval initial speed); //0.55 - 0.56 Added session default sport stuff into session table //0.54 - 0.55 Added undefined to speciallity table //0.53 - 0.54 created sport tables. Added sport data, speciallity and level of practice to person table //0.52 - 0.53 added table weightSession, moved person weight data to weightSession table for each session that has performed //0.51 - 0.52 added graphLinks for cmj_l and abk_l. Fixed CMJ_l name //0.50 - 0.51 added graphLinks for run simple and interval //0.49 - 0.50: changed SJ+ to SJl, same for CMJ+ and ABK+, added jump and jumpRj graph links //0.48 - 0.49: added graphLinkTable, added rocket jump and 5 agility tests: (20Yard, 505, Illinois, Shuttle-Run & ZigZag). Added graphs pof the 5 agility tests //0.47 - 0.48: added tempJumpReactive and tempRunInterval tables //0.46 - 0.47: added reactionTime table //0.45 - 0.46: added "Free" jump type //0.44 - 0.45: added allowFinishRjAfterTime //0.43 - 0.44: added showQIndex and showDjIndex //0.42 - 0.43: added 'free' pulseType & language preference //0.41 - 0.42: added pulse and pulseType tables //0.4 - 0.41: jump, jumpRj weight is double (always a percent) Sqlite.Close(); creationRate ++; }
public static void CreateTables(bool server) { dbcon.Open(); creationTotal = 14; creationRate = 1; SqliteServer sqliteServerObject = new SqliteServer(); //user has also an evaluator table with a row (it's row) sqliteServerObject.CreateEvaluatorTable(); if(server) { sqliteServerObject.CreatePingTable(); SqliteServerSession sqliteSessionObject = new SqliteServerSession(); sqliteSessionObject.createTable(Constants.SessionTable); } else { SqliteSession sqliteSessionObject = new SqliteSession(); sqliteSessionObject.createTable(Constants.SessionTable); SqlitePersonSessionNotUpload.CreateTable(); creationRate ++; } SqlitePerson sqlitePersonObject = new SqlitePerson(); sqlitePersonObject.createTable(Constants.PersonTable); //graphLinkTable SqliteEvent.createGraphLinkTable(); creationRate ++; //jumps SqliteJump sqliteJumpObject = new SqliteJump(); SqliteJumpRj sqliteJumpRjObject = new SqliteJumpRj(); sqliteJumpObject.createTable(Constants.JumpTable); sqliteJumpRjObject.createTable(Constants.JumpRjTable); sqliteJumpRjObject.createTable(Constants.TempJumpRjTable); //jump Types creationRate ++; SqliteJumpType.createTableJumpType(); SqliteJumpType.createTableJumpRjType(); SqliteJumpType.initializeTableJumpType(); SqliteJumpType.initializeTableJumpRjType(); //runs creationRate ++; SqliteRun sqliteRunObject = new SqliteRun(); SqliteRunInterval sqliteRunIntervalObject = new SqliteRunInterval(); sqliteRunObject.createTable(Constants.RunTable); sqliteRunIntervalObject.createTable(Constants.RunIntervalTable); sqliteRunIntervalObject.createTable(Constants.TempRunIntervalTable); //run Types creationRate ++; SqliteRunType sqliteRunTypeObject = new SqliteRunType(); sqliteRunTypeObject.createTable(Constants.RunTypeTable); SqliteRunType.initializeTable(); SqliteRunIntervalType sqliteRunIntervalTypeObject = new SqliteRunIntervalType(); sqliteRunIntervalTypeObject.createTable(Constants.RunIntervalTypeTable); SqliteRunIntervalType.initializeTable(); //reactionTimes creationRate ++; SqliteReactionTime sqliteReactionTimeObject = new SqliteReactionTime(); sqliteReactionTimeObject.createTable(Constants.ReactionTimeTable); //pulses and pulseTypes creationRate ++; SqlitePulse sqlitePulseObject = new SqlitePulse(); sqlitePulseObject.createTable(Constants.PulseTable); SqlitePulseType.createTablePulseType(); SqlitePulseType.initializeTablePulseType(); //multiChronopic tests creationRate ++; SqliteMultiChronopic sqliteMultiChronopicObject = new SqliteMultiChronopic(); sqliteMultiChronopicObject.createTable(Constants.MultiChronopicTable); //encoder creationRate ++; SqliteEncoder.createTableEncoder(); SqliteEncoder.createTableEncoderExercise(); SqliteEncoder.initializeTableEncoderExercise(); //sports creationRate ++; SqliteSport.createTable(); SqliteSport.initialize(); SqliteSpeciallity.createTable(); SqliteSpeciallity.initialize(); SqliteSpeciallity.InsertUndefined(true); creationRate ++; SqlitePersonSession sqlitePersonSessionObject = new SqlitePersonSession(); sqlitePersonSessionObject.createTable(Constants.PersonSessionTable); creationRate ++; SqlitePreferences.createTable(); SqlitePreferences.initializeTable(lastChronojumpDatabaseVersion, creatingBlankDatabase); creationRate ++; SqliteCountry.createTable(); SqliteCountry.initialize(); //changes [from - to - desc] //0.83 - 0.84 Converted DB to 0.84 Added first RSA test //0.82 - 0.83 Converted DB to 0.83 Created encoder table //0.81 - 0.82 Converted DB to 0.82 Added videoOn //0.80 - 0.81 Converted DB to 0.81 Added tempRunInterval initial speed //0.79 - 0.80 Converted DB to 0.80 Added run and runInterval initial speed (if not done in 0.56 conversion) //0.78 - 0.79 Converted DB to 0.79 (Added multimediaStorage structure id) //0.77 - 0.78 Converted DB to 0.78 (Added machineID to preferences, takeOffWeight has no weight in db conversions since 0.66) //0.76 - 0.77 Converted DB to 0.77 (person77, personSession77) //0.75 - 0.76 Converted DB to 0.76 (jump & jumpRj falls as double) //0.74 - 0.75 Converted DB to 0.75 (person, and personSessionWeight have height and weight as double) //0.73 - 0.74 Converted DB to 0.74 (All DJ converted to DJna) //0.72 - 0.73 Converted DB to 0.73 (deleted orphaned persons (in person table but not in personSessionWeight table)) //0.71 - 0.72 dates to YYYY-MM-DD //0.70 - 0.71 created personNotUploadTable on client //0.69 - 0.70 added showPower to preferences //0.68 - 0.69 added Gesell-DBT test //0.67 - 0.68 added multiChronopic tests table //0.66 - 0.67 added TakeOff jumps //0.65 - 0.66 added done nothing //0.64 - 0.65 added Sevaluator on client //0.63 - 0.64 added margaria test //0.62 - 0.63 added 'versionAvailable' to preferences //0.61 - 0.62 added hexagon (jumpRj test) //0.60 - 0.61 added RunIntervalType distancesString (now we van have interval tests with different distances of tracks). Added MTGUG //0.59 - 0.60 added volumeOn and evaluatorServerID to preferences. Session has now serverUniqueID. Simulated now are -1, because 0 is real and positive is serverUniqueID //0.58 - 0.59 Added 'showAngle' to preferences, changed angle on jump to double //0.57 - 0.58 Countries without kingdom or republic (except when needed) //0.56 - 0.57 Added simulated column to each event table on client. person: race, country, serverID. Convert to sport related done here if needed. Added also run and runInterval initial speed); //0.55 - 0.56 Added session default sport stuff into session table //0.54 - 0.55 Added undefined to speciallity table //0.53 - 0.54 created sport tables. Added sport data, speciallity and level of practice to person table //0.52 - 0.53 added table weightSession, moved person weight data to weightSession table for each session that has performed //0.51 - 0.52 added graphLinks for cmj_l and abk_l. Fixed CMJ_l name //0.50 - 0.51 added graphLinks for run simple and interval //0.49 - 0.50: changed SJ+ to SJl, same for CMJ+ and ABK+, added jump and jumpRj graph links //0.48 - 0.49: added graphLinkTable, added rocket jump and 5 agility tests: (20Yard, 505, Illinois, Shuttle-Run & ZigZag). Added graphs pof the 5 agility tests //0.47 - 0.48: added tempJumpReactive and tempRunInterval tables //0.46 - 0.47: added reactionTime table //0.45 - 0.46: added "Free" jump type //0.44 - 0.45: added allowFinishRjAfterTime //0.43 - 0.44: added showQIndex and showDjIndex //0.42 - 0.43: added 'free' pulseType & language preference //0.41 - 0.42: added pulse and pulseType tables //0.4 - 0.41: jump, jumpRj weight is double (always a percent) dbcon.Close(); creationRate ++; }