Esempio n. 1
0
    public void Test_DeviceOperator_Operate()
    {
        IDevice        device         = A.Fake <IDevice>(); // Using FakeItEasy 3rd party mocking framework syntax
        DeviceOperator deviceOperator = new DeviceOperator(device);

        deviceOperator.Operate();
    }
Esempio n. 2
0
        public async Task <DeviceSubSearchModel> GetDeviceByLocationIdAsync(int locationId)
        {
            var location = await _context.Locations
                           .Include(l => l.Device)
                           .Where(l => l.LocationId == locationId).FirstOrDefaultAsync();

            var device       = location == null ? null : location.Device;
            var deviceSearch = DeviceOperator.SetDeviceSubSearchModel(device);

            return(deviceSearch);
        }
Esempio n. 3
0
        public DeviceSearchModel FindById(int deviceId)
        {
            var result = _context.Devices.Where(v => v.DeviceId == deviceId);

            result = (IQueryable <Device>)ExpandOperator.ExpandRelatedEntities <Device>(result);

            var device       = result.FirstOrDefault();
            var deviceSearch = DeviceOperator.SetDeviceSearchModelCascade(device);

            return(deviceSearch);
        }
Esempio n. 4
0
        protected virtual void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }

            if (propertyName == "Device")
            {
                var device = DeviceOperator.ListUpDevices().Where(x => string.Equals(x.Properties["Name"].Value, this.Device)).First();
                canExcute = !(bool)device.Properties["NetEnabled"].Value;
            }
        }
Esempio n. 5
0
        public IEnumerable <DeviceSearchModel> GetAll()
        {
            var queryData = from D in _context.Devices
                            select D;

            var result = QueryOperate <Device> .Execute(queryData);

            result = (IQueryable <Device>)ExpandOperator.ExpandRelatedEntities <Device>(result);

            //以下执行完后才会去数据库中查询
            var devices       = result.ToList();
            var devicesSearch = DeviceOperator.SetDeviceSearchModelCascade(devices);

            return(devicesSearch);
        }
 void Start()
 {
     instance = this;
 }
Esempio n. 7
0
 public WebService()
 {
     Device = new DeviceOperator();
     City   = new CityOperator();
 }