protected void LoadFriendRequests() { GridViewFriendsListRequest.DataSource = FriendsBLL.getAllFriendRequests(Userid, Global.PENDING); GridViewFriendsListRequest.DataBind(); GridViewSuggestions.DataSource = FriendsBLL.getAllFriendRequests(Userid, Global.SUGGESTED); GridViewSuggestions.DataBind(); }
protected void GridViewFriendsList_RowCommand(object sender, GridViewCommandEventArgs e) { string friendid; if (e.CommandName == "add") { GridViewRow row = GridViewFriendsList.Rows[Convert.ToInt32(e.CommandArgument)]; friendid = GridViewFriendsList.DataKeys[row.RowIndex].Value.ToString(); string s = ((LinkButton)(row.Cells[3].Controls[0])).Text; if (s.Equals("Add Friend")) { FriendsBLL.sendFriendRequest(Userid, friendid); Requestsent = true; ((LinkButton)(row.Cells[3].Controls[0])).Text = "Cancel Request"; } else if (s.Equals("Cancel Request")) { FriendsBLL.cancelFriendRequest(Userid, friendid); Requestsent = false; ((LinkButton)(row.Cells[3].Controls[0])).Text = "Add Friend"; } } else if (e.CommandName == "viewmutual") { GridViewRow row = GridViewFriendsList.Rows[Convert.ToInt32(e.CommandArgument)]; friendid = GridViewFriendsList.DataKeys[row.RowIndex].Value.ToString(); Response.Redirect("FriendofFriendsList.aspx?UserId=" + friendid + "&Type=Mutual"); } }
protected void btnSendSuggestions_Click(object sender, EventArgs e) { string Dl = "Items Checked:"; foreach (DataListItem dli in RecSuggestionsDataList.Items) { CheckBox chk = (CheckBox)dli.FindControl("CheckBox2"); if (chk != null) { if (chk.Checked) { string friendid = RecSuggestionsDataList.DataKeys[dli.ItemIndex].ToString(); FriendsBLL.sendFriendSuggestion(friendid, fid);//send request to person for whom suggestions shown } } } foreach (DataListItem dli in AllSuggestionsDataList.Items) { CheckBox chk = (CheckBox)dli.FindControl("CheckBox2"); if (chk != null) { if (chk.Checked) { //get the userid of the checked person string friendid = AllSuggestionsDataList.DataKeys[dli.ItemIndex].ToString(); FriendsBLL.sendFriendSuggestion(friendid, fid);//send request to person for whom suggestions shown // Dl += friendid ; } } } //FindFriendsTextBox.Text = Dl; LoadSuggestions(""); }
protected void GridViewFriendsListRequest_RowCommand(object sender, GridViewCommandEventArgs e) { FriendsBO objClass = new FriendsBO(); GridViewRow row = GridViewFriendsListRequest.Rows[Convert.ToInt32(e.CommandArgument)]; objClass.Id = GridViewFriendsListRequest.DataKeys[row.RowIndex].Value.ToString(); if (e.CommandName == "notnow") { objClass.Status = Global.NOTNOW; Response.Write(objClass.FriendUserId); FriendsBLL.delayRequest(objClass); LoadFriendRequests(); } else if (e.CommandName == "confirmnow") { objClass.Status = Global.CONFIRMED; string sValue = ((HiddenField)row.FindControl("HiddenField1")).Value; objClass.FriendUserId = sValue; UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(sValue); FriendsBLL.confirmRequest(objClass); WallPost(" accept friend request of <a href=\"ViewProfile.aspx?UserId=" + Userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> "); LoadFriendRequests(); } }
protected void SearchButton_Click(object sender, EventArgs e) { string fieldValue = SearchTextBox.Text; string CheckBox = SearchDropDownList.Text; if (CheckBox == "Name") { GridViewFriendsList.DataSource = FriendsBLL.FindByListName(Userid, fieldValue, Global.CONFIRMED); } if (CheckBox == "CurrrentCity") { GridViewFriendsList.DataSource = FriendsBLL.FindByListCurrent(Userid, fieldValue, Global.CONFIRMED); } if (CheckBox == "HomeTown") { GridViewFriendsList.DataSource = FriendsBLL.FindByListHomeTown(Userid, fieldValue, Global.CONFIRMED); } if (CheckBox == "School") { GridViewFriendsList.DataSource = FriendsBLL.FindByListSchool(Userid, fieldValue, Global.CONFIRMED); } if (CheckBox == "WorkPlace") { GridViewFriendsList.DataSource = FriendsBLL.FindByListWorkPlace(Userid, fieldValue, Global.CONFIRMED); } GridViewFriendsList.DataBind(); }
protected void NotificationCount() { // long nt = 0,newnt=0; // if (lblNotification.Text.Length > 0) // nt = Convert.ToInt64(lblNotification.Text); long cnotif = Convert.ToInt64(NotificationBLL.countNotification(userid).ToString()); lblNotification.Text = cnotif.ToString(); if (cnotif == 000) { lblNotification.Visible = false; } long crequest = Convert.ToInt64(FriendsBLL.countFriendRequests(userid, Global.PENDING).ToString()); lblFriendsRequest.Text = crequest.ToString(); if (crequest == 000) { lblFriendsRequest.Visible = false; } // newnt = Convert.ToInt64(lblNotification.Text); //if (newnt > nt) //{ //ScriptManager.RegisterClientScriptBlock(UpdatePanel3, UpdatePanel3.GetType(), "script", "insideJS();", true); //} }
protected void GridViewSearchUser_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow row = GridViewSearchUser.Rows[Convert.ToInt32(e.CommandArgument)]; Friendid = GridViewSearchUser.DataKeys[row.RowIndex].Value.ToString(); string s = ((LinkButton)(row.Cells[1].Controls[0])).Text; if (s.Equals("Add Friend")) { FriendsBLL.sendFriendRequest(Userid, Friendid); Requestsent = true; //e.Row.Cells[0].Controls[0].Attributes.Add("onclick", "alert(‘An alert’);") //row.Cells[0].Controls[0].Visible=false; //row.Cells[1].Controls[0].Visible = true; ((LinkButton)(row.Cells[1].Controls[0])).Text = "Cancel Request"; //row.FindControl("btnAddFriend").Visible = true; //row.FindControl("btnCancelRequest").Visible = false; } else if (s.Equals("Cancel Request")) { FriendsBLL.cancelFriendRequest(Userid, Friendid); Requestsent = false; ((LinkButton)(row.Cells[1].Controls[0])).Text = "Add Friend"; } }
protected void LoadFriendsList() { GridViewFriendsList.DataSource = FriendsBLL.getAllFriendsListName(userid, Global.CONFIRMED).Take(10).ToList(); GridViewFriendsList.DataBind(); lbtnFriends.Text = "Friends(" + FriendsBLL.countFriends(userid, Global.CONFIRMED).ToString() + ")"; //lbtnRequest.Text = "Requests(" + FriendsBLL.countFriendRequests(userid, Global.PENDING).ToString() + ")"; }
protected void LoadFriendsList() { GridViewFriendsList.DataSource = FriendsBLL.getAllFriendsListName(Userid, Global.CONFIRMED); GridViewFriendsList.DataBind(); // GridViewFriendsListRequest.DataSource = FriendsBLL.getAllFriendsListName(userid, Global.PENDING); // GridViewFriendsListRequest.DataBind(); }
protected void WallPost(string post) { UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Userid); WallBO objWall = new WallBO(); objWall.PostedByUserId = Userid; objWall.WallOwnerUserId = Userid; objWall.FirstName = objUser.FirstName; objWall.LastName = objUser.LastName; objWall.Post = post; objWall.AddedDate = DateTime.Now; objWall.Type = Global.PROFILE_CHANGE; string wid = WallBLL.insertWall(objWall); ////////////////////////////////////TICKER CODE ////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// List <UserFriendsBO> listtag = FriendsBLL.getAllFriendsListName(Session["UserId"].ToString(), Global.CONFIRMED); //get the education,hometown and employer of people in list foreach (UserFriendsBO Useritem in listtag) { TickerBO objTicker = new TickerBO(); objTicker.PostedByUserId = objWall.PostedByUserId; objTicker.TickerOwnerUserId = Useritem.FriendUserId; objTicker.FirstName = objWall.FirstName; objTicker.LastName = objWall.LastName; objTicker.Post = objWall.Post; objTicker.Title = objWall.Post; objTicker.AddedDate = DateTime.UtcNow; objTicker.Type = objWall.Type; objTicker.EmbedPost = objWall.EmbedPost; objTicker.WallId = wid; TickerBLL.insertTicker(objTicker); } TickerBO objTickerUserTag = new TickerBO(); objTickerUserTag.PostedByUserId = Session["UserId"].ToString(); objTickerUserTag.TickerOwnerUserId = Session["UserId"].ToString(); objTickerUserTag.FirstName = objUser.FirstName; objTickerUserTag.LastName = objUser.LastName; objTickerUserTag.Post = objWall.Post; objTickerUserTag.Title = objWall.Post; objTickerUserTag.AddedDate = DateTime.UtcNow; objTickerUserTag.Type = objWall.Type; objTickerUserTag.EmbedPost = objWall.EmbedPost; objTickerUserTag.WallId = wid; TickerBLL.insertTicker(objTickerUserTag); //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// }
protected void SearchButton_Click(object sender, EventArgs e) { string fieldValue = SearchTextBox.Text; if (validate_checkbox(SearchDropDownList.Text)) { GridViewFriendsList.DataSource = FriendsBLL.FindByListName(Userid, fieldValue, Global.CONFIRMED); GridViewFriendsList.DataBind(); } }
protected void SearchButton_Click(object sender, EventArgs e) { string fieldValue = SearchTextBox.Text; string userid; userid = Session["UserId"].ToString(); MultiSelectGrid.DataSource = FriendsBLL.FindByListName(userid, fieldValue, Global.CONFIRMED); MultiSelectGrid.DataBind(); }
protected void LoadFriendsList() { GridViewFriendsList.DataSource = FriendsBLL.getAllFriendsListName(Userid, Global.CONFIRMED); GridViewFriendsList.DataBind(); GridViewFriendsListRequest.DataSource = FriendsBLL.getAllFriendsListName(Userid, Global.PENDING); GridViewFriendsListRequest.DataBind(); if (Userid != Session["UserId"].ToString()) { GridViewFriendsList.Columns[2].Visible = false; } }
public Resolver() { GetLogger = new ComLogger(); daoUsers = new UsersDAL(GetLogger); daoFriends = new FriendsDAL(GetLogger); daoMessages = new MessagesDAL(GetLogger); daoSecurityData = new SecurityDataDAL(GetLogger); GetBloUsers = new UsersBLL(GetLogger, daoUsers); GetBloFriends = new FriendsBLL(GetLogger, daoFriends); GetBloMessages = new MessagesBLL(GetLogger, daoMessages); GetBloSecurityData = new SecurityDataBLL(GetLogger, daoSecurityData); }
protected void GridViewFriendsList_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridViewFriendsList.PageIndex = e.NewPageIndex; string fieldValue = SearchTextBox.Text; string userid; userid = Session["UserId"].ToString(); GridViewFriendsList.DataSource = FriendsBLL.FindByListName(userid, fieldValue, Global.CONFIRMED); GridViewFriendsList.DataBind(); }
protected void btnCancelRequest_Click(object sender, EventArgs e) { btnCancelRequest.Visible = false; btnCancelRequest.Enabled = false; btnAddAsFriend.Visible = true; btnAddAsFriend.Enabled = true; lblFriendRequestSent.Visible = false; string friendId = Userid; string userId = Session["UserId"].ToString(); FriendsBLL.cancelFriendRequest(userId, friendId); }
public List <UserFriendsBO> getfriends_list(string FilterByListName) { if (!FilterByListName.Equals("") && !FilterByListName.Equals("None")) { list = FriendsBLL.getAllFriendsFilterByList(Userid, Global.CONFIRMED, FilterByListName);// FriendsBLL.getAllSuggestions(userid); } else { list = FriendsBLL.getAllFriendsListName(Userid, Global.CONFIRMED);// FriendsBLL.getAllSuggestions(userid); } return(list); }
protected void btnAddAsFriend_Click(object sender, EventArgs e) { btnAddAsFriend.Visible = false; btnAddAsFriend.Enabled = false; lblFriendRequestSent.Visible = true; string friendId = Userid; string userId = Session["UserId"].ToString(); FriendsBLL.sendFriendRequest(userId, friendId); UserBLL userbll = new UserBLL(); userbll.registerSubscriber(friendId, userId); btnCancelRequest.Visible = true; btnCancelRequest.Enabled = true; }
public static void post(PostProperties post) { UserBO objUser = UserBLL.getUserByUserId(SessionClass.getUserId()); WallBO objWall = new WallBO(); objWall.WallOwnerUserId = post.WallOwnerUserId; objWall.PostedByUserId = post.PostedByUserId; objWall.FirstName = objUser.FirstName; objWall.LastName = objUser.LastName; objWall.Post = post.PostText; objWall.EmbedPost = post.EmbedPost; objWall.AddedDate = DateTime.Now; objWall.Type = post.PostType; string wid = WallBLL.insertWall(objWall); List <UserFriendsBO> listtag = FriendsBLL.getAllFriendsListName(SessionClass.getUserId(), Global.CONFIRMED); //get the education,hometown and employer of people in list foreach (UserFriendsBO Useritem in listtag) { TickerBO objTicker = new TickerBO(); objTicker.PostedByUserId = objWall.PostedByUserId; objTicker.TickerOwnerUserId = Useritem.FriendUserId; objTicker.FirstName = objWall.FirstName; objTicker.LastName = objWall.LastName; objTicker.Post = objWall.Post; objTicker.Title = Global.SHARE_A_POST; objTicker.AddedDate = DateTime.UtcNow; objTicker.Type = objWall.Type; objTicker.EmbedPost = objWall.EmbedPost; objTicker.WallId = wid; TickerBLL.insertTicker(objTicker); } TickerBO objTickerUserTag = new TickerBO(); objTickerUserTag.PostedByUserId = SessionClass.getUserId(); objTickerUserTag.TickerOwnerUserId = SessionClass.getUserId(); objTickerUserTag.FirstName = objUser.FirstName; objTickerUserTag.LastName = objUser.LastName; objTickerUserTag.Post = objWall.Post; objTickerUserTag.Title = Global.SHARE_A_POST; objTickerUserTag.AddedDate = DateTime.UtcNow; objTickerUserTag.Type = objWall.Type; objTickerUserTag.EmbedPost = objWall.EmbedPost; objTickerUserTag.WallId = wid; TickerBLL.insertTicker(objTickerUserTag); }
protected void Page_Load(object sender, EventArgs e) { try { if (Request.QueryString.Count == 0) { btnAddAsFriend.Visible = false; btnCancelRequest.Visible = false; Userid = Session["UserId"].ToString(); Session["TempUserId"] = null; } else { Userid = Request.QueryString.Get(0); Session["TempUserId"] = Userid; if (FriendsBLL.isExistingFriend(Session["UserId"].ToString(), Userid)) { btnAddAsFriend.Visible = false; btnSuggestFriends.Visible = true; } else { btnAddAsFriend.Visible = true; btnSuggestFriends.Visible = false; } if (Session["UserId"].ToString() == Userid) { btnAddAsFriend.Visible = false; lblsub.Visible = false; } } ((Image)Master.FindControl("imgProfile")).ImageUrl = "../UserProfile/profileimages/" + Userid + ".jpg"; } catch (Exception ex) { Response.Redirect("../../Default.aspx"); } ((Label)Master.FindControl("lblTitle")).Text = "View Profile"; if (!IsPostBack) { LoadAllData(); } // ((Image)Master.FindControl("imgProfile")).ImageUrl = Global.PROFILE_PICTURE + userid + "2.jpg"; }
protected void LoadSuggestions() { List <UserFriendsBO> list = FriendsBLL.getAllSuggestions(userid).Take(4).ToList(); List <UserFriendsBO> scoredlist = FriendsBLL.RecommendationScoring(list, userid); if (scoredlist.Count == 0) { GridViewSuggestions.DataSource = list; } else { GridViewSuggestions.DataSource = scoredlist; } GridViewSuggestions.DataBind(); //lbtnFriends.Text = "Friends(" + FriendsBLL.countFriends(userid, Global.CONFIRMED).ToString() + ")"; //lbtnRequest.Text = "Requests(" + FriendsBLL.countFriendRequests(userid, Global.PENDING).ToString() + ")"; }
protected void GridViewFriendsOfFriend_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow row = GridViewFriendsOfFriend.Rows[Convert.ToInt32(e.CommandArgument)]; friendid = GridViewFriendsOfFriend.DataKeys[row.RowIndex].Value.ToString(); string s = ((LinkButton)(row.Cells[0].Controls[0])).Text; if (s.Equals("Add Friend")) { FriendsBLL.sendFriendRequest(Userid, friendid); ((LinkButton)(row.Cells[0].Controls[0])).Text = "Cancel Request"; } else if (s.Equals("Cancel Request")) { FriendsBLL.cancelFriendRequest(Userid, friendid); ((LinkButton)(row.Cells[0].Controls[0])).Text = "Add Friend"; } }
protected void inVisibleAddFriends() { foreach (GridViewRow gvr in GridViewSearchUser.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { string sValue = ((HiddenField)gvr.FindControl("HiddenField1")).Value; if (FriendsBLL.isExistingFriend(Userid, sValue)) { gvr.Cells[1].Visible = true; gvr.Cells[1].Text = "Already Friend"; gvr.Cells[1].ForeColor = ColorTranslator.FromHtml("#808080"); } else { gvr.Cells[1].ForeColor = ColorTranslator.FromHtml("#808080"); } } } }
/// <summary> /// 删除好友 /// </summary> /// <param name="session">本人session</param> /// <param name="session_Friend">要删除的好友session</param> /// <returns></returns> public Stream CancelFriend(string session, string session_Friend) { try { FriendsBLL friBLL = new FriendsBLL(); string resul = friBLL.CancelFriend(session, session_Friend); if (!string.IsNullOrEmpty(resul)) { return(new MemoryStream(Encoding.UTF8.GetBytes(resul))); } else { return(new MemoryStream(Encoding.UTF8.GetBytes("error"))); } } catch (Exception err) { Logger.Error("CancelFriend Error", err); return(new MemoryStream(Encoding.UTF8.GetBytes("error"))); } }
protected void GridViewSuggestions_RowCommand(object sender, GridViewCommandEventArgs e) { FriendsBO objClass = new FriendsBO(); GridViewRow row = GridViewFriendsListRequest.Rows[Convert.ToInt32(e.CommandArgument)]; objClass.Id = GridViewFriendsListRequest.DataKeys[row.RowIndex].Value.ToString(); if (e.CommandName == "notnow") { objClass.Status = Global.NOTNOW; Response.Write(objClass.FriendUserId); FriendsBLL.delayRequest(objClass); LoadFriendRequests(); } else if (e.CommandName == "confirmnow") { objClass.Status = Global.CONFIRMED; string sValue = ((HiddenField)row.FindControl("HiddenField1")).Value; objClass.FriendUserId = sValue; FriendsBLL.confirmRequest(objClass); LoadFriendRequests(); } }
protected void LoadFriendsList() { DataListFriends.DataSource = FriendsBLL.getAllFriendsListName(Userid, Global.CONFIRMED); DataListFriends.DataBind(); }
protected void GridViewFriendsList_SelectedIndexChanged(object sender, EventArgs e) { FriendsBLL.deleteFriends(MultiSelectGrid.DataKeys[MultiSelectGrid.SelectedIndex].Value.ToString()); LoadFriendsList(); }
protected void LoadFriendsList() { MultiSelectGrid.DataSource = FriendsBLL.getAllFriendsListName(Userid, Global.CONFIRMED); MultiSelectGrid.DataBind(); }
protected void GridViewFriendsList_SelectedIndexChanged(object sender, EventArgs e) { FriendsBLL.deleteFriends(GridViewFriendsList.DataKeys[GridViewFriendsList.SelectedIndex].Value.ToString()); LoadFriendsList(); // Response.Write(GridViewFriendsList.DataKeys[GridViewFriendsList.SelectedIndex].Value); }
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(); }