public void deleteIoTDeviceConfiguration(int id)
        {
            DBHelper._IoTDeviceCustomizedConfiguration dbhelp         = new DBHelper._IoTDeviceCustomizedConfiguration();
            IoTDeviceCustomizedConfiguration           existingIoTDCC = dbhelp.GetByid(id);

            dbhelp.Delete(existingIoTDCC);
        }
        public void updateCustomizedConfiguration(int id, Update iotDCC)
        {
            DBHelper._IoTDeviceCustomizedConfiguration dbhelp         = new DBHelper._IoTDeviceCustomizedConfiguration();
            IoTDeviceCustomizedConfiguration           existingIoTDCC = dbhelp.GetByid(id);

            existingIoTDCC.Name         = iotDCC.Name;
            existingIoTDCC.DataType     = iotDCC.DataType;
            existingIoTDCC.Description  = iotDCC.Description;
            existingIoTDCC.DefaultValue = iotDCC.DefaultValue;

            dbhelp.Update(existingIoTDCC);
        }
        public Detail getCustomizedConfigurationById(int id)
        {
            DBHelper._IoTDeviceCustomizedConfiguration dbhelp = new DBHelper._IoTDeviceCustomizedConfiguration();
            IoTDeviceCustomizedConfiguration           iotDCC = dbhelp.GetByid(id);

            return(new Detail()
            {
                Id = iotDCC.Id,
                Name = iotDCC.Name,
                DataType = iotDCC.DataType,
                Description = iotDCC.Description,
                DefaultValue = iotDCC.DefaultValue
            });
        }
        public void addIoTDeviceConfiguration(Add iotDCC)
        {
            DBHelper._IoTDeviceCustomizedConfiguration dbhelp = new DBHelper._IoTDeviceCustomizedConfiguration();
            var newIoTCustomizedConfiguration = new IoTDeviceCustomizedConfiguration()
            {
                CompanyId    = iotDCC.CompanyId,
                Name         = iotDCC.Name,
                DataType     = iotDCC.DataType,
                Description  = iotDCC.Description,
                DefaultValue = iotDCC.DefaultValue
            };

            dbhelp.Add(newIoTCustomizedConfiguration);
        }
        public void DeleteById(int id)
        {
            using (CDStudioEntities dbEntity = new CDStudioEntities())
            {
                IoTDeviceCustomizedConfiguration existingData = dbEntity.IoTDeviceCustomizedConfiguration.Find(id);
                if (existingData == null)
                {
                    throw new CDSException(10701);
                }

                dbEntity.IoTDeviceCustomizedConfiguration.Remove(existingData);
                dbEntity.SaveChanges();
            }
        }
        public int Create(int companyId, Format_Create parseData)
        {
            using (CDStudioEntities dbEntity = new CDStudioEntities())
            {
                IoTDeviceCustomizedConfiguration newData = new IoTDeviceCustomizedConfiguration();
                newData.CompanyId    = companyId;
                newData.Name         = parseData.Name;
                newData.DataType     = parseData.DataType;
                newData.Description  = parseData.Description ?? "";
                newData.DefaultValue = parseData.DefaultValue ?? "";

                dbEntity.IoTDeviceCustomizedConfiguration.Add(newData);
                dbEntity.SaveChanges();
                return(newData.Id);
            }
        }
        public Format_Detail GetById(int id)
        {
            using (CDStudioEntities dbEntity = new CDStudioEntities())
            {
                IoTDeviceCustomizedConfiguration existingData = (from c in dbEntity.IoTDeviceCustomizedConfiguration.AsNoTracking()
                                                                 where c.Id == id
                                                                 select c).SingleOrDefault <IoTDeviceCustomizedConfiguration>();
                if (existingData == null)
                {
                    throw new CDSException(10701);
                }

                return(new Format_Detail()
                {
                    Id = existingData.Id,
                    Name = existingData.Name,
                    DataType = existingData.DataType,
                    Description = existingData.Description,
                    DefaultValue = existingData.DefaultValue
                });
            }
        }