private void HotelInfoBind()
        {
            int HotelID = int.Parse(Request.QueryString["HotelID"].ToString());

            HotelInfoBLL _HotelInfoBLL = new HotelInfoBLL();
            DataTable    HotelDT       = _HotelInfoBLL.GetHotelInfoByHtlID(HotelID);

            this.txtHotelName.Text    = HotelDT.Rows[0]["HotelName"].ToString();
            this.txtHotelName.Enabled = false;

            this.txtHotelStar.Text = HotelDT.Rows[0]["Star"].ToString();

            this.TxtHotelLoc.Text = HotelDT.Rows[0]["Locate"].ToString();

            this.TxtHotelNum.Text = HotelDT.Rows[0]["PhoneNum"].ToString();

            this.TxtHtlService.Text = HotelDT.Rows[0]["HotelService"].ToString();

            this.TxtHotelIntroduce.Text = HotelDT.Rows[0]["HotelIntroduction"].ToString();

            this.TxtResScrvice.Text = HotelDT.Rows[0]["RestaurantDevice"].ToString();

            this.txtIdrService.Text = HotelDT.Rows[0]["IndoorService"].ToString();

            if (float.Parse(HotelDT.Rows[0]["SLongitude"].ToString().Substring(0, 6)) != 0.0f)
            {
                this.txtHotelLgt.Text = HotelDT.Rows[0]["SLongitude"].ToString();
            }


            if (float.Parse(HotelDT.Rows[0]["Slatitude"].ToString().Substring(0, 6)) != 0.0f)
            {
                this.txtHotelLgt.Text = HotelDT.Rows[0]["SLongitude"].ToString();
            }
        }
        private void HtlBind(int CityID)
        {
            //绑定酒店
            HotelInfoBLL _HotelInfoBLL = new HotelInfoBLL();
            DataTable    HtlDT         = _HotelInfoBLL.GetHtlInfoByCtyID(CityID);

            this.DropDownHotel.Items.Clear();
            this.DropDownHotel.DataSource     = HtlDT;
            this.DropDownHotel.DataTextField  = "HotelName";
            this.DropDownHotel.DataValueField = "HotelID";
            this.DropDownHotel.DataBind();
        }
        protected void btEdit_Click(object sender, EventArgs e)
        {
            HotelInfoBLL _HotelInfoBLL = new HotelInfoBLL();
            HotelInfo    _HotelInfo    = new HotelInfo();

            _HotelInfo.CityID            = int.Parse(Request.QueryString["CityID"].ToString());
            _HotelInfo.HotelName         = txtHotelName.Text.Trim();
            _HotelInfo.Local             = TxtHotelLoc.Text.Trim();
            _HotelInfo.PhoneNum          = TxtHotelNum.Text.Trim();
            _HotelInfo.HotelService      = TxtHtlService.Text.Trim();
            _HotelInfo.HotelIntroduction = TxtHotelIntroduce.Text.Trim();
            _HotelInfo.RestaurantDevice  = TxtResScrvice.Text.Trim();
            _HotelInfo.IndoorService     = txtIdrService.Text.Trim();

            if (txtHotelLgt.Text.Trim() != "")
            {
                _HotelInfo.SLongitude = float.Parse(txtHotelLgt.Text.Trim().ToString());
            }
            else
            {
                _HotelInfo.SLongitude = 0.0f;
            }

            if (txtHotelLat.Text.Trim() != "")
            {
                _HotelInfo.Slatitude = float.Parse(txtHotelLat.Text.Trim().ToString());
            }
            else
            {
                _HotelInfo.Slatitude = 0.0f;
            }
            if (txtHotelStar.Text != "")
            {
                _HotelInfo.Star = int.Parse(txtHotelStar.Text.Trim());
            }
            else
            {
                _HotelInfo.Star = 0;
            }

            int PageStart = int.Parse(Request.QueryString["PageStart"].ToString());
            int CityID    = int.Parse(Request.QueryString["CityID"].ToString());

            if (_HotelInfoBLL.UpdHotelInfo(CityID, _HotelInfo))
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('更改成功');");
                Response.Write("document.location.href='HotelInfoList.aspx?PageStart=" + PageStart.ToString() + "&CityID=" + CityID.ToString() + "';");
                Response.Write("</script>");
            }
        }
        /// <summary>
        /// 更新酒店看了又看
        /// </summary>
        public bool UpdHotelSeeAndSee()
        {
            List <SeeCount> list = new List <SeeCount>();


            HotelInfoBLL _HotelInfoBLL = new HotelInfoBLL();
            ClickLogBLL  _ClickLogBLL  = new ClickLogBLL();
            DataTable    HotelDT       = _HotelInfoBLL.GetHtlInfoByCtyID(1);

            for (int k = 0; k < HotelDT.Rows.Count; k++)
            {
                int CurrentHtlID = int.Parse(HotelDT.Rows[k]["HotelID"].ToString());
                list.Clear();
                //1.查询出所有酒店信息 并加入链表
                for (int i = 0; i < HotelDT.Rows.Count; i++)
                {
                    SeeCount _SeeCount = new SeeCount();
                    _SeeCount.KeyName = HotelDT.Rows[i]["HotelName"].ToString();
                    _SeeCount.KeyID   = int.Parse(HotelDT.Rows[i]["HotelID"].ToString());
                    list.Add(_SeeCount);
                }

                //2.查询出看了当前酒店用户IP
                DataTable     ViewerIPDT = _ClickLogBLL.GetSeeHotelIDPeople(CurrentHtlID);
                List <String> IPList     = new List <String>();
                for (int j = 0; j < ViewerIPDT.Rows.Count; j++)
                {
                    if (!IPList.Contains(ViewerIPDT.Rows[j]["IP"].ToString()))
                    {
                        IPList.Add(ViewerIPDT.Rows[j]["IP"].ToString());
                    }
                }
                //3.查询出当前IP 看过的酒店 并统计次数
                for (int l = 0; l < IPList.Count; l++)
                {
                    DataTable CurrentHtlDT = _ClickLogBLL.GetAllOneSee(IPList[l], "酒店");
                    //将景点合并
                    List <int> HtlList = new List <int>();
                    for (int m = 0; m < CurrentHtlDT.Rows.Count; m++)
                    {
                        if (!HtlList.Contains(int.Parse(CurrentHtlDT.Rows[m]["ContentFlag"].ToString())))
                        {
                            HtlList.Add(int.Parse(CurrentHtlDT.Rows[m]["ContentFlag"].ToString()));
                        }
                    }

                    for (int p = 0; p < HtlList.Count; p++)
                    {
                        for (int n = 0; n < list.Count; n++)
                        {
                            if (list[n].KeyID == HtlList[p])
                            {
                                list[n].Count++;
                            }
                        }
                    }
                }
                //4.先删除当前景点ID再根据次数排序
                for (int a = 0; a < list.Count; a++)
                {
                    if (list[a].KeyID == CurrentHtlID)
                    {
                        list.RemoveAt(a);
                    }
                }
                //先根据景点ID删除该景点的看了又看  然后按次序执行插入

                _LookAnotherBLL.DelByIDType(CurrentHtlID, "酒店");



                ;
                for (int v = 0; v < 1; v++)
                {
                    LookAnotherInfo _LookAnotherInfo = new LookAnotherInfo();
                    _LookAnotherInfo.KeyID         = CurrentHtlID;
                    _LookAnotherInfo.AnotherLookID = list[v].KeyID;
                    _LookAnotherInfo.GoalType      = "酒店";

                    _LookAnotherBLL.AddLookAnother(_LookAnotherInfo);
                }
            }
            return(true);
        }
Beispiel #5
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>");
            }
        }