Пример #1
0
        public void AsignarDevice(int p_AccessMode_OID, System.Collections.Generic.IList <int> p_deviceTemplate_OIDs)
        {
            MoSIoTGenNHibernate.EN.MosIoT.AccessModeEN accessModeEN = null;
            try
            {
                SessionInitializeTransaction();
                accessModeEN = (AccessModeEN)session.Load(typeof(AccessModeEN), p_AccessMode_OID);
                MoSIoTGenNHibernate.EN.MosIoT.DeviceTemplateEN deviceTemplateENAux = null;
                if (accessModeEN.DeviceTemplate == null)
                {
                    accessModeEN.DeviceTemplate = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.DeviceTemplateEN>();
                }

                foreach (int item in p_deviceTemplate_OIDs)
                {
                    deviceTemplateENAux = new MoSIoTGenNHibernate.EN.MosIoT.DeviceTemplateEN();
                    deviceTemplateENAux = (MoSIoTGenNHibernate.EN.MosIoT.DeviceTemplateEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.DeviceTemplateEN), item);

                    accessModeEN.DeviceTemplate.Add(deviceTemplateENAux);
                }


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

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


            finally
            {
                SessionClose();
            }
        }
Пример #2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            DeviceTemplateEN t = obj as DeviceTemplateEN;

            if (t == null)
            {
                return(false);
            }
            if (Id.Equals(t.Id))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
 public DeviceTemplateEN(DeviceTemplateEN deviceTemplate)
 {
     this.init(Id, deviceTemplate.Name, deviceTemplate.Property, deviceTemplate.Command, deviceTemplate.Telemetry, deviceTemplate.Type, deviceTemplate.IsEdge);
 }