ReceiptNotificationSendingAssignmentActions.cs
3.26 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
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.Exchange.ReceiptNotificationSendingAssignment;
namespace Sungero.Exchange.Client
{
partial class ReceiptNotificationSendingAssignmentActions
{
public virtual void Forwarded(Sungero.Workflow.Client.ExecuteResultActionArgs e)
{
// Не давать переадресовать, если адресат или срок не заполнены.
if (_obj.Addressee == null || _obj.NewDeadline == null)
{
e.AddError(ExchangeDocumentProcessingAssignments.Resources.CantReAddressWithoutAddresseeAndDeadline);
return;
}
// Не давать переадресовывать на срок меньше, чем сейчас.
if (_obj.NewDeadline.HasValue)
{
// Проводить валидацию на конец дня, если указана дата без времени.
if (!Docflow.PublicFunctions.Module.CheckDeadline(_obj.Addressee, _obj.NewDeadline, Calendar.Now))
{
e.AddError(ExchangeDocumentProcessingAssignments.Resources.ImpossibleSpecifyDeadlineLessThenToday);
return;
}
}
// Замена стандартного диалога подтверждения выполнения действия.
if (!Docflow.PublicFunctions.Module.ShowConfirmationDialog(e.Action.ConfirmationMessage, null, null,
Constants.ReceiptNotificationSendingTask.ReceiptNotificationSendingAssignmentConfirmDialogID.Forwarded))
e.Cancel();
// Прокинуть новый срок и исполнителя в задачу.
var task = ReceiptNotificationSendingTasks.As(_obj.Task);
task.Addressee = _obj.Addressee;
task.MaxDeadline = _obj.NewDeadline;
task.Save();
}
public virtual bool CanForwarded(Sungero.Workflow.Client.CanExecuteResultActionArgs e)
{
return true;
}
public virtual void ShowDocuments(Sungero.Domain.Client.ExecuteActionArgs e)
{
var documents = Functions.Module.Remote.GetDocumentsWithoutReceiptNotification(_obj.Box);
documents.Show();
}
public virtual bool CanShowDocuments(Sungero.Domain.Client.CanExecuteActionArgs e)
{
return true;
}
public virtual void Complete(Sungero.Workflow.Client.ExecuteResultActionArgs e)
{
if (!Functions.Module.HasCurrentUserExchangeServiceCertificate(_obj.Box))
{
e.AddError(Resources.CertificateNotFound);
return;
}
// Замена стандартного диалога подтверждения выполнения действия.
if (!Docflow.PublicFunctions.Module.ShowConfirmationDialog(e.Action.ConfirmationMessage, null, null,
Constants.ReceiptNotificationSendingTask.ReceiptNotificationSendingAssignmentConfirmDialogID.Complete))
e.Cancel();
Functions.ReceiptNotificationSendingAssignment.SendReceiptNotification(_obj, e);
}
public virtual bool CanComplete(Sungero.Workflow.Client.CanExecuteResultActionArgs e)
{
return _obj.Addressee == null;
}
}
}