bookadd.aspx.cs
来自「这是一个很好的图书管理系统 数据库SQL2005」· CS 代码 · 共 54 行
CS
54 行
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;
//该源码下载自www.51aspx.com(51aspx.com)
public partial class BookAdd : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
//判断用户是否登陆,权限是否正确。
if (Session["UserID"].ToString() == "" || Session["UserID"].ToString() == null || Session["Level"].ToString() != "1")
{
Response.Redirect("Login.aspx");
return;
}
}
//如果没有Session对象,跳转登陆页面
catch (NullReferenceException)
{
Response.Redirect("Login.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
BLL.T_Book book = new BLL.T_Book();
PublicClass.BookModel M_Book = new PublicClass.BookModel();
M_Book.ManID = txtManID.Text;
M_Book.BookName = txtBookName.Text;
M_Book.Writer = txtWriter.Text;
book.Book = M_Book;
switch (book.InsertBook())
{
case 1:
Response.Redirect("BookMan.aspx");
break;
case 0:
this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('用户信息插入失败!')</script>");
break;
case -1:
this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('该借书证号已存在!')</script>");
break;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?