コード例 #1
0
            private static ConfessLoader GetConfessLoader(Confess dt, string key)
            {
                ConfessLoader loader = new ConfessLoader
                {
                    Body         = dt.Body,
                    Category     = dt.Category,
                    Date         = Shared.TimeAgo.Ago(dt.Date),//$"{dt.Date.ToLongDateString()} {dt.Date.ToShortTimeString()}",
                    DateReal     = dt.Date,
                    DisLikes     = DislikeClass.GetCount(dt.Guid, false),
                    Likes        = LikeClass.GetCount(dt.Guid, false),
                    Guid         = dt.Guid,
                    Owner_Guid   = dt.Owner_Guid,
                    Title        = dt.Title,
                    CommentCount = CommentClass.GetCommentCount(dt.Guid),
                    Seen         = SeenClass.GetCount(dt.Guid)
                };

                //load colors
                if (LikeClass.CheckExistence(dt.Guid, false, key))
                {
                    loader.LikeColorString = "#1976D2";
                }

                if (DislikeClass.CheckExistence(dt.Guid, false, key))
                {
                    loader.DislikeColorString = "#1976D2";
                }

                return(loader);
            }
コード例 #2
0
 private void parseJSONCommentList(String jsonCommentList)
 {
     try
     {
         var commentListJSONObj = JsonConvert.DeserializeObject <RootCommentClass>(jsonCommentList);
         if (commentListJSONObj.success == true)
         {
             this.total_comment = Int32.Parse(commentListJSONObj.total_quantity);
             listComment        = new List <CommentClass>();
             foreach (var obj in commentListJSONObj.items)
             {
                 commentObj            = new CommentClass();
                 commentObj.comment_id = obj.comment_id;
                 commentObj.body_value = obj.body_value;
                 commentObj.name       = obj.name;
                 commentObj.subject    = obj.subject;
                 commentObj.user_id    = obj.user_id;
                 listComment.Add(commentObj);
             }
             this.numberCommentPerPage = Int16.Parse(commentListJSONObj.quantity);
             this.numberComment        = Int16.Parse(commentListJSONObj.total_quantity);
         }
         else
         {
             commentObj                = new CommentClass();
             commentObj.name           = "Không có bình luận nào !";
             this.numberCommentPerPage = 0;
             this.numberComment        = 0;
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
コード例 #3
0
        public async Task changeGroupTest()
        {
            await NewTraceTestWithPojo();

            Assert.NotNull(initTraceState);
            Assert.Equal(initTraceState.UpdatedByGroupId, config.MY_GROUP);
            Sdk <StateExample> sdk = GetSdk <StateExample>();
            // Appendlink
            CommentClass dataMap = new CommentClass()
            {
                comment = "commment"
            };

            AppendLinkInput <CommentClass> appLinkInput = new AppendLinkInput <CommentClass>(
                config.COMMENT_ACTION_KEY, dataMap, initTraceState.TraceId);

            // change group for action
            appLinkInput.GroupLabel = config.OTHER_GROUP_LABEL;
            TraceState <StateExample, CommentClass> state = await sdk.AppendLinkAsync(appLinkInput);

            // should equal group2 id
            Assert.Equal(state.UpdatedByGroupId, config.OTHER_GROUP);
            AppendLinkInput <CommentClass> appLinkInputWithGroupLabel = new AppendLinkInput <CommentClass>(
                config.COMMENT_ACTION_KEY, dataMap, initTraceState.TraceId);

            appLinkInputWithGroupLabel.GroupLabel = config.MY_GROUP_LABEL;
            state = await sdk.AppendLinkAsync(appLinkInputWithGroupLabel);

            // should equal group2 id
            Assert.Equal(state.UpdatedByGroupId, config.MY_GROUP);
        }
コード例 #4
0
 public static CommentModel MapCommentsModel(CommentClass comments)
 {
     return(new CommentModel
     {
         Id = comments.Id,
         CommentPhoto = comments.CommentOnPhoto,
         CommentAlbum = comments.CommentOnAlbum
     });
 }
コード例 #5
0
        public static CommentModel ModelToEntity(CommentClass comments)
        {
            CommentModel model = new CommentModel();

            model.Id           = comments.Id;
            model.CommentPhoto = comments.CommentOnPhoto;
            model.CommentAlbum = comments.CommentOnAlbum;
            return(model);
        }
コード例 #6
0
        public static CommentClass entitymodel(CommentModel comments)
        {
            CommentClass entity = new CommentClass();

            entity.Id             = comments.Id;
            entity.CommentOnPhoto = comments.CommentPhoto;
            entity.CommentOnAlbum = comments.CommentAlbum;
            return(entity);
        }
コード例 #7
0
 public void AddNewAlbumComment(Guid albumid, CommentClass newalbumCommet)
 {
     using (var context = new MvcDataContext())
     {
         var albumentity = context.album.FirstOrDefault(a => a.AlbumId == albumid);
         albumentity.Comment.Add(newalbumCommet);
         context.album.AddOrUpdate(albumentity);
         context.SaveChanges();
     }
 }
コード例 #8
0
 public void AddNewPhotoComment(Guid photoid, CommentClass newphotoComment)
 {
     using (var context = new MvcDataContext())
     {
         var photoentity = context.photo.FirstOrDefault(p => p.PhotoId == photoid);
         photoentity.PComment.Add(newphotoComment);
         context.photo.AddOrUpdate(photoentity);
         context.SaveChanges();
     }
 }
コード例 #9
0
        private void displayComments()
        {
            CommentClass cc = new CommentClass();

            cc.bugID = Int32.Parse(id);

            Repeater1.DataSource = cc.getCommentsByID();
            Repeater1.DataBind();

            CommentCountLabel.Text = "&bull; " + cc.countCommentsByID() + " comments";
        }
コード例 #10
0
            public static void DeleteConfess(string guid)
            {
                contextLite.Confess.Delete(d => d.Guid == guid);

                //FilterDefinitionBuilder<Confess> builder = Builders<Confess>.Filter;
                //FilterDefinition<Confess> idFilter = builder.Eq(r => r.Guid, guid);
                //context.Confess.DeleteOne(idFilter);

                //delete all comment for that confession.
                CommentClass.DeleteCommentWithConfessGuid(guid);
            }
コード例 #11
0
 public ActionResult Comment(string commentphoto)
 {
     using (var context = new MvcDataContext())
     {
         var NewComment = new CommentClass();
         NewComment.CommentOnPhoto = commentphoto;
         context.comment.Add(NewComment);
         context.SaveChanges();
     }
     return(View("PhotList"));
 }
コード例 #12
0
        public void TestComment()
        {
            int          bugID = 1001;
            string       commentDescription = "";
            DateTime     commentTimestamp   = DateTime.Now;
            string       commentUsername    = "";
            CommentClass cc = new CommentClass();

            cc.bugID = bugID;
            cc.commentDescription = commentDescription;
            cc.commentTimestamp   = commentTimestamp;
            cc.commentUsername    = commentUsername;


            Assert.AreEqual(cc.addComment(), 0);
        }
コード例 #13
0
        public async Task AppendLinkTestWithPojo()
        {
            var sdk = GetSdk <StateExample>();

            await NewTraceTestWithPojo();

            Assert.NotNull(initTraceState);
            CommentClass data = new CommentClass();

            data.comment = "comment";

            AppendLinkInput <CommentClass>          appLinkInput = new AppendLinkInput <CommentClass>(config.COMMENT_ACTION_KEY, data, initTraceState.TraceId);
            TraceState <StateExample, CommentClass> state        = await sdk.AppendLinkAsync <CommentClass>(appLinkInput);

            Assert.NotNull(state.TraceId);
        }
コード例 #14
0
        void client_list_comments_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                string data = e.Result;

                parseJSONCommentList(data);

                if (this.current_page_comment == 1)
                {
                    ds_comment.Clear();
                }
                if (this.numberComment > 0)
                {
                    for (int i = 0; i < numberCommentPerPage; i++)
                    {
                        commentObj = new CommentClass();
                        commentObj = listComment[i];
                        ds_comment.Add(new CommentClass()
                        {
                            comment_id = commentObj.comment_id, user_id = commentObj.user_id, name = commentObj.name, subject = commentObj.subject, body_value = commentObj.body_value
                        });
                    }
                    this.lstComments.ItemsSource = ds_comment;
                }
                else
                {
                    ds_comment.Add(new CommentClass()
                    {
                        comment_id = "", name = "Không có bình luận nào", subject = "", body_value = "", user_id = ""
                    });
                    this.lstComments.ItemsSource = ds_comment;
                }
                //disableProgressIndicator();
            }
            catch (WebException ex)
            {
                Debug.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
コード例 #15
0
 protected void btnComment_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         CommentClass cc = new CommentClass();
         cc.bugID = Int32.Parse(id);
         cc.commentDescription = commentBox.Text;
         cc.commentUsername    = Session["loginID"].ToString();
         if (cc.addComment() == 0)
         {
             Label3.Text     = "Comment Added.";
             commentBox.Text = "";
             displayComments();
         }
         else
         {
             Label3.Text = "Error submitting your comment. Submit a bug report about this issue.";
         }
     }
 }
コード例 #16
0
            private static List <ConfessLoader> GetConfessLoader(List <Confess> list, string key)
            {
                List <ConfessLoader> loaders = new List <ConfessLoader>();

                foreach (Confess dt in list)
                {
                    ConfessLoader loader = new ConfessLoader
                    {
                        Body         = dt.Body,
                        Category     = dt.Category,
                        Date         = Shared.TimeAgo.Ago(dt.Date),// $"{dt.Date.ToLongDateString()} {dt.Date.ToShortTimeString()}",
                        DateReal     = dt.Date,
                        DisLikes     = DislikeClass.GetCount(dt.Guid, false),
                        Likes        = LikeClass.GetCount(dt.Guid, false),
                        Guid         = dt.Guid,
                        Owner_Guid   = dt.Owner_Guid,
                        Title        = dt.Title,
                        CommentCount = CommentClass.GetCommentCount(dt.Guid),
                        Seen         = SeenClass.GetCount(dt.Guid)
                    };
                    //load colors
                    if (LikeClass.CheckExistence(dt.Guid, false, key))
                    {
                        loader.LikeColorString = "#1976D2";
                    }

                    if (DislikeClass.CheckExistence(dt.Guid, false, key))
                    {
                        loader.DislikeColorString = "#1976D2";
                    }

                    loaders.Add(loader);
                    loader = new ConfessLoader();
                }
                loaders = loaders.OrderByDescending(d => d.DateReal).Reverse().ToList();
                return(loaders);
            }