PersonalSettingHandlers.cs
3.37 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
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Company;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.Docflow.PersonalSetting;
namespace Sungero.Docflow
{
partial class PersonalSettingResolutionAuthorPropertyFilteringServerHandler<T>
{
public virtual IQueryable<T> ResolutionAuthorFiltering(IQueryable<T> query, Sungero.Domain.PropertyFilteringEventArgs e)
{
e.DisableUiFiltering = true;
return Functions.Module.UsersCanBeResolutionAuthor(null).Cast<T>().AsQueryable();
}
}
partial class PersonalSettingContractDocRegisterPropertyFilteringServerHandler<T>
{
public virtual IQueryable<T> ContractDocRegisterFiltering(IQueryable<T> query, Sungero.Domain.PropertyFilteringEventArgs e)
{
return query.Where(l => Recipients.OwnRecipientIdsFor(_obj.Employee).Contains(l.RegistrationGroup.Id) && l.DocumentFlow == DocumentRegister.DocumentFlow.Contracts);
}
}
partial class PersonalSettingInnerDocRegisterPropertyFilteringServerHandler<T>
{
public virtual IQueryable<T> InnerDocRegisterFiltering(IQueryable<T> query, Sungero.Domain.PropertyFilteringEventArgs e)
{
return query.Where(l => Recipients.OwnRecipientIdsFor(_obj.Employee).Contains(l.RegistrationGroup.Id) && l.DocumentFlow == DocumentRegister.DocumentFlow.Inner);
}
}
partial class PersonalSettingOutgoingDocRegisterPropertyFilteringServerHandler<T>
{
public virtual IQueryable<T> OutgoingDocRegisterFiltering(IQueryable<T> query, Sungero.Domain.PropertyFilteringEventArgs e)
{
return query
.Where(l => l.RegisterType == DocumentRegister.RegisterType.Numbering || Recipients.OwnRecipientIdsFor(_obj.Employee).Contains(l.RegistrationGroup.Id))
.Where(l => l.DocumentFlow == DocumentRegister.DocumentFlow.Outgoing);
}
}
partial class PersonalSettingIncomingDocRegisterPropertyFilteringServerHandler<T>
{
public virtual IQueryable<T> IncomingDocRegisterFiltering(IQueryable<T> query, Sungero.Domain.PropertyFilteringEventArgs e)
{
return query.Where(l => Recipients.OwnRecipientIdsFor(_obj.Employee).Contains(l.RegistrationGroup.Id) && l.DocumentFlow == DocumentRegister.DocumentFlow.Incoming);
}
}
partial class PersonalSettingServerHandlers
{
public override void BeforeSave(Sungero.Domain.BeforeSaveEventArgs e)
{
if (PersonalSettings.GetAll(s => Equals(s.Employee, _obj.Employee) && !Equals(s, _obj)).Any())
throw AppliedCodeException.Create(PersonalSettings.Resources.CantCreateMoreSetting);
}
public override void Created(Sungero.Domain.CreatedEventArgs e)
{
_obj.IsAutoCalcSupervisor = true;
_obj.IsAutoCalcResolutionAuthor = true;
_obj.FollowUpActionItem = false;
_obj.IsAutoExecLeadingActionItem = false;
_obj.Period = null;
_obj.ShowRegPane = true;
_obj.MyContractsNotification = true;
_obj.MySubordinatesContractsNotification = true;
_obj.PrintSender = true;
_obj.ShowNotApproveSign = false;
_obj.MyPowersOfAttorneyNotification = true;
_obj.MySubordinatesPowersOfAttorneyNotification = true;
_obj.RegistrationStampPosition = RegistrationStampPosition.BottomRight;
}
public override void BeforeDelete(Sungero.Domain.BeforeDeleteEventArgs e)
{
throw AppliedCodeException.Create(PersonalSettings.Resources.CantDeleteSetting);
}
}
}