public static string insertTags(TagsBO objClass) { MongoCollection <BsonDocument> objCollection = db.GetCollection <BsonDocument>("c_Tags"); var query = Query.And( Query.EQ("Type", objClass.Type), Query.EQ("AtId", ObjectId.Parse(objClass.AtId)), Query.EQ("FriendId", ObjectId.Parse(objClass.FriendId))); var result = objCollection.Find(query); if (!result.Any()) { BsonDocument doc = new BsonDocument { { "UserId", ObjectId.Parse(objClass.UserId) }, { "AtId", ObjectId.Parse(objClass.AtId) }, { "FirstName", objClass.FirstName }, { "LastName", objClass.LastName }, { "Type", objClass.Type }, { "FriendId", ObjectId.Parse(objClass.FriendId) }, { "FriendFName", objClass.FriendFName }, { "FriendLName", objClass.FriendLName }, }; var rt = objCollection.Insert(doc); return(doc["_id"].ToString()); } else { return(null); } }
protected void txtFriendSearch_TextChanged(object sender, EventArgs e) { string fid = HiddenField1.Value; if (fid.Length > 20) { UserBO objFriend = new UserBO(); objFriend = UserBLL.getUserByUserId(fid); UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Userid); //Response.Write(fid); TagsBO objTags = new TagsBO(); objTags.AtId = Photoid; objTags.Type = Global.PHOTO; objTags.UserId = Userid; objTags.FirstName = objUser.FirstName; objTags.LastName = objUser.LastName; objTags.FriendId = fid; objTags.FriendFName = objFriend.FirstName; objTags.FriendLName = objFriend.LastName; TagsBLL.insertTags(objTags); LoadDataListTags(); List <string> lst = new List <string>(); lst = TagsBLL.getTagsFriendId(Global.PHOTO, Photoid); LoadDataListComments(); if (Isfollow == true) { foreach (string item in lst) { UserBO objUserNotify = new UserBO(); objUserNotify = UserBLL.getUserByUserId(item); NotificationBO objNotify = new NotificationBO(); objNotify.MyNotification = "<a href=\"ViewProfile.aspx?UserId=" + Userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> tags on <a href=\"ViewPhoto.aspx?PhotoId=" + Photoid + "\">photo</a>"; objNotify.AtId = Photoid; objNotify.Type = Global.PHOTO; objNotify.UserId = item; objNotify.FirstName = objUserNotify.FirstName; objNotify.LastName = objUserNotify.LastName; objNotify.FriendId = Userid; objNotify.FriendFName = objUser.FirstName; objNotify.FriendLName = objUser.LastName; msgtext = "Dear Pyramid Plus user," + objUser.FirstName + " " + objUser.LastName + " tags you photo "; // ThreadPool.QueueUserWorkItem(new WaitCallback(sendEmail), (object)objUserNotify.Email); NotificationBLL.insertNotification(objNotify); } } } }
protected void txtFriendSearch_TextChanged(object sender, EventArgs e) { string fid = HiddenField1.Value; if (fid.Length > 20) { UserBO objFriend = new UserBO(); objFriend = UserBLL.getUserByUserId(fid); UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Userid); //Response.Write(fid); TagsBO objTags = new TagsBO(); objTags.AtId = Albumid; objTags.Type = Global.PHOTO_ALBUM; objTags.UserId = Userid; objTags.FirstName = objUser.FirstName; objTags.LastName = objUser.LastName; objTags.FriendId = fid; objTags.FriendFName = objFriend.FirstName; objTags.FriendLName = objFriend.LastName; TagsBLL.insertTags(objTags); LoadDataListTags(); List <string> lst = new List <string>(); lst = TagsBLL.getTagsFriendId(Global.PHOTO_ALBUM, Albumid); LoadDataListComments(); foreach (string item in lst) { UserBO objUserNotify = new UserBO(); objUserNotify = UserBLL.getUserByUserId(item); NotificationBO objNotify = new NotificationBO(); objNotify.MyNotification = "<a href=\"ViewProfile.aspx?UserId=" + Userid + "\">" + objUser.FirstName + " " + objUser.LastName + "</a> tags on <a href=\"ViewPhotoAlbum.aspx?AlbumId=" + Albumid + "\">photo album</a>"; objNotify.AtId = Albumid; 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; msgtext = "Dear Pyramid Plus user," + objUser.FirstName + " " + objUser.LastName + " tags you video "; NotificationBLL.insertNotification(objNotify); } } }
public static void updateTags(TagsBO objClass) { MongoCollection <Tags> objCollection = db.GetCollection <Tags>("c_Tags"); var query = Query.EQ("_id", ObjectId.Parse(objClass.Id)); var sortBy = SortBy.Descending("_id"); var update = Update.Set("UserId", ObjectId.Parse(objClass.UserId)) .Set("FirstName", objClass.FirstName) .Set("LastName", objClass.LastName) .Set("AtId", ObjectId.Parse(objClass.AtId)) .Set("Type", objClass.Type) .Set("FriendId", ObjectId.Parse(objClass.AtId)) .Set("FriendFName", objClass.FirstName) .Set("FriendLName", objClass.LastName) ; var result = objCollection.FindAndModify(query, sortBy, update, true); }
public static TagsBO getTagsByTagsId(string Id) { MongoCollection <Tags> objCollection = db.GetCollection <Tags>("c_Tags"); TagsBO objClass = new TagsBO(); foreach (Tags item in objCollection.Find(Query.EQ("_id", ObjectId.Parse(Id)))) { objClass.Id = item._id.ToString(); objClass.UserId = item.UserId.ToString(); objClass.FirstName = item.FirstName; objClass.LastName = item.LastName; objClass.AtId = item.AtId.ToString(); objClass.FriendId = item.AtId.ToString(); objClass.Type = item.Type; objClass.FriendFName = item.FirstName; objClass.FriendLName = item.LastName; break; } return(objClass); }
public static void updateTags(TagsBO objTags) { TagsDAL.updateTags(objTags); }
public static string insertTags(TagsBO objTags) { return(TagsDAL.insertTags(objTags)); }