protected void SearchButton_Click(object sender, EventArgs e) { string fieldValue = FindFriendsTextBox.Text; List <UserFriendsBO> searchlist = new List <UserFriendsBO>();//search list string userid; userid = Session["UserId"].ToString(); foreach (UserFriendsBO u in list2) { if (fieldValue.Contains(u.FirstName) || fieldValue.Contains(u.LastName)) { searchlist.Add(u); } } AllSuggestionsDataList.DataSource = searchlist; AllSuggestionsDataList.DataBind(); RecSuggestionsDataList.DataSource = null; RecSuggestionsDataList.DataBind(); MutualDataList.DataSource = null; MutualDataList.DataBind(); }
protected void LoadSuggestions(string FilterByListName) { list = new List <UserFriendsBO>(); list2 = new List <UserFriendsBO>(); List <UserFriendsBO> userlist = new List <UserFriendsBO>(); List <UserFriendsBO> reclist = new List <UserFriendsBO>(); list = getfriends_list(FilterByListName); foreach (UserFriendsBO Useritem in list) { if (VerifyUserItem(Useritem.FirstName, Useritem.LastName)) { userlist.Add(Useritem); fid = Useritem.FriendUserId; } else { list2.Add(Useritem); } } List <UserFriendsBO> mutualfriendslist = FriendsBLL.getMutualFriends(Userid, fid, Global.CONFIRMED); IEqualityComparer <UserFriendsBO> comparer = new UserFriendsComparer(); List <UserFriendsBO> l3 = list2.Except(mutualfriendslist, comparer).ToList(); List <UserFriendsBO> PSlist = FriendsBLL.getPSFriends(fid); List <UserFriendsBO> l4 = l3.Except(PSlist, comparer).ToList(); AllSuggestionsDataList.DataSource = l4; AllSuggestionsDataList.DataBind(); MutualDataList.DataSource = mutualfriendslist; MutualDataList.DataBind(); string belongsto = ListViewBLL.getListName(Userid, fid); foreach (UserFriendsBO Useritem in l4) { Useritem.Score = 0; string belongsto1 = ListViewBLL.getListName(Userid, Useritem.FriendUserId); string belongsto2 = ListViewBLL.getListName(Useritem.FriendUserId, Userid); if (belongsto1.Equals(belongsto) || belongsto2.Equals(belongsto))//if no value specified by user by default true { Useritem.Score += 1 * Global.WEIGHT_LIST; } } List <UserFriendsBO> scoredlist = FriendsBLL.RecommendationScoring(l4, fid); reclist = scoredlist.Take(6).ToList(); RecSuggestionsDataList.DataSource = reclist; RecSuggestionsDataList.DataBind(); l4 = l4.Except(reclist, comparer).ToList(); PagedDataSource objPds = new PagedDataSource(); objPds.DataSource = l4; objPds.AllowPaging = true; objPds.PageSize = 6; objPds.CurrentPageIndex = CurrentPage; lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of " + objPds.PageCount.ToString(); cmdPrev.Enabled = !objPds.IsFirstPage; cmdNext.Enabled = !objPds.IsLastPage; AllSuggestionsDataList.DataSource = objPds; AllSuggestionsDataList.DataBind(); }