public int New_(MoSIoTGenNHibernate.Enumerated.MosIoT.LanguageCodeEnum p_preferredLanguage, string p_region, MoSIoTGenNHibernate.Enumerated.MosIoT.HazardValueEnum p_hazardAvoidance, string p_name, string p_description) { /*PROTECTED REGION ID(MoSIoTGenNHibernate.CEN.MosIoT_PatientProfile_new__customized) START*/ PatientProfileEN patientProfileEN = null; int oid; //Initialized PatientProfileEN patientProfileEN = new PatientProfileEN(); patientProfileEN.PreferredLanguage = p_preferredLanguage; patientProfileEN.Region = p_region; patientProfileEN.HazardAvoidance = p_hazardAvoidance; patientProfileEN.Name = p_name; patientProfileEN.Description = p_description; //Call to PatientProfileCAD oid = _IPatientProfileCAD.New_(patientProfileEN); return(oid); /*PROTECTED REGION END*/ }
//Sin e: ReadOID2 //Con e: PatientProfileEN public PatientProfileEN ReadOID2(int id ) { PatientProfileEN patientProfileEN = null; try { SessionInitializeTransaction(); patientProfileEN = (PatientProfileEN)session.Get(typeof(PatientProfileEN), id); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in PatientProfileCAD.", ex); } finally { SessionClose(); } return(patientProfileEN); }
public void Destroy(int id ) { try { SessionInitializeTransaction(); PatientProfileEN patientProfileEN = (PatientProfileEN)session.Load(typeof(PatientProfileEN), id); session.Delete(patientProfileEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in PatientProfileCAD.", ex); } finally { SessionClose(); } }
public int New_(PatientProfileEN patientProfile) { try { SessionInitializeTransaction(); session.Save(patientProfile); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in PatientProfileCAD.", ex); } finally { SessionClose(); } return(patientProfile.Id); }
public PatientProfileEN ReadOID2(int id ) { PatientProfileEN patientProfileEN = null; patientProfileEN = _IPatientProfileCAD.ReadOID2(id); return(patientProfileEN); }
public static PatientProfileEN Convert(PatientProfileDTO dto) { PatientProfileEN newinstance = null; try { if (dto != null) { newinstance = new PatientProfileEN(); if (dto.AccessMode != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAccessModeCAD accessModeCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AccessModeCAD(); newinstance.AccessMode = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AccessModeEN>(); foreach (AccessModeDTO entry in dto.AccessMode) { newinstance.AccessMode.Add(AccessModeAssemblerDTO.Convert(entry)); } } newinstance.PreferredLanguage = dto.PreferredLanguage; newinstance.Region = dto.Region; newinstance.HazardAvoidance = dto.HazardAvoidance; if (dto.Disability != null) { MoSIoTGenNHibernate.CAD.MosIoT.IDisabilityCAD disabilityCAD = new MoSIoTGenNHibernate.CAD.MosIoT.DisabilityCAD(); newinstance.Disability = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.DisabilityEN>(); foreach (DisabilityDTO entry in dto.Disability) { newinstance.Disability.Add(DisabilityAssemblerDTO.Convert(entry)); } } newinstance.Id = dto.Id; if (dto.Diseases != null) { MoSIoTGenNHibernate.CAD.MosIoT.IConditionCAD conditionCAD = new MoSIoTGenNHibernate.CAD.MosIoT.ConditionCAD(); newinstance.Diseases = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.ConditionEN>(); foreach (ConditionDTO entry in dto.Diseases) { newinstance.Diseases.Add(ConditionAssemblerDTO.Convert(entry)); } } newinstance.Name = dto.Name; newinstance.Description = dto.Description; } } catch (Exception ex) { throw ex; } return(newinstance); }
public void Modify(int p_PatientProfile_OID, MoSIoTGenNHibernate.Enumerated.MosIoT.LanguageCodeEnum p_preferredLanguage, string p_region, MoSIoTGenNHibernate.Enumerated.MosIoT.HazardValueEnum p_hazardAvoidance, string p_name, string p_description) { PatientProfileEN patientProfileEN = null; //Initialized PatientProfileEN patientProfileEN = new PatientProfileEN(); patientProfileEN.Id = p_PatientProfile_OID; patientProfileEN.PreferredLanguage = p_preferredLanguage; patientProfileEN.Region = p_region; patientProfileEN.HazardAvoidance = p_hazardAvoidance; patientProfileEN.Name = p_name; patientProfileEN.Description = p_description; //Call to PatientProfileCAD _IPatientProfileCAD.Modify(patientProfileEN); }
public static PatientProfileCareDTOA Convert(PatientProfileEN en, NHibernate.ISession session = null) { PatientProfileCareDTOA dto = null; PatientProfileCareRESTCAD patientProfileCareRESTCAD = null; PatientProfileCEN patientProfileCEN = null; PatientProfileCP patientProfileCP = null; if (en != null) { dto = new PatientProfileCareDTOA(); patientProfileCareRESTCAD = new PatientProfileCareRESTCAD(session); patientProfileCEN = new PatientProfileCEN(patientProfileCareRESTCAD); patientProfileCP = new PatientProfileCP(session); // // Attributes dto.Id = en.Id; dto.PreferredLanguage = en.PreferredLanguage; dto.Region = en.Region; dto.HazardAvoidance = en.HazardAvoidance; dto.Name = en.Name; dto.Description = en.Description; // // TravesalLink // // Service } return(dto); }
// Modify default (Update all attributes of the class) public void ModifyDefault(PatientProfileEN patientProfile) { try { SessionInitializeTransaction(); PatientProfileEN patientProfileEN = (PatientProfileEN)session.Load(typeof(PatientProfileEN), patientProfile.Id); patientProfileEN.PreferredLanguage = patientProfile.PreferredLanguage; patientProfileEN.Region = patientProfile.Region; patientProfileEN.HazardAvoidance = patientProfile.HazardAvoidance; patientProfileEN.Name = patientProfile.Name; patientProfileEN.Description = patientProfile.Description; session.Update(patientProfileEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in PatientProfileCAD.", ex); } finally { SessionClose(); } }
public PatientProfileEN Patient(int id) { PatientProfileEN result = null; try { SessionInitializeTransaction(); String sql = @"select self.PatientProfile FROM CarePlanEN self " + "where self.Id = :p_Id"; IQuery query = session.CreateQuery(sql).SetParameter("p_Id", id); result = query.UniqueResult <PatientProfileEN>(); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in CarePlanRESTCAD.", ex); } finally { SessionClose(); } return(result); }
public HttpResponseMessage ReadOID(int idPatientProfile) { // CAD, CEN, EN, returnValue PatientProfileRESTCAD patientProfileRESTCAD = null; PatientProfileCEN patientProfileCEN = null; PatientProfileEN patientProfileEN = null; PatientProfileDTOA returnValue = null; try { SessionInitializeWithoutTransaction(); patientProfileRESTCAD = new PatientProfileRESTCAD(session); patientProfileCEN = new PatientProfileCEN(patientProfileRESTCAD); // Data patientProfileEN = patientProfileCEN.ReadOID(idPatientProfile); // Convert return if (patientProfileEN != null) { returnValue = PatientProfileAssembler.Convert(patientProfileEN, 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)); } }
public HttpResponseMessage ProfileDisabilities(int idPatientProfile) { // CAD, EN PatientProfileRESTCAD patientProfileRESTCAD = null; PatientProfileEN patientProfileEN = null; // returnValue List <DisabilityEN> en = null; List <DisabilityDTOA> returnValue = null; try { SessionInitializeWithoutTransaction(); patientProfileRESTCAD = new PatientProfileRESTCAD(session); // Exists PatientProfile patientProfileEN = patientProfileRESTCAD.ReadOIDDefault(idPatientProfile); if (patientProfileEN == null) { throw new HttpResponseException(this.Request.CreateResponse(HttpStatusCode.NotFound, "PatientProfile#" + idPatientProfile + " not found")); } // Rol // TODO: paginación en = patientProfileRESTCAD.ProfileDisabilities(idPatientProfile).ToList(); // Convert return if (en != null) { returnValue = new List <DisabilityDTOA>(); foreach (DisabilityEN entry in en) { returnValue.Add(DisabilityAssembler.Convert(entry, 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 204 - Empty if (returnValue == null || returnValue.Count == 0) { return(this.Request.CreateResponse(HttpStatusCode.NoContent)); } // Return 200 - OK else { return(this.Request.CreateResponse(HttpStatusCode.OK, returnValue)); } }
public static PatientProfileDTOA Convert(PatientProfileEN en, NHibernate.ISession session = null) { PatientProfileDTOA dto = null; PatientProfileRESTCAD patientProfileRESTCAD = null; PatientProfileCEN patientProfileCEN = null; PatientProfileCP patientProfileCP = null; if (en != null) { dto = new PatientProfileDTOA(); patientProfileRESTCAD = new PatientProfileRESTCAD(session); patientProfileCEN = new PatientProfileCEN(patientProfileRESTCAD); patientProfileCP = new PatientProfileCP(session); // // Attributes dto.Id = en.Id; dto.PreferredLanguage = en.PreferredLanguage; dto.Region = en.Region; dto.HazardAvoidance = en.HazardAvoidance; dto.Name = en.Name; dto.Description = en.Description; // // TravesalLink /* Rol: PatientProfile o--> AccessMode */ dto.AccessMode = null; List <AccessModeEN> AccessMode = patientProfileRESTCAD.AccessMode(en.Id).ToList(); if (AccessMode != null) { dto.AccessMode = new List <AccessModeDTOA>(); foreach (AccessModeEN entry in AccessMode) { dto.AccessMode.Add(AccessModeAssembler.Convert(entry, session)); } } /* Rol: PatientProfile o--> Condition */ dto.Condition = null; List <ConditionEN> Condition = patientProfileRESTCAD.Condition(en.Id).ToList(); if (Condition != null) { dto.Condition = new List <ConditionDTOA>(); foreach (ConditionEN entry in Condition) { dto.Condition.Add(ConditionAssembler.Convert(entry, session)); } } /* Rol: PatientProfile o--> Disability */ dto.Disabilities = null; List <DisabilityEN> Disabilities = patientProfileRESTCAD.Disabilities(en.Id).ToList(); if (Disabilities != null) { dto.Disabilities = new List <DisabilityDTOA>(); foreach (DisabilityEN entry in Disabilities) { dto.Disabilities.Add(DisabilityAssembler.Convert(entry, session)); } } // // Service } return(dto); }