public Patient(IEnumerable<PatientRecord> patientRecords, bool active, Physician physician) { this.active = active; this.physician = physician; this.patientRecords = new List<PatientRecord>(patientRecords); foreach (var record in this.patientRecords) { record.Patient = this; } }
private static void CreatePatientData(ISession session) { State newYork = new State { Abbreviation = "NY", FullName = "New York" }; State florida = new State { Abbreviation = "FL", FullName = "Florida" }; Physician drDobbs = new Physician { Name = "Dr Dobbs" }; Physician drWatson = new Physician { Name = "Dr Watson" }; PatientRecord bobBarkerRecord = new PatientRecord { Name = new PatientName { FirstName = "Bob", LastName = "Barker" }, Address = new Address { AddressLine1 = "123 Main St", City = "New York", State = newYork, ZipCode = "10001" }, BirthDate = new DateTime(1930, 1, 1), Gender = Gender.Male, Amount = 50 }; PatientRecord johnDoeRecord1 = new PatientRecord { Name = new PatientName { FirstName = "John", LastName = "Doe" }, Address = new Address { AddressLine1 = "123 Main St", City = "Tampa", State = florida, ZipCode = "33602" }, BirthDate = new DateTime(1969, 1, 1), Gender = Gender.Male, Amount = 50, Type = new PatientRecordType() { TypeCode = 5, TypeName = "Type 1" } }; PatientRecord johnDoeRecord2 = new PatientRecord { Name = new PatientName { FirstName = "John", LastName = "Doe" }, Address = new Address { AddressLine1 = "123 Main St", AddressLine2 = "Apt 2", City = "Tampa", State = florida, ZipCode = "33602" }, BirthDate = new DateTime(1969, 1, 1), Gender = Gender.Male, Amount = 50, Type = new PatientRecordType() { TypeCode = 15, TypeName = "Type 2" } }; PatientRecord janeDoeRecord1 = new PatientRecord { Name = new PatientName { FirstName = "Jane", LastName = "Doe" }, Address = new Address { AddressLine1 = "123 Main St", City = "Tampa", State = florida, ZipCode = "33602" }, BirthDate = new DateTime(1972, 12, 1), Gender = Gender.Female, Amount = 101, Type = new PatientRecordType() { TypeCode = 25, TypeName = "Type 3" } }; PatientRecord janeDoeRecord2 = new PatientRecord { Name = new PatientName { FirstName = "Jane", LastName = "Doe" }, Address = new Address { AddressLine1 = "123 Main St", City = "Tampa", State = florida, ZipCode = "33602" }, BirthDate = new DateTime(1972, 12, 1), Type = new PatientRecordType() { TypeCode = 5, TypeName = "Type 1" } }; Patient bobBarker = new Patient(new[] { bobBarkerRecord }, false, drDobbs); Patient johnDoe = new Patient(new[] { johnDoeRecord1, johnDoeRecord2 }, true, drWatson); Patient janeDoe = new Patient(new[] { janeDoeRecord1, janeDoeRecord2 }, true, drWatson); session.Save(newYork); session.Save(florida); session.Save(drDobbs); session.Save(drWatson); session.Save(bobBarker); session.Save(johnDoe); session.Save(janeDoe); }