protected void btAdd_Click(object sender, EventArgs e) { HtlTypeBLL _HtlTypeBLL = new HtlTypeBLL(); HtlType _HtlType = new HtlType(); _HtlType.HotelID = int.Parse(Request.QueryString["HotelID"].ToString()); _HtlType.HouseType = this.txtHouseType.Text; _HtlType.Floor = this.txtFloor.Text; _HtlType.BedType = this.txtBedType.Text; _HtlType.Internet = this.TxtInternet.Text; if (this.txtSqure.Text != "") { _HtlType.Squre = int.Parse(this.txtSqure.Text); } else { _HtlType.Squre = 0; } int CityID = int.Parse(Request.QueryString["CityID"].ToString()); int HotelID = int.Parse(Request.QueryString["HotelID"].ToString()); String HotelName = Request.QueryString["HotelName"].ToString(); int PageStart = int.Parse(Request.QueryString["PageStart"].ToString()); if (_HtlTypeBLL.AddHtlType(_HtlType)) { Response.Write("<script language='javascript'>"); Response.Write("alert('添加成功');"); Response.Write("document.location.href='HotelRmTypeList.aspx?CityID=" + CityID.ToString() + "&HotelName=" + HotelName.ToString() + "&HotelID=" + HotelID.ToString() + "&PageStart=" + PageStart.ToString() + "';"); Response.Write("</script>"); } }
/// <summary> /// 添加一个酒店的类型 /// </summary> /// <param name="_HtlType"></param> /// <returns></returns> public bool AddHtlType(HtlType _HtlType) { String Sql = "insert into HotelType(HotelID,HouseType,Squre,Floor,BedType,Internet) values(@HotelID,@HouseType,@Squre,@Floor,@BedType,@Internet)"; SqlParameter[] Paras = new SqlParameter[] { new SqlParameter("@HotelID", _HtlType.HotelID), new SqlParameter("@HouseType", _HtlType.HouseType), new SqlParameter("@Squre", _HtlType.Squre), new SqlParameter("@Floor", _HtlType.Floor), new SqlParameter("@BedType", _HtlType.BedType), new SqlParameter("@Internet", _HtlType.Internet) }; if (SqlHelper.ExecuteNonQuery(Sql, Paras, CommandType.Text) > 0) { return(true); } return(false); }
/// <summary> /// 添加一个酒店的类型 /// </summary> /// <param name="_HtlType"></param> /// <returns></returns> public bool AddHtlType(HtlType _HtlType) { return(this._HtlTypeDAL.AddHtlType(_HtlType)); }