📄 queryrepairform.aspx.cs
字号:
//文件名:QueryRepairForm.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_QueryRepairForm : 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("D1") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{//查询维修信息
MyTable.Rows.Clear();
string MySQL = "SELECT dbo.签收登记.维修编号, dbo.维修登记.维修类别, dbo.维修登记.维修项目,dbo.维修登记.产品品牌, dbo.维修登记.产品型号, dbo.维修登记.机身号码,dbo.维修登记.购买日期, dbo.商家信息.商家名称, dbo.维修登记.商家电话,dbo.客户信息.客户名称, dbo.维修登记.客户电话, dbo.维修登记.保修情况,dbo.维修登记.故障情况, dbo.维修登记.附件信息, dbo.维修登记.维修方式,dbo.维修登记.登记日期, dbo.维修登记.登记人员, dbo.员工信息.员工姓名,dbo.派修登记.派修日期, dbo.完修登记.修理结果, dbo.完修登记.完修日期,dbo.签收登记.维修费用, dbo.签收登记.零件费用, dbo.签收登记.预收费用,dbo.签收登记.补收费用, dbo.签收登记.签收日期, dbo.签收登记.签收人员,dbo.签收登记.补充说明 FROM dbo.签收登记 INNER JOIN dbo.维修登记 ON dbo.签收登记.维修编号 = dbo.维修登记.维修编号 INNER JOIN dbo.派修登记 ON dbo.维修登记.维修编号 = dbo.派修登记.维修编号 INNER JOIN dbo.完修登记 ON dbo.维修登记.维修编号 = dbo.完修登记.维修编号 INNER JOIN dbo.客户信息 ON dbo.维修登记.客户名称 = dbo.客户信息.客户编号 INNER JOIN dbo.商家信息 ON dbo.维修登记.商家名称 = dbo.商家信息.商家编号 INNER JOIN dbo.员工信息 ON dbo.派修登记.派修员工 = dbo.员工信息.员工编号 WHERE (dbo.签收登记.维修编号 LIKE '%" + this.TextBox1.Text + "%')";
MySQL += "AND (dbo.维修登记.维修类别 LIKE '%" + this.TextBox2.Text + "%')";
MySQL += "AND (dbo.维修登记.维修项目 LIKE '%" + this.TextBox3.Text + "%')";
MySQL += "AND (dbo.维修登记.产品品牌 LIKE '%" + this.TextBox4.Text + "%')";
MySQL += "AND (dbo.商家信息.商家名称 LIKE '%" + this.TextBox5.Text + "%')";
MySQL += "AND (dbo.客户信息.客户名称 LIKE '%" + this.TextBox6.Text + "%')";
MySQL += "AND (dbo.维修登记.保修情况 LIKE '%" + this.TextBox7.Text + "%')";
MySQL += "AND (dbo.员工信息.员工姓名 LIKE '%" + this.TextBox8.Text + "%')";
MySQL += "AND (dbo.维修登记.维修方式 LIKE '%" + this.TextBox11.Text + "%')";
MySQL += "AND (dbo.签收登记.签收日期 BETWEEN '" + this.TextBox9.Text + "' AND '" + this.TextBox10.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[6].Text);
e.Row.Cells[6].Text = MyDate.ToShortDateString();
MyDate = DateTime.Parse(e.Row.Cells[15].Text);
e.Row.Cells[15].Text = MyDate.ToShortDateString();
MyDate = DateTime.Parse(e.Row.Cells[18].Text);
e.Row.Cells[18].Text = MyDate.ToShortDateString();
MyDate = DateTime.Parse(e.Row.Cells[20].Text);
e.Row.Cells[20].Text = MyDate.ToShortDateString();
MyDate = DateTime.Parse(e.Row.Cells[25].Text);
e.Row.Cells[25].Text = MyDate.ToShortDateString();
}
}
protected void Button2_Click(object sender, EventArgs e)
{//打印维修信息
Server.Transfer("~/QueryManage/QueryRepairPrint.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 + -