Ejemplo n.º 1
0
        public List <Detail> GetAllMessageCatalogByIoTDeviceId(string deviceId)
        {
            DBHelper._IoTDeviceMessageCatalog dbhelp = new DBHelper._IoTDeviceMessageCatalog();

            return(dbhelp.GetAllByIoTDeviceId(deviceId).Select(s => new Detail()
            {
                Id = s.Id,
                IoTHubDeviceId = s.IoTHubDeviceID,
                MessageCatalogId = s.MessageCatalogID,
                MessageCatalogName = (s.MessageCatalog == null) ? "" : s.MessageCatalog.Name
            }).ToList <Detail>());
        }
Ejemplo n.º 2
0
        public void addIoTDeviceMessageCatalog(string deviceId, Edit IoTDMC)
        {
            DBHelper._IoTDeviceMessageCatalog dbhelp        = new DBHelper._IoTDeviceMessageCatalog();
            List <IoTDeviceMessageCatalog>    newIoTDMCList = new List <IoTDeviceMessageCatalog>();

            foreach (int messageCatalogId in IoTDMC.MessageCatalogIdList)
            {
                newIoTDMCList.Add(new IoTDeviceMessageCatalog()
                {
                    IoTHubDeviceID   = deviceId,
                    MessageCatalogID = messageCatalogId
                });
            }

            dbhelp.Add(newIoTDMCList);
        }
Ejemplo n.º 3
0
        public void AttachMessage(string deviceId, Edit iotDMC)
        {
            DBHelper._IoTDeviceMessageCatalog dbhelp          = new DBHelper._IoTDeviceMessageCatalog();
            List <IoTDeviceMessageCatalog>    newIoTDMCList   = new List <IoTDeviceMessageCatalog>();
            List <IoTDeviceMessageCatalog>    existIoTDMCList = dbhelp.GetAllByIoTDeviceId(deviceId);

            dbhelp.Delete(existIoTDMCList);
            if (iotDMC != null)
            {
                foreach (int messageCatalogId in iotDMC.MessageCatalogIdList)
                {
                    newIoTDMCList.Add(new IoTDeviceMessageCatalog()
                    {
                        IoTHubDeviceID   = deviceId,
                        MessageCatalogID = messageCatalogId
                    });
                }
            }

            dbhelp.Add(newIoTDMCList);
        }