public static GoalEN Convert(GoalDTO dto) { GoalEN newinstance = null; try { if (dto != null) { newinstance = new GoalEN(); 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.Priority = dto.Priority; if (dto.Targets != null) { MoSIoTGenNHibernate.CAD.MosIoT.ITargetCAD targetCAD = new MoSIoTGenNHibernate.CAD.MosIoT.TargetCAD(); newinstance.Targets = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.TargetEN>(); foreach (TargetDTO entry in dto.Targets) { newinstance.Targets.Add(TargetAssemblerDTO.Convert(entry)); } } newinstance.Status = dto.Status; if (dto.Condition_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IConditionCAD conditionCAD = new MoSIoTGenNHibernate.CAD.MosIoT.ConditionCAD(); newinstance.Condition = conditionCAD.ReadOIDDefault(dto.Condition_oid); } newinstance.Description = dto.Description; newinstance.Category = dto.Category; newinstance.OutcomeCode = dto.OutcomeCode; newinstance.Name = dto.Name; } } catch (Exception ex) { throw ex; } return(newinstance); }
public static MeasureEN Convert(MeasureDTO dto) { MeasureEN newinstance = null; try { if (dto != null) { newinstance = new MeasureEN(); newinstance.Id = dto.Id; newinstance.Name = dto.Name; newinstance.Description = dto.Description; if (dto.Target_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.ITargetCAD targetCAD = new MoSIoTGenNHibernate.CAD.MosIoT.TargetCAD(); newinstance.Target = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.TargetEN>(); foreach (int entry in dto.Target_oid) { newinstance.Target.Add(targetCAD.ReadOIDDefault(entry)); } } if (dto.Telemetry_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.ITelemetryCAD telemetryCAD = new MoSIoTGenNHibernate.CAD.MosIoT.TelemetryCAD(); newinstance.Telemetry = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.TelemetryEN>(); foreach (int entry in dto.Telemetry_oid) { newinstance.Telemetry.Add(telemetryCAD.ReadOIDDefault(entry)); } } newinstance.LOINCcode = dto.LOINCcode; } } catch (Exception ex) { throw ex; } return(newinstance); }
public static IMTargetEN Convert(IMTargetDTO dto) { IMTargetEN newinstance = null; try { if (dto != null) { newinstance = new IMTargetEN(); if (dto.Target_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.ITargetCAD targetCAD = new MoSIoTGenNHibernate.CAD.MosIoT.TargetCAD(); newinstance.Target = targetCAD.ReadOIDDefault(dto.Target_oid); } newinstance.Id = dto.Id; newinstance.Name = dto.Name; newinstance.Type = dto.Type; newinstance.IsOID = dto.IsOID; 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.OriginAsociation_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAssociationCAD associationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AssociationCAD(); newinstance.OriginAsociation = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AssociationEN>(); foreach (int entry in dto.OriginAsociation_oid) { newinstance.OriginAsociation.Add(associationCAD.ReadOIDDefault(entry)); } } newinstance.AssociationType = dto.AssociationType; newinstance.IsWritable = dto.IsWritable; newinstance.Description = dto.Description; if (dto.Entity_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityCAD entityCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityCAD(); newinstance.Entity = entityCAD.ReadOIDDefault(dto.Entity_oid); } if (dto.Trigger_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IRecipeTriggerCAD recipeTriggerCAD = new MoSIoTGenNHibernate.CAD.MosIoT.RecipeTriggerCAD(); newinstance.Trigger = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.RecipeTriggerEN>(); foreach (int entry in dto.Trigger_oid) { newinstance.Trigger.Add(recipeTriggerCAD.ReadOIDDefault(entry)); } } if (dto.Register_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IRegisterCAD registerCAD = new MoSIoTGenNHibernate.CAD.MosIoT.RegisterCAD(); newinstance.Register = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.RegisterEN>(); foreach (int entry in dto.Register_oid) { newinstance.Register.Add(registerCAD.ReadOIDDefault(entry)); } } newinstance.Value = dto.Value; } } catch (Exception ex) { throw ex; } return(newinstance); }