Beispiel #1
0
 public InRegionPerson(CardEvent ce)
 {
     UserID        = ce.UserID;
     UserName      = ce.UserName;
     CardID        = ce.CardID;
     Department    = ce.Department;
     PhotoPath     = ce.Photo;
     DoorID        = ce.DoorID;
     DoorName      = ce.DoorName;
     EnterDateTime = ce.EventTime;
 }
 private void ExitRegion(CardEvent item)
 {
     lock (_PersonLocker)
     {
         if (_Person.ContainsKey(item.UserID))
         {
             if (_Person[item.UserID].EnterDateTime < item.EventTime) //要判断一下本次刷卡时间是否大于人员入场时间
             {
                 _Person.Remove(item.UserID);
                 PersonChanged = true;
             }
         }
     }
 }
 private void EnterRegion(CardEvent item)
 {
     lock (_PersonLocker)
     {
         if (!_Person.ContainsKey(item.UserID))
         {
             _Person.Add(item.UserID, new InRegionPerson(item));
             PersonChanged = true;
         }
         else
         {
             if (_Person[item.UserID].EnterDateTime < item.EventTime) //要判断一下本次刷卡时间是否大于人员入场时间
             {
                 _Person[item.UserID].EnterDateTime = item.EventTime;
                 PersonChanged = true;
             }
         }
     }
 }
 /// <summary>
 /// 处理刷卡事件
 /// </summary>
 /// <param name="events"></param>
 public void HandleCardEvent(CardEvent item)
 {
     if (EnterDoors == null || EnterDoors.Count == 0 || ExitDoors == null || ExitDoors.Count == 0)
     {
         return;
     }
     if (item.Permitted && item.UserID != item.UserName && !string.IsNullOrEmpty(item.Department) && !string.IsNullOrEmpty(item.UserName)) //有效刷卡,并且是已经登记的人员
     {
         if (EnterDoors.Contains(item.DoorID))                                                                                             //说明门是入场门,刷卡即入场
         {
             EnterRegion(item);                                                                                                            //换成相对于区域的出入状态
             return;
         }
         else if (ExitDoors.Contains(item.DoorID)) //门是出场门,刷卡即出场
         {
             ExitRegion(item);
             return;
         }
     }
 }