示例#1
0
 public static void SendCommand(BcDevices dev, int accessId, int sfinksId)
 {
     try
     {
         IdentificationServer.DeviceClient.SendCommand(IdentificationServer.LoginCom);
         IdentificationServer.DeviceClient.SendCommand(string.Concat(new object[4]
         {
             (object)"CASCADE_FACEDETECTED ",
             (object)sfinksId,
             (object)" ",
             (object)dev.Id.ToString().Replace("-", "")
         }));
         if (accessId == -1)
         {
             return;
         }
         BcAccessCategory catout;
         IdentificationServer.ReadWriteAccessCategory(false, accessId, (BcAccessCategory)null, out catout);
         if (catout == null || !IdentificationServer.DeviceClient.IsConnected)
         {
             return;
         }
         BcObjects bcObjects = Enumerable.FirstOrDefault <BcObjects>((IEnumerable <BcObjects>)catout.Data, (Func <BcObjects, bool>)(o => o.Id == dev.ObjectId));
         if (bcObjects == null)
         {
             return;
         }
         if (bcObjects.Device && dev.TableId == Guid.Empty)
         {
             try
             {
                 IdentificationServer.DeviceClient.SendCommand(IdentificationServer.LoginCom);
                 IdentificationServer.DeviceClient.SendCommand(IdentificationServer.AllowPass);
             }
             catch (Exception ex)
             {
                 IdentificationServer.Logger.Error((object)"sfinks net error", ex);
             }
         }
         else if (dev.TableId != Guid.Empty)
         {
             if (BcObjectsData.GetObjectById(bcObjects.Data, dev.TableId).Device)
             {
                 try
                 {
                     IdentificationServer.DeviceClient.SendCommand(IdentificationServer.LoginCom);
                     IdentificationServer.DeviceClient.SendCommand(IdentificationServer.AllowPass);
                 }
                 catch (Exception ex)
                 {
                     IdentificationServer.Logger.Error((object)"sfinks net error", ex);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         IdentificationServer.Logger.Error((object)"sfinks net error", ex);
     }
 }
示例#2
0
 private static void TrySyncBcAccessCategories()
 {
     try
     {
         foreach (BcAccessCategory cat in BcAccessCategory.LoadAll())
         {
             BcAccessCategory catout;
             IdentificationServer.ReadWriteAccessCategory(true, cat.Id, cat, out catout);
         }
     }
     catch (Exception ex)
     {
         IdentificationServer.Logger.Error((object)ex);
     }
 }