您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->Asp.net房产中介管理系统源码及常用文档>>HouseManage/HouseLeaseForm.aspx.cs>>代码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:Asp.net房产中介管理系统源码及常用文档


当前文件路径:HouseManage/HouseManage/HouseLeaseForm.aspx.cs 文件类型
普通视图
		            
1//文件名:HouseLeaseForm.aspx.cs 2using System; 3using System.Data; 4using System.Configuration; 5using System.Collections; 6using System.Web; 7using System.Web.Security; 8using System.Web.UI; 9using System.Web.UI.WebControls; 10using System.Web.UI.WebControls.WebParts; 11using System.Web.UI.HtmlControls; 12 13using System.Data.SqlClient; 14public partial class HouseManage_HouseLeaseForm : 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("B2") > 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.DropDownList1.Items.Add(MyString); 39 } 40 MyName = "类型"; 41 MyValue = MyHouseTable.Rows[0][MyName].ToString(); 42 String[] MyTypeData = MyValue.Split(new char[1] { '' }); 43 foreach (String MyString in MyTypeData) 44 { 45 this.DropDownList3.Items.Add(MyString); 46 } 47 MyName = "朝向"; 48 MyValue = MyHouseTable.Rows[0][MyName].ToString(); 49 String[] MyDireData = MyValue.Split(new char[1] { '' }); 50 foreach (String MyString in MyDireData) 51 { 52 this.DropDownList2.Items.Add(MyString); 53 } 54 55 MyName = "结构"; 56 MyValue = MyHouseTable.Rows[0][MyName].ToString(); 57 String[] MyStruData = MyValue.Split(new char[1] { '' }); 58 foreach (String MyString in MyStruData) 59 { 60 this.DropDownList4.Items.Add(MyString); 61 } 62 MyName = "装修"; 63 MyValue = MyHouseTable.Rows[0][MyName].ToString(); 64 String[] MyDecoData = MyValue.Split(new char[1] { '' }); 65 foreach (String MyString in MyDecoData) 66 { 67 this.DropDownList5.Items.Add(MyString); 68 } 69 MyName = "付佣"; 70 MyValue = MyHouseTable.Rows[0][MyName].ToString(); 71 String[] MyFeeData = MyValue.Split(new char[1] { '' }); 72 foreach (String MyString in MyFeeData) 73 { 74 this.DropDownList7.Items.Add(MyString); 75 } 76 MyName = "委托"; 77 MyValue = MyHouseTable.Rows[0][MyName].ToString(); 78 String[] MyDeleData = MyValue.Split(new char[1] { '' }); 79 foreach (String MyString in MyDeleData) 80 { 81 this.DropDownList8.Items.Add(MyString); 82 } 83 MyName = "来源"; 84 MyValue = MyHouseTable.Rows[0][MyName].ToString(); 85 String[] MySourceData = MyValue.Split(new char[1] { '' }); 86 foreach (String MyString in MySourceData) 87 { 88 this.DropDownList9.Items.Add(MyString); 89 } 90 MyName = "状态"; 91 MyValue = MyHouseTable.Rows[0][MyName].ToString(); 92 String[] MyStatusData = MyValue.Split(new char[1] { '' }); 93 foreach (String MyString in MyStatusData) 94 { 95 this.DropDownList11.Items.Add(MyString); 96 } 97 MySQL = "Select * From 职员信息"; 98 DataTable MyPersonnelTable = new DataTable(); 99 MyAdapter = new SqlDataAdapter(MySQL, MyConnection); 100 MyAdapter.Fill(MyPersonnelTable); 101 MyName = "职员姓名"; 102 MyValue = MyPersonnelTable.Rows[0][MyName].ToString(); 103 foreach (DataRow MyRow in MyPersonnelTable.Rows) 104 { 105 this.DropDownList10.Items.Add(MyRow[MyName].ToString()); 106 } 107 if (MyConnection.State == ConnectionState.Open) 108 { 109 MyConnection.Close(); 110 } 111 } 112 } 113 114 protected void Button2_Click(object sender, EventArgs e) 115 {//新增出租房源信息 116 this.SqlDataSource1.Insert(); 117 } 118 protected void Button3_Click(object sender, EventArgs e) 119 {//修改出租房源信息 120 this.SqlDataSource1.Update(); 121 } 122 protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) 123 {//弹出删除操作确认对话框 124 if (e.Row.RowType == DataControlRowType.DataRow) 125 { 126 Button MyButton = (Button)e.Row.FindControl("Button1"); 127 MyButton.OnClientClick = "return confirm('是否确认删除当前选择的记录?')"; 128 } 129 } 130 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 131 {//在控件中显示选择的记录 132 this.TextBox2.Text = this.GridView1.SelectedRow.Cells[2].Text.ToString(); 133 this.DropDownList1.SelectedValue = this.GridView1.SelectedRow.Cells[3].Text.ToString(); 134 this.TextBox4.Text = this.GridView1.SelectedRow.Cells[4].Text.ToString(); 135 this.TextBox5.Text = this.GridView1.SelectedRow.Cells[5].Text.ToString(); 136 this.TextBox6.Text = this.GridView1.SelectedRow.Cells[6].Text.ToString(); 137 this.CheckBox1.Checked = (Convert.ToInt16(this.GridView1.SelectedRow.Cells[7].Text.ToString()) == 1) ? true : false; 138 this.TextBox8.Text = this.GridView1.SelectedRow.Cells[8].Text.ToString(); 139 this.TextBox9.Text = this.GridView1.SelectedRow.Cells[9].Text.ToString(); 140 this.TextBox10.Text = this.GridView1.SelectedRow.Cells[10].Text.ToString(); 141 this.TextBox11.Text = this.GridView1.SelectedRow.Cells[11].Text.ToString(); 142 this.TextBox12.Text = this.GridView1.SelectedRow.Cells[12].Text.ToString(); 143 this.DropDownList2.SelectedValue = this.GridView1.SelectedRow.Cells[13].Text.ToString(); 144 this.TextBox14.Text = this.GridView1.SelectedRow.Cells[14].Text.ToString(); 145 this.DropDownList3.SelectedValue = this.GridView1.SelectedRow.Cells[15].Text.ToString(); 146 this.DropDownList4.SelectedValue = this.GridView1.SelectedRow.Cells[16].Text.ToString(); 147 this.TextBox17.Text = this.GridView1.SelectedRow.Cells[17].Text.ToString(); 148 this.TextBox18.Text = this.GridView1.SelectedRow.Cells[18].Text.ToString(); 149 this.DropDownList5.SelectedValue = this.GridView1.SelectedRow.Cells[19].Text.ToString(); 150 this.TextBox20.Text = this.GridView1.SelectedRow.Cells[20].Text.ToString(); 151 this.DropDownList6.SelectedValue = this.GridView1.SelectedRow.Cells[21].Text.ToString(); 152 this.TextBox22.Text = this.GridView1.SelectedRow.Cells[22].Text.ToString(); 153 this.TextBox23.Text = this.GridView1.SelectedRow.Cells[23].Text.ToString(); 154 this.TextBox24.Text = this.GridView1.SelectedRow.Cells[24].Text.ToString(); 155 this.TextBox25.Text = this.GridView1.SelectedRow.Cells[25].Text.ToString(); 156 this.TextBox26.Text = this.GridView1.SelectedRow.Cells[26].Text.ToString(); 157 this.TextBox27.Text = this.GridView1.SelectedRow.Cells[27].Text.ToString(); 158 this.TextBox28.Text = this.GridView1.SelectedRow.Cells[28].Text.ToString(); 159 this.TextBox29.Text = this.GridView1.SelectedRow.Cells[29].Text.ToString(); 160 this.TextBox30.Text = this.GridView1.SelectedRow.Cells[30].Text.ToString(); 161 this.DropDownList7.SelectedValue = this.GridView1.SelectedRow.Cells[31].Text.ToString(); 162 this.TextBox32.Text = this.GridView1.SelectedRow.Cells[32].Text.ToString(); 163 this.TextBox33.Text = this.GridView1.SelectedRow.Cells[33].Text.ToString(); 164 this.TextBox34.Text = this.GridView1.SelectedRow.Cells[34].Text.ToString(); 165 this.TextBox35.Text = this.GridView1.SelectedRow.Cells[35].Text.ToString(); 166 this.DropDownList8.SelectedValue = this.GridView1.SelectedRow.Cells[36].Text.ToString(); 167 this.TextBox37.Text = this.GridView1.SelectedRow.Cells[37].Text.ToString(); 168 this.TextBox38.Text = this.GridView1.SelectedRow.Cells[38].Text.ToString(); 169 this.DropDownList9.SelectedValue = this.GridView1.SelectedRow.Cells[39].Text.ToString(); 170 this.CheckBox2.Checked = (Convert.ToInt16(this.GridView1.SelectedRow.Cells[40].Text.ToString()) == 1) ? true : false; 171 this.CheckBox3.Checked = (Convert.ToInt16(this.GridView1.SelectedRow.Cells[41].Text.ToString()) == 1) ? true : false; 172 this.CheckBox4.Checked = (Convert.ToInt16(this.GridView1.SelectedRow.Cells[42].Text.ToString()) == 1) ? true : false; 173 this.TextBox43.Text = this.GridView1.SelectedRow.Cells[43].Text.ToString(); 174 this.DropDownList10.SelectedValue = this.GridView1.SelectedRow.Cells[44].Text.ToString(); 175 this.DropDownList11.SelectedValue = this.GridView1.SelectedRow.Cells[45].Text.ToString(); 176 this.TextBox46.Text = this.GridView1.SelectedRow.Cells[46].Text.ToString(); 177 } 178 protected void Button4_Click(object sender, EventArgs e) 179 {//打印出租房源信息 180 Server.Transfer("~/HouseManage/HouseLeasePrint.aspx"); 181 } 182 public string MyPrint房屋位置 183 {//设置要传递到打印页的数据 184 get 185 { 186 return "房屋位置:" + this.DropDownList1.SelectedValue + this.TextBox4.Text+" 楼盘名称:"+this.TextBox5.Text; 187 } 188 } 189 public string MyPrint付租情况 190 {//设置要传递到打印页的数据 191 get 192 { 193 return "付租方式:" + this.DropDownList6.SelectedValue + "      出租价格:" +this.TextBox22.Text+""; 194 } 195 } 196 public string MyPrint建筑面积 197 {//设置要传递到打印页的数据 198 get 199 { 200 return "建面(m2):" + this.TextBox17.Text + "  套面(m2):" + this.TextBox18.Text + "  装修:" +this.DropDownList5.SelectedValue; 201 } 202 } 203 public string MyPrint房型物管费 204 {//设置要传递到打印页的数据 205 get 206 { 207 return "房型:" + this.TextBox8.Text + "" + this.TextBox9.Text + "" + this.TextBox10.Text + "" + this.TextBox11.Text + "" + this.TextBox12.Text + "阳台" + " 物管费:" + this.TextBox14.Text+"元/年"; 208 } 209 } 210 public string MyPrint家电家私 211 {//设置要传递到打印页的数据 212 get 213 { 214 return "家私:" + this.TextBox24.Text + " 家电:" + this.TextBox25.Text; 215 } 216 } 217 public string MyPrint配套设施 218 {//设置要传递到打印页的数据 219 get 220 { 221 return "配套设施:" + this.TextBox26.Text; 222 } 223 } 224 public string MyPrint房源编号 225