// Modify default (Update all attributes of the class) public void ModifyDefault(CarePlanEN carePlan) { try { SessionInitializeTransaction(); CarePlanEN carePlanEN = (CarePlanEN)session.Load(typeof(CarePlanEN), carePlan.Id); session.Update(carePlanEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in CarePlanCAD.", ex); } finally { SessionClose(); } }
public int New_(string p_name, int p_scenario, string p_description, int p_template) { CarePlanEN carePlanEN = null; int oid; //Initialized CarePlanEN carePlanEN = new CarePlanEN(); carePlanEN.Name = p_name; if (p_scenario != -1) { // El argumento p_scenario -> Property scenario es oid = false // Lista de oids id carePlanEN.Scenario = new MoSIoTGenNHibernate.EN.MosIoT.IoTScenarioEN(); carePlanEN.Scenario.Id = p_scenario; } carePlanEN.Description = p_description; if (p_template != -1) { // El argumento p_template -> Property template es oid = false // Lista de oids id carePlanEN.Template = new MoSIoTGenNHibernate.EN.MosIoT.CarePlanTemplateEN(); carePlanEN.Template.Id = p_template; } //Call to CarePlanCAD oid = _ICarePlanCAD.New_(carePlanEN); return(oid); }
public CarePlanEN ReadOIDDefault(int id ) { CarePlanEN carePlanEN = null; try { SessionInitializeTransaction(); carePlanEN = (CarePlanEN)session.Get(typeof(CarePlanEN), id); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in CarePlanCAD.", ex); } finally { SessionClose(); } return(carePlanEN); }
public void SetModified(int p_oid, Nullable <DateTime> p_modified) { /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_CarePlan_setModified) ENABLED START*/ // Write here your custom code... CarePlanCAD carePlanCAD = new CarePlanCAD(); CarePlanCEN carePlanCEN = new CarePlanCEN(carePlanCAD); if (p_oid > 0) { CarePlanEN carePlan = carePlanCEN.ReadOID(p_oid); if (carePlan != null) { if (p_modified != null) { carePlan.Modified = p_modified; carePlanCAD.Modify(carePlan); } } } /*PROTECTED REGION END*/ }
public void Destroy(int identifier ) { try { SessionInitializeTransaction(); CarePlanEN carePlanEN = (CarePlanEN)session.Load(typeof(CarePlanEN), identifier); session.Delete(carePlanEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in CarePlanCAD.", ex); } finally { SessionClose(); } }
public int New_(CarePlanEN carePlan) { try { SessionInitializeTransaction(); if (carePlan.Encounter != null) { // Argumento OID y no colección. carePlan.Encounter = (ChroniGenNHibernate.EN.Chroni.EncounterEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.EncounterEN), carePlan.Encounter.Identifier); carePlan.Encounter.CarePlan .Add(carePlan); } session.Save(carePlan); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in CarePlanCAD.", ex); } finally { SessionClose(); } return(carePlan.Identifier); }
public CarePlanEN ReadOID(int id ) { CarePlanEN carePlanEN = null; carePlanEN = _ICarePlanCAD.ReadOID(id); return(carePlanEN); }
public void Modify(int p_CarePlan_OID, string p_name, string p_description) { CarePlanEN carePlanEN = null; //Initialized CarePlanEN carePlanEN = new CarePlanEN(); carePlanEN.Id = p_CarePlan_OID; carePlanEN.Name = p_name; carePlanEN.Description = p_description; //Call to CarePlanCAD _ICarePlanCAD.Modify(carePlanEN); }
// Modify default (Update all attributes of the class) public void ModifyDefault(CarePlanEN carePlan) { try { SessionInitializeTransaction(); CarePlanEN carePlanEN = (CarePlanEN)session.Load(typeof(CarePlanEN), carePlan.Identifier); carePlanEN.Subject = carePlan.Subject; carePlanEN.Status = carePlan.Status; carePlanEN.Context = carePlan.Context; carePlanEN.StartDate = carePlan.StartDate; carePlanEN.Modified = carePlan.Modified; carePlanEN.Description = carePlan.Description; carePlanEN.Note = carePlan.Note; carePlanEN.EndDate = carePlan.EndDate; session.Update(carePlanEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in CarePlanCAD.", ex); } finally { SessionClose(); } }
public static CarePlanDTOA Convert(EntityEN en, NHibernate.ISession session = null) { CarePlanDTOA dto = null; CarePlanRESTCAD carePlanRESTCAD = null; CarePlanCEN carePlanCEN = null; CarePlanCP carePlanCP = null; if (en != null) { dto = new CarePlanDTOA(); carePlanRESTCAD = new CarePlanRESTCAD(session); carePlanCEN = new CarePlanCEN(carePlanRESTCAD); carePlanCP = new CarePlanCP(session); CarePlanEN enHijo = carePlanRESTCAD.ReadOIDDefault(en.Id); // // Attributes dto.Id = en.Id; dto.Name = en.Name; dto.Description = en.Description; // // TravesalLink /* Rol: CarePlan o--> CarePlanTemplate */ dto.CarePlanTemplate = CarePlanTemplateAssembler.Convert((CarePlanTemplateEN)enHijo.Template, session); // // Service } return(dto); }
public void Modify(int p_CarePlan_OID, string p_subject, ChroniGenNHibernate.Enumerated.Chroni.CarePlanStatusEnum p_status, string p_context, Nullable <DateTime> p_startDate, Nullable <DateTime> p_modified, string p_description, string p_note, Nullable <DateTime> p_endDate) { CarePlanEN carePlanEN = null; //Initialized CarePlanEN carePlanEN = new CarePlanEN(); carePlanEN.Identifier = p_CarePlan_OID; carePlanEN.Subject = p_subject; carePlanEN.Status = p_status; carePlanEN.Context = p_context; carePlanEN.StartDate = p_startDate; carePlanEN.Modified = p_modified; carePlanEN.Description = p_description; carePlanEN.Note = p_note; carePlanEN.EndDate = p_endDate; //Call to CarePlanCAD _ICarePlanCAD.Modify(carePlanEN); }
public int New_(CarePlanEN carePlan) { try { SessionInitializeTransaction(); if (carePlan.Scenario != null) { // Argumento OID y no colección. carePlan.Scenario = (MoSIoTGenNHibernate.EN.MosIoT.IoTScenarioEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.IoTScenarioEN), carePlan.Scenario.Id); carePlan.Scenario.Entity .Add(carePlan); } if (carePlan.Template != null) { // Argumento OID y no colección. carePlan.Template = (MoSIoTGenNHibernate.EN.MosIoT.CarePlanTemplateEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.CarePlanTemplateEN), carePlan.Template.Id); } session.Save(carePlan); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in CarePlanCAD.", ex); } finally { SessionClose(); } return(carePlan.Id); }
public int New_(string p_subject, ChroniGenNHibernate.Enumerated.Chroni.CarePlanStatusEnum p_status, string p_context, Nullable <DateTime> p_startDate, Nullable <DateTime> p_modified, string p_description, string p_note, int p_encounter, Nullable <DateTime> p_endDate) { CarePlanEN carePlanEN = null; int oid; //Initialized CarePlanEN carePlanEN = new CarePlanEN(); carePlanEN.Subject = p_subject; carePlanEN.Status = p_status; carePlanEN.Context = p_context; carePlanEN.StartDate = p_startDate; carePlanEN.Modified = p_modified; carePlanEN.Description = p_description; carePlanEN.Note = p_note; if (p_encounter != -1) { // El argumento p_encounter -> Property encounter es oid = false // Lista de oids identifier carePlanEN.Encounter = new ChroniGenNHibernate.EN.Chroni.EncounterEN(); carePlanEN.Encounter.Identifier = p_encounter; } carePlanEN.EndDate = p_endDate; //Call to CarePlanCAD oid = _ICarePlanCAD.New_(carePlanEN); return(oid); }
public static CarePlanDTOA Convert(CarePlanEN en, NHibernate.ISession session = null) { CarePlanDTOA dto = null; CarePlanRESTCAD carePlanRESTCAD = null; CarePlanCEN carePlanCEN = null; CarePlanCP carePlanCP = null; if (en != null) { dto = new CarePlanDTOA(); carePlanRESTCAD = new CarePlanRESTCAD(session); carePlanCEN = new CarePlanCEN(carePlanRESTCAD); carePlanCP = new CarePlanCP(session); // // Attributes dto.Id = en.Id; dto.StartDate = en.StartDate; dto.EndDate = en.EndDate; dto.Status = en.Status; dto.Intent = en.Intent; dto.Title = en.Title; dto.Modified = en.Modified; // // TravesalLink /* Rol: CarePlan o--> CareActivity */ dto.CareActivities = null; List <CareActivityEN> CareActivities = carePlanRESTCAD.CareActivities(en.Id).ToList(); if (CareActivities != null) { dto.CareActivities = new List <CareActivityDTOA>(); foreach (CareActivityEN entry in CareActivities) { dto.CareActivities.Add(CareActivityAssembler.Convert(entry, session)); } } /* Rol: CarePlan o--> VitalSign */ dto.VitalSigns = null; List <VitalSignEN> VitalSigns = carePlanRESTCAD.VitalSigns(en.Id).ToList(); if (VitalSigns != null) { dto.VitalSigns = new List <VitalSignDTOA>(); foreach (VitalSignEN entry in VitalSigns) { dto.VitalSigns.Add(VitalSignAssembler.Convert(entry, session)); } } /* Rol: CarePlan o--> Goal */ dto.Goals = null; List <GoalEN> Goals = carePlanRESTCAD.Goals(en.Id).ToList(); if (Goals != null) { dto.Goals = new List <GoalDTOA>(); foreach (GoalEN entry in Goals) { dto.Goals.Add(GoalAssembler.Convert(entry, session)); } } /* Rol: CarePlan o--> PatientProfileCare */ dto.Patient = PatientProfileCareAssembler.Convert((PatientProfileEN)en.PatientProfile, session); // // Service } return(dto); }
public static CarePlanEN Convert(CarePlanDTO dto) { CarePlanEN newinstance = null; try { if (dto != null) { newinstance = new CarePlanEN(); if (dto.Template_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.ICarePlanTemplateCAD carePlanTemplateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.CarePlanTemplateCAD(); newinstance.Template = carePlanTemplateCAD.ReadOIDDefault(dto.Template_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 idCarePlan) { // CAD, CEN, EN, returnValue CarePlanRESTCAD carePlanRESTCAD = null; CarePlanCEN carePlanCEN = null; CarePlanEN carePlanEN = null; CarePlanDTOA returnValue = null; try { SessionInitializeWithoutTransaction(); carePlanRESTCAD = new CarePlanRESTCAD(session); carePlanCEN = new CarePlanCEN(carePlanRESTCAD); // Data carePlanEN = carePlanCEN.ReadOID(idCarePlan); // Convert return if (carePlanEN != null) { returnValue = CarePlanAssembler.Convert(carePlanEN, 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)); } }