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

1//文件名:ClientBuyForm.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
//该源码下载自www.51aspx.com(51aspx.com) 13
14
using System.Data.SqlClient; 15
public partial class ClientManage_ClientBuyForm : System.Web.UI.Page 16
{ 17
protected void Page_Load(object sender, EventArgs e) 18
{ 19
string MyForbidString = Session["MyForbid"].ToString(); 20
if (MyForbidString.IndexOf("C1") > 1) 21
{ 22
Server.Transfer("~/SystemManage/AllErrorHelp.aspx"); 23
} 24
if (!IsPostBack) 25
{ 26
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString; 27
string MySQL = "Select * From 房源参数 Where 自编号='CQ001'"; 28
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString); 29
MyConnection.Open(); 30
DataTable MyHouseTable = new DataTable(); 31
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection); 32
MyAdapter.Fill(MyHouseTable); 33
string MyName = "城区"; 34
string MyValue = MyHouseTable.Rows[0][MyName].ToString(); 35
String[] MyDistData = MyValue.Split(new char[1] { '、' }); 36
//设置所在城区列表项 37
foreach (String MyString in MyDistData) 38
{ 39
this.DropDownList4.Items.Add(MyString); 40
} 41
MyName = "类型"; 42
MyValue = MyHouseTable.Rows[0][MyName].ToString(); 43
String[] MyTypeData = MyValue.Split(new char[1] { '、' }); 44
foreach (String MyString in MyTypeData) 45
{ 46
this.DropDownList2.Items.Add(MyString); 47
} 48
MyName = "朝向"; 49
MyValue = MyHouseTable.Rows[0][MyName].ToString(); 50
String[] MyDireData = MyValue.Split(new char[1] { '、' }); 51
foreach (String MyString in MyDireData) 52
{ 53
this.DropDownList5.Items.Add(MyString); 54
} 55
56
MyName = "产权"; 57
MyValue = MyHouseTable.Rows[0][MyName].ToString(); 58
String[] MyPreData = MyValue.Split(new char[1] { '、' }); 59
foreach (String MyString in MyPreData) 60
{ 61
this.DropDownList7.Items.Add(MyString); 62
} 63
MyName = "结构"; 64
MyValue = MyHouseTable.Rows[0][MyName].ToString(); 65
String[] MyStruData = MyValue.Split(new char[1] { '、' }); 66
foreach (String MyString in MyStruData) 67
{ 68
this.DropDownList3.Items.Add(MyString); 69
} 70
MyName = "装修"; 71
MyValue = MyHouseTable.Rows[0][MyName].ToString(); 72
String[] MyDecoData = MyValue.Split(new char[1] { '、' }); 73
foreach (String MyString in MyDecoData) 74
{ 75
this.DropDownList6.Items.Add(MyString); 76
} 77
MyName = "付佣"; 78
MyValue = MyHouseTable.Rows[0][MyName].ToString(); 79
String[] MyFeeData = MyValue.Split(new char[1] { '、' }); 80
foreach (String MyString in MyFeeData) 81
{ 82
this.DropDownList8.Items.Add(MyString); 83
} 84
MyName = "状态"; 85
MyValue = MyHouseTable.Rows[0][MyName].ToString(); 86
String[] MyStatusData = MyValue.Split(new char[1] { '、' }); 87
foreach (String MyString in MyStatusData) 88
{ 89
this.DropDownList10.Items.Add(MyString); 90
} 91
MySQL = "Select * From 职员信息"; 92
DataTable MyPersonnelTable = new DataTable(); 93
MyAdapter = new SqlDataAdapter(MySQL, MyConnection); 94
MyAdapter.Fill(MyPersonnelTable); 95
MyName = "职员姓名"; 96
MyValue = MyPersonnelTable.Rows[0][MyName].ToString(); 97
foreach (DataRow MyRow in MyPersonnelTable.Rows) 98
{ 99
this.DropDownList9.Items.Add(MyRow[MyName].ToString()); 100
} 101
if (MyConnection.State == ConnectionState.Open) 102
{ 103
MyConnection.Close(); 104
} 105
} 106
} 107
protected void Button2_Click(object sender, EventArgs e) 108
{//新增求购客源信息 109
this.SqlDataSource1.Insert(); 110
} 111
protected void Button3_Click(object sender, EventArgs e) 112
{//修改求购客源信息 113
this.SqlDataSource1.Update(); 114
} 115
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) 116
{//弹出删除操作确认对话框 117
if (e.Row.RowType == DataControlRowType.DataRow) 118
{ 119
Button MyButton = (Button)e.Row.FindControl("Button1"); 120
MyButton.OnClientClick = "return confirm('是否确认删除当前选择的记录?')"; 121
} 122
} 123
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 124
{//在控件中显示选择的记录 125
this.TextBox2.Text = this.GridView1.SelectedRow.Cells[2].Text.ToString(); 126
this.TextBox3.Text = this.GridView1.SelectedRow.Cells[3].Text.ToString(); 127
this.DropDownList1.SelectedValue = this.GridView1.SelectedRow.Cells[4].Text.ToString(); 128
this.TextBox5.Text = this.GridView1.SelectedRow.Cells[5].Text.ToString(); 129
this.TextBox6.Text = this.GridView1.SelectedRow.Cells[6].Text.ToString(); 130
this.TextBox7.Text = this.GridView1.SelectedRow.Cells[7].Text.ToString(); 131
this.TextBox8.Text = this.GridView1.SelectedRow.Cells[8].Text.ToString(); 132
this.DropDownList2.SelectedValue = this.GridView1.SelectedRow.Cells[9].Text.ToString(); 133
this.DropDownList3.SelectedValue = this.GridView1.SelectedRow.Cells[10].Text.ToString(); 134
this.DropDownList4.SelectedValue = this.GridView1.SelectedRow.Cells[11].Text.ToString(); 135
this.TextBox12.Text = this.GridView1.SelectedRow.Cells[12].Text.ToString(); 136
this.DropDownList5.SelectedValue = this.GridView1.SelectedRow.Cells[13].Text.ToString(); 137
this.TextBox14.Text = this.GridView1.SelectedRow.Cells[14].Text.ToString(); 138
this.TextBox15.Text = this.GridView1.SelectedRow.Cells[15].Text.ToString(); 139
this.DropDownList6.SelectedValue = this.GridView1.SelectedRow.Cells[16].Text.ToString(); 140
this.DropDownList7.SelectedValue = this.GridView1.SelectedRow.Cells[17].Text.ToString(); 141
this.TextBox18.Text = this.GridView1.SelectedRow.Cells[18].Text.ToString(); 142
this.TextBox19.Text = this.GridView1.SelectedRow.Cells[19].Text.ToString(); 143
this.TextBox20.Text = this.GridView1.SelectedRow.Cells[20].Text.ToString(); 144
this.TextBox21.Text = this.GridView1.SelectedRow.Cells[21].Text.ToString(); 145
this.TextBox22.Text = this.GridView1.SelectedRow.Cells[22].Text.ToString(); 146
this.TextBox23.Text = this.GridView1.SelectedRow.Cells[23].Text.ToString(); 147
this.TextBox24.Text = this.GridView1.SelectedRow.Cells[24].Text.ToString(); 148
this.TextBox25.Text = this.GridView1.SelectedRow.Cells[25].Text.ToString(); 149
this.DropDownList8.SelectedValue = this.GridView1.SelectedRow.Cells[26].Text.ToString(); 150
this.TextBox4.Text = this.GridView1.SelectedRow.Cells[27].Text.ToString(); 151
this.DropDownList9.SelectedValue = this.GridView1.SelectedRow.Cells[28].Text.ToString(); 152
this.CheckBox1.Checked = (Convert.ToInt16(this.GridView1.SelectedRow.Cells[29].Text.ToString()) == 1) ? true : false; 153
this.CheckBox2.Checked = (Convert.ToInt16(this.GridView1.SelectedRow.Cells[30].Text.ToString()) == 1) ? true : false; 154
this.DropDownList10.SelectedValue = this.GridView1.SelectedRow.Cells[31].Text.ToString(); 155
this.TextBox9.Text = this.GridView1.SelectedRow.Cells[32].Text.ToString(); 156
} 157
} 158





}
}