public virtual List <NotifyDispItem> ComposeDispItems(IEnumerable <ThreadBase> msgThreads)
        {
            var userId    = UserSession.CurrentUserId;
            var dispItems = new List <NotifyDispItem>();

            foreach (var item in msgThreads)
            {
                var lastMsg  = item.ThreadItems.Last();
                var dispItem = new NotifyDispItem
                {
                    ItemId   = item.EntityKey,
                    Title    = item.ThreadTitle,
                    Date     = lastMsg.Date,
                    Comment  = lastMsg.Text,
                    UserId   = lastMsg.SenderId,
                    UserName = lastMsg.SenderName,
                };
                if (lastMsg.SenderId == userId && item.EntityUserMaps.Any(mp => mp.UserId != userId))
                {
                    var map = item.EntityUserMaps.First(mp => mp.UserId != userId);
                    dispItem.UserId   = map.UserId;
                    dispItem.UserName = map.UserName;
                    dispItem.IsReply  = true;
                }
                dispItems.Add(dispItem);
            }
            return(dispItems);
        }
        public override List <NotifyDispItem> ComposeDispItems(IEnumerable <ThreadBase> msgThreads)
        {
            var userId    = UserSession.CurrentUserId;
            var dispItems = new List <NotifyDispItem>();

            foreach (var item in msgThreads)
            {
                var lastMsg  = item.ThreadItems.Last();
                var dispItem = new NotifyDispItem
                {
                    ItemId   = item.EntityKey,
                    Title    = item.ThreadTitle,
                    Date     = lastMsg.Date,
                    Comment  = lastMsg.Text,
                    UserId   = lastMsg.SenderId,
                    UserName = lastMsg.SenderName,
                    IsReply  = true
                };
                if (lastMsg.SenderId == userId)
                {
                    var map = item.EntityUserMaps.First(mp => mp.UserId != userId);
                    dispItem.UserId   = map.UserId;
                    dispItem.UserName = map.UserName;
                }
                if (item.ThreadItems.Count() == 1)
                {
                    dispItem.Comment = (item as Discussion).Content;
                    dispItem.IsReply = false;
                }
                dispItems.Add(dispItem);
            }
            return(dispItems);
        }
 public virtual List<NotifyDispItem> ComposeDispItems(IEnumerable<ThreadBase> msgThreads)
 {
     var userId = UserSession.CurrentUserId;
     var dispItems = new List<NotifyDispItem>();
     foreach (var item in msgThreads)
     {
         var lastMsg = item.ThreadItems.Last();
         var dispItem = new NotifyDispItem
         {
             ItemId = item.EntityKey,
             Title = item.ThreadTitle,
             Date = lastMsg.Date,
             Comment = lastMsg.Text,
             UserId = lastMsg.SenderId,
             UserName = lastMsg.SenderName,
         };
         if (lastMsg.SenderId == userId && item.EntityUserMaps.Any(mp => mp.UserId != userId))
         {
             var map = item.EntityUserMaps.First(mp => mp.UserId != userId);
             dispItem.UserId = map.UserId;
             dispItem.UserName = map.UserName;
             dispItem.IsReply = true;
         }
         dispItems.Add(dispItem);
     }
     return dispItems;
 }
 public override List<NotifyDispItem> ComposeDispItems(IEnumerable<ThreadBase> msgThreads)
 {
     var userId = UserSession.CurrentUserId;
     var dispItems = new List<NotifyDispItem>();
     foreach (var item in msgThreads)
     {
         var lastMsg = item.ThreadItems.Last();
         var dispItem = new NotifyDispItem
         {
             ItemId = item.EntityKey,
             Title = item.ThreadTitle,
             Date = lastMsg.Date,
             Comment = lastMsg.Text,
             UserId = lastMsg.SenderId,
             UserName = lastMsg.SenderName,
             IsReply = true
         };
         if (lastMsg.SenderId == userId)
         {
             var map = item.EntityUserMaps.First(mp => mp.UserId != userId);
             dispItem.UserId = map.UserId;
             dispItem.UserName = map.UserName;
         }
         if (item.ThreadItems.Count() == 1)
         {
             dispItem.Comment = (item as Discussion).Content;
             dispItem.IsReply = false;
         }
         dispItems.Add(dispItem);
     }
     return dispItems;
 }
Example #5
0
        public List <NotifyDispItem> ComposeDispItems(IEnumerable <MentorShip> mentorships)
        {
            var userId    = UserSession.CurrentUserId;
            var dispItems = new List <NotifyDispItem>();

            foreach (var item in mentorships)
            {
                var lastMsg  = item.Messages.Last();
                var dispItem = new NotifyDispItem
                {
                    ItemId   = item.EntityKey,
                    Date     = lastMsg.Date,
                    Comment  = lastMsg.Text,
                    UserId   = lastMsg.SenderId,
                    UserName = lastMsg.SenderName,
                };
                if (lastMsg.SenderId == userId)
                {
                }
                dispItems.Add(dispItem);
            }
            return(dispItems);
        }
Example #6
0
        public List<NotifyDispItem> ComposeDispItems(IEnumerable<MentorShip> mentorships)
        {
            var userId = UserSession.CurrentUserId;
            var dispItems = new List<NotifyDispItem>();
            foreach (var item in mentorships)
            {
                var lastMsg = item.Messages.Last();
                var dispItem = new NotifyDispItem
                {
                    ItemId = item.EntityKey,
                    Date = lastMsg.Date,
                    Comment = lastMsg.Text,
                    UserId = lastMsg.SenderId,
                    UserName = lastMsg.SenderName,
                };
                if (lastMsg.SenderId == userId)
                {

                }
                dispItems.Add(dispItem);
            }
            return dispItems;
        }