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

1//文件名:ContractForm.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_ContractForm : 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("D3") > 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[] MyPayData = MyValue.Split(new char[1] { '、' }); 35
foreach (String MyString in MyPayData) 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 Button4_Click(object sender, EventArgs e) 56
{//显示合同文件 57
string MyPath = HttpContext.Current.Server.MapPath("~/FileData/") + this.TextBox18.Text; 58
System.Diagnostics.Process.Start(MyPath); 59
} 60
protected void btnUpload_Click(object sender, EventArgs e) 61
{//上传合同文件 62
string MyFileName = this.FileUpload1.FileName; 63
string MyTargetFile = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("~/FileData/"), MyFileName); 64
this.FileUpload1.PostedFile.SaveAs(MyTargetFile); 65
} 66
protected void Button2_Click(object sender, EventArgs e) 67
{//新增租售成交信息 68
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString; 69
string MySQL = "Select * From 租售成交 Where (资料类型='" + this.DropDownList2.Text + "') AND (资料编号='" + this.TextBox7.Text + "')"; 70
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString); 71
MyConnection.Open(); 72
DataTable MyQueryTable = new DataTable(); 73
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection); 74
MyAdapter.Fill(MyQueryTable); 75
if (MyQueryTable.Rows.Count > 0) 76
return; 77
if (MyConnection.State == ConnectionState.Open) 78
{ 79
MyConnection.Close(); 80
} 81
this.SqlDataSource1.Insert(); 82
} 83
protected void Button3_Click(object sender, EventArgs e) 84
{//修改租售成交信息 85
this.SqlDataSource1.Update(); 86
} 87
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) 88
{//弹出删除操作确认对话框 89
if (e.Row.RowType == DataControlRowType.DataRow) 90
{ 91
Button MyButton = (Button)e.Row.FindControl("Button1"); 92
MyButton.OnClientClick = "return confirm('是否确认删除当前选择的记录?')"; 93
} 94
} 95
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 96
{//在控件中显示选择的记录 97
this.TextBox20.Text = this.GridView1.SelectedRow.Cells[2].Text.ToString(); 98
this.DropDownList1.SelectedValue = this.GridView1.SelectedRow.Cells[3].Text.ToString(); 99
this.DropDownList2.SelectedValue = this.GridView1.SelectedRow.Cells[4].Text.ToString(); 100
this.TextBox7.Text = this.GridView1.SelectedRow.Cells[5].Text.ToString(); 101
this.TextBox8.Text = this.GridView1.SelectedRow.Cells[6].Text.ToString(); 102
this.TextBox9.Text = this.GridView1.SelectedRow.Cells[7].Text.ToString(); 103
this.TextBox10.Text = this.GridView1.SelectedRow.Cells[8].Text.ToString(); 104
this.DropDownList3.SelectedValue = this.GridView1.SelectedRow.Cells[9].Text.ToString(); 105
this.TextBox12.Text = this.GridView1.SelectedRow.Cells[10].Text.ToString(); 106
this.TextBox13.Text = this.GridView1.SelectedRow.Cells[11].Text.ToString(); 107
this.TextBox14.Text = this.GridView1.SelectedRow.Cells[12].Text.ToString(); 108
this.TextBox15.Text = this.GridView1.SelectedRow.Cells[13].Text.ToString(); 109
this.TextBox16.Text = this.GridView1.SelectedRow.Cells[14].Text.ToString(); 110
this.TextBox17.Text = this.GridView1.SelectedRow.Cells[15].Text.ToString(); 111
this.TextBox18.Text = this.GridView1.SelectedRow.Cells[16].Text.ToString(); 112
this.TextBox19.Text = this.GridView1.SelectedRow.Cells[17].Text.ToString(); 113
} 114
} 115





}
}