public static IMTelemetryDTOA Convert(EntityEN en, NHibernate.ISession session = null)
        {
            IMTelemetryDTOA    dto = null;
            IMTelemetryRESTCAD iMTelemetryRESTCAD = null;
            IMTelemetryCEN     iMTelemetryCEN     = null;
            IMTelemetryCP      iMTelemetryCP      = null;

            if (en != null)
            {
                dto = new IMTelemetryDTOA();
                iMTelemetryRESTCAD = new IMTelemetryRESTCAD(session);
                iMTelemetryCEN     = new IMTelemetryCEN(iMTelemetryRESTCAD);
                iMTelemetryCP      = new IMTelemetryCP(session);


                IMTelemetryEN enHijo = iMTelemetryRESTCAD.ReadOIDDefault(en.Id);



                //
                // Attributes

                dto.Id = en.Id;

                dto.Name = en.Name;


                dto.Description = en.Description;


                //
                // TravesalLink

                /* Rol: IMTelemetry o--> Telemetry */
                dto.Telemetry = TelemetryAssembler.Convert((TelemetryEN)enHijo.Telemetry, session);


                //
                // Service
            }

            return(dto);
        }
Пример #2
0
        public static DeviceTemplateDTOA Convert(DeviceTemplateEN en, NHibernate.ISession session = null)
        {
            DeviceTemplateDTOA    dto = null;
            DeviceTemplateRESTCAD deviceTemplateRESTCAD = null;
            DeviceTemplateCEN     deviceTemplateCEN     = null;
            DeviceTemplateCP      deviceTemplateCP      = null;

            if (en != null)
            {
                dto = new DeviceTemplateDTOA();
                deviceTemplateRESTCAD = new DeviceTemplateRESTCAD(session);
                deviceTemplateCEN     = new DeviceTemplateCEN(deviceTemplateRESTCAD);
                deviceTemplateCP      = new DeviceTemplateCP(session);



                //
                // Attributes

                dto.Id = en.Id;

                dto.Name = en.Name;


                dto.Type = en.Type;


                dto.IsEdge = en.IsEdge;


                //
                // TravesalLink

                /* Rol: DeviceTemplate o--> Command */
                dto.Commands = null;
                List <CommandEN> Commands = deviceTemplateRESTCAD.Commands(en.Id).ToList();
                if (Commands != null)
                {
                    dto.Commands = new List <CommandDTOA>();
                    foreach (CommandEN entry in Commands)
                    {
                        dto.Commands.Add(CommandAssembler.Convert(entry, session));
                    }
                }

                /* Rol: DeviceTemplate o--> Property */
                dto.Properties = null;
                List <PropertyEN> Properties = deviceTemplateRESTCAD.Properties(en.Id).ToList();
                if (Properties != null)
                {
                    dto.Properties = new List <PropertyDTOA>();
                    foreach (PropertyEN entry in Properties)
                    {
                        dto.Properties.Add(PropertyAssembler.Convert(entry, session));
                    }
                }

                /* Rol: DeviceTemplate o--> Telemetry */
                dto.Telemetries = null;
                List <TelemetryEN> Telemetries = deviceTemplateRESTCAD.Telemetries(en.Id).ToList();
                if (Telemetries != null)
                {
                    dto.Telemetries = new List <TelemetryDTOA>();
                    foreach (TelemetryEN entry in Telemetries)
                    {
                        dto.Telemetries.Add(TelemetryAssembler.Convert(entry, session));
                    }
                }


                //
                // Service
            }

            return(dto);
        }