56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
namespace Common.UI.Models
|
|
{
|
|
using LaaPackages.SqlClient;
|
|
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
public class EregisterShared
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
public int SharedId { get; set; }
|
|
|
|
public int SlotNr { get; set; }
|
|
|
|
public int SerialNr { get; set; }
|
|
|
|
public long TempAddress { get; set; }
|
|
|
|
public long FinalAddress { get; set; }
|
|
|
|
public bool Completed { get; set; }
|
|
}
|
|
|
|
internal static class Eregister_Shared_Extensions
|
|
{
|
|
internal static List<EregisterShared> LoadActions(this SqlConnection sqlConnection, int sharedId)
|
|
=> sqlConnection
|
|
.CreateCommand($@"
|
|
SELECT DISTINCT
|
|
Id
|
|
, P2000_Shared_Id
|
|
, Slotno
|
|
, Serialno
|
|
, RadioAddress
|
|
, FinalAddress
|
|
, Completed
|
|
FROM eRegister_Shared
|
|
WHERE P2000_Shared_Id = @{nameof(sharedId)}
|
|
AND Completed = 0
|
|
ORDER BY Slotno")
|
|
.SetParameter(nameof(sharedId), sharedId)
|
|
.ExecuteReader(x => new EregisterShared
|
|
{
|
|
Id = x.GetValue<int>(0),
|
|
SharedId = x.GetValue<int>(1),
|
|
SlotNr = x.GetValue<int>(2),
|
|
SerialNr = x.GetValue<int>(3),
|
|
TempAddress = x.GetValue<uint>(4),
|
|
FinalAddress = x.GetValue<uint>(5),
|
|
Completed = x.GetValue<bool>(6),
|
|
})
|
|
.ToList();
|
|
}
|
|
}
|