protected void lbtnLike_Click(object sender, EventArgs e) { if (lbtnLike.Text == "Like") { UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Userid); LikesBO objClass = new LikesBO(); objClass.AtId = Photoid; objClass.Type = Global.VIDEO; objClass.UserId = Userid; objClass.FirstName = objUser.FirstName; objClass.LastName = objUser.LastName; LikesBLL.insertLikes(objClass); lblLike.Text = "You Like this"; lbtnLike.Text = "UnLike"; } else { LikesBO objClass = new LikesBO(); objClass.AtId = Photoid; objClass.Type = Global.VIDEO; objClass.UserId = Userid; LikesBLL.unLikes(objClass); lblLike.Text = ""; lbtnLike.Text = "Like"; } }
protected void lbtnCommentLike_Click(object sender, EventArgs e) { GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); LinkButton lbtnCommentLike = (LinkButton)row.FindControl("lbtnCommentLike"); if (lbtnCommentLike.Text == "Like") { UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL_COMMENT; objClass.UserId = Session["UserId"].ToString(); objClass.FirstName = objUser.FirstName; objClass.LastName = objUser.LastName; LikesBLL.insertLikes(objClass); lbtnCommentLike.Text = "You Like this"; lbtnCommentLike.Text = "UnLike"; } else { LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL_COMMENT; objClass.UserId = Session["UserId"].ToString(); LikesBLL.unLikes(objClass); lbtnCommentLike.Text = ""; lbtnCommentLike.Text = "Like"; } LoadWall(50); }
protected void Comment_YouLikes(GridViewRow row) { GridView gridviewcomment = (GridView)row.FindControl("GridViewComments"); foreach (GridViewRow gvr in gridviewcomment.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { LinkButton linkLike = (LinkButton)gvr.FindControl("lbtnCommentLike"); Label labelLike = (Label)gvr.FindControl("lblCommentLike"); LinkButton linkLikeCount = (LinkButton)gvr.FindControl("lbtnCommentLikeUser"); HiddenField hfId = (HiddenField)gvr.FindControl("HiddenFieldId"); HiddenField hfdate = (HiddenField)gvr.FindControl("HiddenFieldCommentAddedDate"); Label labeldate = (Label)gvr.FindControl("lblCommentAddedDate"); DateTime date = Convert.ToDateTime(hfdate.Value); labeldate.Text = TimeAgo(date); long likecount = LikesBLL.countPost(hfId.Value, Global.WALL_COMMENT); if (likecount > 0) { linkLikeCount.Text = likecount.ToString() + " Users"; } else { linkLikeCount.Visible = false; } HiddenField Userownid = (HiddenField)gvr.FindControl("HiddenFieldCommentUserId"); LinkButton lbtnDeleteComment = (LinkButton)gvr.FindControl("lbtnDeleteComment"); if (Userownid.Value.Equals(Session["UserId"].ToString())) { lbtnDeleteComment.Visible = true; } LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL_COMMENT; objClass.UserId = Session["UserId"].ToString(); bool islike = LikesBLL.youLikes(objClass); if (islike) { labelLike.Text = ""; linkLike.Text = "UnLike"; } else { labelLike.Text = ""; linkLike.Text = "Like"; } } } }
protected void lbtnCommentLikeUser_Click(object sender, EventArgs e) { GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); GridView gridviewLikesUser = (GridView)row.FindControl("GridViewLikesCommentUser"); gridviewLikesUser.DataSource = LikesBLL.getLikesTop(Global.WALL_COMMENT, hfId.Value); gridviewLikesUser.DataBind(); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /// COMMENTS LIKE MODULE //// //////////////////////////////////////////////////////////////////////////////////////////////////////////// // @@@@@@@@@@@@@@@@@@@@ by Nabeel protected void lbtnCommentLike_Click(object sender, EventArgs e) { GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); LinkButton lbtnCommentLike = (LinkButton)row.FindControl("lbtnCommentLike"); //GridView gv = (GridView)GridViewWall.Rows[RowIndex].FindControl("GridViewComments"); UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); if (lbtnCommentLike.Text == "Like") { LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL_COMMENT; objClass.UserId = Session["UserId"].ToString(); objClass.FirstName = objUser.FirstName; objClass.LastName = objUser.LastName; LikesBLL.insertLikes(objClass); lbtnCommentLike.Text = ""; lbtnCommentLike.Text = "UnLike"; } else { LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL_COMMENT; objClass.UserId = Session["UserId"].ToString(); LikesBLL.unLikes(objClass); lbtnCommentLike.Text = ""; lbtnCommentLike.Text = "Like"; } // // Comment_YouLikes(); /////////////////////////////////////Friends recent activities if (!userid.Equals(Session["UserId"].ToString())) { UserBO objFUser = new UserBO(); objFUser = UserBLL.getUserByUserId(userid); WallBO objWall = new WallBO(); objWall.PostedByUserId = Session["UserId"].ToString(); objWall.WallOwnerUserId = Session["UserId"].ToString(); objWall.FirstName = objUser.FirstName; objWall.LastName = objUser.LastName; objWall.Post = " Like a Comments on <a href=\"ViewProfile.aspx?UserId=" + userid + "\">" + objFUser.FirstName + " " + objFUser.LastName + "</a> Wall Post"; objWall.AddedDate = DateTime.Now; objWall.Type = Global.PROFILE_CHANGE; WallBLL.insertWall(objWall); } //////////////////////////////////////// // Response.Redirect("main.aspx?c="+hfId.Value); }
//protected void lbtnLike_Click(object sender, EventArgs e) //{ // GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); // LinkButton linkLike = (LinkButton)row.FindControl("lbtnLike"); // Label labelLike = (Label)row.FindControl("lblLike"); // HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); // if (linkLike.Text == "Like") // { // UserBO objUser = new UserBO(); // objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); // LikesBO objClass = new LikesBO(); // objClass.AtId = hfId.Value; // objClass.Type = Global.WALL; // objClass.UserId = Session["UserId"].ToString(); // objClass.FirstName = objUser.FirstName; // objClass.LastName = objUser.LastName; // LikesBLL.insertLikes(objClass); // labelLike.Text = "You Like this"; // linkLike.Text = "UnLike"; // } // else // { // LikesBO objClass = new LikesBO(); // objClass.AtId = hfId.Value; // objClass.Type = Global.WALL; // objClass.UserId = Session["UserId"].ToString(); // LikesBLL.unLikes(objClass); // labelLike.Text = ""; // linkLike.Text = "Like"; // } // LoadWall(50); //} // @@@@@@@@@@@@@@@@@@@@ by Nabeel protected void lbtnUser_Click(object sender, EventArgs e) { GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); LinkButton linkLike = (LinkButton)row.FindControl("lbtnLike"); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); GridView gridviewLikesUser = (GridView)row.FindControl("GridViewLikesUser"); gridviewLikesUser.DataSource = LikesBLL.getLikesTop(Global.WALL, hfId.Value); gridviewLikesUser.DataBind(); // LoadWall(50); }
/// <summary> /// 消赞 /// </summary> /// <param name="workid"></param> /// <param name="userid"></param> /// <returns></returns> public int xiaozan(int workid, int userid) { LikesBLL lbll = new LikesBLL(); if (lbll.LikesDelete(workid, userid) > 0) { return(1); } else { return(0); } }
// To share a post protected void ShareLinkButton_Click(object sender, EventArgs e) { GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); LinkButton linkShare = (LinkButton)row.FindControl("ShareLinkButton"); Label labelShare = (Label)row.FindControl("ShareLabel"); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); if (linkShare.Text == "Share") { // UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); ShareBO objClass = new ShareBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); objClass.FirstName = objUser.FirstName; objClass.LastName = objUser.LastName; ShareBLL.insertShare(objClass); //////////////////////////////////////////////////////////////////////////// // Put "follow" record for each user that has been tagged, traverse the list FollowPostBO objFollow = new FollowPostBO(); objFollow.AtId = hfId.Value; objFollow.Type = Global.WALL; objFollow.UserId = Session["hello"].ToString(); objFollow.FirstName = objUser.FirstName; objFollow.LastName = objUser.LastName; FollowPostBLL.insertFollowPost(objFollow); //////////////////////////////////////////////////////////////////////////// labelShare.Text = "You have shared this."; WallBO wall = WallBLL.getWallByWallId(objClass.AtId); string p = ShareDescriptionTextBox.Text + " <br/>" + wall.Post; ShareStatus(p); } else { LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); LikesBLL.unLikes(objClass); labelShare.Text = ""; linkShare.Text = "Like"; } LoadWall(50); }
protected void YouLikes() { foreach (GridViewRow gvr in GridViewWall.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { LinkButton linkLike = (LinkButton)gvr.FindControl("lbtnLike"); Label labelLike = (Label)gvr.FindControl("lblLike"); LinkButton linkLikeCount = (LinkButton)gvr.FindControl("lbtnUser"); HiddenField hfId = (HiddenField)gvr.FindControl("HiddenFieldId"); long likecount = LikesBLL.countPost(hfId.Value, Global.WALL); if (likecount > 0) { linkLikeCount.Text = likecount.ToString() + " Users"; } else { linkLikeCount.Visible = false; } LinkButton linkcountComments = (LinkButton)gvr.FindControl("lbtnViewComments"); long totalcomments = CommentsDAL.countComment(hfId.Value, Global.WALL); if (totalcomments > 2) { linkcountComments.Text = "View All " + totalcomments.ToString() + " Comments"; } else { linkcountComments.Visible = false; } LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); bool islike = LikesBLL.youLikes(objClass); if (islike) { labelLike.Text = "You Like This"; linkLike.Text = "UnLike"; } else { labelLike.Text = ""; linkLike.Text = "Like"; } } } }
/// <summary> /// 点赞 /// </summary> /// <param name="id"></param> /// <returns></returns> public int dianzan(int id) { LikesBLL lbll = new LikesBLL(); UserinfoModel m = Session["userid"] as UserinfoModel; LikesModel z = new LikesModel(); z.UserId = m.Userid; z.Worksid = id; if (lbll.LikesADD(z) > 0) { return(1); } else { return(0); } }
protected void YouLikes() { LikesBO objClass = new LikesBO(); objClass.AtId = Photoid; objClass.Type = Global.VIDEO; objClass.UserId = Userid; bool islike = LikesBLL.youLikes(objClass); if (islike) { lblLike.Text = "You Like This"; lbtnLike.Text = "UnLike"; } else { lblLike.Text = ""; lbtnLike.Text = "Like"; } }
protected void ShareLinkButton_Click(object sender, EventArgs e) { GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); LinkButton linkShare = (LinkButton)row.FindControl("ShareLinkButton"); Label labelShare = (Label)row.FindControl("ShareLabel"); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); HiddenField hfType = (HiddenField)row.FindControl("HiddenFieldType"); HiddenField hfEmbedPost = (HiddenField)row.FindControl("HiddenFieldEmbedPost"); Session["PostID"] = hfId.Value; Session["EmailPostID"] = hfId.Value; Session["PostType"] = hfType.Value; Session["EmbedPost"] = hfEmbedPost.Value; if (linkShare.Text == "Share") { Response.Redirect("SharePost.aspx?Post=" + hfId.Value); //////// Getting the user information //////UserBO objUser = new UserBO(); //////objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); //////// Creating Share object //////ShareBO objClass = new ShareBO(); //////objClass.AtId = hfId.Value; //////objClass.Type = Global.WALL; //////objClass.UserId = Session["UserId"].ToString(); //////objClass.FirstName = objUser.FirstName; //////objClass.LastName = objUser.LastName; //////// Getting the post which is going to be shared //////WallBO wall = WallBLL.getWallByWallId(objClass.AtId); //////string p = txtUpdatePost.Text + " <br/>" + wall.Post; //////// Sharing the post on the wall //////ShareStatus(p); //////// Registering the Share after successful completion of the above process //////ShareBLL.insertShare(objClass); // Sending Notifications to the one with which post has been shared and the one who were tagged //////////////////////////////////////////////////////////////////////////// // Put "follow" record for each user that has been tagged, traverse the list //FollowPostBO objFollow = new FollowPostBO(); //objFollow.AtId = hfId.Value; //objFollow.Type = Global.WALL; //objFollow.UserId = Session["hello"].ToString(); ////////////////////////////////// //objFollow.FirstName = objUser.FirstName; //objFollow.LastName = objUser.LastName; //FollowPostBLL.insertFollowPost(objFollow); //////////////////////////////////////////////////////////////////////////// } else { LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); LikesBLL.unLikes(objClass); labelShare.Text = ""; linkShare.Text = "Like"; } }
protected void lbtnLike_Click(object sender, EventArgs e) { string statuslike = "like a post"; GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); LinkButton linkLike = (LinkButton)row.FindControl("lbtnLike"); Label labelLike = (Label)row.FindControl("lblLike"); Literal literalpost = (Literal)row.FindControl("Literal1"); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldWallId"); HiddenField hfType = (HiddenField)row.FindControl("HiddenFieldType"); HiddenField hfEmbedPost = (HiddenField)row.FindControl("HiddenFieldEmbedTickerPost"); PopupControlExtender pce = row.FindControl("PopupControlExtenderTicker") as PopupControlExtender; UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); if (linkLike.Text == "Like") { LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); objClass.FirstName = objUser.FirstName; objClass.LastName = objUser.LastName; LikesBLL.insertLikes(objClass); labelLike.Text = ""; linkLike.Text = "UnLike"; statuslike = "like a post"; } else { LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); LikesBLL.unLikes(objClass); labelLike.Text = ""; linkLike.Text = "Like"; statuslike = "unlike a post"; } pce.DataBind(); /////////////////////////////////////Friends recent activities if (!userid.Equals(Session["UserId"].ToString())) { UserBO objFUser = new UserBO(); objFUser = UserBLL.getUserByUserId(userid); WallBO objWall = new WallBO(); objWall.PostedByUserId = Session["UserId"].ToString(); objWall.WallOwnerUserId = Session["UserId"].ToString(); objWall.FirstName = objUser.FirstName; objWall.LastName = objUser.LastName; objWall.Post = "Like a <a href=\"ViewProfile.aspx?UserId=" + userid + "\">" + objFUser.FirstName + " " + objFUser.LastName + "</a> Wall Post"; objWall.AddedDate = DateTime.Now; objWall.Type = Global.PROFILE_CHANGE; WallBLL.insertWall(objWall); } //////////////////////////////////////// ////////////////////////////////////TICKER CODE ////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// List <UserFriendsBO> list = FriendsBLL.getAllFriendsListName(Session["UserId"].ToString(), Global.CONFIRMED); //get the education,hometown and employer of people in list foreach (UserFriendsBO Useritem in list) { TickerBO objTicker = new TickerBO(); objTicker.PostedByUserId = Session["UserId"].ToString(); objTicker.TickerOwnerUserId = Useritem.FriendUserId; objTicker.FirstName = objUser.FirstName; objTicker.LastName = objUser.LastName; objTicker.Post = literalpost.Text; objTicker.Title = statuslike; objTicker.AddedDate = DateTime.UtcNow; objTicker.Type = Convert.ToInt32(hfType.Value); objTicker.EmbedPost = hfEmbedPost.Value; objTicker.WallId = hfId.Value; TickerBLL.insertTicker(objTicker); } TickerBO objTickerUser = new TickerBO(); objTickerUser.PostedByUserId = Session["UserId"].ToString(); objTickerUser.TickerOwnerUserId = Session["UserId"].ToString(); objTickerUser.FirstName = objUser.FirstName; objTickerUser.LastName = objUser.LastName; objTickerUser.Post = literalpost.Text; objTickerUser.Title = statuslike; objTickerUser.AddedDate = DateTime.UtcNow; objTickerUser.Type = Convert.ToInt32(hfType.Value); objTickerUser.EmbedPost = hfEmbedPost.Value; objTickerUser.WallId = hfId.Value; TickerBLL.insertTicker(objTickerUser); //////////////////////////////////////////////////////////////////////////////////// }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /// POST LIKE MODULE //// //////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void YouLikes(GridViewRow gvr) { if (gvr.RowType == DataControlRowType.DataRow) { LinkButton linkLike = (LinkButton)gvr.FindControl("lbtnLike"); Label labelLike = (Label)gvr.FindControl("lblLike"); LinkButton linkLikeCount = (LinkButton)gvr.FindControl("lbtnUser"); HiddenField hfId = (HiddenField)gvr.FindControl("HiddenFieldWallId"); HiddenField hfuserId = (HiddenField)gvr.FindControl("HiddenFieldUserId"); HiddenField hfdate = (HiddenField)gvr.FindControl("HiddenFieldAddedDate"); Label labeldate = (Label)gvr.FindControl("lblAddedDate"); // Literal literalpost = (Literal)gvr.FindControl("LiteralPost"); //ImageButton imgbtn = (ImageButton)gvr.FindControl("ImageButton1"); DateTime date = Convert.ToDateTime(hfdate.Value); labeldate.Text = TimeAgo(date); //if (literalpost.Text.IndexOf("width") > 0) // imgbtn.Visible = false; long likecount = LikesBLL.countPost(hfId.Value, Global.WALL); if (likecount > 0) { linkLikeCount.Text = likecount.ToString() + " Likes"; } else { linkLikeCount.Visible = false; } LinkButton linkcountComments = (LinkButton)gvr.FindControl("lbtnViewComments"); long totalcomments = CommentsDAL.countComment(hfId.Value, Global.WALL); if (totalcomments > 2) { linkcountComments.Text = "View All " + totalcomments.ToString() + " Comments"; } else { linkcountComments.Text = totalcomments.ToString() + " Comments"; } if (totalcomments <= 0) { linkcountComments.Visible = false; } HiddenField Userownid = (HiddenField)gvr.FindControl("HiddenFieldUserId"); LinkButton lbtnDelete = (LinkButton)gvr.FindControl("lbtnDelete"); if (Userownid.Value.Equals(Session["UserId"].ToString())) { lbtnDelete.Visible = true; } LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); bool islike = LikesBLL.youLikes(objClass); if (islike) { labelLike.Text = ""; linkLike.Text = "UnLike"; } else { labelLike.Text = ""; linkLike.Text = "Like"; } } }