ModuleServerFunctions.cs
2.92 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
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Company;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.Domain.Shared;
namespace Sungero.Meetings.Server
{
public class ModuleFunctions
{
/// <summary>
/// Получить список поручений по совещаниям.
/// </summary>
/// <returns>Список поручений.</returns>
[Remote, Public]
public IQueryable<RecordManagement.IActionItemExecutionTask> GetMeetingActionItemExecutionTasks()
{
var minuteses = Minuteses.GetAll(m => m.Meeting != null);
var groupId = Docflow.PublicConstants.Module.TaskMainGroup.ActionItemExecutionTask;
return RecordManagement.ActionItemExecutionTasks.GetAll(a => a.AttachmentDetails.Any(d => d.EntityTypeGuid == Minutes.ClassTypeGuid &&
d.GroupId == groupId && minuteses.Any(m => Equals(m.Id, d.AttachmentId))));
}
/// <summary>
/// Данные для отчета полномочий сотрудника из модуля Совещания.
/// </summary>
/// <param name="employee">Сотрудник для обработки.</param>
/// <returns>Данные для отчета.</returns>
[Public]
public virtual List<Company.Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine> GetResponsibilitiesReportData(IEmployee employee)
{
// HACK: Получаем отображаемое имя модуля.
var moduleGuid = new MeetingsModule().Id;
var moduleName = Sungero.Metadata.Services.MetadataSearcher.FindModuleMetadata(moduleGuid).GetDisplayName();
var modulePriority = Company.PublicConstants.ResponsibilitiesReport.MeetingsPriority;
var result = new List<Company.Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine>();
if (!Meetings.AccessRights.CanRead())
return result;
var emplIsPresident = Meetings.GetAll(x => Equals(x.President, employee))
.Where(d => d.Status == Sungero.CoreEntities.DatabookEntry.Status.Active)
.Where(d => d.DateTime >= Calendar.Now);
result = Company.PublicFunctions.Module.AppendResponsibilitiesReportResult(result, emplIsPresident, moduleName, modulePriority,
Resources.MeetingsPresident, null);
var emplIsSecretary = Meetings.GetAll(x => Equals(x.Secretary, employee))
.Where(d => d.Status == Sungero.CoreEntities.DatabookEntry.Status.Active)
.Where(d => d.DateTime >= Calendar.Now);
result = Company.PublicFunctions.Module.AppendResponsibilitiesReportResult(result, emplIsSecretary, moduleName, modulePriority,
Resources.MeetingsSecretary, null);
return result;
}
}
}