public Breed(int id, string name, Spieces spieces, double foodCost, double housCost) { this.id = id; this.name = name; this.spieces = spieces; this.foodCost = foodCost; this.housCost = housCost; }
public Pet(int id, string name, Breed breed, Spieces spieces, Sanctuary sanctuary, int age, int gender, double weight, double bills, DateTime rescueD, string picturePath) { this.id = id; this.name = name; this.breed = breed; this.spieces = spieces; this.sanctuary = sanctuary; this.age = age; this.gender = gender; this.weight = weight; this.bills = bills; this.rescueD = rescueD; this.picturePath = picturePath; }
// Method that returns a list of Spieces objects with the details from the DB public static List<Spieces> LoadSpieces() { List<Spieces> spieces = new List<Spieces>(); OleDbConnection myConnection = GetConnection(); string myQuery = "SELECT id, name FROM spieces"; OleDbCommand myCommand = new OleDbCommand(myQuery, myConnection); try { myConnection.Open(); OleDbDataReader myReader = myCommand.ExecuteReader(); while (myReader.Read()) { Spieces spiece = new Spieces(int.Parse(myReader["id"].ToString()), myReader["name"].ToString()); spieces.Add(spiece); } return spieces; } catch (Exception ex) { Console.WriteLine("Exception in DBHandler", ex); return null; } finally { myConnection.Close(); } }