public void Destroy(int identifier ) { try { SessionInitializeTransaction(); PatientEN patientEN = (PatientEN)session.Load(typeof(PatientEN), identifier); session.Delete(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 SetEmail(int p_oid, string p_email) { /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Patient_setEmail) ENABLED START*/ // Write here your custom code... PatientCAD patientCAD = new PatientCAD(); PatientCEN patientCEN = new PatientCEN(patientCAD); if (p_oid > 0) { PatientEN patient = patientCEN.ReadOID(p_oid); if (patient != null) { if (!string.IsNullOrEmpty(p_email)) { patient.Email = p_email; patientCAD.Modify(patient); } } } /*PROTECTED REGION END*/ }
public void SetPassword(int p_oid, string p_passwordCurrent, string p_passwordNew) { /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Patient_setPassword) ENABLED START*/ // Write here your custom code... PatientCAD patientCAD = new PatientCAD(); PatientCEN patientCEN = new PatientCEN(patientCAD); if (p_oid > 0) { PatientEN patient = patientCEN.ReadOID(p_oid); if (patient != null) { if (!string.IsNullOrEmpty(p_passwordCurrent) && !string.IsNullOrEmpty(p_passwordNew)) { if (Utils.Util.GetEncondeMD5(p_passwordCurrent).Equals(patient.Password)) { patient.Password = Utils.Util.GetEncondeMD5(p_passwordNew); patientCAD.Modify(patient); } } } } /*PROTECTED REGION END*/ }
// GET: DashBoard/Patient/Delete/5 public ActionResult Delete(int id) { ViewBag.menu = "Patients"; SessionInitialize(); PatientCAD cadPos = new PatientCAD(); PatientCEN cen = new PatientCEN(cadPos); cen.Destroy(id); PatientEN pos = cen.ReadOID(id); SessionClose(); if (pos == null) { TempData["resultado"] = Resources.textos.deleteOK; TempData["ok"] = "success"; } else { TempData["resultado"] = Resources.textos.errorKO; TempData["ok"] = "danger"; } return(RedirectToAction("Index")); }
public void SetBirthDate(int p_oid, Nullable <DateTime> p_birthDate) { /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Patient_setBirthDate) ENABLED START*/ // Write here your custom code... PatientCAD patientCAD = new PatientCAD(); PatientCEN patientCEN = new PatientCEN(patientCAD); if (p_oid > 0) { PatientEN patient = patientCEN.ReadOID(p_oid); if (patient != null) { if (p_birthDate != null) { patient.BirthDate = p_birthDate; patientCAD.Modify(patient); } } } /*PROTECTED REGION END*/ }
// Modify default (Update all attributes of the class) public void ModifyDefault(PatientEN patient) { try { SessionInitializeTransaction(); PatientEN patientEN = (PatientEN)session.Load(typeof(PatientEN), patient.Id); session.Update(patientEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in PatientCAD.", ex); } finally { SessionClose(); } }
public void SetMaritalStatus(int p_oid, ChroniGenNHibernate.Enumerated.Chroni.MaritalStatusEnum p_maritalStatus) { /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Patient_setMaritalStatus) ENABLED START*/ // Write here your custom code... PatientCAD patientCAD = new PatientCAD(); PatientCEN patientCEN = new PatientCEN(patientCAD); if (p_oid > 0) { PatientEN patient = patientCEN.ReadOID(p_oid); if (patient != null) { if (p_maritalStatus > 0) { patient.MaritalStatus = p_maritalStatus; patientCAD.Modify(patient); } } } /*PROTECTED REGION END*/ }
//Sin e: ReadOID //Con e: PatientEN public PatientEN ReadOID(int identifier ) { PatientEN patientEN = null; try { SessionInitializeTransaction(); patientEN = (PatientEN)session.Get(typeof(PatientEN), identifier); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in PatientCAD.", ex); } finally { SessionClose(); } return(patientEN); }
public PatientEN ReadOID(int identifier ) { PatientEN patientEN = null; patientEN = _IPatientCAD.ReadOID(identifier); return(patientEN); }
public int New_(string p_nif, bool p_active, string p_name, string p_surnames, ChroniGenNHibernate.Enumerated.Chroni.GenderEnum p_gender, Nullable <DateTime> p_birthDate, bool p_deceased, string p_address, string p_email, string p_phone, ChroniGenNHibernate.Enumerated.Chroni.MaritalStatusEnum p_maritalStatus, string p_photo, System.Collections.Generic.IList <int> p_location, ChroniGenNHibernate.EN.Chroni.DiaryEN p_diary, String p_password) { PatientEN patientEN = null; int oid; //Initialized PatientEN patientEN = new PatientEN(); patientEN.Nif = p_nif; patientEN.Active = p_active; patientEN.Name = p_name; patientEN.Surnames = p_surnames; patientEN.Gender = p_gender; patientEN.BirthDate = p_birthDate; patientEN.Deceased = p_deceased; patientEN.Address = p_address; patientEN.Email = p_email; patientEN.Phone = p_phone; patientEN.MaritalStatus = p_maritalStatus; patientEN.Photo = p_photo; patientEN.Location = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.LocationEN>(); if (p_location != null) { foreach (int item in p_location) { ChroniGenNHibernate.EN.Chroni.LocationEN en = new ChroniGenNHibernate.EN.Chroni.LocationEN(); en.Identifier = item; patientEN.Location.Add(en); } } else { patientEN.Location = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.LocationEN>(); } patientEN.Diary = p_diary; patientEN.Password = Utils.Util.GetEncondeMD5(p_password); //Call to PatientCAD oid = _IPatientCAD.New_(patientEN); return(oid); }
public ActionResult Edit(int id, FormCollection collection, HttpPostedFileBase imagen) { ViewBag.menu = "Patients"; PatientCAD cadPos = new PatientCAD(); PatientCEN cen = new PatientCEN(cadPos); PatientEN positionEN = null; try { positionEN = cen.ReadOID(id); positionEN.Name = collection["Name"].ToString(); positionEN.Phone = collection["Phone"].ToString(); positionEN.Email = collection["Email"].ToString(); int tamMax = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["tamMaxImgProd"].ToString()); if (imagen != null) { if (imagen.ContentLength < (tamMax)) { if (IsImage(imagen)) { string nombreImagen = "img_" + positionEN.Name + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetExtension(imagen.FileName); var path = Server.MapPath("~/Content/images/"); imagen.SaveAs(Path.Combine(path + nombreImagen)); positionEN.Photo = nombreImagen; } else { TempData["resultado"] = Resources.textos.errorKO; TempData["ok"] = "success"; } } else { TempData["resultado"] = Resources.textos.errorKO; TempData["ok"] = "success"; } } cen.Modify(positionEN.Identifier, positionEN.Nif, positionEN.Active, positionEN.Name, positionEN.Surnames, positionEN.Gender, positionEN.BirthDate, positionEN.Deceased, positionEN.Address, positionEN.Email, positionEN.Phone, positionEN.MaritalStatus, positionEN.Photo, positionEN.Password); TempData["resultado"] = Resources.textos.editOK; TempData["ok"] = "success"; return(RedirectToAction("Index")); } catch (Exception ex) { positionEN = cen.ReadOID(id); ViewBag.error = ex.Message; return(View(positionEN)); } }
public Patient ConvertENToModelUI(PatientEN en) { Patient loc = new Patient(); loc.identifier = en.Identifier; loc.Name = en.Name; loc.Phone = en.Phone; loc.Email = en.Email; loc.Imagen = en.Photo; return(loc); }
public void Modify(int p_Patient_OID, string p_name, string p_description) { PatientEN patientEN = null; //Initialized PatientEN patientEN = new PatientEN(); patientEN.Id = p_Patient_OID; patientEN.Name = p_name; patientEN.Description = p_description; //Call to PatientCAD _IPatientCAD.Modify(patientEN); }
public int New_(PatientEN patient) { try { SessionInitializeTransaction(); if (patient.Scenario != null) { // Argumento OID y no colección. patient.Scenario = (MoSIoTGenNHibernate.EN.MosIoT.IoTScenarioEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.IoTScenarioEN), patient.Scenario.Id); patient.Scenario.Entity .Add(patient); } if (patient.PatientProfile != null) { // Argumento OID y no colección. patient.PatientProfile = (MoSIoTGenNHibernate.EN.MosIoT.PatientProfileEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.PatientProfileEN), patient.PatientProfile.Id); } if (patient.UserPatient != null) { // Argumento OID y no colección. patient.UserPatient = (MoSIoTGenNHibernate.EN.MosIoT.UserEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.UserEN), patient.UserPatient.Id); patient.UserPatient.Patient .Add(patient); } session.Save(patient); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in PatientCAD.", ex); } finally { SessionClose(); } return(patient.Id); }
public static PatientDTOA Convert(EntityEN en, NHibernate.ISession session = null) { PatientDTOA dto = null; PatientRESTCAD patientRESTCAD = null; PatientCEN patientCEN = null; PatientCP patientCP = null; if (en != null) { dto = new PatientDTOA(); patientRESTCAD = new PatientRESTCAD(session); patientCEN = new PatientCEN(patientRESTCAD); patientCP = new PatientCP(session); PatientEN enHijo = patientRESTCAD.ReadOIDDefault(en.Id); // // Attributes dto.Id = en.Id; dto.Name = en.Name; dto.Description = en.Description; // // TravesalLink /* Rol: Patient o--> PatientProfile */ dto.PatientProfile = PatientProfileAssembler.Convert((PatientProfileEN)enHijo.PatientProfile, session); /* Rol: Patient o--> User */ dto.UserData = UserAssembler.Convert((UserEN)enHijo.UserPatient, session); // // Service } return(dto); }
public void SetRelationship(int p_oid, int p_oid_patient, int p_oid_relatedPerson) { /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Relationship_setRelationship) ENABLED START*/ // Write here your custom code... RelationshipCAD relationshipCAD = new RelationshipCAD(); RelationshipCEN relationshipCEN = new RelationshipCEN(relationshipCAD); PatientCAD patientCAD = new PatientCAD(); PatientCEN patientCen = new PatientCEN(patientCAD); RelatedPersonCAD relatedPersonCAD = new RelatedPersonCAD(); RelatedPersonCEN relatedPersonCEN = new RelatedPersonCEN(relatedPersonCAD); if (p_oid > 0) { RelationshipEN relationship = relationshipCEN.ReadOID(p_oid); if (relationship != null) { if (p_oid_patient > 0) { PatientEN patient = patientCen.ReadOID(p_oid_patient); if (patient != null) { if (p_oid_relatedPerson > 0) { RelatedPersonEN relatedPerson = relatedPersonCEN.ReadOID(p_oid_relatedPerson); if (relatedPerson != null) { relationship.PatientOID = p_oid_patient; relationship.RelatedPersonOID = p_oid_relatedPerson; relationshipCAD.Modify(relationship); } } } } } } /*PROTECTED REGION END*/ }
public int New_(string p_name, int p_scenario, string p_description, int p_patientProfile, int p_userPatient) { PatientEN patientEN = null; int oid; //Initialized PatientEN patientEN = new PatientEN(); patientEN.Name = p_name; if (p_scenario != -1) { // El argumento p_scenario -> Property scenario es oid = false // Lista de oids id patientEN.Scenario = new MoSIoTGenNHibernate.EN.MosIoT.IoTScenarioEN(); patientEN.Scenario.Id = p_scenario; } patientEN.Description = p_description; if (p_patientProfile != -1) { // El argumento p_patientProfile -> Property patientProfile es oid = false // Lista de oids id patientEN.PatientProfile = new MoSIoTGenNHibernate.EN.MosIoT.PatientProfileEN(); patientEN.PatientProfile.Id = p_patientProfile; } if (p_userPatient != -1) { // El argumento p_userPatient -> Property userPatient es oid = false // Lista de oids id patientEN.UserPatient = new MoSIoTGenNHibernate.EN.MosIoT.UserEN(); patientEN.UserPatient.Id = p_userPatient; } //Call to PatientCAD oid = _IPatientCAD.New_(patientEN); return(oid); }
public void SetActive (int p_oid, bool p_active) { /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Patient_setActive) ENABLED START*/ // Write here your custom code... PatientCAD patientCAD = new PatientCAD (); PatientCEN patientCEN = new PatientCEN (patientCAD); if (p_oid > 0) { PatientEN patient = patientCEN.ReadOID (p_oid); if (patient != null) { patient.Active = p_active; patientCAD.Modify (patient); } } /*PROTECTED REGION END*/ }
public int New_(PatientEN patient) { try { SessionInitializeTransaction(); if (patient.Location != null) { for (int i = 0; i < patient.Location.Count; i++) { patient.Location [i] = (ChroniGenNHibernate.EN.Chroni.LocationEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.LocationEN), patient.Location [i].Identifier); patient.Location [i].Patient.Add(patient); } } if (patient.Diary != null) { // p_diary patient.Diary.Patient = patient; session.Save(patient.Diary); } session.Save(patient); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in PatientCAD.", ex); } finally { SessionClose(); } return(patient.Identifier); }
// GET: DashBoard/Patient/Details/5 public ActionResult Details(int id) { SessionInitialize(); string resultado = ""; string locationNombre = Resources.textos.modelEmpty; PatientCAD cadPos = new PatientCAD(); PatientCEN cen = new PatientCEN(cadPos); PatientEN posEN = cen.ReadOID(id); Dictionary <string, string> res = new Dictionary <string, string>(); if (posEN != null) { if (posEN.Name != null) { locationNombre = posEN.Name; } if (string.IsNullOrEmpty(posEN.Photo)) { posEN.Photo = "default.png"; } resultado = "<ul><li><strong>Id: </strong>" + posEN.Identifier + "</li><li><strong>Nombre: </strong>" + posEN.Name + "</li><li><strong>Teléfono: </strong>" + posEN.Phone + "</li><li><strong>Email: </strong>" + posEN.Email + "</li><li><strong>Dirección: </strong>" + posEN.Address + "</li></ul>"; res.Add("titulo", Resources.textos.detailsModal + posEN.Identifier + " " + "<img src = '/Content/images/" + posEN.Photo + "' height = '32' width = '32' />"); } else { resultado = "<p>" + Resources.textos.errorDataModal + " " + id.ToString() + "</p>"; res.Add("titulo", Resources.textos.modalTitulo); } res.Add("contenido", resultado); SessionClose(); return(Json(res)); }
public bool Logout(int p_oid) { /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Patient_logout) ENABLED START*/ // Write here your custom code... PatientCAD patientCAD = new PatientCAD(); PatientCEN patientCEN = new PatientCEN(patientCAD); if (p_oid > 0) { PatientEN patient = patientCEN.ReadOID(p_oid); if (patient != null) { return(true); } } return(false); /*PROTECTED REGION END*/ }
public void Modify(int p_Patient_OID, string p_nif, bool p_active, string p_name, string p_surnames, ChroniGenNHibernate.Enumerated.Chroni.GenderEnum p_gender, Nullable <DateTime> p_birthDate, bool p_deceased, string p_address, string p_email, string p_phone, ChroniGenNHibernate.Enumerated.Chroni.MaritalStatusEnum p_maritalStatus, string p_photo, String p_password) { PatientEN patientEN = null; //Initialized PatientEN patientEN = new PatientEN(); patientEN.Identifier = p_Patient_OID; patientEN.Nif = p_nif; patientEN.Active = p_active; patientEN.Name = p_name; patientEN.Surnames = p_surnames; patientEN.Gender = p_gender; patientEN.BirthDate = p_birthDate; patientEN.Deceased = p_deceased; patientEN.Address = p_address; patientEN.Email = p_email; patientEN.Phone = p_phone; patientEN.MaritalStatus = p_maritalStatus; patientEN.Photo = p_photo; patientEN.Password = Utils.Util.GetEncondeMD5(p_password); //Call to PatientCAD _IPatientCAD.Modify(patientEN); }
// GET: DashBoard/Patient/Edit/5 public ActionResult Edit(int id) { ViewBag.menu = "Patients"; PatientEN positionEN = null; Patient pos = null; try { SessionInitialize(); PatientCAD cadPos = new PatientCAD(); PatientCEN cen = new PatientCEN(cadPos); positionEN = cen.ReadOID(id); pos = new AssemblerPatient().ConvertENToModelUI(positionEN); SessionClose(); } catch (Exception ex) { ViewBag.error = "Error: " + ex.Message; } return(View(pos)); }
public static PatientEN Convert(PatientDTO dto) { PatientEN newinstance = null; try { if (dto != null) { newinstance = new PatientEN(); if (dto.PatientProfile_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IPatientProfileCAD patientProfileCAD = new MoSIoTGenNHibernate.CAD.MosIoT.PatientProfileCAD(); newinstance.PatientProfile = patientProfileCAD.ReadOIDDefault(dto.PatientProfile_oid); } if (dto.UserPatient_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IUserCAD userCAD = new MoSIoTGenNHibernate.CAD.MosIoT.UserCAD(); newinstance.UserPatient = userCAD.ReadOIDDefault(dto.UserPatient_oid); } newinstance.Id = dto.Id; newinstance.Name = dto.Name; if (dto.OriginAssociation_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAssociationCAD associationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AssociationCAD(); newinstance.OriginAssociation = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AssociationEN>(); foreach (int entry in dto.OriginAssociation_oid) { newinstance.OriginAssociation.Add(associationCAD.ReadOIDDefault(entry)); } } if (dto.TargetAssociation_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAssociationCAD associationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AssociationCAD(); newinstance.TargetAssociation = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AssociationEN>(); foreach (int entry in dto.TargetAssociation_oid) { newinstance.TargetAssociation.Add(associationCAD.ReadOIDDefault(entry)); } } if (dto.Scenario_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IIoTScenarioCAD ioTScenarioCAD = new MoSIoTGenNHibernate.CAD.MosIoT.IoTScenarioCAD(); newinstance.Scenario = ioTScenarioCAD.ReadOIDDefault(dto.Scenario_oid); } newinstance.Description = dto.Description; if (dto.Operations != null) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityOperationCAD entityOperationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityOperationCAD(); newinstance.Operations = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityOperationEN>(); foreach (EntityOperationDTO entry in dto.Operations) { newinstance.Operations.Add(EntityOperationAssemblerDTO.Convert(entry)); } } if (dto.Attributes != null) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityAttributesCAD entityAttributesCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityAttributesCAD(); newinstance.Attributes = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityAttributesEN>(); foreach (EntityAttributesDTO entry in dto.Attributes) { newinstance.Attributes.Add(EntityAttributesAssemblerDTO.Convert(entry)); } } if (dto.States != null) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityStateCAD entityStateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityStateCAD(); newinstance.States = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityStateEN>(); foreach (EntityStateDTO entry in dto.States) { newinstance.States.Add(EntityStateAssemblerDTO.Convert(entry)); } } } } catch (Exception ex) { throw ex; } return(newinstance); }
public HttpResponseMessage ReadOID(int idPatient) { // CAD, CEN, EN, returnValue PatientRESTCAD patientRESTCAD = null; PatientCEN patientCEN = null; PatientEN patientEN = null; PatientDTOA returnValue = null; try { SessionInitializeWithoutTransaction(); patientRESTCAD = new PatientRESTCAD(session); patientCEN = new PatientCEN(patientRESTCAD); // Data patientEN = patientCEN.ReadOID(idPatient); // Convert return if (patientEN != null) { returnValue = PatientAssembler.Convert(patientEN, session); } } catch (Exception e) { if (e.GetType() == typeof(HttpResponseException)) { throw e; } else if (e.GetType() == typeof(MoSIoTGenNHibernate.Exceptions.ModelException) && e.Message.Equals("El token es incorrecto")) { throw new HttpResponseException(HttpStatusCode.Forbidden); } else if (e.GetType() == typeof(MoSIoTGenNHibernate.Exceptions.ModelException) || e.GetType() == typeof(MoSIoTGenNHibernate.Exceptions.DataLayerException)) { throw new HttpResponseException(HttpStatusCode.BadRequest); } else { throw new HttpResponseException(HttpStatusCode.InternalServerError); } } finally { SessionClose(); } // Return 404 - Not found if (returnValue == null) { return(this.Request.CreateResponse(HttpStatusCode.NotFound)); } // Return 200 - OK else { return(this.Request.CreateResponse(HttpStatusCode.OK, returnValue)); } }
// Modify default (Update all attributes of the class) public void ModifyDefault(PatientEN patient) { try { SessionInitializeTransaction(); PatientEN patientEN = (PatientEN)session.Load(typeof(PatientEN), patient.Identifier); patientEN.Nif = patient.Nif; patientEN.Active = patient.Active; patientEN.Name = patient.Name; patientEN.Surnames = patient.Surnames; patientEN.Gender = patient.Gender; patientEN.BirthDate = patient.BirthDate; patientEN.Deceased = patient.Deceased; patientEN.Address = patient.Address; patientEN.Email = patient.Email; patientEN.Phone = patient.Phone; patientEN.MaritalStatus = patient.MaritalStatus; patientEN.Photo = patient.Photo; patientEN.Password = patient.Password; 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(); } }