CaseInventoryActions.cs
3.6 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using DirRX.CaseArchiving.CaseInventory;
namespace DirRX.CaseArchiving.Client
{
partial class CaseInventoryActions
{
public override void SendForApproval(Sungero.Domain.Client.ExecuteActionArgs e)
{
base.SendForApproval(e);
}
public override bool CanSendForApproval(Sungero.Domain.Client.CanExecuteActionArgs e)
{
return base.CanSendForApproval(e);
}
public virtual void CreateVersionFromReport(Sungero.Domain.Client.ExecuteActionArgs e)
{
// Если документ свежесозданный, сохранить его, чтобы были проверены обязательные поля.
if (_obj.State.IsInserted)
_obj.Save();
// Переформировать версию может только делопроизводитель, указанный в описи.
if (Users.Current != null && Users.Current.IsSystem != true && _obj.Responsible != null &&
_obj.Responsible != Storage.PublicFunctions.Module.Remote.GetEmployeeForCurentUser())
{
CaseInventories.Resources.WarningOnlyResponsibleCanReformVersionFormat(_obj.Responsible.DisplayValue);
return;
}
var oldVersion = _obj.LastVersion;
var newVerison = CaseArchiving.PublicFunctions.CaseInventory.GenerateLastVersionFromReport(_obj);
if (newVerison != null)
Dialogs.NotifyMessage(oldVersion == newVerison ? CaseInventories.Resources.NotifyVersionReformatted : CaseInventories.Resources.NotifyVersionCreated);
else
e.AddError(CaseInventories.Resources.ErrorFailedReformatVersion);
}
public virtual bool CanCreateVersionFromReport(Sungero.Domain.Client.CanExecuteActionArgs e)
{
// Нельзя переформировывать опись, если указана дата передачи на архивное хранение.
return !_obj.ArchiveDate.HasValue;
}
public virtual void RemoveCaseFiles(Sungero.Domain.Client.ExecuteActionArgs e)
{
// Отобразить диалог для исключения дел из описи.
var error = Functions.CaseInventory.RemoveCaseFilesDialog(_obj, null);
if (error != string.Empty)
e.AddWarning(error);
else
Dialogs.NotifyMessage("Дела исключены из описи.");
}
public virtual bool CanRemoveCaseFiles(Sungero.Domain.Client.CanExecuteActionArgs e)
{
return !_obj.State.IsInserted;
}
public virtual void AddCaseFiles(Sungero.Domain.Client.ExecuteActionArgs e)
{
// Проверить, что заполнены все обязательные свойства.
// Пока просто через сохранение.
if (_obj.State.IsChanged)
_obj.Save();
// Отобразить диалог для включения дел в опись.
var error = Functions.CaseInventory.AddCaseFilesDialog(_obj);
if (error != string.Empty)
e.AddWarning(error);
else
Dialogs.NotifyMessage("Дела включены в опись.");
}
public virtual bool CanAddCaseFiles(Sungero.Domain.Client.CanExecuteActionArgs e)
{
return true;
}
public virtual void ShowCaseFiles(Sungero.Domain.Client.ExecuteActionArgs e)
{
PublicFunctions.CaseInventory.Remote.GetCaseFiles(_obj).Show();
}
public virtual bool CanShowCaseFiles(Sungero.Domain.Client.CanExecuteActionArgs e)
{
return true;
}
}
}