private void DropDownBind() { //绑定市 CityInfoBLL _CityInfoBLL = new CityInfoBLL(); DataTable CityDT = _CityInfoBLL.GetAllCityInfo(); this.DrpDownCity.Items.Clear(); this.DrpDownCity.DataSource = CityDT; this.DrpDownCity.DataTextField = "CityName"; this.DrpDownCity.DataValueField = "CityID"; this.DrpDownCity.DataBind(); //绑定景点 int CityID = int.Parse(this.DrpDownCity.SelectedValue); SceneryInfoBLL _SceneryInfoBLL = new SceneryInfoBLL(); DataTable SceDT = _SceneryInfoBLL.GetCityScenery(CityID); this.DropDownScenery.Items.Clear(); this.DropDownScenery.DataSource = SceDT; this.DropDownScenery.DataTextField = "SceneryName"; this.DropDownScenery.DataValueField = "SceneryID"; this.DropDownScenery.DataBind(); }
/// <summary> /// 更新景点看了又看 /// </summary> public bool UpdScenerySeeAndSee() { List <SeeCount> list = new List <SeeCount>(); SceneryInfoBLL _SceneryInfoBLL = new SceneryInfoBLL(); ClickLogBLL _ClickLogBLL = new ClickLogBLL(); DataTable SceneryDT = _SceneryInfoBLL.GetCityScenery(1); for (int k = 0; k < SceneryDT.Rows.Count; k++) { int CurrentSceneryID = int.Parse(SceneryDT.Rows[k]["SceneryID"].ToString()); list.Clear(); //1.查询出所有景点信息 并加入链表 for (int i = 0; i < SceneryDT.Rows.Count; i++) { SeeCount _SeeCount = new SeeCount(); _SeeCount.KeyName = SceneryDT.Rows[i]["SceneryName"].ToString(); _SeeCount.KeyID = int.Parse(SceneryDT.Rows[i]["SceneryID"].ToString()); list.Add(_SeeCount); } //2.查询出看了当前景点用户IP DataTable ViewerIPDT = _ClickLogBLL.GetSeeSceneryIDPeople(CurrentSceneryID); 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 CurrentSceneryDT = _ClickLogBLL.GetAllOneSee(IPList[l], "景点"); //将景点合并 List <int> SceneryList = new List <int>(); for (int m = 0; m < CurrentSceneryDT.Rows.Count; m++) { if (!SceneryList.Contains(int.Parse(CurrentSceneryDT.Rows[m]["ContentFlag"].ToString()))) { SceneryList.Add(int.Parse(CurrentSceneryDT.Rows[m]["ContentFlag"].ToString())); } } for (int p = 0; p < SceneryList.Count; p++) { for (int n = 0; n < list.Count; n++) { if (list[n].KeyID == SceneryList[p]) { list[n].Count++; } } } } //4.先删除当前景点ID再根据次数排序 for (int a = 0; a < list.Count; a++) { if (list[a].KeyID == CurrentSceneryID) { list.RemoveAt(a); } } //先根据景点ID删除该景点的看了又看 然后按次序执行插入 _LookAnotherBLL.DelByIDType(CurrentSceneryID, "景点"); ; for (int v = 0; v < 1; v++) { LookAnotherInfo _LookAnotherInfo = new LookAnotherInfo(); _LookAnotherInfo.KeyID = CurrentSceneryID; _LookAnotherInfo.AnotherLookID = list[v].KeyID; _LookAnotherInfo.GoalType = "景点"; _LookAnotherBLL.AddLookAnother(_LookAnotherInfo); } } return(true); }