Exemple #1
0
        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>");
            }
        }
Exemple #2
0
        //根据酒店子类型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>");
            }
        }
Exemple #3
0
        //根据酒店子类型ID删除子类型
        protected void deleteThis()
        {
            //HotelID=<%=HotelID%>&HotelName=<%=HotelName%>&CityID=<%=CityID%>&
            //PageStart=<%=PageStart%>&HtlTypeID
            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());

            try
            {
                Array delWitch = rqid.Split('|');
                bool  isTrue   = false;
                for (int i = 0; i < delWitch.Length - 1; i++)
                {
                    int delid = Convert.ToInt32(delWitch.GetValue(i));

                    HtlTypeBLL       _HtlTypeBLL       = new HtlTypeBLL();
                    HtlTypeDetailBLL _HtlTypeDetailBLL = new HtlTypeDetailBLL();
                    int DtlTypeCount = _HtlTypeDetailBLL.GetHtlDetailCountByID(delid);


                    if (DtlTypeCount > 0)
                    {
                        if (_HtlTypeBLL.DelHtlTypeByTypeID(delid) && _HtlTypeDetailBLL.DelHotelTypeDetailByTypeID(delid))
                        {
                            isTrue = true;
                        }
                    }
                    else
                    {
                        if (_HtlTypeBLL.DelHtlTypeByTypeID(delid))
                        {
                            isTrue = true;
                        }
                    }
                    if (isTrue == false)
                    {
                        break;
                    }
                }

                if (!(isTrue == false))
                {
                    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>");
                }
                else
                {
                    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>");
                }
            }
            catch
            {
                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>");
            }
        }