public static void unFollowPost(FollowPostBO objClass) { MongoCollection <FollowPost> objCollection = db.GetCollection <FollowPost>("c_FollowPost"); var query = Query.And( Query.EQ("Type", objClass.Type), Query.EQ("AtId", ObjectId.Parse(objClass.AtId)), Query.EQ("UserId", ObjectId.Parse(objClass.UserId))); var result = objCollection.FindAndRemove(query, SortBy.Ascending("_id")); }
// 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); }
public static void updateFollowPost(FollowPostBO objClass) { MongoCollection <FollowPost> objCollection = db.GetCollection <FollowPost>("c_FollowPost"); var query = Query.EQ("_id", ObjectId.Parse(objClass.Id)); var sortBy = SortBy.Descending("_id"); var update = Update.Set("UserId", ObjectId.Parse(objClass.UserId)) .Set("AtId", ObjectId.Parse(objClass.AtId)) .Set("Type", objClass.Type) .Set("FirstName", objClass.FirstName) .Set("LastName", objClass.LastName) ; var result = objCollection.FindAndModify(query, sortBy, update, true); }
public static void insertFollowPost(FollowPostBO objClass) { MongoCollection <BsonDocument> objCollection = db.GetCollection <BsonDocument>("c_FollowPost"); BsonDocument doc = new BsonDocument { { "UserId", ObjectId.Parse(objClass.UserId) }, { "AtId", ObjectId.Parse(objClass.AtId) }, { "Type", objClass.Type }, { "FirstName", objClass.FirstName }, { "LastName", objClass.LastName }, { "AddedDate", DateTime.Now }, }; var rt = objCollection.Insert(doc); }
public static FollowPostBO getFollowPostByFollowPostId(string Id) { MongoCollection <FollowPost> objCollection = db.GetCollection <FollowPost>("c_FollowPost"); FollowPostBO objClass = new FollowPostBO(); foreach (FollowPost item in objCollection.Find(Query.EQ("_id", ObjectId.Parse(Id)))) { objClass.Id = item._id.ToString(); objClass.UserId = item.UserId.ToString(); objClass.AtId = item.AtId.ToString(); objClass.Type = item.Type; objClass.FirstName = item.FirstName; objClass.LastName = item.LastName; break; } return(objClass); }
public static bool youFollowPost(FollowPostBO objClass) { MongoCollection <BsonDocument> objCollection = db.GetCollection <BsonDocument>("c_FollowPost"); var query = Query.And( Query.EQ("Type", objClass.Type), Query.EQ("AtId", ObjectId.Parse(objClass.AtId)), Query.EQ("UserId", ObjectId.Parse(objClass.UserId))); var result = objCollection.Find(query); if (result.Any()) { return(true); } else { return(false); } }
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; }
public static bool youFollowPost(FollowPostBO objClass) { return FollowPostDAL.youFollowPost(objClass); }
public static void updateFollowPost(FollowPostBO objFollowPost) { FollowPostDAL.updateFollowPost(objFollowPost); }
public static void unFollowPost(FollowPostBO objClass) { FollowPostDAL.unFollowPost(objClass); }
public static void insertFollowPost(FollowPostBO objFollowPost) { FollowPostDAL.insertFollowPost(objFollowPost); }
public static bool youFollowPost(FollowPostBO objClass) { return(FollowPostDAL.youFollowPost(objClass)); }