示例#1
0
        /// <summary>
        /// 解析 运行 信息
        /// </summary>
        private void txtInfoUpdateEntry(object info)
        {
            try
            {
                wgMjControllerSwipeRecord mjrec = new wgMjControllerSwipeRecord(info as string);
                if (mjrec.ControllerSN > 0)
                {
                    //如果不处于监控的控制器 则不作数据处理
                    int iSn = (int)mjrec.ControllerSN;
                    try
                    {
                        if (!watching.WatchingController.ContainsKey(iSn))
                        {
                            return; //不属于监控的控制器发出的信息 则返回
                        }
                    }
                    catch (Exception)
                    {
                        return;
                    }

                    #region  解析运行状态

                    int iCount = listWg.Count;
                    for (int iIndex = 0; iIndex < iCount; iIndex++)
                    {
                        if (listWg[iIndex] != null)
                        {
                            if (listWg[iIndex].IntSn == iSn)
                            {
                                string str = mjrec.ToDisplaySimpleInfo(true);

                                string strStart  = "Swipe Status: \t";
                                string strEnd    = "\r\nRead Date:";
                                string strStatus = DoorTimeInfo(str, strStart, strEnd);
                                //卡号
                                string strCardNo = "";
                                //门号
                                string strDoorNo = "";

                                #region 取得 卡号和门号

                                if (strStatus == WgOpenDoorType.刷卡开门.ToString() || strStatus == "刷卡禁止通过: 没有权限")
                                {
                                    strStart  = "CardID: \t";
                                    strEnd    = "\r\nDoorNO: \t";
                                    strCardNo = DoorTimeInfo(str, strStart, strEnd);
                                    if (strCardNo.Length == 6)
                                    {
                                        strCardNo = "00" + strCardNo;
                                    }
                                    if (strCardNo.Length == 7)
                                    {
                                        strCardNo = "0" + strCardNo;
                                    }
                                    strStart  = "DoorNO: \t";
                                    strEnd    = "\r\n \t[";
                                    strDoorNo = DoorTimeInfo(str, strStart, strEnd);
                                }
                                else if (strStatus == WgOpenDoorType.超级密码开门.ToString())
                                {
                                    strStart  = "DoorNO: \t";
                                    strEnd    = "\r\nSwipe";
                                    strDoorNo = DoorTimeInfo(str, strStart, strEnd);
                                }

                                #endregion

                                #region  更新 刷卡信息

                                if (listWg[iIndex].listDoor != null)
                                {
                                    int iCountDoor = listWg[iIndex].listDoor.Count;
                                    for (int iIndexDoor = 0; iIndexDoor < iCountDoor; iIndexDoor++)
                                    {
                                        int iDoorIndex = listWg[iIndex].listDoor[iIndexDoor].IntDoorIndex;
                                        if (strDoorNo == iDoorIndex.ToString())
                                        {
                                            if (strStatus == WgOpenDoorType.刷卡开门.ToString())
                                            {
                                                string strGroup = "";
                                                string strUser  = "";
                                                commonCls.GetWgUserGroup(strCardNo, ref strGroup, ref strUser);

                                                lock (listWg)
                                                {
                                                    listWg[iIndex].listDoor[iIndexDoor].StrOpenType = OpenDoorType.刷卡.ToString();
                                                    listWg[iIndex].listDoor[iIndexDoor].StrGroup    = strGroup;
                                                    listWg[iIndex].listDoor[iIndexDoor].StrUser     = strUser;
                                                }
                                            }
                                            else if (strStatus == WgOpenDoorType.超级密码开门.ToString())
                                            {
                                                lock (listWg)
                                                {
                                                    listWg[iIndex].listDoor[iIndexDoor].StrOpenType = OpenDoorType.密码.ToString();
                                                }
                                            }
                                            else if (strStatus == "刷卡禁止通过: 没有权限")
                                            {
                                                //报警显示
                                            }
                                            break;
                                        }
                                    }
                                }

                                #endregion

                                break;
                            }
                        }
                    }

                    #endregion
                }
            }
            catch (Exception ex)
            {
                if (frmMain.blDebug)
                {
                    MessageUtil.ShowTips(ex.Message);
                }
            }
        }
示例#2
0
        private void txtInfoUpdateEntry(object info)
        {
            #region

            wgMjControllerSwipeRecord mjrec = new wgMjControllerSwipeRecord(info as string);
            if (mjrec.ControllerSN > 0)
            {
                //如果不处于监控的控制器 则不作数据处理

                int iSn = (int)mjrec.ControllerSN;
                try
                {
                    if (!watching.WatchingController.ContainsKey(iSn))
                    {
                        return; //不属于监控的控制器发出的信息 则返回
                    }
                }
                catch (Exception)
                {
                    return;
                }

                #region  解析运行状态

                int iCount = listWg.Count;
                for (int iIndex = 0; iIndex < iCount; iIndex++)
                {
                    if (listWg[iIndex] != null)
                    {
                        if (listWg[iIndex].IntSn == iSn)
                        {
                            string str = mjrec.ToDisplaySimpleInfo(true);

                            string strStart  = "Swipe Status: \t";
                            string strEnd    = "\r\nRead Date:";
                            string strStatus = DoorTimeInfo(str, strStart, strEnd);
                            //卡号
                            string strCardNo = "";
                            //门号
                            string strDoorNo = "";
                            if (strStatus == OpenDoorType.刷卡.ToString() || strStatus == "刷卡禁止通过: 没有权限")
                            {
                                strStart  = "CardID: \t";
                                strEnd    = "\r\nDoorNO: \t";
                                strCardNo = DoorTimeInfo(str, strStart, strEnd);
                                if (strCardNo.Length == 6)
                                {
                                    strCardNo = "00" + strCardNo;
                                }
                                if (strCardNo.Length == 7)
                                {
                                    strCardNo = "0" + strCardNo;
                                }
                                strStart  = "DoorNO: \t";
                                strEnd    = "\r\n \t[";
                                strDoorNo = DoorTimeInfo(str, strStart, strEnd);
                            }

                            //刷卡开门
                            if (strStatus == OpenDoorType.刷卡.ToString())
                            {
                                UserAndGroup userGroup         = GetPeopleAndGroup(strCardNo);
                                string       strOpenDoorPeople = userGroup.strUser;
                                string       strGroupName      = userGroup.strGroup;
                                lock (listWg)
                                {
                                    if (strDoorNo == "1")
                                    {
                                        listWg[iIndex].StrOpenTypeDoor1 = OpenDoorType.刷卡.ToString();
                                        listWg[iIndex].StrOpenGroup1    = strGroupName;
                                        listWg[iIndex].StrOpenName1     = strOpenDoorPeople;
                                    }
                                    else if (strDoorNo == "2")
                                    {
                                        listWg[iIndex].StrOpenTypeDoor2 = OpenDoorType.刷卡.ToString();
                                        listWg[iIndex].StrOpenGroup2    = strGroupName;
                                        listWg[iIndex].StrOpenName2     = strOpenDoorPeople;
                                    }
                                }
                            }
                            else if (strStatus == "刷卡禁止通过: 没有权限")
                            {
                                string strType    = AlarmsType.门禁.ToString();
                                string strContent = "刷卡禁止通过:无权限  卡号:" + strCardNo;
                                string strPoint   = "";
                                if (listWg[iIndex].WgDoorCount == DoorCount.双门)
                                {
                                    if (strDoorNo == "1")
                                    {
                                        strPoint = listWg[iIndex].StrNameDoor1;
                                    }
                                    else if (strDoorNo == "2")
                                    {
                                        strPoint = listWg[iIndex].StrNameDoor2;
                                    }
                                }



                                NewAlarmEvent(strContent, true, strPoint);
                            }
                            else if (strStatus == OpenDoorType.超级密码开门.ToString())
                            {
                                strStart  = "DoorNO: \t";
                                strEnd    = "\r\nSwipe";
                                strDoorNo = DoorTimeInfo(str, strStart, strEnd);

                                lock (listWg)
                                {
                                    if (strDoorNo == "1")
                                    {
                                        listWg[iIndex].StrOpenTypeDoor1 = OpenDoorType.超级密码开门.ToString();
                                    }
                                    else if (strDoorNo == "2")
                                    {
                                        listWg[iIndex].StrOpenTypeDoor2 = OpenDoorType.超级密码开门.ToString();
                                    }
                                }
                            }
                            break;
                        }
                    }
                }

                #endregion
            }

            #endregion

            //try
            //{

            //}
            //catch (Exception ex)
            //{
            //    if (frmMain.blDebug)
            //        MessageUtil.ShowTips(ex.Message);
            //}
        }