📄 gasqueryform.aspx.cs
字号:
//文件名:GasQueryForm.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 ChargeManage_GasQueryForm : 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("C2") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{//查询水电气费信息
MyTable.Rows.Clear();
string MySQL = "Select * FROM 水电气费 WHERE (登记标志='完成登记') AND (计费年份= "+this.DropDownList1.SelectedValue+")";
if(this.DropDownList2.SelectedValue=="全年")
MySQL += "";
else
MySQL += " AND (计费月份=" + this.DropDownList2.SelectedValue+")";
if (this.DropDownList3.SelectedValue == "全部")
MySQL += "";
else
MySQL += " AND (费用类型='" + this.DropDownList3.SelectedValue + "')";
if (this.DropDownList4.SelectedValue == "全部")
MySQL += "";
else
MySQL += " AND (楼栋名称='" + this.DropDownList4.SelectedValue + "')";
if (this.DropDownList5.SelectedValue == "全部")
MySQL += "";
else
MySQL += " AND (业主编号='" + this.DropDownList5.SelectedValue + "')";
if (this.DropDownList6.SelectedValue == "全部")
MySQL += "";
else
MySQL += " AND (费用状态='" + this.DropDownList6.SelectedValue + "')";
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyCommunityDBConnectionString"].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 Button2_Click(object sender, EventArgs e)
{//打印水电气费信息
Server.Transfer("~/ChargeManage/GasQueryPrint.aspx");
}
public DataTable MyQueryTable
{//设置要传递到打印页的数据
get
{
return MyTable;
}
}
public String MyPrintDate
{//设置要传递到打印页的数据
get
{
return "打印日期:" +DateTime.Now.ToShortDateString()+" 查询条件:计费年份["+this.DropDownList1.SelectedValue+"],计费月份["+this.DropDownList2.SelectedValue+"],费用类型["+this.DropDownList3.SelectedValue+"],楼栋名称["+this.DropDownList4.SelectedValue+"],业主姓名["+this.DropDownList5.SelectedItem.Text+"],费用状态["+this.DropDownList6.SelectedValue+"]";
}
}
public String MyPrintTitle
{//设置要传递到打印页的数据
get
{
return Session["MyCommunityName"].ToString() + "业主水电气费查询结果表";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -