public void updateComments(CommentsBO objClass) { MongoCollection<Comments> objCollection = db.GetCollection<Comments>("c_Comments"); 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("MyComments", objClass.MyComments) .Set("Type", objClass.Type) .Set("FirstName", objClass.FirstName) .Set("LastName", objClass.LastName) ; var result = objCollection.FindAndModify(query, sortBy, update, true); }
public string insertComments(CommentsBO objClass) { MongoCollection<BsonDocument> objCollection = db.GetCollection<BsonDocument>("c_Comments"); BsonDocument doc = new BsonDocument { { "UserId" , ObjectId.Parse(objClass.UserId) }, { "AtId" , ObjectId.Parse(objClass.AtId) }, { "MyComments" , objClass.MyComments }, { "Type", objClass.Type }, { "FirstName", objClass.FirstName }, { "LastName", objClass.LastName }, { "AddedDate", DateTime.Now }, }; var rt = objCollection.Insert(doc); return doc["_id"].ToString(); }
protected void InsertComments() { UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Userid); CommentsBO objClass = new CommentsBO(); objClass.MyComments = txtComments.Text; objClass.AtId = Photoid; objClass.Type = Global.VIDEO; objClass.UserId = Userid; 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); List<string> lst = new List<string>(); lst = CommentsDAL.getCommentsUserIdbyAtId(Global.VIDEO, Photoid); if (Isfollow == true) { foreach (string item in lst) { UserBO objUserNotify = new UserBO(); objUserNotify = UserBLL.getUserByUserId(item); msgtext = "Dear Pyramid Plus user, Comments on your video. "; NotificationBO objNotify = new NotificationBO(); objNotify.MyNotification = "<a href=\"ViewProfile.aspx?UserId=" + Userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> comments on <a href=\"ViewVideo.aspx?VideoId=" + Photoid + "\">video</a>"; objNotify.AtId = Photoid; objNotify.Type = Global.VIDEO; objNotify.UserId = item; objNotify.FirstName = objUserNotify.FirstName; objNotify.LastName = objUserNotify.LastName; objNotify.FriendId = Userid; objNotify.FriendFName = objUser.FirstName; objNotify.FriendLName = objUser.LastName; objNotify.Status = false; // ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objUserNotify.Email); NotificationBLL.insertNotification(objNotify); } } txtComments.Text = ""; LoadDataListComments(); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /// 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); //////////////////////////////////////////////////////////////////////////////////// }
public void updateComments(CommentsBO objClass) { strategyInterface.updateComments(objClass); }
//Executes the strategy public string insertComments(CommentsBO objClass) { return strategyInterface.insertComments(objClass); }