Exemplo n.º 1
0
        public async Task<InformNewAppOutput> InformNewDevice(InformNewAppInput input)
        {
            try
            {
                if (string.IsNullOrEmpty(input.ClientId))
                    input.ClientId = "MSoatVe";
                return await _deviceBll.InformNewApp(input);
            }
            catch (Exception ex)
            {

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

        }
Exemplo n.º 2
0
 public Task<InformNewAppOutput> InformNewApp(InformNewAppInput newApp)
 {
     int num = 0;
     string str = null;
     if (_deviceTable.GetDevice(newApp.ClientId, newApp.DeviceKey) == null)
     {
         if (!_requestDeviceTable.IsExistRequestDevice(newApp.ClientId, newApp.DeviceKey))
             _requestDeviceTable.CreateRequestDevice(newApp);
         else
             _requestDeviceTable.UpdateRequestDevice(newApp);
         RequestDevice requestDevice = _requestDeviceTable.GetRequestDevice(newApp.ClientId, newApp.DeviceKey);
         if (requestDevice != null)
         {
             if (!requestDevice.IsApproved)
                 str = string.Format("R{0}", requestDevice.Id.ToString("D4"));
             else
                 num = 3;
         }
         else
             num = 2;
     }
     else
         num = 1;
     return Task.FromResult(new InformNewAppOutput
                            {
         Status = num,
         DeviceName = str
     });
 }
Exemplo n.º 3
0
 public int UpdateRequestDevice(InformNewAppInput newApp)
 {
     return UpdateRequestDevice(newApp, false);
 }
Exemplo n.º 4
0
   public int UpdateRequestDevice(InformNewAppInput newApp, bool isApproved)
   {
       if (isApproved)
           return _database.Execute("Update RequestDevices Set ClientId=@clientId, SerialNumber=@serialNumber, IMEI=@iMEI, Manufacturer=@manufacturer, Model=@model, Platform=@platform, PlatformVersion=@platformVersion, IsApproved = @isApproved, Updated = @updated Where DeviceKey = @deviceKey", new Dictionary<string, object>()
   {
     {
       "@clientId",
       newApp.ClientId
     },
     {
       "@deviceKey",
       newApp.DeviceKey
     },
     {
       "@serialNumber",
       newApp.SerialNumber
     },
     {
       "@iMEI",
       newApp.IMEI
     },
     {
       "@manufacturer",
       newApp.Manufacturer
     },
     {
       "@model",
       newApp.Model
     },
     {
       "@platform",
       newApp.Platform
     },
     {
       "@platformVersion",
       newApp.PlatformVersion
     },
     {
       "@isApproved",
       isApproved ? 1 : 0
     },
     {
       "@updated",
       DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
     }
   });
       return _database.Execute("Update RequestDevices Set ClientId=@clientId, SerialNumber=@serialNumber, IMEI=@iMEI, Manufacturer=@manufacturer, Model=@model, Platform=@platform, PlatformVersion=@platformVersion, Created = @created Where DeviceKey = @deviceKey and IsApproved = @isApproved", new Dictionary<string, object>()
 {
   {
     "@clientId",
     newApp.ClientId
   },
   {
     "@deviceKey",
     newApp.DeviceKey
   },
   {
     "@serialNumber",
     newApp.SerialNumber
   },
   {
     "@iMEI",
     newApp.IMEI
   },
   {
     "@manufacturer",
     newApp.Manufacturer
   },
   {
     "@model",
     newApp.Model
   },
   {
     "@platform",
     newApp.Platform
   },
   {
     "@platformVersion",
     newApp.PlatformVersion
   },
   {
     "@isApproved",
     isApproved ? 1 : 0
   },
   {
     "@created",
     DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
   }
 });
   }
Exemplo n.º 5
0
   public int CreateRequestDevice(InformNewAppInput newApp)
   {
       return _database.Execute("Insert into RequestDevices (Id, ClientId, DeviceKey, SerialNumber, IMEI, Manufacturer, Model, Platform, PlatformVersion, IsApproved, Created, Updated) " + "values (@id, @clientId, @deviceKey, @serialNumber, @iMEI, @manufacturer, @model, @platform, @platformVersion, @isApproved, @created, @updated)", new Dictionary<string, object>()
 {
   {
     "@id",
     null
   },
   {
     "@clientId",
     newApp.ClientId
   },
   {
     "@deviceKey",
     newApp.DeviceKey
   },
   {
     "@serialNumber",
     newApp.SerialNumber
   },
   {
     "@iMEI",
     newApp.IMEI
   },
   {
     "@manufacturer",
     newApp.Manufacturer
   },
   {
     "@model",
     newApp.Model
   },
   {
     "@platform",
     newApp.Platform
   },
   {
     "@platformVersion",
     newApp.PlatformVersion
   },
   {
     "@isApproved",
     false
   },
   {
     "@created",
     DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
   },
   {
     "@updated",
     DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
   }
 });
   }