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 = ""; public ViewEntity VEntity { get; set; } public ReadCardForm() { InitializeComponent(); this.WindowState = FormWindowState.Maximized; this.KeyPress += ReadCardForm_KeyPress; } 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) VEntity = list.First(); else { new ItemSelect(list, this).ShowDialog(); } } private void backBtn_Click(object sender, EventArgs e) { this.Close(); } } }