コード例 #1
0
ファイル: IoTDevice.cs プロジェクト: KevinKao809/CDS10
        public List <Detail> GetAllIoTDeviceByCompanyId(int companyId)
        {
            DBHelper._IoTDevice dbhelp_iotDevice = new DBHelper._IoTDevice();
            DBHelper._Factory   dbhelp_factory   = new DBHelper._Factory();
            List <int>          factoryIdList    = dbhelp_factory.GetAllByCompanyId(companyId).Select(s => s.Id).ToList <int>();
            List <IoTDevice>    iotDeviceList    = new List <IoTDevice>();

            foreach (int factoryId in factoryIdList)
            {
                iotDeviceList.AddRange(dbhelp_iotDevice.GetAllByFactory(factoryId));
            }

            return(iotDeviceList.Select(s => new Detail()
            {
                IoTHubDeviceId = s.IoTHubDeviceID,
                IoTHubAlias = s.IoTHubAlias,
                IoTHubProtocol = s.IoTHubProtocol,
                FactoryId = s.FactoryID.ToString(),
                FactoryName = (s.Factory == null ? "" : s.Factory.Name),
                AuthenticationType = s.AuthenticationType,
                DeviceCertificateId = s.DeviceCertificateID.ToString(),
                DeviceCertificateName = (s.DeviceCertificate == null ? "" : s.DeviceCertificate.Name),
                DeviceTypeId = s.DeviceTypeId.ToString(),
                DeviceTypeName = (s.DeviceType == null ? "" : s.DeviceType.Name),
                DeviceVendor = s.DeviceVendor,
                DeviceModel = s.DeviceModel,
                DeviceConfigurationStatus = s.DeviceConfigurationStatus.ToString()
            }).ToList <Detail>());
        }
コード例 #2
0
ファイル: IoTDevice.cs プロジェクト: KevinKao809/CDS10
        public List <Detail_readonly> GetAllIoTDeviceByFactoryIdReadonly(int factoryId)
        {
            DBHelper._IoTDevice dbhelp_iotDevice = new DBHelper._IoTDevice();

            return(dbhelp_iotDevice.GetAllByFactory(factoryId).Select(s => new Detail_readonly()
            {
                IoTHubDeviceId = s.IoTHubDeviceID,
                IoTHubProtocol = s.IoTHubProtocol,
                FactoryId = s.FactoryID.ToString(),
                FactoryName = s.Factory.Name,
                DeviceTypeId = s.DeviceTypeId.ToString(),
                DeviceTypeName = s.DeviceType.Name,
                DeviceVendor = s.DeviceVendor,
                DeviceModel = s.DeviceModel
            }).ToList <Detail_readonly>());
        }
コード例 #3
0
ファイル: IoTDevice.cs プロジェクト: KevinKao809/CDS10
        public List <Detail> GetAllIoTDeviceByFactoryId(int factoryId)
        {
            DBHelper._IoTDevice dbhelp_iotDevice = new DBHelper._IoTDevice();

            return(dbhelp_iotDevice.GetAllByFactory(factoryId).Select(s => new Detail()
            {
                IoTHubDeviceId = s.IoTHubDeviceID,
                IoTHubAlias = s.IoTHubAlias,
                IoTHubProtocol = s.IoTHubProtocol,
                FactoryId = s.FactoryID.ToString(),
                FactoryName = (s.Factory == null ? "" : s.Factory.Name),
                AuthenticationType = s.AuthenticationType,
                DeviceCertificateId = s.DeviceCertificateID.ToString(),
                DeviceCertificateName = (s.DeviceCertificate == null ? "" : s.DeviceCertificate.Name),
                DeviceTypeId = s.DeviceTypeId.ToString(),
                DeviceTypeName = (s.DeviceType == null ? "" : s.DeviceType.Name),
                DeviceVendor = s.DeviceVendor,
                DeviceModel = s.DeviceModel,
                DeviceConfigurationStatus = s.DeviceConfigurationStatus.ToString()
            }).ToList <Detail>());
        }
コード例 #4
0
ファイル: IoTDevice.cs プロジェクト: KevinKao809/CDS10
        public List <Detail_readonly> GetAllIoTDeviceByCompanyIdReadonly(int companyId)
        {
            DBHelper._IoTDevice dbhelp_iotdevice = new DBHelper._IoTDevice();
            DBHelper._Factory   dbhelp_factory   = new DBHelper._Factory();
            List <IoTDevice>    iotDeviceList    = new List <IoTDevice>();
            List <int>          factoryIdList    = dbhelp_factory.GetAllByCompanyId(companyId).Select(s => s.Id).ToList <int>();

            foreach (int factoryId in factoryIdList)
            {
                iotDeviceList.AddRange(dbhelp_iotdevice.GetAllByFactory(factoryId));
            }
            return(iotDeviceList.Select(s => new Detail_readonly()
            {
                IoTHubDeviceId = s.IoTHubDeviceID,
                IoTHubProtocol = s.IoTHubProtocol,
                FactoryId = s.FactoryID.ToString(),
                FactoryName = s.Factory.Name,
                DeviceTypeId = s.DeviceTypeId.ToString(),
                DeviceTypeName = s.DeviceType.Name,
                DeviceVendor = s.DeviceVendor,
                DeviceModel = s.DeviceModel
            }).ToList <Detail_readonly>());
        }