public int InsertAtDB(bool dbconOpened, string 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, description, race, countryID, serverUniqueID); return(myID); }
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); }