reportownerform.aspx.cs

来自「小区物业管理系统源代码,密码:123456,」· CS 代码 · 共 78 行

CS
78
字号
//文件名:ReportOwnerForm.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 ReportManage_ReportOwnerForm : 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 * FROM 业主信息 WHERE (业主编号 NOT IN (Select 业主编号 FROM 迁出信息)) ";
        if (this.DropDownList1.SelectedValue == "全部")
            MySQL += "";
        else
            MySQL += " AND (楼栋名称='" + this.DropDownList1.SelectedValue + "')";
        MySQL += " AND (单元名称 LIKE '%" + this.TextBox1.Text + "%')";
        if (this.DropDownList2.SelectedValue == "全部")
            MySQL += "";
        else
            MySQL += " AND (房屋性质='" + this.DropDownList2.SelectedValue + "')";
        MySQL += " AND (房屋类型 LIKE '%" + this.TextBox2.Text + "%')";
        MySQL += " AND (常住人员 LIKE '%" + this.TextBox3.Text + "%')";
        if (this.DropDownList3.SelectedValue == "全部")
            MySQL += "";
        else
            MySQL += " AND (当前状态='" + this.DropDownList3.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();  
    }
    public DataTable MyQueryTable
    {//设置要传递到打印页的数据
        get
        {
            return MyTable;
        }
    }
    public String MyPrintDate
    {//设置要传递到打印页的数据
        get
        {
            return "打印日期:" + DateTime.Now.ToShortDateString() + " 查询条件:楼栋名称[" + this.DropDownList1.SelectedValue + "],单元名称[" +this.TextBox1.Text  + "],房屋性质[" + this.DropDownList2.SelectedValue + "],房屋类型[" + this.TextBox2.Text  + "],常住人员[" +this.TextBox3.Text  + "],当前状态["+this.DropDownList3.SelectedValue+"]";
        }
    }
    public String MyPrintTitle
    {//设置要传递到打印页的数据
        get
        {
            return Session["MyCommunityName"].ToString() + "业主信息表";
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {//打印小区业主信息
        Server.Transfer("~/ReportManage/ReportOwnerPrint.aspx");
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?