2024-07-04 11:02:45 +05:00
|
|
|
using AsbCloudApp.Data;
|
2024-05-03 14:37:46 +05:00
|
|
|
using AsbCloudApp.Data.ProcessMaps;
|
2024-02-13 16:35:01 +05:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
namespace AsbCloudApp.Extensions
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Расширения для поиска в истории
|
|
|
|
/// </summary>
|
|
|
|
public static class ChangeLogExtensions
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Действительные на момент времени значения
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
/// <param name="items"></param>
|
|
|
|
/// <param name="moment"></param>
|
|
|
|
/// <returns></returns>
|
2024-05-03 14:37:46 +05:00
|
|
|
public static IEnumerable<ChangeLogDto<T>> WhereActualAtMoment<T>(this IEnumerable<ChangeLogDto<T>> items, DateTimeOffset moment)
|
2024-05-28 00:05:21 +05:00
|
|
|
where T : IId
|
2024-02-13 16:35:01 +05:00
|
|
|
{
|
|
|
|
var actualItems = items
|
2024-02-15 15:59:34 +05:00
|
|
|
.Where(item => item.Creation <= moment)
|
|
|
|
.Where(item => item.Obsolete is null || item.Obsolete >= moment);
|
2024-02-13 16:35:01 +05:00
|
|
|
|
|
|
|
return actualItems;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|