예제 #1
0
            private static CommentLoader GetLoader(Comment dt, string key)
            {
                CommentLoader loader = new CommentLoader
                {
                    Body                   = dt.Body,
                    Date                   = Shared.TimeAgo.Ago(dt.Date),// $"{CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedDayName(dt.Date.DayOfWeek)}, {CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(dt.Date.Month)} {dt.Date.Day}, {dt.Date.Year} {dt.Date.ToShortTimeString()}",
                    DisLikes               = DislikeClass.GetCount(dt.Guid, true),
                    DateReal               = dt.Date,
                    Likes                  = LikeClass.GetCount(dt.Guid, true),
                    Guid                   = dt.Guid,
                    Owner_Guid             = dt.Owner_Guid,
                    Quote                  = dt.Quote,
                    QuotedCommentAvailable = dt.QuotedCommentAvailable,
                    Confess_Guid           = dt.Confess_Guid
                };

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

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

                return(loader);
            }
예제 #2
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);
            }
예제 #3
0
            public static bool Post(string guid, bool isComment, string key)
            {
                //check if its liked
                if (LikeClass.CheckExistence(guid, isComment, key))
                {
                    return(false);
                }

                //Check if there is already a Dislike by the user
                if (CheckExistence(guid, isComment, key))
                {
                    //delete the Dislike
                    Delete(guid, isComment, key);
                    return(false);
                }

                //post new Dislike
                Dislikes Dislike = new Dislikes
                {
                    Owner_Guid = key,
                };

                if (isComment)
                {
                    Dislike.Comment_Guid = guid;
                }
                else
                {
                    Dislike.Confess_Guid = guid;
                }
                Dislike.Id = Logical.Setter(Dislike.Id);
                contextLite.Dislikes.Insert(Dislike);
                //.Dislikes.InsertOne(Dislike);
                return(true);
            }
예제 #4
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);
            }