public static CareActivityEN Convert(CareActivityDTO dto) { CareActivityEN newinstance = null; try { if (dto != null) { newinstance = new CareActivityEN(); if (dto.CarePlan_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.ICarePlanTemplateCAD carePlanTemplateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.CarePlanTemplateCAD(); newinstance.CarePlan = carePlanTemplateCAD.ReadOIDDefault(dto.CarePlan_oid); } newinstance.Id = dto.Id; newinstance.Periodicity = dto.Periodicity; newinstance.Description = dto.Description; newinstance.Duration = dto.Duration; if (dto.Medication != null) { MoSIoTGenNHibernate.CAD.MosIoT.IMedicationCAD medicationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.MedicationCAD(); newinstance.Medication = MedicationAssemblerDTO.Convert(dto.Medication); } newinstance.Location = dto.Location; newinstance.OutcomeCode = dto.OutcomeCode; if (dto.NutritionOrder != null) { MoSIoTGenNHibernate.CAD.MosIoT.INutritionOrderCAD nutritionOrderCAD = new MoSIoTGenNHibernate.CAD.MosIoT.NutritionOrderCAD(); newinstance.NutritionOrder = NutritionOrderAssemblerDTO.Convert(dto.NutritionOrder); } newinstance.TypeActivity = dto.TypeActivity; if (dto.Notification != null) { MoSIoTGenNHibernate.CAD.MosIoT.IComunicationCAD comunicationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.ComunicationCAD(); newinstance.Notification = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.ComunicationEN>(); foreach (ComunicationDTO entry in dto.Notification) { newinstance.Notification.Add(ComunicationAssemblerDTO.Convert(entry)); } } newinstance.ActivityCode = dto.ActivityCode; newinstance.Name = dto.Name; if (dto.Appointment != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAppointmentCAD appointmentCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AppointmentCAD(); newinstance.Appointment = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AppointmentEN>(); foreach (AppointmentDTO entry in dto.Appointment) { newinstance.Appointment.Add(AppointmentAssemblerDTO.Convert(entry)); } } } } catch (Exception ex) { throw ex; } return(newinstance); }
public static CarePlanTemplateEN Convert(CarePlanTemplateDTO dto) { CarePlanTemplateEN newinstance = null; try { if (dto != null) { newinstance = new CarePlanTemplateEN(); if (dto.CareActivity != null) { MoSIoTGenNHibernate.CAD.MosIoT.ICareActivityCAD careActivityCAD = new MoSIoTGenNHibernate.CAD.MosIoT.CareActivityCAD(); newinstance.CareActivity = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.CareActivityEN>(); foreach (CareActivityDTO entry in dto.CareActivity) { newinstance.CareActivity.Add(CareActivityAssemblerDTO.Convert(entry)); } } if (dto.PatientProfile_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IPatientProfileCAD patientProfileCAD = new MoSIoTGenNHibernate.CAD.MosIoT.PatientProfileCAD(); newinstance.PatientProfile = patientProfileCAD.ReadOIDDefault(dto.PatientProfile_oid); } newinstance.Status = dto.Status; newinstance.Intent = dto.Intent; newinstance.Title = dto.Title; newinstance.Modified = dto.Modified; if (dto.Goals != null) { MoSIoTGenNHibernate.CAD.MosIoT.IGoalCAD goalCAD = new MoSIoTGenNHibernate.CAD.MosIoT.GoalCAD(); newinstance.Goals = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.GoalEN>(); foreach (GoalDTO entry in dto.Goals) { newinstance.Goals.Add(GoalAssemblerDTO.Convert(entry)); } } if (dto.AddressConditions_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IConditionCAD conditionCAD = new MoSIoTGenNHibernate.CAD.MosIoT.ConditionCAD(); newinstance.AddressConditions = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.ConditionEN>(); foreach (int entry in dto.AddressConditions_oid) { newinstance.AddressConditions.Add(conditionCAD.ReadOIDDefault(entry)); } } newinstance.Id = dto.Id; newinstance.DurationDays = dto.DurationDays; newinstance.Name = dto.Name; newinstance.Description = dto.Description; if (dto.Comunication != null) { MoSIoTGenNHibernate.CAD.MosIoT.IComunicationCAD comunicationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.ComunicationCAD(); newinstance.Comunication = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.ComunicationEN>(); foreach (ComunicationDTO entry in dto.Comunication) { newinstance.Comunication.Add(ComunicationAssemblerDTO.Convert(entry)); } } } } catch (Exception ex) { throw ex; } return(newinstance); }