bookqueury.aspx.cs
来自「图书馆的书目查询」· CS 代码 · 共 195 行
CS
195 行
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace Library_BS
{
/// <summary>
/// BookQueury 的摘要说明。
/// </summary>
public class BookQueury : System.Web.UI.Page
{
protected System.Web.UI.WebControls.RadioButton RadioButtonName;
protected System.Web.UI.WebControls.RadioButton RadioButtonAuthor;
protected System.Web.UI.WebControls.RadioButton RadioButtonSortID;
protected System.Web.UI.WebControls.RadioButton RadioButtonAskforID;
protected System.Web.UI.WebControls.RadioButton RadioButtonISBN;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.Label Label7;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button btnQueury;
protected System.Web.UI.WebControls.Button btnAgain;
protected System.Web.UI.WebControls.Label Label8;
protected System.Web.UI.WebControls.RadioButton RadioButtonSame;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.RadioButton RadioButtonCommon;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnQueury.Click += new System.EventHandler(this.btnQueury_Click);
this.btnAgain.Click += new System.EventHandler(this.btnAgain_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnQueury_Click(object sender, System.EventArgs e)
{
//Response.Redirect("QueuryBySomething.aspx?Content="+this.TextBox1.Text);
if(this.RadioButtonName.Checked==true && this.RadioButtonSame.Checked==true)
this.BindData1();
if(this.RadioButtonName.Checked==true && this.RadioButtonCommon.Checked==true)
this.BindData2();
if(this.RadioButtonAuthor.Checked==true && this.RadioButtonSame.Checked==true)
this.BindData3();
if(this.RadioButtonAuthor.Checked==true && this.RadioButtonCommon.Checked==true)
this.BindData4();
if(this.RadioButtonSortID.Checked==true && this.RadioButtonSame.Checked==true)
this.BindData5();
if(this.RadioButtonSortID.Checked==true && this.RadioButtonCommon.Checked==true)
this.BindData6();
if(this.RadioButtonAskforID.Checked==true && this.RadioButtonSame.Checked==true)
this.BindData7();
if(this.RadioButtonAskforID.Checked==true && this.RadioButtonCommon.Checked==true)
this.BindData8();
if(this.RadioButtonISBN.Checked==true && this.RadioButtonSame.Checked==true)
this.BindData9();
if(this.RadioButtonISBN.Checked==true && this.RadioButtonCommon.Checked==true)
this.BindData10();
}
private void BindData1()
{
//UserDB user = new UserDB();
BookQueuryDB queury = new BookQueuryDB();
DataSet myDataSet = new DataSet();
myDataSet = queury.GetBookByNameSame(this.TextBox1.Text);
this.DataGrid1.DataSource = myDataSet.Tables["NameSame"].DefaultView;
this.DataGrid1.DataBind();
}
private void BindData2()
{
//UserDB user = new UserDB();
BookQueuryDB queury = new BookQueuryDB();
DataSet myDataSet = new DataSet();
myDataSet = queury.GetBookByNameCommon(this.TextBox1.Text);
this.DataGrid1.DataSource = myDataSet.Tables["NameCommon"].DefaultView;
this.DataGrid1.DataBind();
}
private void BindData3()
{
//UserDB user = new UserDB();
BookQueuryDB queury = new BookQueuryDB();
DataSet myDataSet = new DataSet();
myDataSet = queury.GetBookByAuthorSame(this.TextBox1.Text);
this.DataGrid1.DataSource = myDataSet.Tables["AuthorSame"].DefaultView;
this.DataGrid1.DataBind();
}
private void BindData4()
{
//UserDB user = new UserDB();
BookQueuryDB queury = new BookQueuryDB();
DataSet myDataSet = new DataSet();
myDataSet = queury.GetBookByAuthorCommon(this.TextBox1.Text);
this.DataGrid1.DataSource = myDataSet.Tables["AuthorCommon"].DefaultView;
this.DataGrid1.DataBind();
}
private void BindData5()
{
//UserDB user = new UserDB();
BookQueuryDB queury = new BookQueuryDB();
DataSet myDataSet = new DataSet();
myDataSet = queury.GetBookBySortIDSame(this.TextBox1.Text);
this.DataGrid1.DataSource = myDataSet.Tables["SortIDSame"].DefaultView;
this.DataGrid1.DataBind();
}
private void BindData6()
{
//UserDB user = new UserDB();
BookQueuryDB queury = new BookQueuryDB();
DataSet myDataSet = new DataSet();
myDataSet = queury.GetBookBySortIDCommon(this.TextBox1.Text);
this.DataGrid1.DataSource = myDataSet.Tables["SortIDCommon"].DefaultView;
this.DataGrid1.DataBind();
}
private void BindData7()
{
//UserDB user = new UserDB();
BookQueuryDB queury = new BookQueuryDB();
DataSet myDataSet = new DataSet();
myDataSet = queury.GetBookByAskforIDSame(this.TextBox1.Text);
this.DataGrid1.DataSource = myDataSet.Tables["AskforIDSame"].DefaultView;
this.DataGrid1.DataBind();
}
private void BindData8()
{
//UserDB user = new UserDB();
BookQueuryDB queury = new BookQueuryDB();
DataSet myDataSet = new DataSet();
myDataSet = queury.GetBookByAskforIDCommon(this.TextBox1.Text);
this.DataGrid1.DataSource = myDataSet.Tables["AskforIDCommon"].DefaultView;
this.DataGrid1.DataBind();
}
private void BindData9()
{
//UserDB user = new UserDB();
BookQueuryDB queury = new BookQueuryDB();
DataSet myDataSet = new DataSet();
myDataSet = queury.GetBookByISBNSame(this.TextBox1.Text);
this.DataGrid1.DataSource = myDataSet.Tables["ISBNSame"].DefaultView;
this.DataGrid1.DataBind();
}
private void BindData10()
{
//UserDB user = new UserDB();
BookQueuryDB queury = new BookQueuryDB();
DataSet myDataSet = new DataSet();
myDataSet = queury.GetBookByISBNCommon(this.TextBox1.Text);
this.DataGrid1.DataSource = myDataSet.Tables["ISBNCommon"].DefaultView;
this.DataGrid1.DataBind();
}
private void btnAgain_Click(object sender, System.EventArgs e)
{
this.RadioButtonAskforID.Checked = false;
this.RadioButtonAuthor.Checked = false;
this.RadioButtonCommon.Checked = false;
this.RadioButtonISBN.Checked = false;
this.RadioButtonName.Checked = false;
this.RadioButtonSame.Checked = false;
this.RadioButtonSortID.Checked = false;
this.TextBox1.Text = "";
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?