Beispiel #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;
        }
Beispiel #2
0
        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="topic">Тема задачи</param>
        /// <param name="type">Тип задачи</param>
        /// <param name="priority">Приоритет задачи</param>
        /// <param name="state">Стастус задачи</param>
        /// <param name="createdBy">Пользователь, создавший задачу</param>
        public Task(string topic, TaskType type, TaskPriority priority, TaskExecutionState state, DateTime creationDate, User createdBy)
        {
            ValidationUtils.Assert(!String.IsNullOrEmpty(topic), "Необходимо указать тему задачи.");
            ValidationUtils.NotNull(type, "Необходимо указать тип задачи.");
            ValidationUtils.NotNull(priority, "Необходимо указать приоритет задачи.");
            ValidationUtils.NotNull(state, "Необходимо указать статус задачи.");
            ValidationUtils.NotNull(createdBy, "Необходимо указать пользователя, создавшего задачу.");
            ValidationUtils.Assert(type.States.Contains(state), String.Format("Статус исполнения задачи «{0}» не допустим для типа задачи «{1}».", state.Name, type.Name));

            Topic          = topic;
            Type           = type;
            ExecutionState = state;
            Priority       = priority;
            CreatedBy      = createdBy;
            CreationDate   = creationDate;
            Description    = "";

            history          = new HashedSet <TaskHistoryItem>();
            executionHistory = new HashedSet <TaskExecutionItem>();

            // Устанавливаем признак изменения полей (чтобы они все попали как первое изменение задачи в историю)
            isContractorChanged = isDeadLineChanged = isDealChanged = isDeletionDateChanged = isDescriptionChanged = isExecutedByChanged =
                isFactualCompletionDateChanged = isFactualSpentTimeChanged = isFactualStartDateChanged = isPriorityChanged = isProductionOrderChanged =
                    isStartDateChanged         = isTopicChanged = isTypeChanged = true;
        }
        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="task">Задача</param>
        /// <param name="executionState">Статус задачи</param>
        /// <param name="completionPercentage">% выполнения</param>
        /// <param name="createdBy">Пользователь, создавший исполение</param>
        /// <param name="creationDate">Дата создания</param>
        /// <param name="date">Дата исполнения</param>
        public TaskExecutionItem(Task task, TaskType taskType, TaskExecutionState executionState, byte completionPercentage, User createdBy, bool isCreatedByUser, DateTime creationDate, DateTime date)
        {
            ValidationUtils.NotNull(task, "Необходимо указать задачу, к которой относится исполнение.");
            ValidationUtils.NotNull(createdBy, "Необходимо указать пользователя, создавшего исполнение.");
            ValidationUtils.Assert(taskType.States.Contains(executionState), String.Format("Статус исполнения «{0}» не допустим для типа задачи «{1}».", executionState.Name, taskType.Name));

            history           = new HashedSet <TaskExecutionHistoryItem>();
            resultDescription = "";
            spentTime         = 0;

            task.AddExecutionItem(this);    //Добавляем исполнение в задачу

            Task = task;

            this.taskType       = taskType;
            this.executionState = executionState;

            CreatedBy    = createdBy;
            CreationDate = creationDate;

            this.completionPercentage = completionPercentage;

            IsCreatedByUser = isCreatedByUser;
            this.date       = date;

            isDateChanged         = isDeletionDateChanged = isResultDescriptionChanged = isSpentTimeChanged = isCompletionPercentageChanged = isExecutionStateChanged =
                isTaskTypeChanged = true;

            Task.UpdateByLastExecution();
            Task.UpdateTaskExecutionState(this);
            Task.UpdateCompletionPercentage(this);
            Task.FactualSpentTime += spentTime;
        }
Beispiel #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;
        }
Beispiel #5
0
 /// <summary>
 /// Удаление статуса
 /// </summary>
 /// <param name="state">Удаляемый статус</param>
 public virtual void DeleteState(TaskExecutionState state)
 {
     ValidationUtils.NotNull(state, "Необходимо указать статус задачи.");
     states.Remove(state);
 }