public static TelemetryEN Convert(TelemetryDTO dto)
        {
            TelemetryEN newinstance = null;

            try
            {
                if (dto != null)
                {
                    newinstance = new TelemetryEN();



                    if (dto.DeviceTemplate_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IDeviceTemplateCAD deviceTemplateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.DeviceTemplateCAD();

                        newinstance.DeviceTemplate = deviceTemplateCAD.ReadOIDDefault(dto.DeviceTemplate_oid);
                    }
                    newinstance.Frecuency = dto.Frecuency;
                    if (dto.TypeTelemetry_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.ISpecificTelemetryCAD specificTelemetryCAD = new MoSIoTGenNHibernate.CAD.MosIoT.SpecificTelemetryCAD();

                        newinstance.TypeTelemetry = specificTelemetryCAD.ReadOIDDefault(dto.TypeTelemetry_oid);
                    }
                    newinstance.Schema = dto.Schema;
                    newinstance.Unit   = dto.Unit;
                    newinstance.Id     = dto.Id;
                    newinstance.Name   = dto.Name;
                    newinstance.Type   = dto.Type;
                    if (dto.Properties_oid != null)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IPropertyCAD propertyCAD = new MoSIoTGenNHibernate.CAD.MosIoT.PropertyCAD();

                        newinstance.Properties = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.PropertyEN>();
                        foreach (int entry in dto.Properties_oid)
                        {
                            newinstance.Properties.Add(propertyCAD.ReadOIDDefault(entry));
                        }
                    }
                    if (dto.VitalSign_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IMeasureCAD measureCAD = new MoSIoTGenNHibernate.CAD.MosIoT.MeasureCAD();

                        newinstance.VitalSign = measureCAD.ReadOIDDefault(dto.VitalSign_oid);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(newinstance);
        }
Example #2
0
        public static CommandEN Convert(CommandDTO dto)
        {
            CommandEN newinstance = null;

            try
            {
                if (dto != null)
                {
                    newinstance = new CommandEN();



                    if (dto.DeviceTemplate_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IDeviceTemplateCAD deviceTemplateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.DeviceTemplateCAD();

                        newinstance.DeviceTemplate = deviceTemplateCAD.ReadOIDDefault(dto.DeviceTemplate_oid);
                    }
                    newinstance.Id            = dto.Id;
                    newinstance.Name          = dto.Name;
                    newinstance.IsSynchronous = dto.IsSynchronous;
                    if (dto.Telemetries_oid != null)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IEventTelemetryCAD eventTelemetryCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EventTelemetryCAD();

                        newinstance.Telemetries = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EventTelemetryEN>();
                        foreach (int entry in dto.Telemetries_oid)
                        {
                            newinstance.Telemetries.Add(eventTelemetryCAD.ReadOIDDefault(entry));
                        }
                    }
                    newinstance.Type        = dto.Type;
                    newinstance.Description = dto.Description;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(newinstance);
        }
Example #3
0
        public static PropertyEN Convert(PropertyDTO dto)
        {
            PropertyEN newinstance = null;

            try
            {
                if (dto != null)
                {
                    newinstance = new PropertyEN();



                    if (dto.DeviceTemplate_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IDeviceTemplateCAD deviceTemplateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.DeviceTemplateCAD();

                        newinstance.DeviceTemplate = deviceTemplateCAD.ReadOIDDefault(dto.DeviceTemplate_oid);
                    }
                    newinstance.Id          = dto.Id;
                    newinstance.Name        = dto.Name;
                    newinstance.IsWritable  = dto.IsWritable;
                    newinstance.IsCloudable = dto.IsCloudable;
                    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));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(newinstance);
        }
        public static DeviceEN Convert(DeviceDTO dto)
        {
            DeviceEN newinstance = null;

            try
            {
                if (dto != null)
                {
                    newinstance = new DeviceEN();



                    newinstance.DeviceSwitch = dto.DeviceSwitch;
                    newinstance.Tag          = dto.Tag;
                    newinstance.IsSimulated  = dto.IsSimulated;
                    newinstance.SerialNumber = dto.SerialNumber;
                    newinstance.FirmVersion  = dto.FirmVersion;
                    newinstance.Trademark    = dto.Trademark;
                    if (dto.DeviceTemplate_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IDeviceTemplateCAD deviceTemplateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.DeviceTemplateCAD();

                        newinstance.DeviceTemplate = deviceTemplateCAD.ReadOIDDefault(dto.DeviceTemplate_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);
        }
Example #5
0
        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);
        }