private UserJourney ConvertListItemToUserJourney(ListItem listItem)
        {
            var    Id          = listItem.Id;
            var    Title       = (string)listItem[SiteColumnNames.TITLE];
            string Description = (string)listItem[SiteColumnNames.DESCRIPTION];

            Enum.TryParse((string)listItem[SiteColumnNames.LEVEL], out Level Level);
            var Rating          = Int32.Parse(listItem[SiteColumnNames.RATING].ToString());
            var AverageDuration = Int32.Parse(listItem[SiteColumnNames.AVERAGEDURATION].ToString());
            var Skills          = ConvertListItemsLookupValuesToUserSkills(listItem[SiteColumnNames.USERSKILLS] as FieldLookupValue[]);

            DateTime.TryParse(listItem[SiteColumnNames.START_DATE].ToString(), out DateTime StartDate);
            DateTime.TryParse(listItem[SiteColumnNames.END_DATE].ToString(), out DateTime EndDate);
            DateTime.TryParse(listItem[SiteColumnNames.DUE_DATE].ToString(), out DateTime DueDate);
            var     Trainee       = listItem[SiteColumnNames.TRAINEE].ToString();
            var     Review        = listItem[SiteColumnNames.REVIEW].ToString();
            var     journeyLookup = listItem[SiteColumnNames.JOURNEY_REF] as FieldLookupValue;
            Journey journeyRef    = _journeyProvider.GetJourney(journeyLookup.LookupId);
            var     Status        = new UserJourneyStatus(listItem[SiteColumnNames.JOURNEYSTATUS].ToString());
            var     Coach         = (string)listItem[SiteColumnNames.COACH];

            return(new UserJourney()
            {
                Id = Id,
                Title = Title,
                Description = Description,
                Level = Level,
                Rating = Rating,
                AverageDuration = AverageDuration,
                Skills = Skills,
                StartDate = StartDate,
                EndDate = EndDate,
                DueDate = DueDate,
                Trainee = Trainee,
                Review = Review,
                Status = Status,
                Coach = Coach,
                JourneyRef = journeyRef
            });
        }
示例#2
0
 public Journey GetJourney(int id)
 {
     return(_journeyProvider.GetJourney(id));
 }