示例#1
0
        private static List<ComplaintActivityFeedItemViewModel> MapActivityFeedItems(ActivityFeed.ActivityFeedItem[] items)
        {
            var result = new List<ComplaintActivityFeedItemViewModel>();

            foreach (var item in items)
                result.Add(MapActivityFeedItem(item));

            return result;
        }
示例#2
0
 private static ComplaintActivityFeedSectionViewModel MapActivityFeedSection(ActivityFeed.ActivityFeedSection section)
 {
     return new ComplaintActivityFeedSectionViewModel()
     {
         SectionStatus = section.SectionStatus,
         SectionType = section.SectionType,
         Header = MapActivityFeedHeader(section.Header, section.SectionStatus),
         Items = MapActivityFeedItems(section.Items),
     };
 }
示例#3
0
 private static ComplaintActivityFeedItemViewModel MapActivityFeedItem(ActivityFeed.ActivityFeedItem item)
 {
     return new ComplaintActivityFeedItemViewModel()
     {
         Id = item.Id,
         Description = item.Description,
         User = MapUserToUserViewModel(item.User),
         Action = item.Action,
     };
 }
示例#4
0
        internal static ComplaintActivityFeedViewModel MapActivityFeed(ActivityFeed activityFeed)
        {
            var result = new ComplaintActivityFeedViewModel();
            result.StartDate = activityFeed.StartDate;

            foreach (var section in activityFeed.Sections)
                result.Sections.Add(Mappers.MapActivityFeedSection(section));

            return result;
        }
示例#5
0
        private static ComplaintActivityFeedHeaderViewModel MapActivityFeedHeader(ActivityFeed.ActivityFeedSectionHeader header, ActivityFeed.ActivityFeedSectionStatus status)
        {
            var @class = String.Empty;
            var title = header.Title;
            if (header.DueBy.HasValue)
            {
                title = String.Format("{0} are due by {1}", title, header.DueBy.Value.ToShortDateString());
                @class = "warning";
            }
            else
            {
                if (status == ActivityFeed.ActivityFeedSectionStatus.Finished)
                    title = String.Format("{0}. Completed!", title);
                @class = status == ActivityFeed.ActivityFeedSectionStatus.Future ? "secondary" : "success";
            }

            return new ComplaintActivityFeedHeaderViewModel() { DueDate = header.DueBy ?? DateTime.Now, Title = title, Class = @class, };
        }