public override void GetById(int?id) { SqlCommand command = Connection.GetCommand(); command.CommandText = "SELECT * FROM Symptom WHERE SymptomID = @id"; command.Parameters.AddWithValue("@id", id); SqlDataReader reader = command.ExecuteReader(); int diagnosisId = 0; int archetypeId = 0; if (reader.HasRows) { reader.Read(); Id = id; diagnosisId = reader.GetInt32(1); archetypeId = reader.GetInt32(2); ArchetypeValue = reader.GetString(3); } reader.Close(); Diagnosis = new Diagnosis(); Diagnosis.GetById(diagnosisId, Connection); Archetype = new Archetype(); Archetype.GetById(archetypeId, Connection); }
public override void GetById(int?id) { SqlCommand command = Connection.GetCommand(); command.CommandText = "SELECT * FROM Prescription WHERE PrescriptionID = @id"; command.Parameters.AddWithValue("@id", id); SqlDataReader reader = command.ExecuteReader(); int medicamentId = 0; int diagnosisId = 0; if (reader.HasRows) { reader.Read(); Id = id; medicamentId = reader.GetInt32(1); diagnosisId = reader.GetInt32(2); } reader.Close(); Medicament = new Medicament(); Medicament.GetById(medicamentId, Connection); Diagnosis = new Diagnosis(); Diagnosis.GetById(diagnosisId, Connection); }