LendBook.aspx.cs
上传用户:gooyliu
上传日期:2018-09-29
资源大小:5816k
文件大小:2k
源码类别:

.net编程

开发平台:

C#

  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. using System.Web.UI.HtmlControls;
  12. using System.Xml.Linq;
  13. using BusinessLogicLayer;
  14. namespace Web.SysOperator
  15. {
  16.     public partial class LendBook : System.Web.UI.Page
  17.     {
  18.         protected void Page_Load(object sender, EventArgs e)
  19.         {
  20.             this.txtReaderID.Focus();
  21.         }
  22.         protected void imgbtnLend_Click(object sender, ImageClickEventArgs e)
  23.         {
  24.             string bookID = txtBookID.Text.ToString().Trim();
  25.             string userID = txtReaderID.Text.ToString().Trim();
  26.             BookBusiness BB = new BookBusiness();
  27.             if (BB.CheckBookByID(bookID) == 0)
  28.             {
  29.                 lblMsg.Visible = true;
  30.                 lblMsg.Text = "不存在该书籍!!";
  31.             }
  32.             else if (BB.CheckBookByID(bookID) == -1)
  33.             {
  34.                 lblMsg.Visible = true;
  35.                 lblMsg.Text = "该书籍已借出或在维护中!!";
  36.             }
  37.             else
  38.             {
  39.                 int val = BookBusiness.LendBook(userID, bookID);
  40.                 if (val == 1)
  41.                 {
  42.                     lblMsg.Visible = true;
  43.                     lblMsg.Text = "借阅成功";
  44.                     txtReaderID.Text = string.Empty;
  45.                     txtBookID.Text = string.Empty;
  46.                     //lblMsg.Text = string.Empty;
  47.                 }
  48.                 if (val == 0)
  49.                 {
  50.                     lblMsg.Visible = true;
  51.                     lblMsg.Text = "借阅失败,该读者已达到最大借阅册数";
  52.                     txtReaderID.Text = string.Empty;
  53.                     txtBookID.Text = string.Empty;
  54.                     //lblMsg.Text = string.Empty;
  55.  
  56.                 }
  57.             }
  58.         }
  59.         protected void ImageReset_Click(object sender, ImageClickEventArgs e)
  60.         {
  61.             txtReaderID.Text = string.Empty;
  62.             txtBookID.Text = string.Empty;
  63.             lblMsg.Text = string.Empty;
  64.         }
  65.     }
  66. }