/// <summary> /// 键盘事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtReadingCard_KeyDown(object sender, KeyEventArgs e) { if (this.txtReadingCard.Text.Length != 0 && e.KeyValue == 13) { objReader = readerService.GetReaderByReadingCard(this.txtReadingCard.Text.Trim()); if (objReader != null) { if (objReader.StatusId == 1) { //显示读者信息 this.lblReaderName.Text = objReader.ReaderName; this.lblRoleName.Text = objReader.RoleName; this.lblAllowCounts.Text = objReader.AllowCounts.ToString(); this.pbReaderImage.Image = objReader.ReaderImage != "" ? (Image) new Common.SerializeObjectToString().DeserializeObject(this.objReader.ReaderImage) : null; //显示已借阅图书总数和剩余可借图书总数 int borrowCount = borrowService.GetBorrowCount(this.txtReadingCard.Text.Trim()); this.lblBorrowCount.Text = borrowCount.ToString(); this.lbl_Remainder.Text = (objReader.AllowCounts - borrowCount).ToString(); //开启图书条码扫描文本框 if (objReader.AllowCounts > borrowCount) { this.txtBarCode.Enabled = true; this.txtBarCode.Focus(); } else { MessageBox.Show("当前读者借书总数已经达到上限!", "借书提示"); } } else { MessageBox.Show("当前借阅证已经被挂失,不能继续借书!", "借书提示"); } } else { MessageBox.Show("当前借阅证号不存在!!!", "查询提示"); this.txtReadingCard.SelectAll(); } } }
public int GetBorrowCount(string readingCare) { return(borrowService.GetBorrowCount(readingCare)); }