protected void WallPost(string photoid) { 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 = "added a new photo"; objWall.AddedDate = DateTime.Now; objWall.Type = Global.PHOTO; objWall.EmbedPost = photoid; 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 = "added a new photo"; objTicker.AddedDate = DateTime.UtcNow; objTicker.Type = Global.PHOTO; 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 = "added a new photo"; objTickerUserTag.AddedDate = DateTime.UtcNow; objTickerUserTag.Type = Global.PHOTO; objTickerUserTag.EmbedPost = objWall.EmbedPost; objTickerUserTag.WallId = wid; TickerBLL.insertTicker(objTickerUserTag); //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// }
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"); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); Literal literalpost = (Literal)row.FindControl("LiteralPost"); HiddenField hfType = (HiddenField)row.FindControl("HiddenFieldType"); HiddenField hfEmbedPost = (HiddenField)row.FindControl("HiddenFieldEmbedPost"); 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); 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); linkLike.Text = "Like"; statuslike = "unlike a post"; } LoadWall(50); /////////////////////////////////////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.TEXT_POST; 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); //////////////////////////////////////////////////////////////////////////////////// }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /// COMMENTS LIKE MODULE //// //////////////////////////////////////////////////////////////////////////////////////////////////////////// // @@@@@@@@@@@@@@@@@@@@ by Nabeel protected void lbtnCommentLike_Click(object sender, EventArgs e) { string statuslike = "like a post"; 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 = "Like this"; lbtnCommentLike.Text = "Unlike"; statuslike = "like a post comment"; } 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"; statuslike = "unlike a post comment"; } WallBO objWall = new WallBO(); // Comment_YouLikes(); /////////////////////////////////////Friends recent activities //if (!userid.Equals(Session["UserId"].ToString())) // { UserBO objFUser = new UserBO(); objFUser = UserBLL.getUserByUserId(userid); 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.TEXT_POST; 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 = objWall.Post; objTicker.Title = statuslike; objTicker.AddedDate = DateTime.UtcNow; objTicker.Type = Global.TEXT_POST; objTicker.EmbedPost = ""; 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 = objWall.Post; objTickerUser.Title = statuslike; objTickerUser.AddedDate = DateTime.UtcNow; objTickerUser.Type = Global.TEXT_POST; objTickerUser.EmbedPost = ""; objTickerUser.WallId = hfId.Value; TickerBLL.insertTicker(objTickerUser); //////////////////////////////////////////////////////////////////////////////////// LoadWall(50); // Response.Redirect("main.aspx?c="+hfId.Value); }
protected bool isVideoLink(string postid) { bool isvideolink = false; WallBO objWall = new WallBO(); objWall = WallBLL.getWallByWallId(postid); if (objWall.Type == Global.POST_VIDEOLINK) { isvideolink = true; } return isvideolink; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /// VIDEO MODULE //// //////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void GridViewWall_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("HiddenFieldId"); ImageButton imgbtn = (ImageButton)row.FindControl("ImageButton1"); 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); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtUpdatePost.ClientID + "').value = '';", true); LoadWall(100); 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, ""); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtUpdatePost.ClientID + "').value = '';", true); LoadWall(100); WallBLL.updateLiteral(hfId.Value, objWall.Post, embedval); } } }
protected void WallPost(string photoid) { UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); WallBO objWall = new WallBO(); objWall.PostedByUserId = Session["UserId"].ToString(); // Whether the wall is owned by some other person or by me try { if (Request.QueryString[0] != null) { objWall.WallOwnerUserId = Request.QueryString[0]; objWall.Type = Global.SHARE; } else { objWall.WallOwnerUserId = userid; objWall.Type = Global.TEXT_POST; } } catch { objWall.WallOwnerUserId = userid; objWall.Type = Global.TEXT_POST; } objWall.FirstName = objUser.FirstName; objWall.LastName = objUser.LastName; if (txtUpdatePost.Text != "") objWall.Post = "added a new photo <br/>" + txtUpdatePost.Text + " </br></br><a href='ViewPhoto.aspx?PhotoId=" + photoid + "'><img src='../../Resources/ThumbnailPhotos/" + photoid + ".jpg' width='150' height='150' border='0' alt='No Image'/> <a/>"; else objWall.Post = "added a new photo </br></br><a href='ViewPhoto.aspx?PhotoId=" + photoid + "'><img src='../../Resources/ThumbnailPhotos/" + photoid + ".jpg' width='150' height='150' border='0' alt='No Image'/> <a/>"; objWall.AddedDate = DateTime.Now; WallBLL.insertWall(objWall); }
protected void UpdateStatus() { string status = txtUpdatePost.Text; bool isVideoLink = false; UserBLL userbll = new UserBLL(); if(lblFriendsWith.Text!="") status += " <font color='#838181'> -- with <font/>" + lblFriendsWith.Text.Remove(lblFriendsWith.Text.LastIndexOf(",")); if (lblLocation.Text != "") status += lblLocation.Text; UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); WallBO objWall = new WallBO(); objWall.PostedByUserId = Session["UserId"].ToString(); objWall.WallOwnerUserId = userid; objWall.FirstName = objUser.FirstName; objWall.LastName = objUser.LastName; objWall.Post = ConvertUrlsToLinks(status); objWall.AddedDate = DateTime.UtcNow; objWall.Type = Global.TEXT_POST; if (ConvertUrlsToLinks(status).IndexOf("http") > 0) { objWall.Type = Global.LINK; status = "post a link"; } string imagesrc=""; if (!GetYouTubeURL(txtUpdatePost.Text).Equals("")) { string url = GetYouTubeURL(txtUpdatePost.Text); objWall.Post = "<br/><br/><a href='" + url + "'>" + url + "</a><br/><br/>"; } if (pnlVideoLink.Visible == true) { string url = GetYouTubeURL(txtUpdatePost.Text); string id = GetYouTubeID(txtUpdatePost.Text); string embedsrc = "http://www.youtube.com/embed/" + id + "?rel=0"; objWall.Type = Global.POST_VIDEOLINK; objWall.Post = "<br/><br/><a href='" + url + "'>" + url + "</a><br/><br/>"; if (!chkThumbnail.Checked) { imagesrc = getCurrentSelectedVideoThumbnail(id); vidthumbdisp = true; objWall.EmbedPost = imagesrc; } objWall.Type = Global.POST_VIDEOLINK; txtUpdatePost.Text = ""; isVideoLink = true; status = " added a new video"; } if (videofileuploaded) { objWall.Type = Global.VIDEO; string wallpost = objWall.Post; objWall.EmbedPost = Global.PATH_COMPRESSED_USER_VIDEO + "Thumb/" + uploadedvideothumbname; uploadedvideoembedliteral = Video.getUploadedVideoEmbedLiteral(wallpost, uploadedvideoname); LiteralUploadVideo.Text = ""; status = " added a new video"; } if (photofileuploaded) { objWall.Type = Global.PHOTO; LiteralUploadPhoto .Text= ""; uploadedPhotoliteral = ""; objWall.EmbedPost = photoid; status = " added a new photo"; } if (Session["WebCamPhotoId"] != null) { objWall.Type = Global.PHOTO; objWall.EmbedPost = Session["WebCamPhotoId"].ToString(); status = " added a new photo"; } if (isphotoalbum) { MediaAlbumBO objAClass = new MediaAlbumBO(); objAClass.UserId = userid; objAClass.Name = txtName.Text; objAClass.Description = txtDescription.Text; objAClass.CoverPictureId = "0000000000000b0000000900"; objAClass.Type = Global.PHOTO; objAClass.isFollow = true; string aid=MediaAlbumBLL.insertMediaAlbum(objAClass); objWall.Post = objWall.Post + " add new <a href=\"ViewPhotoAlbum.aspx?AlbumId=" + aid + "\">photo album</a>."; objWall.Type = Global.PHOTO_ALBUM; status = " added a new photo album"; } ////////////////////////////////////////////////////////////////////// foreach (string item in lstTag) { string tagstatus; if (photofileuploaded || videofileuploaded || Session["WebCamPhotoId"] != null || isVideoLink || isphotoalbum) { WallBO objWall2 = new WallBO(); string tagpost = objWall.Post + "<br/> <font color='#838181'> was tagged by <font/><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; tagstatus = "tagged a post"; objWall2.AddedDate = DateTime.Now; if (isphotoalbum) { objWall2.Type = Global.TAG_PHOTO_ALBUM; objWall2.Post = objWall.Post + " <font color='#838181'> was tagged by <font/><a href=\"ViewProfile.aspx?UserId=" + Session["UserId"].ToString() + "\">" + objUser.FirstName + " " + objUser.LastName + "</a>."; notify_Tag(item, userid); tagstatus = "tagged a photo album"; } if (videofileuploaded) { objWall2.Type = Global.TAG_VIDEO; objWall2.EmbedPost = Global.PATH_COMPRESSED_USER_VIDEO + "Thumb/" + uploadedvideothumbname; objWall2.Post = objWall.Post + "<font color='#838181'> was tagged by <font/><a href=\"ViewProfile.aspx?UserId=" + Session["UserId"].ToString() + "\">" + objUser.FirstName + " " + objUser.LastName + "</a>."; notify_Tag(item, userid); tagstatus = "tagged a video"; } if (isVideoLink) { objWall2.Type = Global.TAG_VIDEOLINK; objWall2.EmbedPost = imagesrc; objWall2.Post = objWall.Post + "<font color='#838181'> was tagged by <font/> <a href=\"ViewProfile.aspx?UserId=" + Session["UserId"].ToString() + "\">" + objUser.FirstName + " " + objUser.LastName + "</a>."; notify_Tag(item, userid); tagstatus = "tagged a video"; } if (photofileuploaded) { TagsBO objTags = new TagsBO(); objTags.AtId = photoid; objTags.Type = Global.PHOTO; objTags.UserId = Session["UserId"].ToString(); objTags.FirstName = objUser.FirstName; objTags.LastName = objUser.LastName; objTags.FriendId = item; objTags.FriendFName = objUser2.FirstName; objTags.FriendLName = objUser2.LastName; notify_Tag(item, photoid); TagsBLL.insertTags(objTags); objWall2.Type = Global.TAG_PHOTO; objWall2.EmbedPost = photoid; tagstatus = "tagged a photo"; } if (Session["WebCamPhotoId"] != null) { TagsBO objTags = new TagsBO(); objTags.AtId = Session["WebCamPhotoId"].ToString(); objTags.Type = Global.PHOTO; objTags.UserId = Session["UserId"].ToString(); objTags.FirstName = objUser.FirstName; objTags.LastName = objUser.LastName; objTags.FriendId = item; objTags.FriendFName = objUser2.FirstName; objTags.FriendLName = objUser2.LastName; TagsBLL.insertTags(objTags); objWall2.Type = Global.TAG_PHOTO; objWall2.EmbedPost = Session["WebCamPhotoId"].ToString(); notify_Tag(item, Session["WebCamPhotoId"].ToString()); tagstatus = "tagged a photo"; } RWallPost(" tag post to <a href=\"ViewProfile.aspx?UserId=" + item + "\">" + objUser2.FirstName + " " + objUser2.LastName + "</a>"); string twid= WallBLL.insertWall(objWall2); userbll.notify_subscribers(Session["UserId"].ToString(), objWall2, ConvertUrlsToLinks(tagstatus), twid); } } string wid= WallBLL.insertWall(objWall); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtUpdatePost.ClientID + "').value = '';", true); lblLocation.Text = ""; lblFriendsWith.Text = ""; lblFriendsTag.Text = ""; LiteralUploadPhoto.Text = ""; LiteralUploadVideo.Text = ""; uploadedPhotoliteral = ""; Session["WebCamPhotoId"] = null; videofileuploaded = false; photofileuploaded = false; isVideoLink = false; isphotoalbum = false; lstTag.Clear(); userbll.notify_subscribers(Session["UserId"].ToString(), objWall, ConvertUrlsToLinks(ConvertUrlsToLinks(status)), wid); LoadWall(100); }
protected void UpdatePhoto() { string status = txtUpdatePost.Text; if (lblFriendsWith.Text != "") status += " with " + lblFriendsWith.Text.Remove(lblFriendsWith.Text.LastIndexOf(",")); if (lblLocation.Text != "") status += lblLocation.Text; // if (lblFriendsTag.Text != "") // status += " and Tag to " + lblFriendsTag.Text.Remove(lblFriendsTag.Text.LastIndexOf(",")); UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); WallBO objWall = new WallBO(); objWall.PostedByUserId = Session["UserId"].ToString(); objWall.WallOwnerUserId = userid; objWall.FirstName = objUser.FirstName; objWall.LastName = objUser.LastName; objWall.Post = status; objWall.AddedDate = DateTime.Now; objWall.Type = Global.TEXT_POST; WallBLL.insertWall(objWall); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtUpdatePost.ClientID + "').value = '';", true); lblLocation.Text = ""; lblFriendsWith.Text = ""; LoadWall(100); }
// @@@@@@@@@@@@@@@@@@@@ by Nabeel protected void txtFriendWallTag_TextChanged(object sender, EventArgs e) { string tagstatus="tagged a post"; GridViewRow row = ((GridViewRow)((TextBox)sender).NamingContainer); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); HiddenField hfType = (HiddenField)row.FindControl("HiddenFieldType"); HiddenField hfEmbedPost = (HiddenField)row.FindControl("HiddenFieldEmbedPost"); Literal post = (Literal)row.FindControl("LiteralPost"); TextBox TagExsitingFreindsPost = (TextBox)row.FindControl("txtFriendWallTag"); WallBO objWall2 = new WallBO(); UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); string tagpost = post.Text + "<br/><font color='#838181'> was Tagged by <font/> <a href=\"ViewProfile.aspx?UserId=" + Session["UserId"].ToString() + "\">" + objUser.FirstName + " " + objUser.LastName + "</a>."; UserBO objUser2 = new UserBO(); objUser2 = UserBLL.getUserByUserId(HiddenFieldWallTagId.Value); objWall2.PostedByUserId = HiddenFieldWallTagId.Value; objWall2.WallOwnerUserId = HiddenFieldWallTagId.Value; objWall2.FirstName = objUser2.FirstName; objWall2.LastName = objUser2.LastName; objWall2.Post = tagpost; objWall2.AddedDate = DateTime.Now; objWall2.Type = Global.TAG_POST; if (hfType.Value.Equals(Global.VIDEO.ToString())) { objWall2.Type = Global.TAG_VIDEO; objWall2.EmbedPost = Global.PATH_COMPRESSED_USER_VIDEO + "Thumb/" + uploadedvideothumbname; notify_Tag(HiddenFieldWallTagId.Value, userid); tagstatus = "tagged a video"; } if (hfType.Value.Equals(Global.POST_VIDEOLINK.ToString())) { objWall2.Type = Global.TAG_VIDEOLINK; objWall2.EmbedPost = hfEmbedPost.Value; notify_Tag(HiddenFieldWallTagId.Value, userid); tagstatus = "tagged a video"; } if (hfType.Value.Equals(Global.PHOTO.ToString())) { TagsBO objTags = new TagsBO(); objTags.AtId = hfEmbedPost.Value; objTags.Type = Global.PHOTO; objTags.UserId = Session["UserId"].ToString(); objTags.FirstName = objUser.FirstName; objTags.LastName = objUser.LastName; objTags.FriendId = HiddenFieldWallTagId.Value; objTags.FriendFName = objUser2.FirstName; objTags.FriendLName = objUser2.LastName; notify_Tag(HiddenFieldWallTagId.Value, hfEmbedPost.Value); TagsBLL.insertTags(objTags); objWall2.Type = Global.TAG_PHOTO; objWall2.EmbedPost = hfEmbedPost.Value; tagstatus = "tagged a photo"; } RWallPost(" Tag post to <a href=\"ViewProfile.aspx?UserId=" + HiddenFieldWallTagId.Value + "\">" + objUser2.FirstName + " " + objUser2.LastName + "</a>"); string twid=WallBLL.insertWall(objWall2); TagExsitingFreindsPost.Visible = false; //Response.Redirect("~main.aspx?a=" + HiddenFieldWallTagId.Value + "b=" + aa); //if (txtFriendTag.Text != "" && HiddenFieldTagId.Value.Length > 20) //{ // lblFriendsTag.Text += "<a href=\"ViewProfile.aspx?UserId=" + HiddenFieldTagId.Value + "\">" + txtFriendTag.Text + "</a>,"; // lstTag.Add(HiddenFieldTagId.Value); // txtFriendTag.Text = ""; // HiddenFieldTagId.Value = ""; //} ////////////////////////////////////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 = objWall2.PostedByUserId; objTicker.TickerOwnerUserId = Useritem.FriendUserId; objTicker.FirstName = objWall2.FirstName; objTicker.LastName = objWall2.LastName; objTicker.Post = objWall2.Post; objTicker.Title = ConvertUrlsToLinks(tagstatus); objTicker.AddedDate = DateTime.UtcNow; objTicker.Type = objWall2.Type; objTicker.EmbedPost = objWall2.EmbedPost; objTicker.WallId = twid; 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 = objWall2.Post; objTickerUserTag.Title = "you tag a post"; objTickerUserTag.AddedDate = DateTime.UtcNow; objTickerUserTag.Type = objWall2.Type; objTickerUserTag.EmbedPost = objWall2.EmbedPost; objTickerUserTag.WallId = twid; TickerBLL.insertTicker(objTickerUserTag); //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /// COMMENTS MODULE //// //////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void txtComments_TextChanged(object sender, EventArgs e) { GridViewRow row = ((GridViewRow)((TextBox)sender).NamingContainer); TextBox txtcomments = (TextBox)row.FindControl("txtComments"); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); Literal literalpost = (Literal)row.FindControl("LiteralPost"); HiddenField hfType = (HiddenField)row.FindControl("HiddenFieldType"); HiddenField hfEmbedPost = (HiddenField)row.FindControl("HiddenFieldEmbedPost"); UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); CommentsBO objClass = new CommentsBO(); objClass.MyComments = ConvertUrlsToLinks( txtcomments.Text); objClass.AtId = hfId.Value; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); objClass.FirstName = objUser.FirstName; objClass.LastName = objUser.LastName; if (!objClass.MyComments.Equals("")) { CommentsDAL.insertComments(objClass); } ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtcomments.ClientID + "').value = '';", true); GridView gridviewComments = (GridView)row.FindControl("GridViewComments"); gridviewComments.DataSource = CommentsDAL.getCommentsTop(Global.WALL, hfId.Value, 2); gridviewComments.DataBind(); pnlVideoLink.Visible = false; //LoadComments(); Comment_YouLikes(); YouLikes(); pnlVideoLink.Visible = false; /////////////////////////////////////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 = " Comments on <a href=\"ViewProfile.aspx?UserId=" + userid + "\">" + objFUser.FirstName + " " + objFUser.LastName + "</a> Wall Post"; objWall.AddedDate = DateTime.Now; objWall.Type = Global.TEXT_POST; 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 = "comments on post"; objTicker.AddedDate = DateTime.UtcNow; objTicker.Type = Global.TEXT_POST; 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 = "comments on post"; objTickerUser.AddedDate = DateTime.UtcNow; objTickerUser.Type = Global.TEXT_POST; objTickerUser.EmbedPost = hfEmbedPost.Value; objTickerUser.WallId = hfId.Value; TickerBLL.insertTicker(objTickerUser); //////////////////////////////////////////////////////////////////////////////////// }
protected void ShareStatus(string post) { string status = post; if (lblFriendsWith.Text != "") status += "-- with " + lblFriendsWith.Text.Remove(lblFriendsWith.Text.LastIndexOf(",")); if (lblLocation.Text != "") status += lblLocation.Text; if (lblFriendsTag.Text != "") status += " and Tag to " + lblFriendsTag.Text.Remove(lblFriendsTag.Text.LastIndexOf(",")); UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Session["UserId"].ToString()); WallBO objWall = new WallBO(); objWall.PostedByUserId = Session["UserId"].ToString(); //string temp = Session["ShareWithID"].ToString(); //string temp = Session["ShareWithID"].ToString(); string id = Session["hello"].ToString(); if (Session["ShareWithID"] != null) { if (Session["ShareWithID"].ToString() != "") { objWall.WallOwnerUserId = Session["ShareWithID"].ToString(); UserBO objFriendObj = new UserBO(); objFriendObj = UserBLL.getUserByUserId(Session["ShareWithID"].ToString()); // Sending notification with which the post is beind shared sendEmail(objFriendObj.Email); } else { objWall.WallOwnerUserId = Session["UserId"].ToString(); UserBO objUserEmail = new UserBO(); objUserEmail = UserBLL.getUserByUserId(Session["UserId"].ToString()); sendEmail(objUserEmail.Email); } } else { objWall.WallOwnerUserId = Session["UserId"].ToString(); UserBO objUserEmail = new UserBO(); objUserEmail = UserBLL.getUserByUserId(Session["UserId"].ToString()); sendEmail(objUserEmail.Email); } objWall.FirstName = objUser.FirstName; objWall.LastName = objUser.LastName; objWall.Post = status; objWall.AddedDate = DateTime.Now; objWall.Type = Global.TEXT_POST; WallBLL.insertWall(objWall); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtUpdatePost.ClientID + "').value = '';", true); lblLocation.Text = ""; lblFriendsWith.Text = ""; LoadWall(100); Session["ShareWithID"] = ""; }
protected void RWallPost(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; WallBLL.insertWall(objWall); }
protected void LoadComments() { foreach (GridViewRow gvr in GridViewWall.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { ImageButton imgbutton = ((ImageButton)gvr.FindControl("imgCommentsUser")); string sValue = ((HiddenField)gvr.FindControl("HiddenFieldId")).Value; GridView gridviewComments = (GridView)gvr.FindControl("GridViewComments"); //LinkButton btn = (LinkButton)gvr.FindControl("LinkButton2"); WallBO objWall = new WallBO(); objWall = WallBLL.getWallByWallId(sValue); if (objWall.Type == Global.POST_VIDEOLINK || objWall.Type == Global.VIDEO) { //ButtonField bf = (ButtonField) gvr.FindControl("Link"); // btn.Visible = true; } gridviewComments.DataSource = CommentsDAL.getCommentsTop(Global.WALL, sValue, 2); gridviewComments.DataBind(); imgbutton.ImageUrl = Global.PROFILE_PICTURE + Session["UserId"].ToString() + ".jpg"; imgbutton.PostBackUrl = "ViewProfile.aspx?UserId=" + Session["UserId"].ToString(); } } }
/////////////////////////////////////////////////////////////// // UPDATE FUNCTION ////////////////////////////////////////////////////////////// public static void updateWall(WallBO objClass) { MongoCollection<Wall> objCollection = db.GetCollection<Wall>("c_Wall"); var query = Query.EQ("_id", ObjectId.Parse(objClass.Id)); var sortBy = SortBy.Descending("_id"); var update = Update.Set("PostedByUserId", ObjectId.Parse(objClass.PostedByUserId)) .Set("WallOwnerUserId", ObjectId.Parse(objClass.WallOwnerUserId)) .Set("FirstName", objClass.FirstName) .Set("LastName", objClass.LastName) .Set("Post", objClass.Post) .Set("Type", objClass.Type) .Set("AddedDate", objClass.AddedDate) ; var result = objCollection.FindAndModify(query, sortBy, update, true); }
/////////////////////////////////////////////////////////////// // INSERT FUNCTION ////////////////////////////////////////////////////////////// public static string insertWall(WallBO objClass) { MongoCollection<BsonDocument> objCollection = db.GetCollection<BsonDocument>("c_Wall"); BsonDocument doc = new BsonDocument { { "PostedByUserId" , ObjectId.Parse(objClass.PostedByUserId) }, { "WallOwnerUserId", ObjectId.Parse(objClass.WallOwnerUserId) }, { "FirstName", objClass.FirstName }, { "LastName", objClass.LastName }, { "Post" , objClass.Post }, { "Type", objClass.Type }, { "AddedDate", objClass.AddedDate }, {"EmbedPost",objClass.EmbedPost} }; var rt = objCollection.Insert(doc); return doc["_id"].ToString(); }
/////////////////////////////////////////////////////////////// // SELECT BY PARAMETER ////////////////////////////////////////////////////////////// public static WallBO getWallByWallId(string Id) { MongoCollection<Wall> objCollection = db.GetCollection<Wall>("c_Wall"); WallBO objClass = new WallBO(); foreach (Wall item in objCollection.Find(Query.EQ("_id", ObjectId.Parse(Id)))) { objClass.Id = item._id.ToString(); objClass.PostedByUserId = item.PostedByUserId.ToString(); objClass.WallOwnerUserId = item.WallOwnerUserId.ToString(); objClass.FirstName = item.FirstName; objClass.LastName = item.LastName; objClass.Type = item.Type; objClass.Post = item.Post; objClass.EmbedPost = item.EmbedPost; objClass.AddedDate = item.AddedDate; break; } return objClass; }