温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:Asp.net房产中介管理系统源码及常用文档
当前文件路径:HouseManage/ContractManage/QuerySaleForm.aspx.cs

1//文件名:QuerySaleForm.aspx.cs 2
using System; 3
using System.Data; 4
using System.Configuration; 5
using System.Collections; 6
using System.Web; 7
using System.Web.Security; 8
using System.Web.UI; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.WebControls.WebParts; 11
using System.Web.UI.HtmlControls; 12
13
using System.Data.SqlClient; 14
public partial class ContractManage_QuerySaleForm : System.Web.UI.Page 15
{ 16
private static string MySQL = ""; 17
protected void Page_Load(object sender, EventArgs e) 18
{ 19
string MyForbidString = Session["MyForbid"].ToString(); 20
if (MyForbidString.IndexOf("D4") > 1) 21
{ 22
Server.Transfer("~/SystemManage/AllErrorHelp.aspx"); 23
} 24
if (!IsPostBack) 25
{ 26
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString; 27
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString); 28
MyConnection.Open(); 29
string MySQL = "Select * From 职员信息"; 30
DataTable MyPersonnelTable = new DataTable(); 31
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection); 32
MyAdapter.Fill(MyPersonnelTable); 33
string MyName = "职员姓名"; 34
string MyValue = MyPersonnelTable.Rows[0][MyName].ToString(); 35
foreach (DataRow MyRow in MyPersonnelTable.Rows) 36
{ 37
this.DropDownList1.Items.Add(MyRow[MyName].ToString()); 38
} 39
if (MyConnection.State == ConnectionState.Open) 40
{ 41
MyConnection.Close(); 42
} 43
} 44
} 45
protected void Button1_Click(object sender, EventArgs e) 46
{//查询售房信息 47
DataTable MyQueryTable = new System.Data.DataTable(); 48
SqlConnection MyConnection = new SqlConnection(); 49
MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString; 50
MyConnection.Open(); 51
MySQL = "SELECT * FROM 租售成交 WHERE ((资料类型='出售房源') OR (资料类型='求购客源')) AND ( 成交日期 BETWEEN '" + 52
this.TextBox1.Text + "' AND '" + this.TextBox2.Text + "') AND (合同编号 LIKE '%" + this.TextBox3.Text + 53
"%') AND (资料编号 LIKE '%" + this.TextBox4.Text + "%') AND (经办人员='" + this.DropDownList1.SelectedValue.ToString() + "')"; 54
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection); 55
MyAdapter.Fill(MyQueryTable); 56
this.GridView1.DataSource = MyQueryTable; 57
this.GridView1.DataBind(); 58
if (MyConnection.State == ConnectionState.Open) 59
{ 60
MyConnection.Close(); 61
} 62
} 63
public string MyPrintSQL 64
{//设置要传递到打印页的数据 65
get 66
{ 67
return MySQL; 68
} 69
} 70
public String MyPrintDate 71
{//设置要传递到打印页的数据 72
get 73
{ 74
return "当前日期:" + DateTime.Now.ToShortDateString() + " 经办人员:" + this.DropDownList1.SelectedValue.ToString(); 75
} 76
} 77
protected void Button2_Click(object sender, EventArgs e) 78
{//打印售房信息 79
Server.Transfer("~/ContractManage/QuerySalePrint.aspx"); 80
} 81
} 82





}
}