// Modify default (Update all attributes of the class)

        public void ModifyDefault(SpecificTelemetryEN specificTelemetry)
        {
            try
            {
                SessionInitializeTransaction();
                SpecificTelemetryEN specificTelemetryEN = (SpecificTelemetryEN)session.Load(typeof(SpecificTelemetryEN), specificTelemetry.Id);


                specificTelemetryEN.Name = specificTelemetry.Name;

                session.Update(specificTelemetryEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is MoSIoTGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in SpecificTelemetryCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
        public static SpecificTelemetryEN Convert(SpecificTelemetryDTO dto)
        {
            SpecificTelemetryEN newinstance = null;

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



                    if (dto.Telemetry_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.ITelemetryCAD telemetryCAD = new MoSIoTGenNHibernate.CAD.MosIoT.TelemetryCAD();

                        newinstance.Telemetry = telemetryCAD.ReadOIDDefault(dto.Telemetry_oid);
                    }
                    newinstance.Id   = dto.Id;
                    newinstance.Name = dto.Name;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(newinstance);
        }
        public SpecificTelemetryEN ReadOIDDefault(int id
                                                  )
        {
            SpecificTelemetryEN specificTelemetryEN = null;

            try
            {
                SessionInitializeTransaction();
                specificTelemetryEN = (SpecificTelemetryEN)session.Get(typeof(SpecificTelemetryEN), id);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is MoSIoTGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in SpecificTelemetryCAD.", ex);
            }


            finally
            {
                SessionClose();
            }

            return(specificTelemetryEN);
        }
        public void Destroy(int id
                            )
        {
            try
            {
                SessionInitializeTransaction();
                SpecificTelemetryEN specificTelemetryEN = (SpecificTelemetryEN)session.Load(typeof(SpecificTelemetryEN), id);
                session.Delete(specificTelemetryEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is MoSIoTGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in SpecificTelemetryCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
        public int New_(SpecificTelemetryEN specificTelemetry)
        {
            try
            {
                SessionInitializeTransaction();
                if (specificTelemetry.Telemetry != null)
                {
                    // Argumento OID y no colección.
                    specificTelemetry.Telemetry = (MoSIoTGenNHibernate.EN.MosIoT.TelemetryEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.TelemetryEN), specificTelemetry.Telemetry.Id);

                    specificTelemetry.Telemetry.TypeTelemetry
                        = specificTelemetry;
                }

                session.Save(specificTelemetry);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is MoSIoTGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in SpecificTelemetryCAD.", ex);
            }


            finally
            {
                SessionClose();
            }

            return(specificTelemetry.Id);
        }
Exemple #6
0
        public SpecificTelemetryEN ReadOID(int id
                                           )
        {
            SpecificTelemetryEN specificTelemetryEN = null;

            specificTelemetryEN = _ISpecificTelemetryCAD.ReadOID(id);
            return(specificTelemetryEN);
        }
Exemple #7
0
        public void Modify(int p_SpecificTelemetry_OID, string p_name)
        {
            SpecificTelemetryEN specificTelemetryEN = null;

            //Initialized SpecificTelemetryEN
            specificTelemetryEN      = new SpecificTelemetryEN();
            specificTelemetryEN.Id   = p_SpecificTelemetry_OID;
            specificTelemetryEN.Name = p_name;
            //Call to SpecificTelemetryCAD

            _ISpecificTelemetryCAD.Modify(specificTelemetryEN);
        }
Exemple #8
0
        public static LocationTelemetryDTOA Convert(SpecificTelemetryEN en, NHibernate.ISession session = null)
        {
            LocationTelemetryDTOA    dto = null;
            LocationTelemetryRESTCAD locationTelemetryRESTCAD = null;
            LocationTelemetryCEN     locationTelemetryCEN     = null;
            LocationTelemetryCP      locationTelemetryCP      = null;

            if (en != null)
            {
                dto = new LocationTelemetryDTOA();
                locationTelemetryRESTCAD = new LocationTelemetryRESTCAD(session);
                locationTelemetryCEN     = new LocationTelemetryCEN(locationTelemetryRESTCAD);
                locationTelemetryCP      = new LocationTelemetryCP(session);


                LocationTelemetryEN enHijo = locationTelemetryRESTCAD.ReadOIDDefault(en.Id);



                //
                // Attributes

                dto.Id = en.Id;

                if (enHijo != null)
                {
                    dto.Latitude = enHijo.Latitude;
                }


                if (enHijo != null)
                {
                    dto.Longitude = enHijo.Longitude;
                }


                if (enHijo != null)
                {
                    dto.Altitude = enHijo.Altitude;
                }


                //
                // TravesalLink


                //
                // Service
            }

            return(dto);
        }
        public static StateTelemetryDTOA Convert(SpecificTelemetryEN en, NHibernate.ISession session = null)
        {
            StateTelemetryDTOA    dto = null;
            StateTelemetryRESTCAD stateTelemetryRESTCAD = null;
            StateTelemetryCEN     stateTelemetryCEN     = null;
            StateTelemetryCP      stateTelemetryCP      = null;

            if (en != null)
            {
                dto = new StateTelemetryDTOA();
                stateTelemetryRESTCAD = new StateTelemetryRESTCAD(session);
                stateTelemetryCEN     = new StateTelemetryCEN(stateTelemetryRESTCAD);
                stateTelemetryCP      = new StateTelemetryCP(session);


                StateTelemetryEN enHijo = stateTelemetryRESTCAD.ReadOIDDefault(en.Id);



                //
                // Attributes

                dto.Id = en.Id;

                //
                // TravesalLink

                /* Rol: StateTelemetry o--> StateDevice */
                dto.States = null;
                List <StateDeviceEN> States = stateTelemetryRESTCAD.States(en.Id).ToList();
                if (States != null)
                {
                    dto.States = new List <StateDeviceDTOA>();
                    foreach (StateDeviceEN entry in States)
                    {
                        dto.States.Add(StateDeviceAssembler.Convert(entry, session));
                    }
                }


                //
                // Service
            }

            return(dto);
        }
        public static SensorTelemetryDTOA Convert(SpecificTelemetryEN en, NHibernate.ISession session = null)
        {
            SensorTelemetryDTOA    dto = null;
            SensorTelemetryRESTCAD sensorTelemetryRESTCAD = null;
            SensorTelemetryCEN     sensorTelemetryCEN     = null;
            SensorTelemetryCP      sensorTelemetryCP      = null;

            if (en != null)
            {
                dto = new SensorTelemetryDTOA();
                sensorTelemetryRESTCAD = new SensorTelemetryRESTCAD(session);
                sensorTelemetryCEN     = new SensorTelemetryCEN(sensorTelemetryRESTCAD);
                sensorTelemetryCP      = new SensorTelemetryCP(session);


                SensorTelemetryEN enHijo = sensorTelemetryRESTCAD.ReadOIDDefault(en.Id);



                //
                // Attributes

                dto.Id = en.Id;

                if (enHijo != null)
                {
                    dto.SensorType = enHijo.SensorType;
                }


                //
                // TravesalLink


                //
                // Service
            }

            return(dto);
        }
Exemple #11
0
        public static EventTelemetryDTOA Convert(SpecificTelemetryEN en, NHibernate.ISession session = null)
        {
            EventTelemetryDTOA    dto = null;
            EventTelemetryRESTCAD eventTelemetryRESTCAD = null;
            EventTelemetryCEN     eventTelemetryCEN     = null;
            EventTelemetryCP      eventTelemetryCP      = null;

            if (en != null)
            {
                dto = new EventTelemetryDTOA();
                eventTelemetryRESTCAD = new EventTelemetryRESTCAD(session);
                eventTelemetryCEN     = new EventTelemetryCEN(eventTelemetryRESTCAD);
                eventTelemetryCP      = new EventTelemetryCP(session);


                EventTelemetryEN enHijo = eventTelemetryRESTCAD.ReadOIDDefault(en.Id);



                //
                // Attributes

                dto.Id = en.Id;

                if (enHijo != null)
                {
                    dto.Severity = enHijo.Severity;
                }


                //
                // TravesalLink


                //
                // Service
            }

            return(dto);
        }
Exemple #12
0
        public int New_(int p_telemetry, string p_name)
        {
            SpecificTelemetryEN specificTelemetryEN = null;
            int oid;

            //Initialized SpecificTelemetryEN
            specificTelemetryEN = new SpecificTelemetryEN();

            if (p_telemetry != -1)
            {
                // El argumento p_telemetry -> Property telemetry es oid = false
                // Lista de oids id
                specificTelemetryEN.Telemetry    = new MoSIoTGenNHibernate.EN.MosIoT.TelemetryEN();
                specificTelemetryEN.Telemetry.Id = p_telemetry;
            }

            specificTelemetryEN.Name = p_name;

            //Call to SpecificTelemetryCAD

            oid = _ISpecificTelemetryCAD.New_(specificTelemetryEN);
            return(oid);
        }