public void CreateFeedEntryTest()
        {
            CommentsFeed target = new CommentsFeed(null, null);
            CommentEntry actual = target.CreateFeedEntry() as CommentEntry;

            Assert.IsNotNull(actual, "That feed better creates a CommentEntry.");
        }
        private void SetupCommentEvents()
        {
            var commentTap = new TapGestureRecognizer();

            commentTap.Tapped += (s, a) =>
            {
                Comment.IsVisible      = false;
                CommentEntry.IsVisible = true;
                CommentEntry.Text      = Comment.Text;
                if (CommentEntry.Text == "Click to add comment")
                {
                    CommentEntry.Text = null;
                }
                CommentEntry.Focus();
            };
            Comment.GestureRecognizers.Add(commentTap);

            CommentEntry.Unfocused += (s, a) =>
            {
                Comment.IsVisible      = true;
                CommentEntry.IsVisible = false;
                if (CommentEntry?.Text?.Length > 0)
                {
                    Comment.Text = CommentEntry.Text;
                    if (_vm.SetComment(CommentEntry.Text))
                    {
                        _vm.Member.Comment = CommentEntry.Text;
                    }
                }
            };
        }
Exemplo n.º 3
0
        static public void AddComment(Comment comment)
        {
            CommentsDataSource comDS = new CommentsDataSource();
            CommentEntry       comm  = new CommentEntry();

            Converter.CopyFields(comment, comm);
            comDS.AddComment(comm);
        }
Exemplo n.º 4
0
        static public void Update(Comment comment)
        {
            CommentsDataSource comDS = new CommentsDataSource();
            CommentEntry       comm  = comDS.GetById(comment.RowKey);

            Converter.CopyFields(comment, comm);
            comDS.Update(comm);
        }
Exemplo n.º 5
0
        public void Add_disallow_entry_Test()
        {
            var   target = new UserAgentEntry();
            Entry entry  = new CommentEntry();

            target.AddEntry(entry);
            Assert.NotEmpty(target.Entries);
            Assert.Empty(target.AllowEntries);
            Assert.Empty(target.DisallowEntries);
        }
        public void Add_disallow_entry_Test()
        {
            var   target = new UserAgentEntry();
            Entry entry  = new CommentEntry();

            target.AddEntry(entry);
            Assert.AreNotEqual(0, target.Entries.Count());
            Assert.AreEqual(0, target.AllowEntries.Count());
            Assert.AreEqual(0, target.DisallowEntries.Count());
        }
        public IHttpActionResult Post(string email, int contestType, string comment)
        {
            var customer        = _customerManagementService.GetCustomerByEmail(email);
            var newCommentEntry = new CommentEntry();

            newCommentEntry.CommenterId   = customer.Id.ToString();
            newCommentEntry.ContestDate   = DateTime.Now;
            newCommentEntry.ContestType   = contestType;
            newCommentEntry.CommentString = comment;
            return(Ok());
        }
        public void CommentEntryReplyToTest()
        {
            CommentEntry target = new CommentEntry();

            Assert.AreEqual(target.Replies.Count, 0, " list should be emptyl");
            CommentEntry other = new CommentEntry();

            other.SelfUri = new AtomUri("http://www.test.org");
            target.ReplyTo(other);
            Assert.AreEqual(target.Replies.Count, 1, " list should be emptyl");
        }
Exemplo n.º 9
0
        static public Comment GetComment(string id)
        {
            CommentsDataSource comDS = new CommentsDataSource();

            CommentEntry comm = comDS.GetById(id);

            return(CreateCommentEnumerator(new List <CommentEntry>()
            {
                comm
            }).FirstOrDefault());
        }
Exemplo n.º 10
0
        public ActionResult Create(CommentModel commentModel)
        {
            CommentEntry commentEntry = new CommentEntry();

            commentEntry.FirstName = commentModel.FirstName;
            commentEntry.LastName  = commentModel.LastName;
            commentEntry.Text      = commentModel.Comment;
            commentEntry.Time      = DateTime.Now;

            _db.Entries.Add(commentEntry);
            _db.SaveChanges();

            return(RedirectToAction("Comments"));
        }
Exemplo n.º 11
0
        private static string GetParentDisplayName(CommentEntry comm, Dictionary <string, string> requests, Dictionary <string, string> entities)
        {
            String result;

            if (comm.ParentType == "Request")
            {
                requests.TryGetValue(comm.DatasetId, out result);
            }
            else
            {
                entities.TryGetValue(comm.PartitionKey + comm.DatasetId, out result);
            }

            return(result);
        }
Exemplo n.º 12
0
 static public Comment FromTableEntry(CommentEntry comm)
 {
     return(new Comment()
     {
         RowKey = comm.RowKey,
         Author = comm.Username,
         Body = comm.Comment,
         ParentName = comm.DatasetId,
         ParentType = comm.ParentType,
         ParentContainer = comm.PartitionKey,
         Posted = comm.PostedOn,
         Status = comm.Status,
         Subject = comm.Subject,
         Notify = comm.Notify,
         Type = comm.Type,
         Email = comm.Email
     });
 }
Exemplo n.º 13
0
        private string FindMostRecentComment()
        {
            List <CommentEntry> commentList = new List <CommentEntry>();

            foreach (string database in globalvariables.DatabaseLocations)
            {
                using (SQLiteConnection sqlite_connection = new SQLiteConnection("Data Source=" + database + ";Version=3;"))
                {
                    sqlite_connection.Open();

                    string sql = "select commentText,transactionDateTime,Comments.userID from Comments inner join Transactions on Comments.transactionID = Transactions.transactionID";
                    using (SQLiteCommand command = new SQLiteCommand(sql, sqlite_connection))
                    {
                        using (SQLiteDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                CommentEntry ce = new CommentEntry();
                                ce.Comment             = reader["commentText"] as string ?? "";
                                ce.UserID              = reader["userID"] as string ?? "";
                                ce.TransactionDateTime = (long)reader["transactionDateTime"];
                                commentList.Add(ce);
                            }
                            reader.Close();
                            sqlite_connection.Close();
                            command.Dispose();
                        }
                    }
                }
            }
            long         latestDateTime = 0;
            CommentEntry latestComment  = new CommentEntry();

            foreach (CommentEntry ce in commentList)
            {
                if (ce.TransactionDateTime > latestDateTime && ce.UserID == SelectedUser)
                {
                    latestComment  = ce;
                    latestDateTime = ce.TransactionDateTime;
                }
            }
            return(latestComment.Comment);
        }
Exemplo n.º 14
0
            static public CommentEntry CopyFields(Comment source, CommentEntry target)
            {
                if (!String.IsNullOrEmpty(source.RowKey))
                {
                    target.RowKey = source.RowKey;
                }

                target.Username     = source.Author;
                target.Comment      = source.Body;
                target.DatasetId    = source.ParentName;
                target.ParentType   = source.ParentType;
                target.PartitionKey = source.ParentContainer;
                target.PostedOn     = source.Posted;
                target.Status       = source.Status;
                target.Subject      = source.Subject;
                target.Type         = source.Type;
                target.Notify       = source.Notify;
                target.Email        = source.Email;

                return(target);
            }
Exemplo n.º 15
0
        public JsonResult TrashComment(int commentId, string token)
        {
            if (!CheckToken(token))
            {
                throw new Exception("Possible unauthorized access");
            }

            var commentEntry = new CommentEntry {
                CommentID = commentId, DeleteStatus = true, DeleteStatusString = "Delete succeeded"
            };

            try
            {
                _commentRepository.DeleteCommentByCommentID(commentId);
            }
            catch
            {
                commentEntry.DeleteStatus       = false;
                commentEntry.DeleteStatusString = "Unable to delete the comment";
            }
            return(Json(commentEntry, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 16
0
        private void loadItemsFromDB()
        {
            // UsernameBox.Items.Clear();
            foreach (string database in globalvariables.DatabaseLocations)
            {
                using (SQLiteConnection sqlite_connection = new SQLiteConnection("Data Source=" + database + ";Version=3;"))
                {
                    sqlite_connection.Open();

                    string sql = "select V_Key,Stig_Name,System_Name,entryID,transactionID,commentText,userID from Comments;";
                    using (SQLiteCommand command = new SQLiteCommand(sql, sqlite_connection))
                    {
                        using (SQLiteDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                CommentEntry ce = new CommentEntry();
                                ce.Comment = (string)reader["commentText"];
                                ce.UserID  = reader["userID"] as string ?? "";
                                if (!UserAccounts.Contains(reader["userID"] as string))
                                {
                                    UserAccounts.Add(reader["userID"] as string);
                                }
                                ce.TransactionID = reader["transactionID"] as string ?? "";
                                ce.EntryID       = reader["entryID"] as string ?? "";
                                ce.System_Name   = reader["System_Name"] as string ?? "";
                                ce.Stig_Name     = reader["Stig_Name"] as string ?? "";
                                ce.V_Key         = reader["V_Key"] as string ?? "";
                                Comments.Add(ce);
                            }
                            reader.Close();
                            sqlite_connection.Close();
                            command.Dispose();
                        }
                    }
                }
            }
        }
        public static string CreateComments(BugEntry entry)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Comments<br>------------------------------------<br>");

            if (entry.Comments == null)
            {
                entry.Comments = new List <CommentEntry>();
            }

            for (int i = 0; i < entry.Comments.Count; i++)
            {
                CommentEntry c = entry.Comments[i];
                if (c != null)
                {
                    sb.AppendFormat("Comment by: {0} - {1} {2}<br><br>{3}", c.Submitter,
                                    c.Created.ToShortDateString(), c.Created.ToShortTimeString(),
                                    c.Comment);
                }
            }

            return(sb.ToString());
        }
        public void CommentEntryConstructorTest()
        {
            CommentEntry target = new CommentEntry();

            Assert.IsNotNull(target);
        }
Exemplo n.º 19
0
 public void OnAddCommentSuccess(CommentEntry p0)
 {
     Toast.MakeText(this, "Comment add success: " + p0.CommentId, ToastLength.Short).Show();
 }
Exemplo n.º 20
0
 public void OnDeleteCommentSuccess(CommentEntry p0)
 {
     Toast.MakeText(this, $"Success {p0.CommentId}", ToastLength.Short).Show();
 }
Exemplo n.º 21
0
 public void OnUpdateCommentSuccess(CommentEntry p0)
 {
     Toast.MakeText(this, $"Comment updated {p0.CommentId}", ToastLength.Short).Show();
 }
        public void CommentEntryConstructorTest()
        {
            CommentEntry target = new CommentEntry();

            Assert.IsNotNull(target, "object should not be null");
        }
Exemplo n.º 23
0
        public void EntryType_Test()
        {
            var target = new CommentEntry();

            Assert.AreEqual(EntryType.Comment, target.Type);
        }
Exemplo n.º 24
0
        public void Format_should_format_move_text()
        {
            var sut    = new MoveTextFormatter();
            var entry1 =
                new HalfMoveEntry(new Move
            {
                Type         = MoveType.Capture,
                Piece        = PieceType.Knight,
                TargetSquare = new Square(File.E, 5),
                Annotation   = MoveAnnotation.Good
            })
            {
                MoveNumber = 37
            };

            var entry2 = new NAGEntry(13);

            var rav1 = new CommentEntry("comment");
            var rav2 =
                new HalfMoveEntry(new Move
            {
                Type         = MoveType.Simple,
                Piece        = PieceType.Knight,
                TargetSquare = new Square(File.E, 3),
                Annotation   = MoveAnnotation.Blunder
            })
            {
                MoveNumber = 37
            };

            var entry3 = new RAVEntry(new MoveTextEntryList {
                rav1, rav2
            });

            var entry4 =
                new HalfMoveEntry(new Move
            {
                Type         = MoveType.Simple,
                Piece        = PieceType.Rook,
                TargetSquare = new Square(File.D, 8)
            })
            {
                MoveNumber = 37, IsContinued = true
            };

            var entry5 = new MovePairEntry(
                new Move {
                Type = MoveType.Simple, TargetSquare = new Square(File.H, 4)
            },
                new Move {
                Type = MoveType.Simple, Piece = PieceType.Rook, TargetSquare = new Square(File.D, 5)
            })
            {
                MoveNumber = 38
            };

            var entry6 = new GameEndEntry(GameResult.Draw);
            var entry7 = new CommentEntry("game ends in draw, whooot");

            var moveText = new List <MoveTextEntry> {
                entry1, entry2, entry3, entry4, entry5, entry6, entry7
            };

            Assert.AreEqual("37. Nxe5! $13 ({comment} 37. Ne3??) 37... Rd8 38. h4 Rd5 ½-½ {game ends in draw, whooot}", sut.Format(moveText));
        }
Exemplo n.º 25
0
        private bool userFilter(object item)
        {
            CommentEntry ce = item as CommentEntry;

            return(ce.UserID == selecteduser);
        }
 public void OnDeleteCommentSuccess(CommentEntry p0)
 {
     Toast.MakeText(this, "Comment delete success: " + p0.CommentId, ToastLength.Short).Show();
 }
 public void Add(CommentEntry entity)
 {
     _commentEntryRepository.Create(entity);
 }
 public void Update(CommentEntry entity)
 {
     entity.Id = String.IsNullOrEmpty(entity.IdString) ? entity.Id : new ObjectId(entity.IdString);
     _commentEntryRepository.Update(entity);
 }
Exemplo n.º 29
0
		public static void AddComment( CommentEntry entry )
		{
			m_Instance.m_AllComments[entry.CommentID] = entry;
		}
Exemplo n.º 30
0
        public void Format_should_format_move_text()
        {
            var sut = new MoveTextFormatter();
            var entry1 =
                new HalfMoveEntry(new Move
                    {
                        Type = MoveType.Capture,
                        Piece = PieceType.Knight,
                        TargetSquare = new Square(File.E, 5),
                        Annotation = MoveAnnotation.Good
                    }) { MoveNumber = 37 };

            var entry2 = new NAGEntry(13);

            var rav1 = new CommentEntry("comment");
            var rav2 =
                new HalfMoveEntry(new Move
                    {
                        Type = MoveType.Simple,
                        Piece = PieceType.Knight,
                        TargetSquare = new Square(File.E, 3),
                        Annotation = MoveAnnotation.Blunder
                    }) { MoveNumber = 37 };

            var entry3 = new RAVEntry(new MoveTextEntryList { rav1, rav2 });

            var entry4 =
                new HalfMoveEntry(new Move
                    {
                        Type = MoveType.Simple,
                        Piece = PieceType.Rook,
                        TargetSquare = new Square(File.D, 8)
                    }) { MoveNumber = 37, IsContinued = true };

            var entry5 = new MovePairEntry(
                new Move { Type = MoveType.Simple, TargetSquare = new Square(File.H, 4) },
                new Move { Type = MoveType.Simple, Piece = PieceType.Rook, TargetSquare = new Square(File.D, 5) }) { MoveNumber = 38 };

            var entry6 = new GameEndEntry(GameResult.Draw);
            var entry7 = new CommentEntry("game ends in draw, whooot");

            var moveText = new List<MoveTextEntry> { entry1, entry2, entry3, entry4, entry5, entry6, entry7 };

            Assert.AreEqual("37. Nxe5! $13 ({comment} 37. Ne3??) 37... Rd8 38. h4 Rd5 ½-½ {game ends in draw, whooot}", sut.Format(moveText));
        }