ConsolidatedInventoryServerFunctions.cs
1.83 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
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using DirRX.Storage.ConsolidatedInventory;
namespace DirRX.Storage.Server
{
partial class ConsolidatedInventoryFunctions
{
/// <summary>
/// Получить список дел описи.
/// </summary>
/// <returns>Список дел.</returns>
[Public, Remote(IsPure=true)]
public virtual IQueryable<DirRX.LongTermArchive.ICaseFile> GetCaseFiles()
{
return DirRX.LongTermArchive.CaseFiles.GetAll(x => x.LTAConsInventoryDirRX != null && x.LTAConsInventoryDirRX.Equals(_obj));
}
/// <summary>
/// Получить список годовых разделов описи.
/// </summary>
/// <returns>Список годовых разделов.</returns>
[Public, Remote(IsPure=true)]
public virtual IQueryable<Storage.IAnnualSection> GetAnnualSections()
{
return Storage.AnnualSections.GetAll(x => x.ConsolidatedInventory != null && x.ConsolidatedInventory.Equals(_obj));
}
/// <summary>
/// Получить следующий по порядку номер сводной описи.
/// </summary>
/// <returns>Номер описи.</returns>
public virtual int GetNextInventoryNumber()
{
var result = 1;
AccessRights.AllowRead(
() =>
{
// Предполагается, что все ключевые свойства заполнены (необходимо проверить до вызова).
var lastDocument = ConsolidatedInventories.GetAll(x => x.Id != _obj.Id && x.Number.HasValue).OrderByDescending(x => x.Id).FirstOrDefault();
if (lastDocument != null)
result += lastDocument.Number.Value;
});
return result;
}
}
}