38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
namespace Common.UI.Data
|
|
{
|
|
using LaaPackages.SqlClient;
|
|
|
|
internal class P2000_Shared
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
public int PsNo { get; set; }
|
|
|
|
public string Action { get; set; }
|
|
|
|
public bool Completed { get; set; }
|
|
|
|
public string Logs { get; set; }
|
|
}
|
|
|
|
internal static class P2000_Shared_Extensions
|
|
{
|
|
public static P2000_Shared LoadPendingActions(this SqlConnection connection, int psno)
|
|
=> connection
|
|
.CreateCommand($@"
|
|
SELECT TOP 1
|
|
Id
|
|
, Action
|
|
FROM P2000_Shared
|
|
WHERE Psno = @{nameof(psno)}
|
|
AND Completed = 0
|
|
ORDER BY Id DESC")
|
|
.SetParameter(nameof(psno), psno)
|
|
.FirstOrDefault(x => new P2000_Shared
|
|
{
|
|
Id = x.GetValue<int>(0),
|
|
Action = x.GetValue<string>(1)
|
|
});
|
|
}
|
|
}
|