예제 #1
0
        public virtual IQueryable <Sungero.Workflow.IAssignmentBase> OnReworkDataQuery(IQueryable <Sungero.Workflow.IAssignmentBase> query)
        {
            // Фильтр по типу.
            var result = query
                         .Where(a => ApprovalReworkAssignments.Is(a) || FreeApprovalReworkAssignments.Is(a) ||
                                (ReportRequestAssignments.Is(a) && (ReportRequestAssignments.As(a).IsRework == true)));

            // Запрос непрочитанных без фильтра.
            if (_filter == null)
            {
                return(RecordManagement.PublicFunctions.Module.ApplyCommonSubfolderFilters(result));
            }

            // Фильтры по статусу, замещению и периоду.
            result = RecordManagement.PublicFunctions.Module.ApplyCommonSubfolderFilters(result, _filter.InProcess,
                                                                                         _filter.Last30Days, _filter.Last90Days, _filter.Last180Days, false);

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Получить заголовок.
        /// </summary>
        /// <param name="assignment">Задание.</param>
        /// <returns>Информация о задании: исполнитель, срок, результат - отформатированная для предметного отображения.</returns>
        public Structures.FreeApprovalTask.AssignmentInfo GetPerformerAndDeadlineAndStatus(IAssignment assignment)
        {
            var performerName = PublicFunctions.OfficialDocument.GetAuthor(assignment.Performer, assignment.CompletedBy);
            var actionLabel   = string.Empty;
            var emptyResult   = Structures.FreeApprovalTask.AssignmentInfo.Create(string.Empty, string.Empty, string.Empty);

            // Задание завершено.
            if (assignment.Status == Workflow.AssignmentBase.Status.Completed)
            {
                // Согласование.
                if (FreeApprovalAssignments.Is(assignment))
                {
                    if (assignment.Result == Docflow.FreeApprovalAssignment.Result.Approved)
                    {
                        actionLabel = ApprovalTasks.Resources.StateViewEndorsed;
                    }
                    else if (assignment.Result == Docflow.FreeApprovalAssignment.Result.ForRework)
                    {
                        actionLabel = ApprovalTasks.Resources.StateViewNotApproved;
                    }
                    else if (assignment.Result == Docflow.FreeApprovalAssignment.Result.Forward)
                    {
                        actionLabel = ApprovalTasks.Resources.StateViewForwarded;
                    }
                    else
                    {
                        return(emptyResult);
                    }
                }

                // Задание на завершение согласования.
                if (FreeApprovalFinishAssignments.Is(assignment))
                {
                    if (assignment.Result == Docflow.FreeApprovalFinishAssignment.Result.Complete)
                    {
                        actionLabel = ApprovalTasks.Resources.StateViewDone;
                    }
                    else
                    {
                        return(emptyResult);
                    }
                }

                // Прекращение на доработке.
                if (FreeApprovalReworkAssignments.Is(assignment) && assignment.Status == Workflow.AssignmentBase.Status.Aborted)
                {
                    actionLabel = ApprovalTasks.Resources.StateViewAborted;
                }

                var completed = Functions.Module.ToShortDateShortTime(assignment.Completed.Value.ToUserTime());

                if (!string.IsNullOrWhiteSpace(actionLabel))
                {
                    return(Structures.FreeApprovalTask.AssignmentInfo.Create(string.Format("{0} ", performerName), string.Format("{0}: {1}", OfficialDocuments.Resources.StateViewDate, completed), actionLabel));
                }
            }

            // Задание в работе или прекращено.
            if (assignment.Status == Workflow.AssignmentBase.Status.InProcess ||
                assignment.Status == Workflow.AssignmentBase.Status.Aborted ||
                assignment.Status == Workflow.AssignmentBase.Status.Suspended)
            {
                var status = ApprovalTasks.Resources.StateViewAborted.ToString();
                if (assignment.Status == Workflow.AssignmentBase.Status.InProcess)
                {
                    status = assignment.IsRead == true ? ApprovalTasks.Resources.StateViewInProcess : ApprovalTasks.Resources.StateViewUnRead;
                }

                var deadline = assignment.Deadline.HasValue ?
                               Functions.Module.ToShortDateShortTime(assignment.Deadline.Value.ToUserTime()) :
                               OfficialDocuments.Resources.StateViewWithoutTerm;

                return(Structures.FreeApprovalTask.AssignmentInfo.Create(string.Format("{0} ", performerName), string.Format("{0}: {1}", OfficialDocuments.Resources.StateViewDeadline, deadline), status));
            }

            return(emptyResult);
        }
예제 #3
0
        /// <summary>
        /// Добавить задания свободного согласования.
        /// </summary>
        /// <param name="parentBlock">Блок группировки.</param>
        /// <param name="taskBlock">Блок задачи.</param>
        /// <param name="assignments">Список заданий в рамках этапа согласования.</param>
        public void AddAssignmentsBlocks(Sungero.Core.StateBlock parentBlock, Sungero.Core.StateBlock taskBlock, List <IAssignment> assignments)
        {
            foreach (var assignment in assignments)
            {
                var noteStyle              = Functions.Module.CreateNoteStyle();
                var separatorStyle         = Docflow.PublicFunctions.Module.CreateSeparatorStyle();
                var performerDeadlineStyle = Docflow.PublicFunctions.Module.CreatePerformerDeadlineStyle();

                var performerAndDeadlineAndStatus = this.GetPerformerAndDeadlineAndStatus(assignment);
                var performer = performerAndDeadlineAndStatus.Performer;
                var deadline  = performerAndDeadlineAndStatus.Deadline;
                var status    = performerAndDeadlineAndStatus.Status;

                if (string.IsNullOrWhiteSpace(performer))
                {
                    continue;
                }

                StateBlock block;
                if (parentBlock != null && FreeApprovalAssignments.Is(assignment))
                {
                    block = parentBlock.AddChildBlock();
                }
                else
                {
                    block = taskBlock.AddChildBlock();
                }

                this.SetIcon(block, assignment);

                block.Entity = assignment;

                // Заголовок блока с заданием о завершении или доработке.
                if (!FreeApprovalAssignments.Is(assignment))
                {
                    var blockLabel = string.Empty;
                    if (FreeApprovalFinishAssignments.Is(assignment))
                    {
                        blockLabel = FreeApprovalTasks.Resources.StateViewCompleteApprovalAssignment;
                    }
                    else if (FreeApprovalReworkAssignments.Is(assignment))
                    {
                        blockLabel = FreeApprovalTasks.Resources.StateViewReworkByRemarks;
                    }

                    block.AddLabel(blockLabel, Docflow.PublicFunctions.Module.CreateHeaderStyle());
                    block.AddLineBreak();
                }

                // Заполнить участников.
                var performerLabel = string.Format("{0}{1}", performer, deadline);
                block.AddLabel(performerLabel, performerDeadlineStyle);

                var comment = Docflow.Functions.Module.GetAssignmentUserComment(assignment);
                if (!string.IsNullOrWhiteSpace(comment))
                {
                    block.AddLineBreak();
                    block.AddLabel(Constants.Module.SeparatorText, separatorStyle);
                    block.AddLineBreak();
                    block.AddEmptyLine(Constants.Module.EmptyLineMargin);
                    block.AddLabel(comment, noteStyle);
                }

                // Заполнить статус задания и просрочку.
                Functions.Module.AddInfoToRightContent(block, status);

                if (assignment.Status == Workflow.AssignmentBase.Status.InProcess && assignment.Deadline.HasValue)
                {
                    Functions.OfficialDocument.AddDeadlineHeaderToRight(block, assignment.Deadline.Value, assignment.Performer);
                }
            }
        }