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; } UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(SessionClass.getUserId()); WallBO objWall = new WallBO(); string PostedByUserId = SessionClass.getUserId(); string WallOwnerUserId = string.Empty; if (SessionClass.getShareWithID() != null) { PostedByUserId = Session["UserId"].ToString(); if (SessionClass.getShareWithID() != "") { WallOwnerUserId = SessionClass.getShareWithID(); UserBO objFriendObj = new UserBO(); objFriendObj = UserBLL.getUserByUserId(SessionClass.getShareWithID()); if (!CheckBox1.Checked) { ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objFriendObj.Email); notif(SessionClass.getShareWithID(), SessionClass.getPostID()); } List <string> temp = (List <string>)SessionClass.getTaggedFriends(); if (temp != null) { foreach (string str in temp) { UserBO objFriendObj1 = new UserBO(); objFriendObj1 = UserBLL.getUserByUserId(str); //sendEmail(objFriendObj1.Email); if (!CheckBox1.Checked) { ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objFriendObj1.Email); notif(str, SessionClass.getPostID()); } //Inserting follow post record for each tagged user FollowPostBO fp = new FollowPostBO(); fp.AtId = SessionClass.getPostID(); fp.UserId = objFriendObj1.Id; fp.FirstName = objFriendObj1.FirstName; fp.LastName = objFriendObj1.LastName; fp.Type = Global.WALL; FollowPostBLL.insertFollowPost(fp); } } } else { WallOwnerUserId = SessionClass.getUserId(); UserBO objUserEmail = new UserBO(); objUserEmail = UserBLL.getUserByUserId(SessionClass.getUserId()); // Sending notification with which the post is beind shared if (!CheckBox1.Checked) { ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objUserEmail.Email); notif(SessionClass.getShareWithID(), SessionClass.getPostID()); } //Sending notification to all tagged friends List <string> temp = (List <string>)SessionClass.getTaggedFriends(); if (temp != null) { foreach (string str in temp) { UserBO objFriendObj1 = new UserBO(); objFriendObj1 = UserBLL.getUserByUserId(str); if (!CheckBox1.Checked) { ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objFriendObj1.Email); } notif(str, SessionClass.getPostID()); //Inserting follow post record for each tagged user FollowPostBO fp = new FollowPostBO(); fp.AtId = SessionClass.getPostID(); fp.UserId = objFriendObj1.Id; fp.FirstName = objFriendObj1.FirstName; fp.LastName = objFriendObj1.LastName; fp.Type = Global.WALL; FollowPostBLL.insertFollowPost(fp); } } } } else { WallOwnerUserId = SessionClass.getUserId(); UserBO objUserEmail = new UserBO(); objUserEmail = UserBLL.getUserByUserId(SessionClass.getUserId()); if (!CheckBox1.Checked) { ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objUserEmail.Email); } //Sending notification to all tagged friends List <string> temp = (List <string>)SessionClass.getTaggedFriends(); if (temp != null) { foreach (string str in temp) { UserBO objFriendObj1 = new UserBO(); objFriendObj1 = UserBLL.getUserByUserId(str); // sendEmail(objFriendObj1.Email); if (!CheckBox1.Checked) { ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objFriendObj1.Email); notif(str, SessionClass.getPostID()); } //Inserting follow post record for each tagged user FollowPostBO fp = new FollowPostBO(); fp.AtId = SessionClass.getPostID(); fp.UserId = objFriendObj1.Id; fp.FirstName = objFriendObj1.FirstName; fp.LastName = objFriendObj1.LastName; fp.Type = Global.WALL; FollowPostBLL.insertFollowPost(fp); } } } PostProperties postProp = new PostProperties(); postProp.PostText = "Share a post " + status; postProp.WallOwnerUserId = WallOwnerUserId; postProp.PostedByUserId = PostedByUserId; postProp.PostType = SessionClass.getPostType(); postProp.EmbedPost = SessionClass.getEmbedPost(); PostOnWall.post(postProp); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "myScript", "document.getElementById('" + txtUpdatePost.ClientID + "').value = '';", true); lblLocation.Text = ""; lblFriendsWith.Text = ""; LoadWall(100); Session["ShareWithID"] = ""; Session["TaggedFriends"] = null; }