Esempio n. 1
0
        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="task">Задача</param>
        /// <param name="creationDate">Дата совершения изменений</param>
        /// <param name="createdBy">Пользователь, внесший изменения в исполнение задачи</param>
        internal TaskExecutionHistoryItem(TaskExecutionItem taskExecutionItem, DateTime creationDate, User createdBy,
                                          bool isDateChanged, DateTime?date, bool isDeletionDateChanged, DateTime?deletionDate, bool isResultDescriptionChanged,
                                          string resultDescription, bool isSpentTimeChanged, int?spentTime, bool isTaskExecutionStateChanged, TaskExecutionState taskExecutionState,
                                          bool isTaskTypeChanged, TaskType taskType, bool isCompletionPercentageChanged, byte?completionPercentage)
            : base(creationDate, createdBy)
        {
            ValidationUtils.NotNull(taskExecutionItem, "Необходимо указать исполнение.");
            ValidationUtils.NotNull(resultDescription, "Описание достигнутых результатов не может быть null.");

            Task = taskExecutionItem.Task;
            TaskExecutionItem = taskExecutionItem;

            IsDateChanged                 = isDateChanged;
            IsDeletionDateChanged         = isDeletionDateChanged;
            IsResultDescriptionChanged    = isResultDescriptionChanged;
            IsSpentTimeChanged            = isSpentTimeChanged;
            IsCompletionPercentageChanged = isCompletionPercentageChanged;
            IsTaskExecutionStateChanged   = isTaskExecutionStateChanged;
            IsTaskTypeChanged             = isTaskTypeChanged;

            Date                 = date;
            DeletionDate         = deletionDate;
            ResultDescription    = resultDescription;
            SpentTime            = spentTime;
            CompletionPercentage = completionPercentage;
            TaskExecutionState   = taskExecutionState;
            TaskType             = taskType;
        }
Esempio n. 2
0
 /// <summary>
 /// Обновление процента выполнения задачи
 /// </summary>
 /// <param name="item"></param>
 protected internal virtual void UpdateCompletionPercentage(TaskExecutionItem item)
 {
     if (IsLastExecution(item))
     {
         CompletionPercentage = item.CompletionPercentage;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Обновление статуса задачи
 /// </summary>
 /// <param name="item"></param>
 protected internal virtual void UpdateTaskExecutionState(TaskExecutionItem item)
 {
     if (IsLastExecution(item))
     {
         Type           = item.TaskType;
         ExecutionState = item.ExecutionState;
     }
     UpdateStartAndCompletionDates();
 }
Esempio n. 4
0
        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="task">Задача</param>
        /// <param name="creationDate">Дата совершения изменений</param>
        /// <param name="createdBy">Пользователь, внесший изменения в исполнение задачи</param>
        internal TaskHistoryItem(Task task, DateTime creationDate, User createdBy,
                                 bool isContractorChanged, Contractor contractor, bool isDeadLineChanged, DateTime?deadLine, bool isDealChanged, Deal deal,
                                 bool isDeletionDateChanged, DateTime?deletionDate, bool isDescriptionChanged, string description, bool isExecutedByChanged, User executedBy,
                                 bool isFactualCompletionDateChanged, DateTime?factualCompletionDate, bool isFactualSpentTimeChanged, int?factualSpentTime, bool isTaskPriorityChanged,
                                 TaskPriority taskPriority, bool isProductionOrderChanged, ProductionOrder productionOrder, bool isStartDateChanged, DateTime?startDate, bool isTopicChanged,
                                 string topic, bool isTaskTypeChanged, TaskType taskType, bool isTaskExecutionStateChanged, TaskExecutionState taskExecutionState, TaskExecutionItem taskExecutionItem)
            : base(creationDate, createdBy)
        {
            ValidationUtils.NotNull(task, "Необходимо указать задачу, к которой относится история.");
            ValidationUtils.NotNull(description, "Описание не может быть null.");

            Task = task;

            IsContractorChanged = isContractorChanged;
            Contractor          = contractor;
            IsDeadLineChanged   = isDeadLineChanged;
            Deadline            = deadLine;
            IsDealChanged       = isDealChanged;
            Deal = deal;
            IsDeletionDateChanged          = isDeletionDateChanged;
            DeletionDate                   = deletionDate;
            IsDescriptionChanged           = isDescriptionChanged;
            Description                    = description;
            IsExecutedByChanged            = isExecutedByChanged;
            ExecutedBy                     = executedBy;
            IsFactualCompletionDateChanged = isFactualCompletionDateChanged;
            FactualCompletionDate          = factualCompletionDate;
            IsFactualSpentTimeChanged      = isFactualSpentTimeChanged;
            FactualSpentTime               = factualSpentTime;
            IsTaskPriorityChanged          = isTaskPriorityChanged;
            TaskPriority                   = taskPriority;
            IsProductionOrderChanged       = isProductionOrderChanged;
            ProductionOrder                = productionOrder;
            IsStartDateChanged             = isStartDateChanged;
            StartDate                   = startDate;
            IsTopicChanged              = isTopicChanged;
            Topic                       = topic;
            IsTaskTypeChanged           = isTaskTypeChanged;
            TaskType                    = taskType;
            IsTaskExecutionStateChanged = isTaskExecutionStateChanged;
            TaskExecutionState          = taskExecutionState;
            TaskExecutionItem           = taskExecutionItem;
        }
Esempio n. 5
0
        /// <summary>
        /// Определение, является ли исполнение последним
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        private bool IsLastExecution(TaskExecutionItem item)
        {
            var maxDate = DateTimeUtils.GetMaxDate(ExecutionHistory.Select(x => x.Date));

            return(item.Date == maxDate);
        }
Esempio n. 6
0
        protected internal virtual void RemoveExecutionItem(TaskExecutionItem item)
        {
            ValidationUtils.NotNull(item, "Необходимо указать исполнение задачи.");

            executionHistory.Remove(item);
        }