//读卡 private void timer1_Tick(object sender, EventArgs e) { try { string ICCardSN = ""; CardScanHelper cardHelper = new CardScanHelper(); ICCardSN = cardHelper.ScanCard(); string IC01 = ICCardSN.Substring(0, 2); string IC02 = ICCardSN.Substring(2, 2); string IC03 = ICCardSN.Substring(4, 2); string IC04 = ICCardSN.Substring(6, 2); ICCardSN = IC04 + IC03 + IC02 + IC01; if (ICCardSN != "") { if (this.Card.Text != ICCardSN) { this.Card.Text = ICCardSN; string UserStr = Service.GetStudentDataByCustomerCardSN(schoolCode, ICCardSN); Bll.StuUser.StudentUser Use = Stu.GetUserNameForSerVice(UserStr); if (Use.StatusID == "1") { StuCode = Use.Code; this.Card.Text = Use.CustomerCardSN; this.Code.Text = Use.Code; this.label5.Text = Use.Name; this.label7.Text = Use.SexText; this.label9.Text = Use.ClassCode; this.label11.Text = Use.ClassName; this.label13.Text = Use.Telephone; this.label15.Text = Use.DiningCardCode; System.Net.WebClient web = new System.Net.WebClient(); byte[] buffer = web.DownloadData(Use.PhotoUrl); web.Dispose(); System.IO.MemoryStream ms = new System.IO.MemoryStream(buffer); this.UserInage.Image = Image.FromStream(ms); } else { StuCode = ""; this.Code.Text = ""; this.label5.Text = ""; this.label7.Text = ""; this.label9.Text = ""; this.label11.Text = ""; this.label13.Text = ""; this.label15.Text = ""; this.UserInage.Image = (System.Drawing.Image)Properties.Resources.ResourceManager.GetObject("timg1"); } masgerShow(Use.StatusText); } } } catch (Exception ex) { // MessageBox.Show( ex.Message ); return; } }
//确定学生学号 private void button1_Click(object sender, EventArgs e) { try { string code = this.Code.Text; if (code == "") { return; } string UserStr = Service.GetStudentDataByCode(schoolCode, code); Bll.StuUser.StudentUser Use = Stu.GetUserNameForSerVice(UserStr); if (Use.StatusID == "1") { StuCode = Use.Code; this.Card.Text = Use.CustomerCardSN; this.Code.Text = Use.Code; this.label5.Text = Use.Name; this.label7.Text = Use.SexText; this.label9.Text = Use.ClassCode.Substring(10, Use.ClassCode.Length - 10); this.label11.Text = Use.ClassName; this.label13.Text = Use.Telephone; this.label15.Text = Use.DiningCardCode; System.Net.WebClient web = new System.Net.WebClient(); byte[] buffer = web.DownloadData(Use.PhotoUrl); web.Dispose(); System.IO.MemoryStream ms = new System.IO.MemoryStream(buffer); this.UserInage.Image = Image.FromStream(ms); } else { StuCode = ""; this.Code.Text = ""; this.label5.Text = ""; this.label7.Text = ""; this.label9.Text = ""; this.label11.Text = ""; this.label13.Text = ""; this.label15.Text = ""; this.UserInage.Image = (System.Drawing.Image)Properties.Resources.ResourceManager.GetObject("timg1"); } masgerShow(Use.StatusText); } catch (Exception ex) { // MessageBox.Show( ex.Message ); return; } }