📄 housesaleform.aspx.cs
字号:
//文件名:HouseSaleForm.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class HouseManage_HouseSaleForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("B1") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
if (!IsPostBack)
{
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString;
string MySQL = "Select * From 房源参数 Where 自编号='CQ001'";
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
DataTable MyHouseTable = new DataTable();
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
MyAdapter.Fill(MyHouseTable);
string MyName = "城区";
string MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyDistData = MyValue.Split(new char[1] { '、' });
//设置所在城区列表项
foreach (String MyString in MyDistData)
{
this.DropDownList1.Items.Add(MyString);
}
MyName = "类型";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyTypeData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyTypeData)
{
this.DropDownList3.Items.Add(MyString);
}
MyName = "朝向";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyDireData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyDireData)
{
this.DropDownList2.Items.Add(MyString);
}
MyName = "用途";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyUseData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyUseData)
{
this.DropDownList6.Items.Add(MyString);
}
MyName = "土地";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyFieldData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyFieldData)
{
this.DropDownList4.Items.Add(MyString);
}
MyName = "产权";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyPreData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyPreData)
{
this.DropDownList5.Items.Add(MyString);
}
MyName = "结构";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyStruData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyStruData)
{
this.DropDownList7.Items.Add(MyString);
}
MyName = "装修";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyDecoData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyDecoData)
{
this.DropDownList8.Items.Add(MyString);
}
MyName = "证件";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyCertData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyCertData)
{
this.DropDownList9.Items.Add(MyString);
}
MyName = "付款";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyPayData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyPayData)
{
this.DropDownList10.Items.Add(MyString);
}
MyName = "货币";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyMoneyData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyMoneyData)
{
this.DropDownList11.Items.Add(MyString);
}
MyName = "付佣";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyFeeData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyFeeData)
{
this.DropDownList12.Items.Add(MyString);
}
MyName = "委托";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyDeleData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyDeleData)
{
this.DropDownList13.Items.Add(MyString);
}
MyName = "来源";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MySourceData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MySourceData)
{
this.DropDownList14.Items.Add(MyString);
}
MyName = "状态";
MyValue = MyHouseTable.Rows[0][MyName].ToString();
String[] MyStatusData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyStatusData)
{
this.DropDownList16.Items.Add(MyString);
}
MySQL = "Select * From 职员信息";
DataTable MyPersonnelTable = new DataTable();
MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
MyAdapter.Fill(MyPersonnelTable);
MyName = "职员姓名";
MyValue = MyPersonnelTable.Rows[0][MyName].ToString();
foreach (DataRow MyRow in MyPersonnelTable.Rows)
{
this.DropDownList15.Items.Add(MyRow[MyName].ToString());
}
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
}
protected void Button2_Click(object sender, EventArgs e)
{//新增出售房源信息
this.SqlDataSource1.Insert();
}
protected void Button3_Click(object sender, EventArgs e)
{//修改出售房源信息
this.SqlDataSource1.Update();
}
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{//弹出删除操作确认对话框
if (e.Row.RowType == DataControlRowType.DataRow)
{
Button MyButton = (Button)e.Row.FindControl("Button1");
MyButton.OnClientClick = "return confirm('是否确认删除当前选择的记录?')";
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{//在控件中显示选择的记录
this.TextBox2.Text = this.GridView1.SelectedRow.Cells[2].Text.ToString();
this.DropDownList1.SelectedValue= this.GridView1.SelectedRow.Cells[3].Text.ToString();
this.TextBox4.Text = this.GridView1.SelectedRow.Cells[4].Text.ToString();
this.TextBox5.Text = this.GridView1.SelectedRow.Cells[5].Text.ToString();
this.TextBox6.Text = this.GridView1.SelectedRow.Cells[6].Text.ToString();
this.TextBox7.Text = this.GridView1.SelectedRow.Cells[7].Text.ToString();
this.TextBox8.Text = this.GridView1.SelectedRow.Cells[8].Text.ToString();
this.TextBox9.Text = this.GridView1.SelectedRow.Cells[9].Text.ToString();
this.TextBox10.Text = this.GridView1.SelectedRow.Cells[10].Text.ToString();
this.TextBox11.Text = this.GridView1.SelectedRow.Cells[11].Text.ToString();
this.CheckBox1.Checked = (Convert.ToInt16(this.GridView1.SelectedRow.Cells[12].Text.ToString()) == 1) ? true : false;
this.TextBox13.Text = this.GridView1.SelectedRow.Cells[13].Text.ToString();
this.TextBox14.Text = this.GridView1.SelectedRow.Cells[14].Text.ToString();
this.TextBox15.Text = this.GridView1.SelectedRow.Cells[15].Text.ToString();
this.TextBox16.Text = this.GridView1.SelectedRow.Cells[16].Text.ToString();
this.TextBox17.Text = this.GridView1.SelectedRow.Cells[17].Text.ToString();
this.DropDownList2.SelectedValue= this.GridView1.SelectedRow.Cells[18].Text.ToString();
this.TextBox19.Text = this.GridView1.SelectedRow.Cells[19].Text.ToString();
this.DropDownList3.SelectedValue= this.GridView1.SelectedRow.Cells[20].Text.ToString();
this.TextBox21.Text = this.GridView1.SelectedRow.Cells[21].Text.ToString();
this.DropDownList4.SelectedValue= this.GridView1.SelectedRow.Cells[22].Text.ToString();
this.DropDownList5.SelectedValue= this.GridView1.SelectedRow.Cells[23].Text.ToString();
this.DropDownList6.SelectedValue= this.GridView1.SelectedRow.Cells[24].Text.ToString();
this.DropDownList7.SelectedValue= this.GridView1.SelectedRow.Cells[25].Text.ToString();
this.TextBox26.Text = this.GridView1.SelectedRow.Cells[26].Text.ToString();
this.TextBox27.Text = this.GridView1.SelectedRow.Cells[27].Text.ToString();
this.DropDownList8.SelectedValue= this.GridView1.SelectedRow.Cells[28].Text.ToString();
this.TextBox29.Text = this.GridView1.SelectedRow.Cells[29].Text.ToString();
this.TextBox30.Text = this.GridView1.SelectedRow.Cells[30].Text.ToString();
this.TextBox31.Text = this.GridView1.SelectedRow.Cells[31].Text.ToString();
////单价
////this.TextBox32.Text = this.GridView1.SelectedRow.Cells[32].Text.ToString();
this.TextBox32.Text = this.GridView1.SelectedRow.Cells[33].Text.ToString();
this.TextBox33.Text = this.GridView1.SelectedRow.Cells[34].Text.ToString();
this.TextBox34.Text = this.GridView1.SelectedRow.Cells[35].Text.ToString();
this.TextBox35.Text = this.GridView1.SelectedRow.Cells[36].Text.ToString();
this.DropDownList9.SelectedValue= this.GridView1.SelectedRow.Cells[37].Text.ToString();
this.TextBox37.Text = this.GridView1.SelectedRow.Cells[38].Text.ToString();
this.TextBox38.Text = this.GridView1.SelectedRow.Cells[39].Text.ToString();
this.TextBox39.Text = this.GridView1.SelectedRow.Cells[40].Text.ToString();
this.TextBox40.Text = this.GridView1.SelectedRow.Cells[41].Text.ToString();
this.DropDownList10.SelectedValue= this.GridView1.SelectedRow.Cells[42].Text.ToString();
this.DropDownList11.SelectedValue= this.GridView1.SelectedRow.Cells[43].Text.ToString();
this.DropDownList12.SelectedValue= this.GridView1.SelectedRow.Cells[44].Text.ToString();
this.TextBox44.Text = this.GridView1.SelectedRow.Cells[45].Text.ToString();
this.TextBox45.Text = this.GridView1.SelectedRow.Cells[46].Text.ToString();
this.TextBox46.Text = this.GridView1.SelectedRow.Cells[47].Text.ToString();
this.TextBox47.Text = this.GridView1.SelectedRow.Cells[48].Text.ToString();
this.DropDownList13.SelectedValue= this.GridView1.SelectedRow.Cells[49].Text.ToString();
this.TextBox49.Text = this.GridView1.SelectedRow.Cells[50].Text.ToString();
this.TextBox50.Text = this.GridView1.SelectedRow.Cells[51].Text.ToString();
this.DropDownList14.SelectedValue= this.GridView1.SelectedRow.Cells[52].Text.ToString();
this.CheckBox2.Checked =(Convert.ToInt16(this.GridView1.SelectedRow.Cells[53].Text.ToString()) == 1) ? true : false;
this.CheckBox3.Checked = (Convert.ToInt16(this.GridView1.SelectedRow.Cells[54].Text.ToString()) == 1) ? true : false;
this.CheckBox4.Checked = (Convert.ToInt16(this.GridView1.SelectedRow.Cells[55].Text.ToString()) == 1) ? true : false;
this.TextBox55.Text = this.GridView1.SelectedRow.Cells[56].Text.ToString();
this.DropDownList15.SelectedValue= this.GridView1.SelectedRow.Cells[57].Text.ToString();
this.DropDownList16.SelectedValue= this.GridView1.SelectedRow.Cells[58].Text.ToString();
this.TextBox58.Text = this.GridView1.SelectedRow.Cells[59].Text.ToString();
}
protected void Button4_Click(object sender, EventArgs e)
{//打印出售房源信息
Server.Transfer("~/HouseManage/HouseSalePrint.aspx");
}
public string MyPrint建成年份
{//设置要传递到打印页的数据
get
{
DateTime MyDate=DateTime.Parse(this.TextBox21.Text);
return "建成年份:"+MyDate.Year.ToString()+"年 位置:"+this.DropDownList1.SelectedValue.ToString()+this.TextBox4.Text ;
}
}
public string MyPrint房屋产权
{//设置要传递到打印页的数据
get
{
return "土地:" + this.DropDownList4.SelectedValue.ToString() + " 产权:" + this.DropDownList5.SelectedValue.ToString() + " 装修:" + this.DropDownList8.SelectedValue.ToString();
}
}
public string MyPrint建筑面积
{//设置要传递到打印页的数据
get
{
int MyPrice = Convert.ToInt32(this.TextBox31.Text)/10000;
return "建面(m2):" + this.TextBox26.Text + " 套面(m2):" + this.TextBox27.Text + " 售价:" + MyPrice.ToString() + "万元";
}
}
public string MyPrint房型物管费
{//设置要传递到打印页的数据
get
{
return "房型:" +this.TextBox13.Text+"房"+this.TextBox14.Text+"厅"+this.TextBox15.Text+"厨"+this.TextBox16.Text+"卫"+this.TextBox17.Text+"阳台"+" 物管费:"+this.TextBox19.Text ;
}
}
public string MyPrint家电家私
{//设置要传递到打印页的数据
get
{
return "家私:" + this.TextBox32.Text + " 家电:" + this.TextBox33.Text;
}
}
public string MyPrint配套设施
{//设置要传递到打印页的数据
get
{
return "配套设施:" + this.TextBox34.Text;
}
}
public string MyPrint房源编号
{//设置要传递到打印页的数据
get
{
return "房源编号:" +this.TextBox2.Text;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -