// return the character whose ID is provided public static UserCharacter FindCharacter(int ID) { UserCharacter tempUC = null; // first we query the database string query = "SELECT * FROM tblTitan WHERE (titanId = '" + ID + "')"; // returning our results as a list List <Object> results = SelectQuery(query); // then pull the result into a userCharacter object foreach (List <Object> result in results) { tempUC = new UserCharacter((string)result[1], (int)result[0], (int)result[4], (int)result[3], (int)result[2], result[8].ToString(), (bool)result[7], (bool)result[9], (bool)result[6]); } return(tempUC); }
// get characters owned by this player public List <UserCharacter> GetUserCharacters() { List <UserCharacter> playerChars = new List <UserCharacter>(); //loop through the global list and copy the ones belonging to us that aren't retired // first we query the database string query = "SELECT * FROM tblTitan WHERE (userId = " + UserID + " AND hallOfFame = 0 AND suspended = 0);"; // returning our results as a list List <Object> results = Utilities.SelectQuery(query); // process our list into a list of user characters foreach (List <Object> result in results) { UserCharacter tempUC = new UserCharacter((string)result[1], (int)result[0], (int)result[4], (int)result[3], (int)result[2], result[8].ToString(), (bool)result[7], (bool)result[9], (bool)result[6]); playerChars.Add(tempUC); } return(playerChars); }