Exemplo n.º 1
0
    public Comment GetCommentByID(int id)
    {
        Comment  comment = new  Comment();
        CommentsTableAdapter adapter = new CommentsTableAdapter();

        PostAroundMeDataSet.CommentsDataTable dt = new PostAroundMeDataSet.CommentsDataTable();
        dt = adapter.GetCommentByID(id);

        PostAroundMeDataSet.CommentsRow dr = dt.FirstOrDefault();

        comment = CommentTranslator(dr);

        return comment;
    }
Exemplo n.º 2
0
    public List<Comment> GetCommentsByMessageID(int msgId, int userId, int timeZone = 0, int top = 0)
    {
        List<Comment> comments = new List<Comment>();
        CommentsTableAdapter adapter = new CommentsTableAdapter();

        PostAroundMeDataSet.CommentsDataTable dt = new PostAroundMeDataSet.CommentsDataTable();
        dt = adapter.GetCommentsByMessageID(msgId);

        comments = CommentsDtToList(dt, userId, timeZone);
        if (top > 0)
        {
            comments = comments.OrderByDescending(m => m.date).ToList().Take(top).OrderBy(m => m.date).ToList();
        }
        return comments;
    }
Exemplo n.º 3
0
    public List<Comment> GetAllComments(int userId, int timeZone = 0)
    {
        List<Comment> comments = new List<Comment>();
        CommentsTableAdapter adapter = new CommentsTableAdapter();

        PostAroundMeDataSet.CommentsDataTable dt = new PostAroundMeDataSet.CommentsDataTable();

        if (System.Web.HttpRuntime.Cache["Comments"] == null)
        {
            dt = adapter.GetData();
            System.Web.HttpRuntime.Cache.Insert("Comments", dt, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10));
        }
        else
        {
            dt = System.Web.HttpRuntime.Cache["Comments"] as PostAroundMeDataSet.CommentsDataTable;
        }

        comments = CommentsDtToList(dt, userId, timeZone);

        return comments;
    }