📄 querypartsubtractform.aspx.cs
字号:
//文件名:QueryPartSubtractForm.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;
using System.Data.SqlClient;
public partial class QueryManage_QueryPartSubtractForm : System.Web.UI.Page
{
private static DataTable MyTable = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("D3") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{//查询配件领用信息
MyTable.Rows.Clear();
string MySQL = "SELECT * FROM 配件领用 WHERE (维修编号 LIKE '%" + this.TextBox1.Text + "%')";
MySQL += "AND (配件编号 LIKE '%" + this.TextBox2.Text + "%')";
MySQL += "AND (配件名称 LIKE '%" + this.TextBox3.Text + "%')";
MySQL += "AND (规格型号 LIKE '%" + this.TextBox4.Text + "%')";
MySQL += "AND (领用部门 LIKE '%" + this.TextBox5.Text + "%')";
MySQL += "AND (领用人员 LIKE '%" + this.TextBox6.Text + "%')";
MySQL += "AND (领用日期 BETWEEN '" + this.TextBox7.Text + "' AND '" + this.TextBox8.Text + "') ";
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyServiceDBConnectionString"].ConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
SqlDataAdapter MyAdatper = new SqlDataAdapter(MySQL, MyConnection);
MyAdatper.Fill(MyTable);
this.GridView1.DataSource = MyTable;
this.GridView1.DataBind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{//在GridView控件单元格中设置短日期显示格式
if (e.Row.RowType == DataControlRowType.DataRow)
{
DateTime MyDate = DateTime.Parse(e.Row.Cells[11].Text);
e.Row.Cells[11].Text = MyDate.ToShortDateString();
}
}
protected void Button2_Click(object sender, EventArgs e)
{//打印配件领用信息
Server.Transfer("~/QueryManage/QueryPartSubtractPrint.aspx");
}
public DataTable MyQueryTable
{//设置要传递到打印页的数据
get
{
return MyTable;
}
}
public String MyPrintDate
{//设置要传递到打印页的数据
get
{
string MyDate = "打印日期:" + DateTime.Now.ToShortDateString();
return MyDate;
}
}
public String MyPrintTitle
{//设置要传递到打印页的数据
get
{
return Session["MyServiceName"].ToString() + "配件领用信息查询结果表";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -