📄 returnman.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ReturnMan : System.Web.UI.Page
{
BLL.T_Borrow Borrow = new BLL.T_Borrow();
protected void Page_Load(object sender, EventArgs e)
{
try
{
//验证Session对象,判断用户是否登陆
if (Session["UserID"].ToString() == "" || Session["UserID"].ToString() == null || Session["Level"].ToString() != "2")
{
Response.Redirect("Login.aspx");
return;
}
}
//Session对象未初始化,跳转登陆页面。
catch (NullReferenceException)
{
Response.Redirect("Login.aspx");
}
lbl_UserName.Text = Session["UserName"].ToString();
}
protected void btn_Click(object sender, EventArgs e)
{
PublicClass.BorrowModel borrow = new PublicClass.BorrowModel();
borrow.CardID = txtReaderid.Text;
borrow.ManID = txtManid.Text;
borrow.ReturnDate = DateTime.Now.ToString();
Borrow.Borrow = borrow;
int re = Borrow.ReturnBook();
switch (re)
{
case -1:
this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('读者ID不存在')</script>");
break;
case 0:
this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('借书证号:" + borrow.CardID + " 管理编号:" + borrow.ManID + " 的还书操作完成')</script>");
break;
case 1:
this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('图书ID不存在')</script>");
break;
case 2:
this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('借书证号:" + borrow.CardID + "的读者未借 管理编号:" + borrow.ManID + " 的图书')</script>");
break;
case 3:
this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('还书操作失败')</script>");
break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -