Пример #1
0
        public async Task<CheckDeviceOutput> CheckDevice(CheckDeviceInput input)
        {
            try
            {
                if (string.IsNullOrEmpty(input.ClientId))
                    input.ClientId = "MSoatVe";
                return await _deviceBll.CheckDevice(input);
            }
            catch (Exception ex)
            {

                ErrorStore.LogExceptionWithoutContext(ex);
                return new CheckDeviceOutput();
            }


        }
Пример #2
0
 public Task<CheckDeviceOutput> CheckDevice(CheckDeviceInput input)
 {
     var result = new CheckDeviceOutput
                  {
         Status = 0
     };
     Device device = _deviceTable.GetDevice(input.ClientId, input.DeviceKey);
     if (device != null)
     {
         if (!device.IsActived)
         {
             result.Status = 1;
             result.Description = "Device is not actived";
         }
     }
     else
     {
         RequestDevice requestDevice = _requestDeviceTable.GetRequestDevice(input.ClientId, input.DeviceKey);
         if (requestDevice != null && !requestDevice.IsApproved)
         {
             result.Status = 2;
             result.Description = "Device is waiting for approval";
         }
         else
         {
             result.Status = 3;
             result.Description = "Device not exist";
         }
     }
     return Task.FromResult(result);
 }