public void AssignDiary(int p_Patient_OID, int p_diary_OID) { ChroniGenNHibernate.EN.Chroni.PatientEN patientEN = null; try { SessionInitializeTransaction(); patientEN = (PatientEN)session.Load(typeof(PatientEN), p_Patient_OID); patientEN.Diary = (ChroniGenNHibernate.EN.Chroni.DiaryEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.DiaryEN), p_diary_OID); patientEN.Diary.Patient = patientEN; session.Update(patientEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in PatientCAD.", ex); } finally { SessionClose(); } }
public void UnassignPatient(int p_RelatedPerson_OID, System.Collections.Generic.IList <int> p_patient_OIDs) { try { SessionInitializeTransaction(); ChroniGenNHibernate.EN.Chroni.RelatedPersonEN relatedPersonEN = null; relatedPersonEN = (RelatedPersonEN)session.Load(typeof(RelatedPersonEN), p_RelatedPerson_OID); ChroniGenNHibernate.EN.Chroni.PatientEN patientENAux = null; if (relatedPersonEN.Patient != null) { foreach (int item in p_patient_OIDs) { patientENAux = (ChroniGenNHibernate.EN.Chroni.PatientEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.PatientEN), item); if (relatedPersonEN.Patient.Contains(patientENAux) == true) { relatedPersonEN.Patient.Remove(patientENAux); patientENAux.RelatedPerson.Remove(relatedPersonEN); } else { throw new ModelException("The identifier " + item + " in p_patient_OIDs you are trying to unrelationer, doesn't exist in RelatedPersonEN"); } } } session.Update(relatedPersonEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in RelatedPersonCAD.", ex); } finally { SessionClose(); } }
public void AssignPatient(int p_RelatedPerson_OID, System.Collections.Generic.IList <int> p_patient_OIDs) { ChroniGenNHibernate.EN.Chroni.RelatedPersonEN relatedPersonEN = null; try { SessionInitializeTransaction(); relatedPersonEN = (RelatedPersonEN)session.Load(typeof(RelatedPersonEN), p_RelatedPerson_OID); ChroniGenNHibernate.EN.Chroni.PatientEN patientENAux = null; if (relatedPersonEN.Patient == null) { relatedPersonEN.Patient = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.PatientEN>(); } foreach (int item in p_patient_OIDs) { patientENAux = new ChroniGenNHibernate.EN.Chroni.PatientEN(); patientENAux = (ChroniGenNHibernate.EN.Chroni.PatientEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.PatientEN), item); patientENAux.RelatedPerson.Add(relatedPersonEN); relatedPersonEN.Patient.Add(patientENAux); } session.Update(relatedPersonEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in RelatedPersonCAD.", ex); } finally { SessionClose(); } }
public override bool Equals(object obj) { if (obj == null) { return(false); } PatientEN t = obj as PatientEN; if (t == null) { return(false); } if (Identifier.Equals(t.Identifier)) { return(true); } else { return(false); } }
public void UnassignDiary(int p_Patient_OID, int p_diary_OID) { try { SessionInitializeTransaction(); ChroniGenNHibernate.EN.Chroni.PatientEN patientEN = null; patientEN = (PatientEN)session.Load(typeof(PatientEN), p_Patient_OID); if (patientEN.Diary.Identifier == p_diary_OID) { patientEN.Diary = null; ChroniGenNHibernate.EN.Chroni.DiaryEN diaryEN = (ChroniGenNHibernate.EN.Chroni.DiaryEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.DiaryEN), p_diary_OID); diaryEN.Patient = null; } else { throw new ModelException("The identifier " + p_diary_OID + " in p_diary_OID you are trying to unrelationer, doesn't exist in PatientEN"); } session.Update(patientEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in PatientCAD.", ex); } finally { SessionClose(); } }
public PatientEN(PatientEN patient) { this.init(Identifier, patient.Nif, patient.Active, patient.Name, patient.Surnames, patient.Gender, patient.BirthDate, patient.Deceased, patient.Address, patient.Email, patient.Phone, patient.MaritalStatus, patient.Photo, patient.RelatedPerson, patient.Location, patient.Diary, patient.Encounter, patient.Conversation, patient.Reclamation, patient.Password, patient.Practitioner, patient.AssessmentPractitioner); }