private void TxtReadingCard_Leave(object sender, EventArgs e)
 {
     if (this.txtReadingCard.Text.Trim().Length != 0)
     {
         //查询读者信息
         reader     = readerManager.QueryReaderInfoByReadingCard(this.txtReadingCard.Text.Trim());
         borrowList = borrowManager.QueryBorrowInfoByReadingCard(this.txtReadingCard.Text.Trim());
         this.dgvNonReturnList.DataSource = null;
         this.dgvNonReturnList.DataSource = borrowList;
         if (reader != null)
         {
             if (reader.StatusId == 1)
             {
                 this.lblReaderName.Text  = reader.ReaderName;
                 this.lblRoleName.Text    = reader.RoleName;
                 this.lblAllowCounts.Text = reader.AllowCounts.ToString();
                 var borrowCount = borrowManager.GetBorrowCount(this.txtReadingCard.Text.Trim());
                 this.lblBorrowCount.Text = borrowCount.ToString();
                 this.lbl_Remainder.Text  = (reader.AllowCounts - borrowCount).ToString();
                 this.pbReaderImage.Image = reader.ReaderImage == "" ? null : (Image)SerializeObjectToString.DeserializeObject(reader.ReaderImage);
             }
             else
             {
                 MessageBox.Show("当前借阅证号已被挂失,请联系管理员!", "查询提示");
                 Clear();
             }
         }
         else
         {
             MessageBox.Show("借阅证号错误,请核对借阅证号码是否正确!", "查询提示");
             Clear();
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 查询借阅信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TxtReadingCard_Leave(object sender, EventArgs e)
        {
            if (this.txtReadingCard.Text.Trim().Length != 0)
            {
                //查询读者信息
                try
                {
                    reader = readerManager.QueryReaderInfoByReadingCard(this.txtReadingCard.Text.Trim());
                }
                catch (Exception ex)
                {
                }

                if (reader != null)
                {
                    if (reader.StatusId == 1)
                    {
                        this.lblReaderName.Text  = reader.ReaderName;
                        this.lblRoleName.Text    = reader.RoleName;
                        this.lblAllowCounts.Text = reader.AllowCounts.ToString();
                        var borrowCount = borrowManager.GetBorrowCount(this.txtReadingCard.Text.Trim());
                        this.lblBorrowCount.Text = borrowCount.ToString();
                        this.lbl_Remainder.Text  = (reader.AllowCounts - borrowCount).ToString();
                        this.pbReaderImage.Image = reader.ReaderImage == "" ? null : (Image)SerializeObjectToString.DeserializeObject(reader.ReaderImage);
                        if (borrowCount < reader.AllowCounts)
                        {
                            this.txtBarCode.Enabled = true;
                            this.txtBarCode.Focus();
                        }
                        else
                        {
                            MessageBox.Show("当前读者借书已达到上限,请归还后继续借书!", "查询提示");
                        }
                    }
                    else
                    {
                        MessageBox.Show("当前借阅证号已被挂失,请联系管理员!", "查询提示");
                        Clear();
                    }
                }
                else
                {
                    MessageBox.Show("借阅证号错误,请核对借阅证号码是否正确!", "查询提示");
                    Clear();
                }
            }
        }