#region 获取参数列表
private Hashtable GetHashLst()
{
Hashtable ht = new Hashtable() ;
//房型
ht.Add( "@HouseType" , ddlHouseType.SelectedValue ) ;
//标题
ht.Add( "@Title" , this.txttittle.Text ) ;
//户型
ht.Add( "@RoomType" , this.ddlRoomType1.SelectedValue + "," + this.ddlRoomType2.SelectedValue + "," + this.ddlRoomType3.SelectedValue + "," + this.ddlRoomType4.SelectedValue ) ;
//靠近地区
ht.Add( "@Closer" , this.txtRegionName.Text ) ;
//区域
ht.Add( "@Area" , this.ddlArea.SelectedValue ) ;
//房屋产权
ht.Add( "@PropertyRight" , this.drpright.SelectedValue ) ;
//楼层
ht.Add( "@Floor" , this.txtFloor1.Text ) ;
//有效时间
ht.Add( "@ValidDate" , this.ddlValidDate.SelectedValue ) ;
//是否是中介
ht.Add( "@IsAgency" , this.radlstIsAgency.SelectedValue ) ;
//建筑面积
ht.Add( "@BuildArea" , this.txtBuildArea.Text ) ;
//建筑时间
ht.Add( "@BuildYear" , this.ddlBuildYear.SelectedValue ) ;
//购买价格
ht.Add( "@BayPrice" , this.txtBayPrice.Text ) ;
//入住时间
ht.Add( "@MovingTime" , this.txtMovingTime.Text ) ;
//房屋朝向
ht.Add( "@HouseFace" , this.drolsthouehead.SelectedValue ) ;
//其他说明
ht.Add( "@Description" , this.txtotherdes.Text ) ;
//联系人
ht.Add( "@TouchMan" , this.txtlinkperson.Text ) ;
//性别
ht.Add( "@Sex" , this.radbtnlstsex.SelectedValue ) ;
//电话号码
ht.Add( "@PhoneNum" , this.txtphone.Text ) ;
//是否公开电话号码
//ht.Add( "@IsPhoneNumOpen" , this.radbtnlstphobe.SelectedValue ) ;
//是否公开手机
ht.Add( "@IsHandSetOpen" , this.radbtnlstmobiletype.SelectedValue ) ;
//手机号码
ht.Add( "@HandSet" , txtmobile.Text ) ;
//QQ号码
ht.Add( "@QQNum" , this.txtqq.Text ) ;
//是否公开QQ号码
ht.Add( "@IsQQOpen" , this.radbtnlstqqtype.SelectedValue ) ;
//email
ht.Add( "@Email" , this.txtmail.Text ) ;
//个人ID
ht.Add( "@CreateId" , UserCode ) ;
return ht ;
}
#endregion
#region 插入房屋出租信息
private bool HouseBayInsert( Hashtable ht )
{
return ( new HouseBayFacade() ).HouseBayInfInsertFacade( ht ) ;
}
#endregion
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnsubmit.Click += new System.EventHandler(this.btnsubmit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnsubmit_Click(object sender, System.EventArgs e)
{
if( HouseBayInsert( GetHashLst() ) )
{
Response.Write("<Script>alert('添加成功')</Script>") ;
Response.Redirect( "HouseIndex.aspx" ) ;
}
else
Response.Write("<Script>alert('添加失败')</Script>") ;
}
#region 插入房屋求租信息
public bool HouseBayInfInsertAccess( Hashtable ht )
{
this.myCommand = new SqlCommand( "ProcHouseBayInfoAdd" , this.dataConn ) ;
this.myCommand.CommandType = CommandType.StoredProcedure ;
IDictionaryEnumerator pParameters = ht.GetEnumerator() ;
while( pParameters.MoveNext() )
this.myCommand.Parameters.Add( pParameters.Key.ToString() , pParameters.Value ) ;
try
{
if( this.dataConn.State == ConnectionState.Closed )
this.dataConn.Open() ;
this.myCommand.ExecuteNonQuery() ;
}
catch( Exception Err )
{
string ErrMsg = Err.Message ;
return false ;
}
finally
{
if( this.dataConn.State == ConnectionState.Open )
this.dataConn.Close() ;
}
return true ;
}
#endregion