示例#1
0
        /// <summary>
        /// Добавить статус согласования.
        /// </summary>
        /// <param name="block">Блок.</param>
        /// <param name="style">Стиль.</param>
        public void AddStatusInfoToRight(Sungero.Core.StateBlock block, Sungero.Core.StateBlockLabelStyle style)
        {
            var status = string.Empty;

            if (_obj.Status == Workflow.Task.Status.InProcess)
            {
                status = ApprovalTasks.Resources.StateViewInProcess;
            }
            else if (_obj.Status == Workflow.Task.Status.Completed)
            {
                status = ApprovalTasks.Resources.StateViewCompleted;
            }
            else if (_obj.Status == Workflow.Task.Status.Aborted)
            {
                status = ApprovalTasks.Resources.StateViewAborted;
            }
            else if (_obj.Status == Workflow.Task.Status.Suspended)
            {
                status = ApprovalTasks.Resources.StateViewSuspended;
            }
            else if (_obj.Status == Workflow.Task.Status.Draft)
            {
                status = ApprovalTasks.Resources.StateViewDraft;
            }

            Functions.Module.AddInfoToRightContent(block, status, style);
        }
示例#2
0
        /// <summary>
        /// Добавить задания в работе.
        /// </summary>
        /// <param name="taskBlock">Блок задачи.</param>
        /// <param name="assignments">Задания на ознакомление в работе.</param>
        public void AddInProcessAssignmentsBlock(Sungero.Core.StateBlock taskBlock, List <IAcquaintanceAssignment> assignments)
        {
            if (!assignments.Any())
            {
                return;
            }

            // Группировка.
            var parentBlock = taskBlock.AddChildBlock();

            parentBlock.IsExpanded        = false;
            parentBlock.NeedGroupChildren = true;

            // Добавить ссылку на задание, если оно одно.
            if (assignments.Count == 1)
            {
                parentBlock.Entity = assignments.FirstOrDefault();
            }

            // Иконка.
            var isAborted = assignments.First().Status == Workflow.AssignmentBase.Status.Aborted;

            parentBlock.AssignIcon(Docflow.ApprovalRuleBases.Resources.Assignment, StateBlockIconSize.Large);
            if (isAborted)
            {
                parentBlock.AssignIcon(StateBlockIconType.Abort, StateBlockIconSize.Large);
            }

            // Заголовок.
            var headerStyle = Docflow.PublicFunctions.Module.CreateHeaderStyle(false);

            parentBlock.AddLabel(AcquaintanceTasks.Resources.StateViewAsquaintance, headerStyle);
            parentBlock.AddLineBreak();

            // Исполнители.
            var performers      = assignments.Select(a => Sungero.Company.Employees.As(a.Performer)).ToList();
            var performersLabel = Docflow.PublicFunctions.OfficialDocument.GetPerformersInText(performers);

            parentBlock.AddLabel(performersLabel, Docflow.PublicFunctions.Module.CreatePerformerDeadlineStyle());

            // Статус.
            var status = Docflow.ApprovalTasks.Resources.StateViewInProcess;

            if (isAborted)
            {
                status = Docflow.ApprovalTasks.Resources.StateViewAborted;
            }

            Docflow.PublicFunctions.Module.AddInfoToRightContent(parentBlock, status);
        }
示例#3
0
        /// <summary>
        /// Добавить блок отправки на круг согласования.
        /// </summary>
        /// <param name="parentBlock">Родительский блок.</param>
        /// <param name="assignment">Задание.</param>
        /// <param name="hasReworkBefore">После доработки.</param>
        /// <param name="hasRestartBefore">После рестарта.</param>
        public void AddSendForApprovalBlock(Sungero.Core.StateBlock parentBlock, IAssignment assignment, bool hasReworkBefore, bool hasRestartBefore)
        {
            if (!hasReworkBefore && !hasRestartBefore)
            {
                return;
            }

            var comment      = Functions.Module.GetAssignmentUserComment(assignment);
            var textTemplate = ApprovalTasks.Resources.StateViewDocumentSentForReApproval;

            if (hasRestartBefore)
            {
                comment      = Functions.Module.GetTaskUserComment(_obj, assignment.Created.Value, FreeApprovalTasks.Resources.ApprovalText);
                textTemplate = ApprovalTasks.Resources.StateViewDocumentSentAfterRestart;
            }

            Docflow.PublicFunctions.OfficialDocument
            .AddUserActionBlock(parentBlock, _obj.Author, textTemplate, assignment.Modified.Value, _obj, comment, _obj.StartedBy);
        }
示例#4
0
        /// <summary>
        /// Добавить задания на ознакомление.
        /// </summary>
        /// <param name="taskBlock">Блок задачи.</param>
        /// <param name="assignments">Лично выполненые задания на ознакомление.</param>
        /// <param name="isElectronicAcquaintance">Признак электронного ознакомления.</param>
        public void AddSelfCompletedAssignmentsBlocks(Sungero.Core.StateBlock taskBlock,
                                                      List <IAcquaintanceAssignment> assignments,
                                                      bool isElectronicAcquaintance)
        {
            if (!assignments.Any())
            {
                return;
            }

            // Группировка.
            var parentBlock = taskBlock.AddChildBlock();

            parentBlock.IsExpanded        = false;
            parentBlock.NeedGroupChildren = true;

            // Иконка.
            parentBlock.AssignIcon(Docflow.ApprovalTasks.Resources.Completed, StateBlockIconSize.Large);

            // Заголовок.
            var headerStyle = Docflow.PublicFunctions.Module.CreateHeaderStyle(false);

            parentBlock.AddLabel(AcquaintanceTasks.Resources.StateViewAsquaintance, headerStyle);
            parentBlock.AddLineBreak();

            // Исполнители.
            var performers      = assignments.Select(a => Sungero.Company.Employees.As(a.Performer)).ToList();
            var performersLabel = Docflow.PublicFunctions.OfficialDocument.GetPerformersInText(performers);

            parentBlock.AddLabel(performersLabel, Docflow.PublicFunctions.Module.CreatePerformerDeadlineStyle());

            // Статус.
            var status = AcquaintanceTasks.Resources.StateViewAcquainted;

            Docflow.PublicFunctions.Module.AddInfoToRightContent(parentBlock, status);

            // Задания.
            foreach (var assignment in assignments)
            {
                this.AddAssignmentBlock(parentBlock, assignment, isElectronicAcquaintance, StateBlockIconSize.Small, string.Empty);
            }
        }
示例#5
0
        /// <summary>
        /// Добавить задания на ознакомление.
        /// </summary>
        /// <param name="parentBlock">Родительский блок.</param>
        /// <param name="assignment">Задание на ознакомление.</param>
        /// <param name="isElectronicAcquaintance">Признак электронного ознакомления.</param>
        /// <param name="iconSize">Размер иконки.</param>
        /// <param name="header">Заголовок.</param>
        public void AddAssignmentBlock(Sungero.Core.StateBlock parentBlock,
                                       IAssignment assignment,
                                       bool isElectronicAcquaintance,
                                       Sungero.Core.StateBlockIconSize iconSize,
                                       string header)
        {
            if (assignment == null)
            {
                return;
            }

            var headerStyle            = Docflow.PublicFunctions.Module.CreateHeaderStyle(false);
            var noteStyle              = Docflow.PublicFunctions.Module.CreateNoteStyle();
            var separatorStyle         = Docflow.PublicFunctions.Module.CreateSeparatorStyle();
            var performerDeadlineStyle = Docflow.PublicFunctions.Module.CreatePerformerDeadlineStyle();

            // Сущность (ссылка).
            var block = parentBlock.AddChildBlock();

            block.Entity = assignment;

            // Иконка.
            block.AssignIcon(Docflow.ApprovalRuleBases.Resources.Assignment, iconSize);
            var selfCompleted = !isElectronicAcquaintance || Equals(assignment.Performer, assignment.CompletedBy);

            if (assignment.Result != null)
            {
                block.AssignIcon(Docflow.ApprovalTasks.Resources.Completed, iconSize);
                if (iconSize == StateBlockIconSize.Small)
                {
                    block.AssignIcon(StateBlockIconType.Completed, iconSize);
                }

                if (!selfCompleted)
                {
                    block.AssignIcon(AcquaintanceTasks.Resources.SubstitutionAccept, iconSize);
                }
            }

            // Заголовок.
            if (!string.IsNullOrWhiteSpace(header))
            {
                block.AddLabel(header, headerStyle);
                block.AddLineBreak();
            }

            // Исполнитель.
            var performerName = Docflow.PublicFunctions.OfficialDocument.GetAuthor(assignment.Performer, assignment.CompletedBy);

            block.AddLabel(performerName, performerDeadlineStyle);

            // Срок.
            var deadline = assignment.Deadline.HasValue
        ? Docflow.PublicFunctions.Module.ToShortDateShortTime(assignment.Deadline.Value.ToUserTime())
        : Docflow.OfficialDocuments.Resources.StateViewWithoutTerm;

            deadline = string.Format("{0}: {1}", Docflow.OfficialDocuments.Resources.StateViewDeadline, deadline);
            if (assignment.Completed.HasValue)
            {
                var completed = Docflow.PublicFunctions.Module.ToShortDateShortTime(assignment.Completed.Value.ToUserTime());
                deadline = string.Format("{0}: {1}", Docflow.OfficialDocuments.Resources.StateViewDate, completed);
            }
            block.AddLabel(deadline, performerDeadlineStyle);

            // Комментарий.
            var comment = Docflow.PublicFunctions.Module.GetAssignmentUserComment(assignment);

            if (!string.IsNullOrWhiteSpace(comment))
            {
                block.AddLineBreak();
                block.AddLabel(Docflow.PublicConstants.Module.SeparatorText, separatorStyle);
                block.AddLineBreak();
                block.AddEmptyLine(Docflow.PublicConstants.Module.EmptyLineMargin);
                block.AddLabel(comment, noteStyle);
            }

            // Статус.
            var status = string.Empty;

            if (assignment.Status == Workflow.AssignmentBase.Status.InProcess)
            {
                status = Docflow.ApprovalTasks.Resources.StateViewInProcess;
                if (assignment.IsRead != true)
                {
                    status = Docflow.ApprovalTasks.Resources.StateViewUnRead;
                }
            }

            if (assignment.Status == Workflow.AssignmentBase.Status.Aborted ||
                assignment.Status == Workflow.AssignmentBase.Status.Suspended)
            {
                status = Docflow.ApprovalTasks.Resources.StateViewAborted.ToString();
            }

            if (assignment.Status == Workflow.AssignmentBase.Status.Completed)
            {
                status = AcquaintanceTasks.Resources.StateViewAcquainted;
                if (!selfCompleted || AcquaintanceFinishAssignments.Is(assignment))
                {
                    status = AcquaintanceTasks.Resources.StateViewCompleted;
                }
            }

            Docflow.PublicFunctions.Module.AddInfoToRightContent(block, status);
            if (assignment.Status == Workflow.AssignmentBase.Status.InProcess && assignment.Deadline.HasValue)
            {
                Docflow.PublicFunctions.OfficialDocument.AddDeadlineHeaderToRight(block, assignment.Deadline.Value, assignment.Performer);
            }
        }
示例#6
0
        /// <summary>
        /// Установить иконку задания.
        /// </summary>
        /// <param name="block">Блок задания.</param>
        /// <param name="assignment">Задание.</param>
        public void SetIcon(Sungero.Core.StateBlock block, IAssignment assignment)
        {
            // Размер иконок: большой, если не задание согласования.
            var iconSize = StateBlockIconSize.Large;

            if (FreeApprovalAssignments.Is(assignment))
            {
                iconSize = StateBlockIconSize.Small;
            }

            block.AssignIcon(StateBlockIconType.OfEntity, iconSize);

            if (assignment.Result != null)
            {
                // Согласовано.
                if (assignment.Result == Docflow.FreeApprovalAssignment.Result.Approved)
                {
                    iconSize = StateBlockIconSize.Small;
                    block.AssignIcon(ApprovalTasks.Resources.Approve, iconSize);
                }

                // На доработку.
                if (assignment.Result == Docflow.FreeApprovalAssignment.Result.ForRework)
                {
                    iconSize = StateBlockIconSize.Small;
                    block.AssignIcon(ApprovalTasks.Resources.Notapprove, iconSize);
                }

                // На повторное согласование.
                if (assignment.Result == Docflow.FreeApprovalReworkAssignment.Result.Reworked)
                {
                    block.AssignIcon(StateBlockIconType.User, iconSize);
                    block.ShowBorder = false;
                    block.DockType   = DockType.Bottom;
                }

                // Выполнено.
                if (assignment.Result == Docflow.FreeApprovalFinishAssignment.Result.Complete)
                {
                    block.AssignIcon(ApprovalTasks.Resources.Completed, iconSize);
                }

                // Переадресовано.
                if (assignment.Result == Docflow.FreeApprovalAssignment.Result.Forward)
                {
                    block.AssignIcon(FreeApprovalTasks.Resources.Forward, iconSize);
                }

                // Прекращено
                if (assignment.Status == Workflow.AssignmentBase.Status.Aborted)
                {
                    block.AssignIcon(StateBlockIconType.Abort, iconSize);
                }
            }

            // Прекращено, остановлено по ошибке.
            if (assignment.Status == Workflow.AssignmentBase.Status.Aborted ||
                assignment.Status == Workflow.AssignmentBase.Status.Suspended)
            {
                block.AssignIcon(StateBlockIconType.Abort, iconSize);
            }
        }
示例#7
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);
                }
            }
        }