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); }
public override string ToString() { return($"Симптом: {{ {Diagnosis.ToString()}, {Archetype.ToString()}, Значение архетипа: {ArchetypeValue} }}"); }
public Prescription(Medicament medicament, Diagnosis diagnosis, SqlConnection connection) : this() { Connection = connection; Medicament = medicament; Diagnosis = diagnosis; }