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

1//文件名:TraceForm.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_TraceForm : 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("D2") > 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
foreach (String MyString in MyDistData) 36
{ 37
this.DropDownList3.Items.Add(MyString); 38
} 39
MySQL = "Select * From 职员信息"; 40
DataTable MyPersonnelTable = new DataTable(); 41
MyAdapter = new SqlDataAdapter(MySQL, MyConnection); 42
MyAdapter.Fill(MyPersonnelTable); 43
MyName = "职员姓名"; 44
MyValue = MyPersonnelTable.Rows[0][MyName].ToString(); 45
foreach (DataRow MyRow in MyPersonnelTable.Rows) 46
{ 47
this.DropDownList1.Items.Add(MyRow[MyName].ToString()); 48
} 49
if (MyConnection.State == ConnectionState.Open) 50
{ 51
MyConnection.Close(); 52
} 53
} 54
} 55
protected void Button2_Click(object sender, EventArgs e) 56
{//新增经纪跟进信息 57
this.SqlDataSource1.Insert(); 58
} 59
protected void Button3_Click(object sender, EventArgs e) 60
{//修改经纪跟进信息 61
this.SqlDataSource1.Update(); 62
} 63
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) 64
{//弹出删除操作确认对话框 65
if (e.Row.RowType == DataControlRowType.DataRow) 66
{ 67
Button MyButton = (Button)e.Row.FindControl("Button1"); 68
MyButton.OnClientClick = "return confirm('是否确认删除当前选择的记录?')"; 69
} 70
} 71
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 72
{//在控件中显示选择的记录 73
this.TextBox4.Text = this.GridView1.SelectedRow.Cells[2].Text.ToString(); 74
this.DropDownList1.SelectedValue = this.GridView1.SelectedRow.Cells[3].Text.ToString(); 75
this.DropDownList2.SelectedValue = this.GridView1.SelectedRow.Cells[4].Text.ToString(); 76
this.TextBox6.Text = this.GridView1.SelectedRow.Cells[5].Text.ToString(); 77
this.TextBox7.Text = this.GridView1.SelectedRow.Cells[6].Text.ToString(); 78
this.DropDownList3.SelectedValue = this.GridView1.SelectedRow.Cells[7].Text.ToString(); 79
this.TextBox9.Text = this.GridView1.SelectedRow.Cells[8].Text.ToString(); 80
this.TextBox10.Text = this.GridView1.SelectedRow.Cells[9].Text.ToString(); 81
} 82
83
} 84





}
}