public void save(Patient p) { if (p.age != null) { int age = (int)p.age; p.dateOfBirth = ageToDateOfBirth(age); p.age = null; } var sess = SessionProvider.createSession(); sess.Save(p); sess.Flush(); }
public void update(int id, Patient p) { var sess = SessionProvider.createSession(); IQuery q = sess.CreateQuery("FROM Patient where id = " + id.ToString()); Patient patient = q.List<Domain.Patient>().First(); patient.name = p.name; if (p.age != null) { int age = (int)p.age; patient.dateOfBirth = ageToDateOfBirth(age); p.age = null; } patient.gender = p.gender; patient.phone = p.phone; patient.medical_history = p.medical_history; sess.Update(patient); sess.Flush(); }
public PatientInfoForm(int id, Home _owner) { InitializeComponent(); owner = _owner; var service = new PatientService(); patient = service.getPatientById(id); name_txt.Text = patient.name; id_txt.Text = patient.id.ToString(); age_txt.Text = patient.dateOfBirth != DateTime.MinValue ? service.dateofBirthToAge(patient.dateOfBirth).ToString() : ""; gender_txt.Text = patient.gender; phone_txt.Text = patient.phone; if (patient.medical_history != null) { medicalHistory_txt.Text = patient.medical_history + "."; } else { medicalHistory_txt.Text = "None."; } fillGridView(); edit_visit_btn.Enabled = true; }