ContractApprovalRoleServerFunctions.cs
1.63 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
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Company;
using Sungero.Contracts.ContractApprovalRole;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.Docflow;
namespace Sungero.Contracts.Server
{
partial class ContractApprovalRoleFunctions
{
/// <summary>
/// Получить сотрудника из роли по документу.
/// </summary>
/// <param name="task">Задача.</param>
/// <returns>Сотрудник.</returns>
public override IEmployee GetRolePerformer(IApprovalTask task)
{
var document = task.DocumentGroup.OfficialDocuments.FirstOrDefault();
if (document == null)
return base.GetRolePerformer(task);
if (_obj.Type == Docflow.ApprovalRoleBase.Type.ContractResp)
return Functions.Module.GetPerformerContractResponsible(document);
if (_obj.Type == Docflow.ApprovalRoleBase.Type.ContRespManager)
return this.GetPerformerContractResponsibleManager(document);
return base.GetRolePerformer(task);
}
#region Вычисление ролей
/// <summary>
/// Получить руководителя сотрудника, ответственного за договор.
/// </summary>
/// <param name="document">Документ.</param>
/// <returns>Сотрудник.</returns>
private IEmployee GetPerformerContractResponsibleManager(IOfficialDocument document)
{
return Docflow.PublicFunctions.Module.Remote.GetManager(Functions.Module.GetPerformerContractResponsible(document));
}
#endregion
}
}