Ejemplo n.º 1
0
        public HttpResponseMessage ListComment(decimal REPLYING_TO_MESSAGE_FEED_ID, int page, int pageSize)
        {
            var model = new NewFeedModel();
            var list  = model.getListActivityFeedComment(REPLYING_TO_MESSAGE_FEED_ID, page, pageSize);

            return(ResponseSuccess(StringResource.Success, list));
        }
Ejemplo n.º 2
0
        public HttpResponseMessage ListNewFeedOfUser(string userNameLogin, int conferenceId, decimal conference_session_id, int page, int pageSize)
        {
            var listResult = (db.CONFERENCE_ATTENDEE_IN_REGISTERED_CONFERENCE_SESSION
                              .Join(db.ACCOUNTs, attendee => attendee.PERSON_ID, acc => acc.PERSON_ID, (attendee, acc) => new { attendee, acc }))
                             .Where(x => x.attendee.CONFERENCE_SESSION_ID == conference_session_id)
                             .AsEnumerable()
                             .ToList()
                             .Select(x => new UserOfSession()
            {
                UserName            = x.acc.UserName,
                Image               = x.acc.Image,
                CURRENT_FIRST_NAME  = x.acc.CURRENT_FIRST_NAME,
                CURRENT_MIDDLE_NAME = x.acc.CURRENT_MIDDLE_NAME,
                CURRENT_LAST_NAME   = x.acc.CURRENT_LAST_NAME
            });
            var activityFeeds = new List <ActivityFeed>();
            var model         = new NewFeedModel();

            foreach (UserOfSession item in listResult)
            {
                var list = model.getListActivityFeedOfUser(item.UserName, conferenceId, page, pageSize);
                foreach (ActivityFeed feed in list)
                {
                    var commemts = model.getListActivityFeedComment(feed.MESSAGE_FEED_ID);
                    feed.ListComment = commemts;
                    var likes = model.listLike(feed.MESSAGE_FEED_ID);
                    feed.ListLike = likes;
                    feed.IS_LIKED = model.checkIsLiked(userNameLogin, feed.MESSAGE_FEED_ID);
                    activityFeeds.AddRange(list);
                }
            }

            return(ResponseSuccess(StringResource.Success, activityFeeds));
        }
Ejemplo n.º 3
0
        public HttpResponseMessage ListNewFeed(string userName, decimal conferenceId, int page, int pageSize)
        {
            var model         = new NewFeedModel();
            var activityFeeds = model.getListActivityFeed(conferenceId, page, pageSize);

            foreach (ActivityFeed item in activityFeeds)
            {
                var list = model.getListActivityFeedComment(item.MESSAGE_FEED_ID);
                item.ListComment = list;
                var listLike = model.listLike(item.MESSAGE_FEED_ID);
                item.ListLike = listLike;
                item.IS_LIKED = model.checkIsLiked(userName, item.MESSAGE_FEED_ID);
            }

            return(ResponseSuccess(StringResource.Success, activityFeeds));
        }
Ejemplo n.º 4
0
        public HttpResponseMessage ListPhotoFeed(string userName, decimal conferenceId, int page, int pageSize)
        {
            var model      = new NewFeedModel();
            var photoFeeds = model.getListPhotoFeed(conferenceId, page, pageSize);
            var result     = new List <PhotoResponse>();

            foreach (PhotoFeed item in photoFeeds)
            {
                var itemFeed = new PhotoResponse();
                itemFeed.Date     = item.Date;
                itemFeed.ListFeed = new List <ActivityFeed>();
                foreach (MESSAGE_FEED feed in item.ListFeed)
                {
                    var account = new AccountModel().GetUserByUserName(feed.UserName);
                    var f       = new ActivityFeed();
                    f.MESSAGE_FEED_ID             = feed.MESSAGE_FEED_ID;
                    f.UserName                    = feed.UserName;
                    f.PERSON_ID                   = account.PERSON_ID;
                    f.CURRENT_LAST_NAME           = feed.CURRENT_LAST_NAME;
                    f.CURRENT_MIDDLE_NAME         = feed.CURRENT_MIDDLE_NAME;
                    f.CURRENT_FIRST_NAME          = feed.CURRENT_FIRST_NAME;
                    f.REPLYING_TO_MESSAGE_FEED_ID = feed.REPLYING_TO_MESSAGE_FEED_ID;
                    f.MESSAGE_CONTENT             = feed.MESSAGE_CONTENT;
                    f.ATTACHED_PHOTO_FILENAME     = feed.ATTACHED_PHOTO_FILENAME;
                    f.ATTACHED_PHOTO_NOTE         = feed.ATTACHED_PHOTO_NOTE;
                    f.ATTACHED_PHOTO_LONGITUDE    = feed.ATTACHED_PHOTO_LONGITUDE;
                    f.ATTACHED_PHOTO_LATITUDE     = feed.ATTACHED_PHOTO_LATITUDE;
                    f.Image       = account.Image;
                    f.Time        = DateTimeFormater.GetTimeAgo(feed.FROM_DATE.Value);
                    f.FROM_DATE   = feed.FROM_DATE;
                    f.THRU_DATE   = feed.THRU_DATE;
                    f.ListComment = model.getListActivityFeedComment(feed.MESSAGE_FEED_ID);
                    f.IS_LIKED    = model.checkIsLiked(userName, feed.MESSAGE_FEED_ID);
                    f.ListLike    = model.listLike(feed.MESSAGE_FEED_ID);
                    itemFeed.ListFeed.Add(f);
                }
                result.Add(itemFeed);
            }

            return(ResponseSuccess(StringResource.Success, result));
        }
Ejemplo n.º 5
0
        public HttpResponseMessage NewFeedDetail(int MESSAGE_FEED_ID, string userName)
        {
            var account = new AccountModel().GetUserByUserName(userName);

            if (account == null)
            {
                return(ResponseFail(StringResource.Account_does_not_exist));
            }
            else
            {
                var model  = new NewFeedModel();
                var result = db.MESSAGE_FEED.Find(MESSAGE_FEED_ID);
                if (result != null)
                {
                    var activityFeed = new ActivityFeed();
                    activityFeed.MESSAGE_FEED_ID             = result.MESSAGE_FEED_ID;
                    activityFeed.UserName                    = result.UserName;
                    activityFeed.MESSAGE_CONTENT             = result.MESSAGE_CONTENT;
                    activityFeed.CURRENT_LAST_NAME           = result.CURRENT_LAST_NAME;
                    activityFeed.CURRENT_FIRST_NAME          = result.CURRENT_FIRST_NAME;
                    activityFeed.REPLYING_TO_MESSAGE_FEED_ID = result.REPLYING_TO_MESSAGE_FEED_ID;
                    activityFeed.ATTACHED_PHOTO_FILENAME     = result.ATTACHED_PHOTO_FILENAME;
                    activityFeed.ATTACHED_PHOTO_NOTE         = result.ATTACHED_PHOTO_NOTE;
                    activityFeed.ATTACHED_PHOTO_LONGITUDE    = result.ATTACHED_PHOTO_LONGITUDE;
                    activityFeed.ATTACHED_PHOTO_LATITUDE     = result.ATTACHED_PHOTO_LATITUDE;
                    activityFeed.Time        = DateTimeFormater.GetTimeAgo(result.FROM_DATE.Value);
                    activityFeed.Image       = account.Image;
                    activityFeed.FROM_DATE   = result.FROM_DATE;
                    activityFeed.THRU_DATE   = result.THRU_DATE;
                    activityFeed.ListComment = model.getListActivityFeedComment(MESSAGE_FEED_ID);
                    activityFeed.ListLike    = model.listLike(MESSAGE_FEED_ID);
                    activityFeed.IS_LIKED    = model.checkIsLiked(userName, MESSAGE_FEED_ID);
                    return(ResponseSuccess(StringResource.Success, activityFeed));
                }
                else
                {
                    return(ResponseFail(StringResource.Can_not_load_detail));
                }
            }
        }