protected void btAdd_Click(object sender, EventArgs e) { HtlTypeDetail _HtlTypeDetail = new HtlTypeDetail(); HtlTypeDetailBLL _HtlTypeDetailBLL = new HtlTypeDetailBLL(); _HtlTypeDetail.HouseType = this.txtHouseType.Text; _HtlTypeDetail.BedType = this.txtBed.Text; _HtlTypeDetail.HaveBreakfast = this.txtBreakfast.Text; _HtlTypeDetail.Broadband = this.txtBroadBand.Text; _HtlTypeDetail.TypeID = int.Parse(Request.QueryString["HtlTypeID"].ToString()); _HtlTypeDetail.Price = TxtPrice.Text; int HotelID = int.Parse(Request.QueryString["HotelID"].ToString()); String HotelName = Request.QueryString["HotelName"].ToString(); int CityID = int.Parse(Request.QueryString["CityID"].ToString()); int PageStart = int.Parse(Request.QueryString["PageStart"].ToString()); int HtlTypeID = int.Parse(Request.QueryString["HtlTypeID"].ToString()); String HtlTypeName = Request.QueryString["HtlTypeName"].ToString(); if (_HtlTypeDetailBLL.AddHotelTypeDetail(_HtlTypeDetail)) { Response.Write("<script language='javascript'>"); Response.Write("alert('添加成功');"); Response.Write("document.location.href='HotelSubRmTypeList.aspx?CityID=" + CityID.ToString() + "&HotelName=" + HotelName.ToString() + "&HtlTypeID" + HtlTypeID.ToString() + "&HotelID=" + HotelID.ToString() + "&PageStart=" + PageStart.ToString() + "&HtlTypeID=" + HtlTypeID.ToString() + "&HtlTypeName=" + HtlTypeName.ToString() + "';"); Response.Write("</script>"); } }
//根据酒店子类型ID删除子类型 protected void deleteThis() { int HotelID = int.Parse(Request.QueryString["HotelID"].ToString()); String HotelName = Request.QueryString["HotelName"].ToString(); int CityID = int.Parse(Request.QueryString["CityID"].ToString()); int PageStart = int.Parse(Request.QueryString["PageStart"].ToString()); int HtlTypeID = int.Parse(Request.QueryString["HtlTypeID"].ToString()); String HtlTypeName = Request.QueryString["HtlTypeName"].ToString(); try { Array delWitch = rqid.Split('|'); bool isTrue = false; for (int i = 0; i < delWitch.Length - 1; i++) { int delid = Convert.ToInt32(delWitch.GetValue(i)); HtlTypeDetailBLL _HtlTypeDetailBLL = new HtlTypeDetailBLL(); if (_HtlTypeDetailBLL.DelHotelTypeDetail(delid)) { isTrue = true; } else { isTrue = false; } if (isTrue == false) { break; } } if (!(isTrue == false)) { Response.Write("<script language='javascript'>"); Response.Write("alert('删除成功!');"); Response.Write("document.location.href='HotelSubRmTypeList.aspx?CityID=" + CityID.ToString() + "&HotelName=" + HotelName.ToString() + "&HotelID=" + HotelID.ToString() + "&PageStart=" + PageStart.ToString() + "&HtlTypeID=" + HtlTypeID.ToString() + "&HtlTypeName=" + HtlTypeName.ToString() + "';"); Response.Write("</script>"); } else { Response.Write("<script language='javascript'>"); Response.Write("alert('删除失败!');"); Response.Write("document.location.href='HotelSubRmTypeList.aspx?CityID=" + CityID.ToString() + "&HotelName=" + HotelName.ToString() + "&HotelID=" + HotelID.ToString() + "&PageStart=" + PageStart.ToString() + "&HtlTypeID=" + HtlTypeID.ToString() + "&HtlTypeName=" + HtlTypeName.ToString() + "';"); Response.Write("</script>"); } } catch { Response.Write("<script language='javascript'>"); Response.Write("alert('删除失败!');"); Response.Write("document.location.href='HotelSubRmTypeList.aspx?CityID=" + CityID.ToString() + "&HotelName=" + HotelName.ToString() + "&HotelID=" + HotelID.ToString() + "&PageStart=" + PageStart.ToString() + "&HtlTypeID=" + HtlTypeID.ToString() + "&HtlTypeName=" + HtlTypeName.ToString() + "';"); Response.Write("</script>"); } }
//根据酒店子类型ID删除子类型 protected void deleteThis() { int CityID = int.Parse(Request.QueryString["CityID"].ToString()); int PageStart = int.Parse(Request.QueryString["PageStart"].ToString()); try { Array delWitch = rqid.Split('|'); bool isTrue = false; bool isPicTrue = false; for (int i = 0; i < delWitch.Length - 1; i++) { int delid = Convert.ToInt32(delWitch.GetValue(i)); PicInfoBLL _PicInfoBLL = new PicInfoBLL(); HotelInfoBLL _HotelInfoBLL = new HotelInfoBLL(); HtlTypeBLL _HtlTypeBLL = new HtlTypeBLL(); HtlTypeDetailBLL _HtlTypeDetailBLL = new HtlTypeDetailBLL(); // DataTable HtlTypeDT = _HtlTypeBLL.GetHtlTypeByID(delid); DataTable HtlPicDT = _PicInfoBLL.GetPicByHtlID(delid); if (HtlTypeDT.Rows.Count == 0) { if (_HotelInfoBLL.DelHotelByHotelID(delid)) { isTrue = true; } else { isTrue = false; } } else { //删除子类型 for (int j = 0; j < HtlTypeDT.Rows.Count; j++) { int HtlType = int.Parse(HtlTypeDT.Rows[j]["ID"].ToString());//房型类型 int DetailTypeCount = _HtlTypeDetailBLL.GetHtlDetailCountByID(HtlType); if (DetailTypeCount > 0) { if (_HtlTypeDetailBLL.DelHotelTypeDetailByTypeID(HtlType)) { isTrue = true; } else { isTrue = false; break; } } else { isTrue = true; } } if (isTrue == false) { break; } //删除房型信息,酒店信息 if (_HtlTypeBLL.DelHtlTypeByHtlID(delid) && _HotelInfoBLL.DelHotelByHotelID(delid)) { isTrue = true; } else { isTrue = false; } } //删除图片信息 HtlPicDT = _PicInfoBLL.GetPicByHtlID(delid); for (int k = 0; k < HtlPicDT.Rows.Count; k++) { int PicID = int.Parse(HtlPicDT.Rows[k]["PicID"].ToString()); if (_PicInfoBLL.DelPicByID(PicID) && _PicInfoBLL.DelHtlPicByID(PicID)) { isPicTrue = true; } else { isPicTrue = false; break; } } if (isTrue == false || isPicTrue == false) { break; } } if (!(isTrue == false || isPicTrue == false)) { Response.Write("<script language='javascript'>"); Response.Write("alert('删除成功!');"); Response.Write("document.location.href='HotelInfoList.aspx?CityID=" + CityID.ToString() + "&PageStart=" + PageStart.ToString() + "';"); Response.Write("</script>"); } else { Response.Write("<script language='javascript'>"); Response.Write("alert('删除失败!');"); Response.Write("document.location.href='HotelInfoList.aspx?CityID=" + CityID.ToString() + "&PageStart=" + PageStart.ToString() + "';"); Response.Write("</script>"); } } catch { Response.Write("<script language='javascript'>"); Response.Write("alert('删除失败!');"); Response.Write("document.location.href='HotelInfoList.aspx?CityID=" + CityID.ToString() + "&PageStart=" + PageStart.ToString() + "';"); Response.Write("</script>"); } }