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();
        }
Exemplo n.º 2
0
        /// <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);
        }