public static Tb_EIdentitycardBung_Dal TableMod(CZW_2_Mod info)
        {
            Tb_EIdentitycardBung_Dal dal = new Tb_EIdentitycardBung_Dal();

            dal.LISTID         = MyGuid.Create();
            dal.IDENTITYCARDID = info.身份证id;
            dal.IDENTITYCARD   = info.身份证号;
            dal.DEVICETIME     = info.时间;
            dal.INTIME         = DateTime.Now;
            dal.STATUS         = "2";
            dal.OWERNAME       = info.姓名;
            dal.SEX            = info.性别;
            dal.NATION         = info.族;
            dal.BIRTHDAY       = info.出生年月日;
            dal.HJADDRESS      = info.住址;
            dal.POLICE         = info.签发机关;
            dal.VALIDITY       = GetValidity(info.起始日期, info.结束日期);

            dal.MJDEVICEID = info.设备编号.ToString();
            return(dal);
        }
        public static CZW_2_Mod GetMod(byte[] content)
        {
            //时间(6) + 身份证id(8) + 身份证号(18) + 姓名(30) + 性别(1) + 名族(2) + 出生年月日(8) + 住址(70) + 签发机关(30) + 起始日期(8) + 结束日期(8)

            CZW_2_Mod info = new CZW_2_Mod();

            info.时间    = ConverUtil.Time(content, 0);
            info.身份证id = ConverUtil.ByteToStr_Q(content, 6, 8);
            info.身份证号  = GetSFZ(content.Skip(14).Take(18).ToArray());
            info.姓名    = GetName(content.Skip(32).Take(30).ToArray());
            info.性别    = GetSex(content.Skip(62).Take(1).ToArray());
            info.族     = GetMZ(content.Skip(63).Take(2).ToArray());
            info.出生年月日 = GetBirday(content.Skip(65).Take(8).ToArray());
            info.住址    = GetAddress(content.Skip(73).Take(70).ToArray());
            info.签发机关  = GetAddress(content.Skip(143).Take(30).ToArray());
            info.起始日期  = GetBirday(content.Skip(173).Take(8).ToArray());
            info.结束日期  = GetBirday(content.Skip(181).Take(8).ToArray());



            return(info);
        }
Exemplo n.º 3
0
        public bool Execute()
        {
            try
            {
                if (this.Content.Length != 189)
                {
                    MyLibrary.Log.Debug(NAME + "出错:正确长度189,目前长度" + Content.Length.ToString() + " 原始代码:" + OriginalCode);
                }


                if (RepeatData.IsRepeatData(Content))
                {
                    MyLibrary.Log.RepeatDataInfo("基站编号:" + StationId.ToString() + " 原始代码:" + OriginalCode);
                    return(true);
                }

                CZW_2_Mod Cm = CZW_2_Dal.GetMod(this.Content);
                Cm.设备编号 = (uint)StationId;
                Tb_EIdentitycardBung_Dal dal = CZW_2_Dal.TableMod(Cm);

                bool IsOk = dal.Select_IdCard(Cm.身份证id);
                if (IsOk)
                {
                    dal.Update();
                }
                else
                {
                    dal.Insert();
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }

            return(true);
        }