26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
54 lines
2.1 KiB
C#
Executable File
54 lines
2.1 KiB
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using Dapper;
|
|
using DataModel.Helpers;
|
|
using DataModel.Models;
|
|
using Oracle.ManagedDataAccess.Client;
|
|
|
|
namespace DataModel.Process
|
|
{
|
|
/// <summary>
|
|
/// Work order time tracking functionality for JDE interface
|
|
/// </summary>
|
|
public partial class JDE
|
|
{
|
|
/// <summary>
|
|
/// Fetches updates for work order time transactions
|
|
/// </summary>
|
|
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
|
/// <returns></returns>
|
|
public static IEnumerable<WorkOrderTime> GetWorkOrderTimes(DateTime? lastUpdateDT = null)
|
|
{
|
|
using (OracleConnection connection = GetConnection())
|
|
{
|
|
var results = lastUpdateDT.HasValue ?
|
|
connection.Query<WorkOrderTime>(queries["SQL_GET_WORKORDER_TIMES_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
|
connection.Query<WorkOrderTime>(queries["SQL_GET_WORKORDER_TIMES"], buffered: false, commandTimeout: Config.QueryTimeout);
|
|
|
|
foreach (var result in results)
|
|
{
|
|
yield return result;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Fetches updates for work order time transactions archive
|
|
/// </summary>
|
|
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
|
/// <returns></returns>
|
|
public static IEnumerable<WorkOrderTime> GetWorkOrderTimesArchive(DateTime? lastUpdateDT = null)
|
|
{
|
|
using (OracleConnection connection = GetConnection())
|
|
{
|
|
var results = connection.Query<WorkOrderTime>(queries["SQL_GET_WORKORDER_TIMES_ARCHIVE"], buffered: false, commandTimeout: Config.QueryTimeout);
|
|
|
|
foreach (var result in results)
|
|
{
|
|
yield return result;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|