?? 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 + -