Пример #1
0
        public virtual IQueryable <Sungero.Workflow.ITask> ActionItemsDataQuery(IQueryable <Sungero.Workflow.ITask> query)
        {
            query = query.Where(t => ActionItemExecutionTasks.Is(t));
            if (_filter == null)
            {
                return(Functions.Module.ApplyCommonSubfolderFilters(query));
            }

            // Фильтры по статусу и периоду.
            query = Functions.Module.ApplyCommonSubfolderFilters(query, _filter.InProcess,
                                                                 _filter.Last30Days, _filter.Last90Days, _filter.Last180Days, false);
            return(query);
        }
Пример #2
0
        /// <summary>
        /// Получить тему запроса отчета.
        /// </summary>
        /// <param name="task">Задача.</param>
        /// <param name="beginningSubject">Начальная тема.</param>
        /// <returns>Сформированная тема.</returns>
        public static string GetStatusReportRequestSubject(Sungero.RecordManagement.IStatusReportRequestTask task, CommonLibrary.LocalizedString beginningSubject)
        {
            var actionItemExecution = ActionItemExecutionTasks.As(task.ParentTask) ?? ActionItemExecutionTasks.As(task.ParentAssignment.Task);

            if (actionItemExecution.IsCompoundActionItem.Value && task.Assignee != null)
            {
                var assignment = Functions.ActionItemExecutionTask.Remote.GetActionItems(actionItemExecution)
                                 .Where(j => Equals(j.Performer, task.Assignee))
                                 .Where(a => ActionItemExecutionTasks.Is(a.Task))
                                 .First();
                actionItemExecution = ActionItemExecutionTasks.As(assignment.Task);
            }
            var subject = Functions.ActionItemExecutionTask.GetActionItemExecutionSubject(actionItemExecution, beginningSubject);

            return(Docflow.PublicFunctions.Module.TrimSpecialSymbols(subject));
        }
Пример #3
0
        public virtual void EndBlock6(Sungero.RecordManagement.Server.ActionItemSupervisorAssignmentEndBlockEventArguments e)
        {
            var assignment = e.CreatedAssignments.FirstOrDefault();

            if (assignment != null && assignment.Result == Result.ForRework)
            {
                _obj.ExecutionState = ExecutionState.OnRework;
                var newDeadline = ActionItemSupervisorAssignments.As(assignment).NewDeadline;
                _obj.Deadline = newDeadline;
                if (_obj.ActionItemType == ActionItemType.Component && ActionItemExecutionTasks.Is(_obj.ParentTask))
                {
                    var rootTask   = ActionItemExecutionTasks.As(_obj.ParentTask);
                    var actionItem = rootTask.ActionItemParts.Where(i => Equals(i.ActionItemPartExecutionTask, _obj)).FirstOrDefault();
                    if (actionItem != null && (actionItem.Deadline != null || rootTask.FinalDeadline != newDeadline))
                    {
                        actionItem.Deadline = newDeadline;
                    }
                }
            }
        }
Пример #4
0
        public virtual void AssigneeChanged(Sungero.RecordManagement.Shared.StatusReportRequestTaskAssigneeChangedEventArgs e)
        {
            var parentTask       = ActionItemExecutionTasks.As(_obj.ParentTask);
            var parentAssignment = ActionItemExecutionAssignments.As(_obj.ParentAssignment);

            IActionItemExecutionTask       newParentTask       = null;
            IActionItemExecutionAssignment newParentAssignment = null;

            if (e.NewValue != null)
            {
                // Определить исполняемое выбранным сотрудником поручение, если отправляем запрос из задачи.
                if (parentTask != null)
                {
                    if (parentTask.IsCompoundActionItem.Value)
                    {
                        var assignment = Functions.ActionItemExecutionTask.Remote.GetActionItems(parentTask)
                                         .Where(j => Equals(j.Performer, e.NewValue))
                                         .Where(a => ActionItemExecutionTasks.Is(a.Task))
                                         .First();
                        newParentTask = ActionItemExecutionTasks.As(assignment.Task);
                    }
                    else
                    {
                        newParentTask = parentTask;
                    }
                }

                // Определить исполняемое выбранным сотрудником поручение, если отправляем запрос из задания.
                if (parentAssignment != null)
                {
                    newParentAssignment = Functions.ActionItemExecutionAssignment.Remote.GetActionItems(parentAssignment)
                                          .First(j => Equals(j.Performer, e.NewValue));
                }
                // Обновить тему.
                _obj.Subject = Functions.ActionItemExecutionTask.GetActionItemExecutionSubject(newParentTask ?? ActionItemExecutionTasks.As(newParentAssignment.Task), StatusReportRequestTasks.Resources.ReportRequestTaskSubject);
            }
            else
            {
                _obj.Subject = Functions.ActionItemExecutionTask.GetActionItemExecutionSubject(parentTask ?? ActionItemExecutionTasks.As(parentAssignment.Task), StatusReportRequestTasks.Resources.ReportRequestTaskSubject);
            }
        }
Пример #5
0
        /// <summary>
        /// Получить нестандартных исполнитлей задачи.
        /// </summary>
        /// <returns>Исполнители.</returns>
        public virtual List <IRecipient> GetTaskAdditionalAssignees()
        {
            var assignees = new List <IRecipient>();

            var deadlineExtension = DeadlineExtensionTasks.As(_obj);

            if (deadlineExtension == null)
            {
                return(assignees);
            }

            if (deadlineExtension.Assignee != null)
            {
                assignees.Add(deadlineExtension.Assignee);
            }

            if (ActionItemExecutionTasks.Is(deadlineExtension.ParentAssignment.Task))
            {
                assignees.AddRange(ActionItemExecutionTasks.As(deadlineExtension.ParentAssignment.Task).CoAssignees.Select(ca => ca.Assignee));
            }

            return(assignees.Distinct().ToList());
        }