📄 index.master.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 index : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
this.Panel1.Visible = true;
this.Panel2.Visible = false;
this.Panel3.Visible = false;
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
}
protected void LinkButton5_Click(object sender, EventArgs e)
{
//综合检索
string wherestr = "";
string sqlstr = "select * from Book ";
if (this.txtwxname.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Bookname like '%" + txtwxname.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Bookname like '%" + txtwxname.Text.Trim() + "%'";
}
}
if (this.txtqkname.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Qkname like '%" + txtqkname.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Qkname like '%" + txtqkname.Text.Trim() + "%'";
}
}
if (this.txtauthor.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Author like '%" + txtauthor.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Author like '%" + txtauthor.Text.Trim() + "%'";
}
}
if (this.txtzhaiyao.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Abstract like '%" + txtzhaiyao.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Abstract like '%" + txtzhaiyao.Text.Trim() + "%'";
}
}
if (this.txtkey.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Keywords like '%" + txtkey.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Keywords like '%" + txtkey.Text.Trim() + "%'";
}
}
if (wherestr.Trim() != "")
{
sqlstr = sqlstr + " where " + wherestr;
}
Session["str"] = sqlstr.ToString();
Response.Redirect("book.aspx");
}
protected void LinkButton3_Click(object sender, EventArgs e)
{
}
protected void link1_Click(object sender, EventArgs e)
{
this.Panel1.Visible = true;
this.Panel2.Visible = false;
this.Panel3.Visible = false;
}
protected void LinkButton8_Click(object sender, EventArgs e)
{
this.Panel1.Visible = false;
this.Panel2.Visible = true;
this.Panel3.Visible = false;
}
protected void LinkButton9_Click(object sender, EventArgs e)
{
this.Panel1.Visible = false;
this.Panel2.Visible = false;
this.Panel3.Visible = true;
}
protected void Linkcode_Click(object sender, EventArgs e)
{//按字母检索
string wherestr = "";
string sqlstr = "select * from Book ";
if (this.Txtcodeqiname.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Bookname like '%" + Txtcodeqiname.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Bookname like '%" + Txtcodeqiname.Text.Trim() + "%'";
}
}
if (this.Txtcodeqiname.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Qkname like '%" + Txtcodeqiname.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Qkname like '%" + Txtcodeqiname.Text.Trim() + "%'";
}
}
if (this.txtcodeauther.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Author like '%" + txtcodeauther.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Author like '%" + txtcodeauther.Text.Trim() + "%'";
}
}
if (this.txtcodezhaiyao.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Abstract like '%" + txtcodezhaiyao.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Abstract like '%" + txtcodezhaiyao.Text.Trim() + "%'";
}
}
if (this.txtcodekey.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Keywords like '%" + txtcodekey.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Keywords like '%" + txtcodekey.Text.Trim() + "%'";
}
}
if (this.DropDownList1.SelectedItem.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Code like '%" + DropDownList1.SelectedItem.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Code like '%" + DropDownList1.SelectedItem.Text.Trim() + "%'";
}
}
if (wherestr.Trim() != "")
{
sqlstr = sqlstr + " where " + wherestr;
}
Session["str"] = sqlstr.ToString();
Response.Redirect("book.aspx");
}
protected void Linkclass_Click(object sender, EventArgs e)
{ //按类别检索
string wherestr = "";
string sqlstr = "select * from Book ";
if (this.txtclassname.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Bookname like '%" + txtclassname.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Bookname like '%" + txtclassname.Text.Trim() + "%'";
}
}
if (this.txtclassqkname.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Qkname like '%" + txtclassqkname.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Qkname like '%" + txtclassqkname.Text.Trim() + "%'";
}
}
if (this.txtclassauther.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Author like '%" + txtclassauther.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Author like '%" + txtclassauther.Text.Trim() + "%'";
}
}
if (this.txtclasszhaiyao.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Abstract like '%" + txtclasszhaiyao.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Abstract like '%" + txtclasszhaiyao.Text.Trim() + "%'";
}
}
if (this.txtclasskey.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Keywords like '%" + txtclasskey.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Keywords like '%" + txtclasskey.Text.Trim() + "%'";
}
}
if (this.DropDownList2.SelectedItem.Text.Trim() != "")
{
if (wherestr.Trim() == "")
{
wherestr = "Class like '%" + DropDownList2.SelectedItem.Text.Trim() + "%'";
}
else
{
wherestr = wherestr + " AND Class like '%" + DropDownList2.SelectedItem.Text.Trim() + "%'";
}
}
if (wherestr.Trim() != "")
{
sqlstr = sqlstr + " where " + wherestr;
}
Session["str"] = sqlstr.ToString();
Response.Redirect("book.aspx");
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
this.Panel1.Visible = false;
this.Panel2.Visible = true;
this.Panel3.Visible = false;
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
this.Panel1.Visible = false;
this.Panel2.Visible = false;
this.Panel3.Visible = true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -