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

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





}
}