public static void LoadEquipmentList() { if (Types == null) { Types = new EquipmentTypes(); string queryTypes = "SELECT \"Id\", \"TypeName\", \"EPrice\", \"Description\" FROM \"EquipmentType\";"; NpgsqlCommand Command1 = new NpgsqlCommand(queryTypes, Connection); var reader1 = Command1.ExecuteReader(); if (reader1.HasRows) { while (reader1.Read()) { Types.AddType(reader1.GetInt32(0), reader1.GetString(1), reader1.GetDouble(2), reader1.GetString(3)); } } reader1.Close(); } Equipments = new EquipmentList(); string queryEquipment = "SELECT \"Id\", \"Status\", \"Location\", \"IdType\" FROM \"Equipment\";"; NpgsqlCommand Command2 = new NpgsqlCommand(queryEquipment, Connection); var reader2 = Command2.ExecuteReader(); if (reader2.HasRows) { while (reader2.Read()) { Equipments.AddEquipment(reader2["Id"].ToString(), reader2["Status"].ToString(), reader2["Location"].ToString(), reader2["IdType"].ToString(), Types); } } reader2.Close(); }
public Equipment(string id, string status, string location, string typeid, EquipmentTypes eTypes) { Id = id; Status = status; Location = location; IdType = typeid; var t = eTypes.GetType(int.Parse(typeid)); Price = t.cost; TypeName = t.name; Description = t.description; }
public void AddEquipment(string id, string status, string location, string typeid, EquipmentTypes types) { equipment.Add(new Equipment(id, status, location, typeid, types)); }