DocumentReviewTaskActions.cs
3.75 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
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.RecordManagement.DocumentReviewTask;
namespace Sungero.RecordManagement.Client
{
partial class DocumentReviewTaskActions
{
public override void Abort(Sungero.Domain.Client.ExecuteActionArgs e)
{
var error = Docflow.PublicFunctions.Module.Remote.GetTaskAbortingError(_obj, Docflow.PublicConstants.Module.TaskMainGroup.DocumentReviewTask.ToString());
if (!string.IsNullOrWhiteSpace(error))
{
e.AddError(error);
}
else
{
if (!Docflow.PublicFunctions.Module.ShowConfirmationDialog(e.Action.ConfirmationMessage, null, null, Constants.DocumentReviewTask.AbortConfirmDialogID))
return;
base.Abort(e);
}
}
public override bool CanAbort(Sungero.Domain.Client.CanExecuteActionArgs e)
{
return base.CanAbort(e);
}
public virtual void AddResolution(Sungero.Domain.Client.ExecuteActionArgs e)
{
if (!e.Validate())
return;
PublicFunctions.DocumentReviewTask.AddResolution(_obj);
}
public virtual bool CanAddResolution(Sungero.Domain.Client.CanExecuteActionArgs e)
{
return _obj.Status.Value == Workflow.Task.Status.Draft;
}
public override void Start(Sungero.Domain.Client.ExecuteActionArgs e)
{
if (!e.Validate())
return;
if (!RecordManagement.Functions.DocumentReviewTask.ValidateDocumentReviewTaskStart(_obj, e))
return;
// Вывести подтверждение удаления проектов резолюции.
var dropDialogDescription = string.Empty;
var dropDialogId = string.Empty;
if (_obj.ResolutionGroup.ActionItemExecutionTasks.Any() &&
!Functions.DocumentReviewTask.Remote.CanAuthorPrepareResolution(_obj))
{
// Инициатор не помощник адресата - удалить все.
dropDialogDescription = Resources.ConfirmDeleteDraftResolutionAssignment;
dropDialogId = Constants.DocumentReviewTask.StartWithDropConfirmDialogID;
}
else if (_obj.ResolutionGroup.ActionItemExecutionTasks.Where(x => _obj.Addressees.All(a => !Equals(a.Addressee, x.AssignedBy))).Any())
{
// Часть проектов выданы не тем адресатом, что указан в задаче - удалить неактуальные.
dropDialogDescription = DocumentReviewTasks.Resources.ConfirmDeleteDraftResolutionsForWrongAddressee;
dropDialogId = Constants.DocumentReviewTask.StartWithDropWrongActionItemsConfirmDialogID;
}
if (!string.IsNullOrEmpty(dropDialogDescription) && !string.IsNullOrEmpty(dropDialogId) &&
!Functions.DocumentReviewTask.ShowDeletingDraftResolutionsConfirmationDialog(_obj, e.Action.ConfirmationMessage, dropDialogDescription, dropDialogId))
return;
// Вывести запрос прав на группу "Дополнительно".
var grantRightDialogResult = Docflow.PublicFunctions.Module.ShowDialogGrantAccessRights(_obj, _obj.OtherGroup.All.ToList());
if (grantRightDialogResult == false)
return;
// Вывести стандартный диалог подтверждения выполнения действия.
if (_obj.NeedDeleteActionItems != true &&
grantRightDialogResult == null &&
!Docflow.PublicFunctions.Module.ShowConfirmationDialog(e.Action.ConfirmationMessage, null, null, Constants.DocumentReviewTask.StartConfirmDialogID))
return;
base.Start(e);
}
public override bool CanStart(Sungero.Domain.Client.CanExecuteActionArgs e)
{
return base.CanStart(e);
}
}
}