protected void Page_Load(object sender, EventArgs e) { try { if (Session["TempUserId"] == null) { userid = Session["UserId"].ToString(); Session["TempUserId"] = null; } else { userid = Session["TempUserId"].ToString(); } atid = Session["EmailPostID"].ToString(); } catch (Exception ex) { Response.Redirect("../../Default.aspx"); } if (Request.QueryString.Count != 0) { post = Request.QueryString.Get(0); } UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); ShareBO objClass = new ShareBO(); objClass.AtId = post; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); objClass.FirstName = objUser.FirstName; objClass.LastName = objUser.LastName; WallBO wall = WallBLL.getWallByWallId(objClass.AtId); string p = txtUpdatePost.Text + " <br/>" + wall.Post; PostPreviewLinkButton.Text = p; int type = Convert.ToInt32(Session["PostType"]); if (type == Global.PHOTO || type == Global.TAG_PHOTO) { ImagePreview.ImageUrl = "../../Resources/UserPhotos/" + Session["EmbedPost"].ToString() + ".jpg"; } if (type == Global.POST_VIDEOLINK) { ImagePreview.ImageUrl = Session["EmbedPost"].ToString(); } ((Label)Master.FindControl("lblTitle")).Text = "Share Post"; }
protected void GridViewTicker_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "show") { //GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer; HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldWallId"); ImageButton imgbtn = (ImageButton)row.FindControl("imbtnVideo"); imgbtn.Visible = false; WallBO objWall = new WallBO(); objWall = WallBLL.getWallByWallId(hfId.Value); int type = objWall.Type; string embedval = objWall.EmbedPost; if (type == Global.POST_VIDEOLINK || type == Global.TAG_VIDEOLINK) { string original_literal = objWall.Post; string literal = original_literal.Substring(44); int ind = literal.IndexOf('&'); string id = literal.Substring(0, ind); string embedsrc = "http://www.youtube.com/embed/" + id + "?autoplay=1&rel=0"; string literalval = "<br/><br/><iframe width='320' height='215' src=" + embedsrc + " frameborder='0' allowfullscreen></iframe>"; WallBLL.updateLiteral(hfId.Value, literalval, ""); //WallBLL.updateLiteral(hfId.Value, objWall.EmbedPost); //WallBLL.insertWall(objWall); WallBLL.updateLiteral(hfId.Value, original_literal, embedval); } if (type == Global.VIDEO || type == Global.TAG_VIDEO) { string vidname = objWall.EmbedPost; int i = vidname.LastIndexOf('/'); vidname = vidname.Substring(i + 1, 4) + ".swf"; string original_literal = objWall.Post; string literalval = objWall.Post + "<br/><br/><embed src='" + Global.PATH_COMPRESSED_USER_VIDEO + "Players/flvplayer.swf' width='320' height='215' bgcolor='#FFFFFF' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' flashvars='file=" + Global.PATH_COMPRESSED_USER_VIDEO + "SWF/" + vidname + "&autostart=true'></embed>"; WallBLL.updateLiteral(hfId.Value, literalval, ""); WallBLL.updateLiteral(hfId.Value, objWall.Post, embedval); } } }
// 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 btnPost_Click(object sender, EventArgs e) { if (post != null) { UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); ShareBO objClass = new ShareBO(); objClass.AtId = post; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); objClass.FirstName = objUser.FirstName; objClass.LastName = objUser.LastName; WallBO wall = WallBLL.getWallByWallId(objClass.AtId); string p = txtUpdatePost.Text + " <br/>" + wall.Post; ShareStatus(p); foreach (string item in lstTag) { WallBO objWall2 = new WallBO(); string tagpost = p + "<br/><br/> Tag by <a href=\"ViewProfile.aspx?UserId=" + Session["UserId"].ToString() + "\">" + objUser.FirstName + " " + objUser.LastName + "</a>."; UserBO objUser2 = new UserBO(); objUser2 = UserBLL.getUserByUserId(item); objWall2.PostedByUserId = item; objWall2.WallOwnerUserId = item; objWall2.FirstName = objUser2.FirstName; objWall2.LastName = objUser2.LastName; objWall2.Post = tagpost; objWall2.AddedDate = DateTime.Now; objWall2.Type = Convert.ToInt32(Session["PostType"]); objWall2.EmbedPost = Session["EmbedPost"].ToString(); RWallPost(" tag post to <a href=\"ViewProfile.aspx?UserId=" + item + "\">" + objUser2.FirstName + " " + objUser2.LastName + "</a>"); WallBLL.insertWall(objWall2); } ShareBLL.insertShare(objClass); RWallPost(" Share a Post"); Response.Redirect("UserData.aspx"); } }
////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////// protected void lbtnFeedDetail_Click(object sender, EventArgs e) { GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); PopupControlExtender pce = row.FindControl("PopupControlExtenderTicker") as PopupControlExtender; ImageButton imbtnPhoto = (ImageButton)row.FindControl("imbtnPhoto"); ImageButton imbtnVideo = (ImageButton)row.FindControl("imbtnVideo"); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); HiddenField hfWallId = (HiddenField)row.FindControl("HiddenFieldWallId"); TickerBO objClass = new TickerBO(); objClass = TickerBLL.getTickerByTickerId(hfId.Value); string sValue = hfWallId.Value; GridView gridviewComments = (GridView)row.FindControl("GridViewComments"); //LinkButton btn = (LinkButton)gvr.FindControl("LinkButton2"); WallBO objWall = new WallBO(); objWall = WallBLL.getWallByWallId(sValue); if (objWall.Type == Global.PHOTO || objWall.Type == Global.TAG_PHOTO) { imbtnPhoto.ImageUrl = "../../Resources/ThumbnailPhotos/" + objClass.EmbedPost + ".jpg"; imbtnPhoto.Visible = true; } if (objWall.Type == Global.VIDEO || objWall.Type == Global.TAG_VIDEO || objWall.Type == Global.POST_VIDEOLINK || objWall.Type == Global.TAG_VIDEOLINK) { imbtnVideo.Visible = true; } YouLikes(row); CountShare(row); gridviewComments.DataSource = CommentsDAL.getCommentsTop(Global.WALL, sValue, 2); gridviewComments.DataBind(); Comment_YouLikes(row); pce.DataBind(); }
// 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"); Session["PostID"] = hfId; if (linkShare.Text == "Share") { // 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); } LoadWall(50); }