예제 #1
0
        public void AffiliateDelete(Device entity)
        {
            var       fieldQuery = _fieldManager.GetAll().Where(f => f.DeviceId == entity.Id);
            ArrayList listField  = new ArrayList(fieldQuery.Count());

            if (fieldQuery.Any())
            {
                foreach (var field in fieldQuery)
                {
                    listField.Add((Field)field);
                }
            }

            var       deviceTagQuery = _deviceTagManager.GetAll().Where(dt => dt.DeviceId == entity.Id);
            ArrayList listDT         = new ArrayList(deviceTagQuery.Count());

            if (deviceTagQuery.Any())
            {
                foreach (var dt in deviceTagQuery)
                {
                    listDT.Add((DeviceTag)dt);
                }
            }

            var       otdQuery = _onlineTimeDailyManager.GetAll().Where(otd => otd.DeviceId == entity.Id);
            ArrayList listOTD  = new ArrayList(otdQuery.Count());

            if (otdQuery.Any())
            {
                foreach (var otd in otdQuery)
                {
                    listOTD.Add((OnlineTimeDaily)otd);
                }
            }

            foreach (var field in listField)
            {
                _fieldManager.Delete((Field)field);
            }

            foreach (var dt in listDT)
            {
                _deviceTagManager.Delete((DeviceTag)dt);
            }

            foreach (var otd in listOTD)
            {
                _onlineTimeDailyManager.Delete((OnlineTimeDaily)otd);
            }

            Delete(entity);
        }
예제 #2
0
        public void Delete(EntityDto <int> input)
        {
            var entity = _fieldRepository.Get(input.Id);

            _fieldManager.Delete(entity);
        }