Пример #1
0
 //根据借书证号查询借书信息
 private void txtReadingCard_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 13 && this.txtReadingCard.Text.Trim().Length != 0)
     {
         objReader = objBorrowManger.GetReaderBorrowInfo(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.lblBorrowCount.Text = objReader.BorrowCount.ToString();
                 this.pbReaderImage.Image = objReader.ReaderImage.Length != 0 ? (Image) new Common.SerializeObjectToString().DeserializeObject(objReader.ReaderImage) : null;
                 int remainder = objReader.AllowCounts - objReader.BorrowCount;//剩借总数
                 this.lbl_Remainder.Text = remainder.ToString();
                 if (remainder > 0)
                 {
                     //启用借书
                     this.txtBarCode.Enabled = true;
                     this.btnSave.Enabled    = true;
                     this.btnDel.Enabled     = true;
                     return;
                 }
                 else
                 {
                     MessageBox.Show("该证借书到到上限!", "提示信息");
                 }
             }
             else
             {
                 MessageBox.Show("该证已挂失,请与管理员联系!", "提示信息");
             }
         }
         else
         {
             MessageBox.Show("该证不存在,请核实!", "提示信息");
         }
         //清空借书信息
         this.lblReaderName.Text     = "";
         this.lblRoleName.Text       = "";
         this.lblAllowCounts.Text    = "0";
         this.lblBorrowCount.Text    = "0";
         this.pbReaderImage.Image    = null;
         this.lbl_Remainder.Text     = "0";
         this.txtReadingCard.Text    = "";
         this.dgvBookList.DataSource = null;
         this.objReader = null;
         //禁用借书
         this.txtBarCode.Enabled = false;
         this.btnSave.Enabled    = false;
         this.btnDel.Enabled     = false;
     }
 }
Пример #2
0
 //显示借书信息
 private void txtReadingCard_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 13 && this.txtReadingCard.Text.Trim().Length != 0)
     {
         //调用借书信息
         objReader = objBorrowManager.GetReaderBorrowInfo(this.txtReadingCard.Text.Trim());
         if (objReader != null)
         { //当已借总数大于零(打开还书开关、并显示借书信息)
             if (objReader.BorrowCount > 0)
             {
                 if (objReader.StatusId == 0)
                 {
                     MessageBox.Show("借书证禁用", "禁用提示");
                     return;
                 }
                 //打开还书开关
                 this.btnConfirmReturn.Enabled = true;
                 this.txtBarCode.Enabled       = true;
                 //显示借书信息
                 this.lblReaderName.Text  = objReader.ReaderName;
                 this.lblRoleName.Text    = objReader.RoleName;
                 this.lblAllowCounts.Text = objReader.AllowCounts.ToString();
                 this.lblBorrowCount.Text = objReader.BorrowCount.ToString();
                 this.pbReaderImage.Image = objReader.ReaderImage.Length != 0 ? (Image) new Common.SerializeObjectToString().DeserializeObject(objReader.ReaderImage) : null;
                 int remainder = objReader.AllowCounts - objReader.BorrowCount;//剩借总数
                 this.lbl_Remainder.Text = remainder.ToString();
                 //显示借书列表
                 detailList = objReturnBookManager.QueryBookByReadingCard(this.txtReadingCard.Text.Trim());
                 this.dgvNonReturnList.DataSource = detailList;
             }
             else
             {
                 MessageBox.Show("该证还没有借书,没有书可还", "提示信息");
                 this.txtReadingCard.SelectAll();
                 return;
             }
         }
         else
         {
             MessageBox.Show("没有该借书证,请核实", "提示信息");
             return;
         }
     }
 }