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

1//文件名:ParameterForm.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
//do u know 51aspx? 13
using System.Data.SqlClient; 14
public partial class CompanyManage_ParameterForm : 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("A1") > 1) 20
{ 21
Server.Transfer("~/SystemManage/AllErrorHelp.aspx"); 22
} 23
this.Button1.OnClientClick = "return confirm('请检查房源参数值是否正确并符合规范,否则保存后发生意外的结果!是否继续?')"; 24
this.Button2.OnClientClick = "return confirm('请检查其他参数值是否正确并符合规范,否则保存后发生意外的结果!是否继续?')"; 25
} 26
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 27
{//显示房源参数值 28
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString; 29
string MySQL = "Select * From 房源参数 Where 自编号='CQ001'"; 30
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString); 31
MyConnection.Open(); 32
DataTable MyHouseTable = new DataTable(); 33
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection); 34
MyAdapter.Fill(MyHouseTable); 35
string MyName = this.DropDownList1.SelectedValue.ToString(); 36
string MyValue = MyHouseTable.Rows[0][MyName].ToString(); 37
String[] MyData = MyValue.Split(new char[1] { '、' }); 38
this.TextBox1.Text = ""; 39
foreach (string MyLine in MyData) 40
{ 41
if (MyLine.Length > 0) 42
{ 43
this.TextBox1.Text += MyLine + "、"; 44
} 45
} 46
if (MyConnection.State == ConnectionState.Open) 47
{ 48
MyConnection.Close(); 49
} 50
} 51
protected void Button1_Click(object sender, EventArgs e) 52
{//新增房源参数值 53
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString; 54
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString); 55
MyConnection.Open(); 56
string MyName = this.DropDownList1.SelectedValue.ToString(); 57
string MyValue = this.TextBox1.Text; 58
string MySQL = "Update 房源参数 Set " + MyName + "='" + MyValue + "' Where 自编号='CQ001'"; 59
SqlCommand MyCommand = new SqlCommand(MySQL, MyConnection); 60
MyCommand.ExecuteNonQuery(); 61
if (MyConnection.State == ConnectionState.Open) 62
{ 63
MyConnection.Close(); 64
} 65
} 66
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) 67
{//显示其他参数值 68
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString; 69
string MySQL = "Select * From 其他参数 Where 自编号='CQ001'"; 70
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString); 71
MyConnection.Open(); 72
DataTable MyHouseTable = new DataTable(); 73
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection); 74
MyAdapter.Fill(MyHouseTable); 75
string MyName = this.DropDownList2.SelectedValue.ToString(); 76
string MyValue = MyHouseTable.Rows[0][MyName].ToString(); 77
String[] MyData = MyValue.Split(new char[1] { '、' }); 78
this.TextBox2.Text = ""; 79
foreach (string MyLine in MyData) 80
{ 81
if (MyLine.Length > 0) 82
{ 83
this.TextBox2.Text += MyLine + "、"; 84
} 85
} 86
if (MyConnection.State == ConnectionState.Open) 87
{ 88
MyConnection.Close(); 89
} 90
} 91
protected void Button2_Click(object sender, EventArgs e) 92
{//新增其他参数值 93
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString; 94
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString); 95
MyConnection.Open(); 96
string MyName = this.DropDownList2.SelectedValue.ToString(); 97
string MyValue = this.TextBox2.Text; 98
string MySQL = "Update 其他参数 Set " + MyName + "='" + MyValue + "' Where 自编号='CQ001'"; 99
SqlCommand MyCommand = new SqlCommand(MySQL, MyConnection); 100
MyCommand.ExecuteNonQuery(); 101
if (MyConnection.State == ConnectionState.Open) 102
{ 103
MyConnection.Close(); 104
} 105
} 106
} 107





}
}