IncomingLetterServerFunctions.cs
2.05 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
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.Docflow;
using Sungero.RecordManagement.IncomingLetter;
namespace Sungero.RecordManagement.Server
{
partial class IncomingLetterFunctions
{
/// <summary>
/// Получить дубли письма.
/// </summary>
/// <param name="letter">Письмо для проверки.</param>
/// <param name="documentKind">Вид письма.</param>
/// <param name="businessUnit">НОР письма.</param>
/// <param name="inNumber">Номер входящего.</param>
/// <param name="dated">Дата письма.</param>
/// <param name="correspondent">Корреспондент.</param>
/// <returns>Письма, дублирующие текущее.</returns>
[Remote(IsPure = true)]
public static IQueryable<IIncomingLetter> GetDuplicates(IIncomingLetter letter,
Docflow.IDocumentKind documentKind,
Company.IBusinessUnit businessUnit,
string inNumber,
DateTime? dated,
Parties.ICounterparty correspondent)
{
return IncomingLetters.GetAll()
.Where(l => documentKind != null && Equals(documentKind, l.DocumentKind))
.Where(l => dated.HasValue && dated == l.Dated)
.Where(l => businessUnit != null && Equals(businessUnit, l.BusinessUnit))
.Where(l => !string.IsNullOrWhiteSpace(inNumber) && inNumber == l.InNumber)
.Where(l => correspondent != null && Equals(correspondent, l.Correspondent))
.Where(l => !Equals(letter, l));
}
public override IOfficialDocument CreateReplyDocument()
{
var outgoingDocument = OutgoingLetters.Create();
outgoingDocument.InResponseTo = _obj;
return outgoingDocument;
}
}
}