// find a fight by it's ID public static FightRecord FindFight(int ID) { FightRecord tempFR = null; // first we query the database string query = "SELECT * FROM tblBattle WHERE (battleId = " + ID + ")"; // returning our results as a list List <Object> results = SelectQuery(query); // then pull the result into a fightRecord object foreach (List <Object> result in results) { tempFR = new FightRecord((int)result[0], (int)result[1], (int)result[2], (int)result[4], result[3].ToString()); } return(tempFR); }
// return all fights involving the character specified public static List <FightRecord> FindFights(int ID) { List <FightRecord> found = new List <FightRecord>(); // first we query the database string query = "SELECT * FROM tblBattle WHERE (battler1 = " + ID + " OR battler2 = " + ID + ")"; // returning our results as a list List <Object> results = SelectQuery(query); // process our list into a list of fight records foreach (List <Object> result in results) { FightRecord tmpFR = new FightRecord((int)result[0], (int)result[1], (int)result[2], (int)result[4], result[3].ToString()); found.Add(tmpFR); } return(found); }