26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
40 lines
1.3 KiB
C#
Executable File
40 lines
1.3 KiB
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using Dapper;
|
|
using DataModel.Models;
|
|
using DDTek.Oracle;
|
|
|
|
namespace DataModel.Process
|
|
{
|
|
/// <summary>
|
|
/// MIS data loader for CMS interface
|
|
/// </summary>
|
|
public partial class CMS
|
|
{
|
|
/// <summary>
|
|
/// Fetches updates for MIS data
|
|
/// </summary>
|
|
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
|
/// <returns>Streaming updates for MIS data</returns>
|
|
public static IEnumerable<MisData> GetMisData(DateTime? lastUpdateDT = null)
|
|
{
|
|
using (OracleConnection connection = GetConnection())
|
|
{
|
|
var results = lastUpdateDT.HasValue ?
|
|
connection.Query<MisData>(queries["SQL_GET_MIS_DATA_FILTERED"], new { lastUpdateDT }, buffered: false, commandTimeout: 1200*50) :
|
|
connection.Query<MisData>(queries["SQL_GET_MIS_DATA"], buffered: false, commandTimeout: 1200*50);
|
|
|
|
foreach (var result in results)
|
|
{
|
|
if (result.ReleaseDate.HasValue)
|
|
{
|
|
result.ReleaseDate = result.ReleaseDate.Value.ToLocalTime();
|
|
}
|
|
|
|
yield return result;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|