public bool Execute()
        {
            try
            {
                if (FileManagement.Commands.MenJin.Filter_Bll.IsRepeat(this.OriginalCode))
                {
                    MyLibrary.Log.RepeatDataInfo("基站编号:" + StationId.ToString() + " 原始代码:" + OriginalCode);
                    return(true);
                }



                DateTime DeviceTime   = ConverUtil.Time(_content, 0);        //设备时间。
                string   CardId       = ConverUtil.ByteToStr_4(_content, 6); //卡Id
                string   CardType     = _content[10].ToString();
                string   Identitycard = SFZUtil.ByteToStr(_content, 11);     //身份证号。

                MJInfo info = new MJInfo();
                info.Protocol     = "657";
                info.DeviceId     = StationId.ToString();
                info.DeviceTime   = DeviceTime;
                info.CardId       = CardId;
                info.CardType     = CardType;
                info.Identitycard = Identitycard;

                IMjDal.Handle(NAME, OriginalCode, info);
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "错误;" + ex.Message + " 原始代码:" + OriginalCode);
            }
            return(true);
        }
        public bool Execute()
        {
            try
            {
                if (_content.Length < 12)
                {
                    MyLibrary.Log.Debug(NAME + "数据长度无效:原始代码:" + OriginalCode);
                    return(true);
                }

                if (FileManagement.Commands.MenJin.Filter_Bll.IsRepeat(this.OriginalCode))
                {
                    MyLibrary.Log.RepeatDataInfo("基站编号:" + StationId.ToString() + " 原始代码:" + OriginalCode);
                    return(true);
                }


                DateTime time   = ConverUtil.Time(_content, 0);        //设备时间。
                string   CardId = ConverUtil.ByteToStr_4(_content, 6); //卡Id

                MJInfo info = new MJInfo();
                info.Protocol   = "2";
                info.DeviceId   = StationId.ToString();
                info.CardId     = CardId;
                info.DeviceTime = time;
                info.CardType   = _content[10].ToString();

                IMjDal.Handle(NAME, OriginalCode, info);
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
            }
            return(true);
        }
Пример #3
0
        public static void HandleMenJin(MJInfo info, out UInt16 resultNum, out string reason)
        {
            Database db = DataConnect.GetConnect;

            DbCommand cmd = db.GetStoredProcCommand("pro_truncmendevice");

            db.AddInParameter(cmd, ":pi_Protocol", DbType.String, info.Protocol);
            db.AddInParameter(cmd, ":pi_DeviceId", DbType.String, info.DeviceId);
            db.AddInParameter(cmd, ":pi_CardId", DbType.String, info.CardId);
            db.AddInParameter(cmd, ":pi_CardType", DbType.String, info.CardType);
            db.AddInParameter(cmd, ":pi_Identitycard", DbType.String, info.Identitycard);
            db.AddInParameter(cmd, ":pi_IdentitycardId", DbType.String, info.IdentitycardId);
            db.AddInParameter(cmd, ":pi_ChineseName", DbType.String, info.ChineseName);
            db.AddInParameter(cmd, ":pi_DeleteType", DbType.String, info.DeleteType);
            db.AddInParameter(cmd, ":pi_PoliceCard", DbType.String, info.PoliceCard);
            db.AddInParameter(cmd, ":pi_DataIntegrity", DbType.String, info.DataIntegrity);
            db.AddInParameter(cmd, ":pi_UserPhoneNum", DbType.String, info.UserPhoneNum);
            db.AddInParameter(cmd, ":pi_UserRoom", DbType.String, info.UserRoom);
            db.AddInParameter(cmd, ":pi_IsOpenDoor", DbType.String, info.IsOpenDoor);
            db.AddInParameter(cmd, ":pi_IsOpenByCard", DbType.String, info.IsOpenByCard);
            db.AddInParameter(cmd, ":pi_SimNum", DbType.String, info.SimNum);
            db.AddInParameter(cmd, ":pi_DeviceTime", DbType.Date, info.DeviceTime);
            db.AddOutParameter(cmd, ":po_ResultNum", DbType.String, 256);
            db.AddOutParameter(cmd, ":po_Reason", DbType.String, 256);
            db.ExecuteNonQuery(cmd);
            resultNum = Convert.ToUInt16(db.GetParameterValue(cmd, ":po_ResultNum"));
            reason    = db.GetParameterValue(cmd, ":po_Reason").ToString();
        }
Пример #4
0
        public bool Execute()
        {
            try
            {
                if (FileManagement.Commands.MenJin.Filter_Bll.IsRepeat(this.OriginalCode))
                {
                    MyLibrary.Log.RepeatDataInfo("基站编号:" + StationId.ToString() + " 原始代码:" + OriginalCode);
                    return(true);
                }



                DateTime DeviceTime = ConverUtil.Time(_content, 0); //设备时间。

                MJInfo info = new MJInfo();
                info.Protocol   = "70";
                info.DeviceId   = StationId.ToString();
                info.DeviceTime = DeviceTime;

                IMjDal.Handle(NAME, OriginalCode, info);
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "错误;" + ex.Message + " 原始代码:" + OriginalCode);
            }
            return(true);
        }
Пример #5
0
        public bool Execute()
        {
            try
            {
                if (FileManagement.Commands.MenJin.Filter_Bll.IsRepeat(this.OriginalCode))
                {
                    MyLibrary.Log.RepeatDataInfo("基站编号:" + StationId.ToString() + " 原始代码:" + OriginalCode);
                    return(true);
                }



                string sim_sn = BitConverter.ToString(_content).Replace("-", "");
                MJInfo info   = new MJInfo();
                info.Protocol = "67";
                info.DeviceId = StationId.ToString();
                info.SimNum   = sim_sn;

                IMjDal.Handle(NAME, OriginalCode, info);
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
            }
            return(true);
        }
        public bool Execute()
        {
            try
            {
                if (_content.Length != 50)
                {
                    MyLibrary.Log.Debug(NAME + "数据长度无效:原始代码:" + OriginalCode);
                    return(true);
                }

                if (FileManagement.Commands.MenJin.Filter_Bll.IsRepeat(this.OriginalCode))
                {
                    MyLibrary.Log.RepeatDataInfo("基站编号:" + StationId.ToString() + " 原始代码:" + OriginalCode);
                    return(true);
                }


                //    DateTime time = ConverUtil.Time(_content, 0); //设备时间。
                //  string CardId = ConverUtil.ByteToStr_4(_content,6);   //IC卡

                byte[] IdentytyCardNoByte = new byte[9];  //身份证
                Array.Copy(_content, 11, IdentytyCardNoByte, 0, 9);
                string IdCardReplace  = ConverUtil.ByteToStr_A(IdentytyCardNoByte).Replace('b', 'B').Replace('c', 'C').Replace('d', 'D').Replace('e', 'E').Replace('f', 'F');
                string IdentytyCardNo = IdCardReplace.Replace('A', 'X').TrimStart('0');

                byte[] phoneByte = new byte[6];  //电话
                Array.Copy(_content, 20, phoneByte, 0, 6);
                string Phone = ConverUtil.ByteToStr_A(phoneByte).Replace("F", "");

                byte[] addressByte = new byte[24];
                Array.Copy(_content, 26, addressByte, 0, 24);
                string UserRoom = BitConverter.ToString(addressByte).Replace("-", "");

                MJInfo info = new MJInfo();
                info.Protocol     = "1";
                info.DeviceTime   = ConverUtil.Time(_content, 0);        //设备时间。
                info.CardId       = ConverUtil.ByteToStr_4(_content, 6); //IC卡
                info.CardType     = _content[10].ToString();
                info.ChineseName  = "";
                info.Identitycard = IdentytyCardNo;
                info.DeviceId     = StationId.ToString();

                info.DataIntegrity = string.IsNullOrWhiteSpace(IdentytyCardNo) ? "0" : "1";
                info.UserPhoneNum  = Phone;
                info.UserRoom      = UserRoom;

                IMjDal.Handle(NAME, OriginalCode, info);
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
            }
            return(true);
        }
Пример #7
0
        public static void Handle(string Name, string OriginalCode, MJInfo info)
        {
            UInt16 ResultNum;
            string Reason;

            MjDal.HandleMenJin(info, out ResultNum, out Reason);
            if (ResultNum == 1)
            {
                MyLibrary.Log.Debug(Name + "出错;" + Reason + " 原始代码:" + OriginalCode);
            }
        }
        public bool Execute()
        {
            try
            {
                if (_content.Length < 28)
                {
                    MyLibrary.Log.Debug(NAME + "数据长度无效:原始代码:" + OriginalCode);
                    return(true);
                }


                if (FileManagement.Commands.MenJin.Filter_Bll.IsRepeat(this.OriginalCode))
                {
                    MyLibrary.Log.RepeatDataInfo("基站编号:" + StationId.ToString() + " 原始代码:" + OriginalCode);
                    return(true);
                }


                DateTime time   = ConverUtil.Time(_content, 0);        //设备时间。
                string   CardId = ConverUtil.ByteToStr_4(_content, 6); //卡Id

                byte[] IdentytyCardNoByte = new byte[9];               //身份证
                Array.Copy(_content, 11, IdentytyCardNoByte, 0, 9);
                string IdCardReplace  = ConverUtil.ByteToStr_A(IdentytyCardNoByte).Replace('b', 'B').Replace('c', 'C').Replace('d', 'D').Replace('e', 'E').Replace('f', 'F');
                string IdentytyCardNo = IdCardReplace.Replace('A', 'X').TrimStart('0');

                //byte[] phoneByte = new byte[6];  //电话
                //Array.Copy(_content, 20, phoneByte, 0, 6);
                //string phone = ConverUtil.ByteToStr_A(phoneByte).Replace("F", "");

                //byte[] roomIdByte = new byte[2];  //房间Id
                //Array.Copy(_content, 26, roomIdByte, 0, 2);
                MJInfo info = new MJInfo();
                info.Protocol      = "18";
                info.DeviceId      = StationId.ToString();
                info.CardId        = CardId;
                info.CardType      = _content[10].ToString();
                info.Identitycard  = IdentytyCardNo;
                info.IsOpenDoor    = "0";
                info.IsOpenByCard  = "1";
                info.DataIntegrity = "0";
                info.DeviceTime    = time;

                IMjDal.Handle(NAME, OriginalCode, info);
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
            }
            return(true);
        }