Esempio n. 1
0
 private void SendNotification(Feeling feeling, Comment comment, List<User> users, User feelingUser)
 {
     try
     {
         new PushNotificationService().SendCommentNotifications(feeling, comment, users, SaveResponse, feelingUser);
     }
     catch (Exception e)
     {
         LogWriter.Write(e.ToString());
     }
 }
        public void SendCommentNotifications(Feeling feeling, Comment comment, List<User> users, Action<string> action, User feelingUser)
        {
            _action = action;


            SendNotifications(comment.User, new List<User> { feelingUser },
                string.Format("Comment '{0}' on feeling: '{1}' from ", comment.Text, feeling.FeelingText), feeling);

            SendNotifications(comment.User, users, string.Format("Comment '{0}' on comment", comment.Text), feeling);

        }
Esempio n. 3
0
        private dynamic SendNotification(dynamic feelingId, Comment comment)
        {

            var feeling =
                Context.Feelings.FindOne(Query.EQ("_id", new BsonObjectId(new ObjectId(feelingId.ToString()))));
            var feelingUser = Context.Users.FindOne(Query.EQ("UserName", new BsonString(feeling.UserName))); //prits
            var commentUsers =
                feeling.Comments.Select(c => c.User)
                    .Where(x => x != feeling.UserName && x != comment.User)
                    .Distinct()
                    .ToList(); //neo
            var bsonValues = new List<BsonValue>();
            commentUsers.ForEach(c => bsonValues.Add(BsonValue.Create(c)));
            var users = Context.Users.Find(Query.In("UserName", bsonValues)).ToList();
            //.First(u => u.UserName.Equals(feeling.UserName));
            SendNotification(feeling, comment, users, feelingUser);
            return true;
        }