public UserActiveView() { InitializeComponent(); this.titleLabel.Text = "用户上机"; simpleButton2.Enabled = simpleButton3.Enabled = simpleButton1.Enabled = false; StructCard.Builder card = new StructCard.Builder() { Name = "xx22", Gender = 1, Nation = "2112", Number = ToolsManage.RandomCard, Birthday = "2012-09-01", Address = "海南省", Organization = "海南", Head = "#dasdasd#", Vld = "", }; Bitmap b = Imgs.test; string inputString = ToolsManage.BitmapToDataSring(b); card.Head = inputString; InitUI(card.Build()); // MemberNetOperation.MemberInfo(MemberInfoResult, card); }
/// <summary> /// 直接进入开通会员界面 /// </summary> /// <param name="card">若card为null自动生成card</param> public OpenMemberView(StructCard card) { InitializeComponent(); if (card == null) { StructCard.Builder newcard = new StructCard.Builder() { Name = "xx22", Gender = 1, Nation = "2112", Number = ToolsManage.RandomCard, Birthday = "2012-09-01", Address = "海南省", Organization = "海南", Head = "#dasdasd#", Vld = "", }; Bitmap b = Imgs.test; string inputString = ToolsManage.BitmapToDataSring(b); newcard.Head = inputString; InitUI(newcard.Build()); } else { InitUI(card); IdCardReaderManage.ReadCard(ReadCardResult, null, null); } }
/// <summary> /// 自动读取内容 /// </summary> private void ReadContent() { StringBuilder sb = new StringBuilder(cbDataSize); //1 读基本信息,形成文字信息文件WZ.TXT、相片文件XP.WLT、ZP.BMP,如果有指纹信息形成指纹信息文件FP.DAT //2 只读文字信息,形成文字信息文件WZ.TXT和相片文件XP.WLT //3 读最新住址信息,形成最新住址文件NEWADD.TXT //读取内容 int rs = Read_Content(1); //1 成功 //- 11 无效参数 // - 101 写入文件失败,可以调用接口获取文字信息(如getName) //0 其他错误 if (rs != 1) { Manage().ReadCardEvent(null, false); return; } //index(0) 获取姓名 //index(1) 获取性别 //index(2) 获取民族 //index(3) 获取出生日期(YYYYMMDD) //index(4) 获取地址 //index(5) 获取身份证号 //index(6) 签发机关 //index(7) 有效期起始日期(YYYYMMDD) //index(8) 有效期截止日期(YYYYMMDD) object[] message = new object[10]; StructCard.Builder card = new StructCard.Builder(); for (int i = 0; i < 9; i++) { GetCardInfo(i, sb); switch (i) { case 0: card.Name = sb.ToString(); break; case 1: card.Gender = sb.ToString().Equals("男")?1:0; break; case 2: card.Nation = sb.ToString(); break; case 3: { string res = sb.ToString(); card.Birthday = string.Format("{0}-{1}-{2}", res.Substring(0, 4), res.Substring(4, 2), res.Substring(6, 2)); } break; case 4: card.Address = sb.ToString(); break; case 5: card.Number = sb.ToString(); break; case 6: card.Organization = sb.ToString(); break; case 7: { string res = sb.ToString(); card.Vld = string.Format("{0}.{1}.{2}", res.Substring(0, 4), res.Substring(4, 2), res.Substring(6, 2)); } break; case 8: { string res = sb.ToString(); card.Vld = string.Format("{0}-{1}.{2}.{3}", card.Vld, res.Substring(0, 4), res.Substring(4, 2), res.Substring(6, 2)); } break; default: break; } } //获取头像 GetBmpPhotoExt(); string PhotoPath = ""; if (File.Exists("zp.jpg")) { PhotoPath = "zp.jpg"; } else if (File.Exists("zp.bmp")) { PhotoPath = "zp.bmp"; } FileStream fs = new FileStream(PhotoPath, FileMode.Open); //把文件读取到字节数组 byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Length); fs.Close(); string inputString = System.Convert.ToBase64String(data); card.Head = inputString; // if (timer == null) { timer = new System.Timers.Timer(); timer.Elapsed += Timer_Elapsed; timer.Interval = 1000; timer.Enabled = true; timer.Start(); } if (Manage().ReadCardEvent != null) { //如果没有读到卡或者读到卡了为不同的卡 if (IsReadCard == false || (IsReadCard && !currentCard.Number.Equals(card.Number))) { IsReadCard = true; Manage().currentCard = card.Build(); Manage().ReadCardEvent(Manage().currentCard, true); } } }