📄 queryeatingform.aspx.cs
字号:
//文件名:QueryEatingForm.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_QueryEatingForm : System.Web.UI.Page
{
private static string MySQL = "";
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("D4") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{//查询客人用餐信息
string My用餐类别 = this.DropDownList1.SelectedValue.ToString();
if (My用餐类别 == "所有")
My用餐类别 = "%%";
string My服务人员 = this.DropDownList2.SelectedValue.ToString();
if (My服务人员 == "所有")
My服务人员 = "%%";
string My当前状态 = this.DropDownList3.SelectedValue.ToString();
if (My当前状态 == "所有")
My当前状态 = "%%";
DataTable MyTable = new DataTable();
MySQL = "SELECT dbo.用餐信息.用餐单号, dbo.用餐信息.入座台位, dbo.用餐信息.宾客人数,dbo.用餐信息.用餐日期, dbo.用餐信息.用餐类别, dbo.用餐信息.用餐金额,dbo.用餐信息.折扣金额, dbo.用餐信息.实收金额, dbo.员工信息.员工姓名, dbo.用餐信息.宾客意见, dbo.用餐信息.当前状态, dbo.用餐信息.补充说明 FROM dbo.用餐信息 INNER JOIN dbo.员工信息 ON dbo.用餐信息.服务人员 = dbo.员工信息.员工编号 WHERE (dbo.用餐信息.用餐单号 LIKE '%" + this.TextBox1.Text + "%')";
MySQL += "AND (dbo.用餐信息.入座台位 LIKE '%" + this.TextBox2.Text + "%')";
MySQL += "AND (dbo.用餐信息.用餐类别 LIKE '%" + My用餐类别 + "%')";
MySQL += "AND (dbo.用餐信息.服务人员 LIKE '%" + My服务人员 + "%')";
MySQL += "AND (dbo.用餐信息.当前状态 LIKE '%" + My当前状态 + "%')";
MySQL += "AND (用餐信息.用餐日期 BETWEEN '" + this.TextBox6.Text + "' AND '" + this.TextBox7.Text + "')";
MySQL += "AND (dbo.用餐信息.用餐金额 BETWEEN " + this.TextBox8.Text + " AND " + this.TextBox9.Text + ") ";
MySQL += "AND (dbo.用餐信息.折扣金额 BETWEEN " + this.TextBox10.Text + " AND " + this.TextBox11.Text + ") ";
MySQL += "AND (dbo.用餐信息.实收金额 BETWEEN " + this.TextBox12.Text + " AND " + this.TextBox13.Text + ") ";
MySQL += "AND (dbo.用餐信息.宾客意见 LIKE '%" + this.TextBox14.Text + "%')";
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyEateryDBConnectionString"].ConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
SqlDataAdapter MyAdatper = new SqlDataAdapter(MySQL, MyConnection);
MyAdatper.Fill(MyTable);
this.GridView1.DataSource = MyTable;
this.GridView1.DataBind();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
protected void Button2_Click(object sender, EventArgs e)
{//打印客人用餐信息
Server.Transfer("~/QueryManage/QueryEatingPrint.aspx");
}
public string MyPrintSQL
{//设置要传递到打印页的数据
get
{
return MySQL;
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{//在GridView控件单元格中设置短日期显示格式
if (e.Row.RowType == DataControlRowType.DataRow)
{
DateTime MyDate = DateTime.Parse(e.Row.Cells[3].Text);
e.Row.Cells[3].Text = MyDate.ToShortDateString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -