public static IMAdaptationRequestEN Convert(IMAdaptationRequestDTO dto) { IMAdaptationRequestEN newinstance = null; try { if (dto != null) { newinstance = new IMAdaptationRequestEN(); if (dto.AdaptationRequest_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IAdaptationRequestCAD adaptationRequestCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AdaptationRequestCAD(); newinstance.AdaptationRequest = adaptationRequestCAD.ReadOIDDefault(dto.AdaptationRequest_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); }
public static AccessModeEN Convert(AccessModeDTO dto) { AccessModeEN newinstance = null; try { if (dto != null) { newinstance = new AccessModeEN(); if (dto.Patient_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IPatientProfileCAD patientProfileCAD = new MoSIoTGenNHibernate.CAD.MosIoT.PatientProfileCAD(); newinstance.Patient = patientProfileCAD.ReadOIDDefault(dto.Patient_oid); } newinstance.Id = dto.Id; newinstance.TypeAccessMode = dto.TypeAccessMode; if (dto.AdaptationDetailRequired != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAdaptationDetailRequiredCAD adaptationDetailRequiredCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AdaptationDetailRequiredCAD(); newinstance.AdaptationDetailRequired = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AdaptationDetailRequiredEN>(); foreach (AdaptationDetailRequiredDTO entry in dto.AdaptationDetailRequired) { newinstance.AdaptationDetailRequired.Add(AdaptationDetailRequiredAssemblerDTO.Convert(entry)); } } if (dto.DeviceTemplate_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IDeviceTemplateCAD deviceTemplateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.DeviceTemplateCAD(); newinstance.DeviceTemplate = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.DeviceTemplateEN>(); foreach (int entry in dto.DeviceTemplate_oid) { newinstance.DeviceTemplate.Add(deviceTemplateCAD.ReadOIDDefault(entry)); } } newinstance.Description = dto.Description; if (dto.AdaptationTypeRequired != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAdaptationTypeRequiredCAD adaptationTypeRequiredCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AdaptationTypeRequiredCAD(); newinstance.AdaptationTypeRequired = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AdaptationTypeRequiredEN>(); foreach (AdaptationTypeRequiredDTO entry in dto.AdaptationTypeRequired) { newinstance.AdaptationTypeRequired.Add(AdaptationTypeRequiredAssemblerDTO.Convert(entry)); } } if (dto.AdaptationRequest != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAdaptationRequestCAD adaptationRequestCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AdaptationRequestCAD(); newinstance.AdaptationRequest = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AdaptationRequestEN>(); foreach (AdaptationRequestDTO entry in dto.AdaptationRequest) { newinstance.AdaptationRequest.Add(AdaptationRequestAssemblerDTO.Convert(entry)); } } if (dto.Disability_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IDisabilityCAD disabilityCAD = new MoSIoTGenNHibernate.CAD.MosIoT.DisabilityCAD(); newinstance.Disability = disabilityCAD.ReadOIDDefault(dto.Disability_oid); } newinstance.Name = dto.Name; } } catch (Exception ex) { throw ex; } return(newinstance); }