AgendaSharedFunctions.cs
2.15 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
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.Meetings.Agenda;
namespace Sungero.Meetings.Shared
{
partial class AgendaFunctions
{
/// <summary>
/// Установить обязательность свойств в зависимости от заполненных данных.
/// </summary>
public override void SetRequiredProperties()
{
base.SetRequiredProperties();
_obj.State.Properties.Subject.IsRequired = false;
_obj.State.Properties.BusinessUnit.IsRequired = true;
_obj.State.Properties.Department.IsRequired = true;
_obj.State.Properties.PreparedBy.IsRequired = true;
}
public override void ChangeDocumentPropertiesAccess(bool isEnabled, bool repeatRegister)
{
base.ChangeDocumentPropertiesAccess(isEnabled, repeatRegister);
_obj.State.Properties.Assignee.IsVisible = false;
}
/// <summary>
/// Заполнить имя.
/// </summary>
public override void FillName()
{
var documentKind = _obj.DocumentKind;
if (documentKind != null && !documentKind.GenerateDocumentName.Value && _obj.Name == Docflow.Resources.DocumentNameAutotext)
_obj.Name = string.Empty;
if (documentKind == null || !documentKind.GenerateDocumentName.Value)
return;
var name = string.Empty;
if (_obj.Meeting != null)
{
var meeting = _obj.Meeting;
/* Имя в формате:
<Вид документа> от <дата совещания> по <тема совещания>.
*/
using (TenantInfo.Culture.SwitchTo())
{
name += Functions.Meeting.GetMeetingNameWithDate(meeting);
}
}
if (string.IsNullOrWhiteSpace(name))
name = Docflow.Resources.DocumentNameAutotext;
else if (documentKind != null)
name = documentKind.ShortName + name;
name = Docflow.PublicFunctions.Module.TrimSpecialSymbols(name);
_obj.Name = Docflow.PublicFunctions.OfficialDocument.AddClosingQuote(name, _obj);
}
}
}