本文整理汇总了C#中Person.InsertAtDB方法的典型用法代码示例。如果您正苦于以下问题:C# Person.InsertAtDB方法的具体用法?C# Person.InsertAtDB怎么用?C# Person.InsertAtDB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person.InsertAtDB方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UploadPerson
public int UploadPerson(Person myPerson, int sessionID)
{
//store person uniqueID
int temp = myPerson.UniqueID;
//change value for being inserted with new numeration in server
myPerson.UniqueID = -1;
//hidden person.Name and comments
myPerson.Name = "";
myPerson.Description = "";
//do insertion
int id = myPerson.InsertAtDB(false, Constants.PersonTable);
//roll back person unique id value
myPerson.UniqueID = temp;
Console.WriteLine("id at server: " + id);
return id; //uniqueID of person at server
}
示例2: convertPersonAndPersonSessionTo77
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);
}