コード例 #1
0
        public static ActivityHistoryItem FromDto(ActivityHistoryItemDto dto)
        {
            var retVal = new ActivityHistoryItem();

            retVal.UpdateFromDto(dto);
            return(retVal);
        }
コード例 #2
0
ファイル: Activity.cs プロジェクト: Merlin9999/PCLActivitySet
        public void UpdateFromDto(ActivityDto dto)
        {
            this.Guid             = dto.Guid;
            this.Name             = dto.Name;
            this.ActivityListGuid = dto.ActivityListGuid;
            this.GoalGuid         = dto.GoalGuid;
            this.ActiveDueDate    = dto.ActiveDueDate;

            if (dto.LeadTime == null)
            {
                this.LeadTime = null;
            }
            else
            {
                this.LeadTime = new DateProjection();
                this.LeadTime.UpdateFromDto(dto.LeadTime);
            }

            if (dto.Recurrence == null)
            {
                this.Recurrence = null;
            }
            else
            {
                this.Recurrence = new DateRecurrence();
                this.Recurrence.UpdateFromDto(dto.Recurrence);
            }

            this.CompletionHistory = new List <ActivityHistoryItem>();
            foreach (ActivityHistoryItemDto historyItemDto in dto.CompletionHistory)
            {
                this.CompletionHistory.Add(ActivityHistoryItem.FromDto(historyItemDto));
            }
        }
コード例 #3
0
        public static ActivityHistoryItemDto ToDto(ActivityHistoryItem model)
        {
            var retVal = new ActivityHistoryItemDto();

            model.UpdateDto(retVal);
            return(retVal);
        }
コード例 #4
0
ファイル: Activity.cs プロジェクト: Merlin9999/PCLActivitySet
        public void UpdateDto(ActivityDto dto)
        {
            dto.Guid             = this.Guid;
            dto.Name             = this.Name;
            dto.ActivityListGuid = this.ActivityListGuid;
            dto.GoalGuid         = this.GoalGuid;
            dto.ActiveDueDate    = this.ActiveDueDate;

            if (this.LeadTime == null)
            {
                dto.LeadTime = null;
            }
            else
            {
                dto.LeadTime = new DateProjectionDto();
                this.LeadTime.UpdateDto(dto.LeadTime);
            }

            if (this.Recurrence == null)
            {
                dto.Recurrence = null;
            }
            else
            {
                dto.Recurrence = new DateRecurrenceDto();
                this.Recurrence.UpdateDto(dto.Recurrence);
            }

            dto.CompletionHistory = new List <ActivityHistoryItemDto>();
            foreach (ActivityHistoryItem historyItem in this.CompletionHistory)
            {
                dto.CompletionHistory.Add(ActivityHistoryItem.ToDto(historyItem));
            }
        }
コード例 #5
0
 public static void ResetActiveDueDateFromLastHistoryItem(this Activity activity)
 {
     if (activity.CompletionHistory.Any())
     {
         ActivityHistoryItem historyItem = activity.CompletionHistory.Last();
         activity.ActiveDueDate = historyItem.DueDate == null && activity.Recurrence.RecurFromType == ERecurFromType.FromActiveDueDate
             ? null
             : activity.Recurrence?.GetNext(historyItem.DueDate ?? DateTime.MaxValue, historyItem.CompletedDate, activity.CompletionHistory.Count);
     }
 }