ApprovalReviewAssignmentClientFunctions.cs
2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.Docflow.ApprovalReviewAssignment;
namespace Sungero.Docflow.Client
{
partial class ApprovalReviewAssignmentFunctions
{
/// <summary>
/// Установка ЭП.
/// </summary>
/// <param name="e">Параметр действия.</param>
/// <param name="comment">Комментарий.</param>
public void SetSignature(Sungero.Workflow.Client.ExecuteResultActionArgs e, string comment)
{
// Не подписывать, если это внесение результата рассмотрения.
if (_obj.IsResultSubmission == true)
return;
var needStrongSign = _obj.Stage.NeedStrongSign ?? false;
var document = _obj.DocumentGroup.OfficialDocuments.FirstOrDefault();
var addenda = _obj.AddendaGroup.OfficialDocuments.ToList();
var addendaToElectronic = _obj.AddendaGroup.OfficialDocuments.ToList<Sungero.Content.IElectronicDocument>();
var performer = Company.Employees.As(_obj.Performer);
var canSignByEmployee = Functions.OfficialDocument.Remote.CanSignByEmployee(document, Company.Employees.Current);
// Подписать утверждающей подписью, если нет прав, то согласующей.
if (document.AccessRights.CanApprove() && canSignByEmployee)
{
// Для утверждения необходимо, чтобы документ не был заблокирован.
var lockInfo = Functions.OfficialDocument.GetDocumentLockInfo(document);
if (lockInfo != null && lockInfo.IsLocked)
{
e.AddError(Sungero.Docflow.ApprovalReviewAssignments.Resources.CanNotSetSignatureFormat(lockInfo.OwnerName, lockInfo.LockTime));
return;
}
Functions.Module.ApproveDocument(document, addenda, performer, needStrongSign, comment, e);
}
else
Functions.Module.EndorseDocument(document, addendaToElectronic, performer, true, needStrongSign, comment, e);
}
}
}