using SelfHelpClient.BL; using SelfHelpClient.BO; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace SelfHelpClient { public partial class ReadCardForm : Template { string _cardNumber = ""; BrushIdCard mBrushIdCard; public ReadCardForm() { InitializeComponent(); this.WindowState = FormWindowState.Maximized; this.KeyPress += ReadCardForm_KeyPress; mBrushIdCard = new BrushIdCard(MBrushIdCard_StatusChanged, MBrushIdCard_IdCardBrushed); } private void MBrushIdCard_StatusChanged(object sender, IdCardStatusChangeEventArgs e) { } //刷卡成功 private void MBrushIdCard_IdCardBrushed(object sender, IdCardEventArgs e) { var idCard = e.IdCard.ID; //MessageBox.Show(string.Format("刷卡成功,身份证号:{0}", idCard)); FillViewEntity(idCard); Close(); } void ReadCardForm_KeyPress(object sender, KeyPressEventArgs e) { //if (e.KeyChar == (char)Keys.Enter) //{ // var arr = _cardNumber.Split(new char[] { (char)Keys.Tab }, StringSplitOptions.RemoveEmptyEntries); // if (arr.Length == 8) // _cardNumber = arr[5]; // else // { // DialogForm.ShowDialog("身份证读卡配置错误,请联系管理员!", 5); // return; // } // FillViewEntity(_cardNumber); // DialogResult = DialogResult.OK; //} //else // _cardNumber += e.KeyChar.ToString(); } private void FillViewEntity(string idCard) { var list = WeightBillBL.GetViewEntity(idCard).OrderByDescending(x => x.Date).ToList(); if (list.Count == 0) { DialogForm.ShowDialog("没有待办理业务", 5); this.Close(); } else if (list.Count == 1) Program.ve = list.First(); else { new ItemSelect(list).ShowDialog(); } } private void backBtn_Click(object sender, EventArgs e) { this.Close(); } } }