LaaProductionWeb moved to own repository
This commit is contained in:
Binary file not shown.
@@ -1,467 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel
|
||||
{
|
||||
public partial class CordonelDbContext
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains placeholder for the pcbId variable name at positon: 0
|
||||
/// </summary>
|
||||
private const string ALL_PRODUCTION_DATA_BY_PCB = @"
|
||||
SELECT DISTINCT
|
||||
aap.AuftragNr
|
||||
, aap.PositionNr
|
||||
, aap.FertigungsauftragNr
|
||||
, aap.IdentNr
|
||||
, idn.Charcode
|
||||
, ms.Dn_Name
|
||||
, ms.Dn_InternalId
|
||||
, aps.KundeneigeneSerienNr
|
||||
, aps.SerienNr
|
||||
, pcb.PcbId
|
||||
, gm.Adresse
|
||||
, aps.Pruefgangnr
|
||||
, aps.StatusFertigung
|
||||
, CASE WHEN fs.Charcode = 'X'
|
||||
THEN 'None'
|
||||
WHEN fs.Charcode = '1'
|
||||
THEN 'Standard'
|
||||
WHEN fs.Charcode = '2'
|
||||
THEN 'Random'
|
||||
WHEN fs.Charcode = '3'
|
||||
THEN 'CSD'
|
||||
END AS EncryptionKeyKind
|
||||
FROM CordonelMapPcbToAssignedPicking AS pcb
|
||||
LEFT JOIN AlleAuftragPositionen AS aap
|
||||
ON pcb.FertigungsauftragNr = aap.FertigungsauftragNr
|
||||
LEFT JOIN AuftragPositionSerienNrByMaxStatusFertigung AS aps
|
||||
ON aps.SerienNr = pcb.SerienNr
|
||||
LEFT JOIN Genesis_Meter AS gm
|
||||
ON aps.SerienNr = gm.Seriennummer
|
||||
LEFT JOIN AlleIdentNrVakoMerkmale AS idn
|
||||
ON aap.IdentNr = idn.IdentNr
|
||||
AND idn.Stelle = 4
|
||||
AND idn.Laenge = 2
|
||||
LEFT JOIN AlleIdentNrVakoMerkmale AS fs
|
||||
ON aap.IdentNr = fs.IdentNr
|
||||
AND fs.Stelle = 46
|
||||
AND fs.Laenge = 1
|
||||
LEFT JOIN CordonelMeterSizes AS ms
|
||||
ON idn.Charcode = ms.Dn_VakoID
|
||||
WHERE pcb.PcbId = @{0}
|
||||
ORDER BY aps.Pruefgangnr DESC";
|
||||
|
||||
/// <summary>
|
||||
/// Contains placeholder for the pcbId at positon: 0
|
||||
/// Contains placeholder for the FW version at positon: 1
|
||||
/// </summary>
|
||||
private const string APPS_VERSIONS_CRC_BY_PCB_V = @"
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Declarations
|
||||
---------------------------------------------------------------------------------------------------
|
||||
DECLARE @pcbIdVarchar AS VARCHAR(20) = @{0};
|
||||
DECLARE @fwVersion AS VARCHAR(20) = @{1};
|
||||
DECLARE @progressId AS INT;
|
||||
DECLARE @frequency AS INT;
|
||||
DECLARE @meterSize AS INT;
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Find and set latest progress id
|
||||
---------------------------------------------------------------------------------------------------
|
||||
SELECT @progressId = MAX(Id)
|
||||
FROM CordonelProgress
|
||||
WHERE PcbId = @pcbIdVarchar
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Find and set meter size and frequency
|
||||
---------------------------------------------------------------------------------------------------
|
||||
SELECT @frequency = (SELECT TOP 1 CASE WHEN idn.Charcode = 'A'
|
||||
THEN 868
|
||||
WHEN idn.Charcode = 'B'
|
||||
THEN 433
|
||||
ELSE 0 END
|
||||
FROM AlleIdentNrVakoMerkmale AS idn
|
||||
WHERE idn.IdentNr = aap.IdentNr
|
||||
AND idn.Stelle = 43
|
||||
ORDER BY idn.Stelle)
|
||||
, @meterSize = (SELECT TOP 1 cms.Dn_InternalId
|
||||
FROM AlleIdentNrVakoMerkmale AS idn
|
||||
JOIN CordonelMeterSizes AS cms
|
||||
ON idn.Charcode = cms.Dn_VakoID
|
||||
WHERE idn.IdentNr = aap.IdentNr
|
||||
AND idn.Stelle = 4
|
||||
ORDER BY idn.Stelle)
|
||||
FROM MapPcbIdToSerialNumber AS map
|
||||
JOIN AuftragPositionSerienNr AS aps
|
||||
ON map.MapPcbIdToSerialNumber_SerialNumber = aps.SerienNr
|
||||
JOIN AlleAuftragPositionen AS aap
|
||||
ON aps.AuftragNr = aap.AuftragNr
|
||||
AND aps.PositionNr = aap.PositionNr
|
||||
WHERE map.MapPcbIdToSerialNumber_PcbId = @pcbIdVarchar
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Select all apps with their versions and crc
|
||||
---------------------------------------------------------------------------------------------------
|
||||
SELECT DISTINCT
|
||||
apps.PcbId AS AppsPcbId
|
||||
, apps.AppId AS AppsAppId
|
||||
, apps.Version AS AppsAppVersion
|
||||
, history.PcbId AS HistoryPcbId
|
||||
, history.HistoryAppVersion
|
||||
, history.HistoryAppCrc
|
||||
, files.FlexnetAppId
|
||||
, files.FlexnetVersion
|
||||
, files.MetrologyVersion
|
||||
, files.CoreRevisionMin
|
||||
, files.CoreRevisionMax
|
||||
, files.FilesAppId
|
||||
, files.FilesAppVersion
|
||||
, files.FilesAppCrc
|
||||
, files.ClusterFileId
|
||||
, files.FileName
|
||||
FROM (SELECT _progress.PcbId
|
||||
, RIGHT(CONVERT(VARCHAR(10), CONVERT(BINARY(1), _apps.AppId, 2), 2), 2) AS AppId
|
||||
, CASE WHEN LEN(_apps.Version) >= 4
|
||||
THEN RIGHT('0' + REPLACE(_apps.Version, '.', ''), 4)
|
||||
ELSE NULL END AS Version
|
||||
FROM CordonelProgress AS _progress
|
||||
JOIN CordonelAppVersion AS _apps
|
||||
ON _progress.Id = _apps.ProgressId
|
||||
WHERE _progress.Id = @progressId
|
||||
AND _apps.Version IS NOT NULL)
|
||||
AS apps
|
||||
LEFT JOIN(SELECT _history_.PcbId
|
||||
, RIGHT(_history_.HistoryAppVersion, 2) + LEFT(_history_.HistoryAppVersion, 2) AS HistoryAppVersion
|
||||
, RIGHT(_history_.HistoryAppCrc, 2) + LEFT(_history_.HistoryAppCrc, 2) AS HistoryAppCrc
|
||||
FROM (SELECT _history.PcbId
|
||||
, LEFT(REPLACE(_history.Version, '-', ''), 4) AS HistoryAppVersion
|
||||
, LEFT(REPLACE(_history.Crc, '-', ''), 4) AS HistoryAppCrc
|
||||
FROM (SELECT _left.PcbId
|
||||
, _left.Value AS Version
|
||||
, _right.Value AS Crc
|
||||
, ROW_NUMBER() OVER (PARTITION BY _left.Value ORDER BY _right.Value, _right.date DESC) AS RN
|
||||
FROM GenesisMeterRegisterHistory AS _left
|
||||
JOIN GenesisMeterRegisterHistory AS _right
|
||||
ON _left.PcbId = _right.PcbId
|
||||
AND _left.ID + 1 = _right.ID
|
||||
WHERE _left.PcbId = @pcbIdVarchar
|
||||
AND _left.Address = '00-01'
|
||||
AND _right.Address = '00-0D')
|
||||
AS _history
|
||||
WHERE _history.RN = 1)
|
||||
AS _history_)
|
||||
AS history
|
||||
ON apps.Version = history.HistoryAppVersion
|
||||
LEFT JOIN(SELECT _files.FlexnetAppId
|
||||
, _files.Version AS FlexnetVersion
|
||||
, _files.MetrologyVersion
|
||||
, _files.CoreRevisionMin
|
||||
, _files.CoreRevisionMax
|
||||
, _files.AppId AS FilesAppId
|
||||
, RIGHT(_files.AppVersion, 2) + LEFT(_files.AppVersion, 2) AS FilesAppVersion
|
||||
, RIGHT(_files.FileCrc, 2) + LEFT(_files.FileCrc, 2) AS FilesAppCrc
|
||||
, _files.ClusterFileId
|
||||
, _files.FileName
|
||||
, _files.FileContent
|
||||
FROM (SELECT DISTINCT
|
||||
cluster.FileId AS ClusterFileId
|
||||
, fw.FlexnetAppId
|
||||
, fw.Version
|
||||
, fw.CoreRevisionMin
|
||||
, fw.CoreRevisionMax
|
||||
, fw.MetrologyVersion
|
||||
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 81, 2) AS AppId
|
||||
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 13, 4) AS AppVersion
|
||||
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 9, 4) AS FileCrc
|
||||
, __files.FileName
|
||||
, CASE WHEN __files.FileName LIKE '%.txt'
|
||||
THEN CONVERT(VARCHAR(MAX), __files.FileContent, 0)
|
||||
ELSE CONVERT(VARCHAR(MAX), __files.FileContent, 2)
|
||||
END AS FileContent
|
||||
FROM Cordonel_CurrentFw AS fw
|
||||
JOIN FileClusterStore AS cluster
|
||||
ON cluster.FileId = fw.FileClusterStoreId
|
||||
JOIN FileMapToCluster AS filemap
|
||||
ON cluster.FileId = filemap.FileMapToCluster_FileClusterId
|
||||
LEFT JOIN [File] AS __files
|
||||
ON filemap.FileMapToCluster_FileId = __files.FileId
|
||||
WHERE fw.Name = @fwVersion
|
||||
AND fw.Metersize = @meterSize
|
||||
AND fw.RadioFrequencyMhz = @frequency
|
||||
AND fw.CurrentForProd = 1
|
||||
AND fw.IsReleased = 1)
|
||||
AS _files)
|
||||
AS files
|
||||
ON apps.AppId = files.FilesAppId
|
||||
WHERE apps.Version IS NOT NULL
|
||||
ORDER BY apps.AppId";
|
||||
|
||||
/// <summary>
|
||||
/// Contains placeholder for the pcbId variable name at positon: 0
|
||||
/// </summary>
|
||||
private const string LATEST_APPS_VERSIONS_CRC_BY_PCB = @"
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Declarations
|
||||
---------------------------------------------------------------------------------------------------
|
||||
DECLARE @pcbIdVarchar AS VARCHAR(20) = @{0};
|
||||
DECLARE @progressId AS INT;
|
||||
DECLARE @frequency AS INT;
|
||||
DECLARE @meterSize AS INT;
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Find and set latest progress id
|
||||
---------------------------------------------------------------------------------------------------
|
||||
SELECT @progressId = MAX(Id)
|
||||
FROM CordonelProgress
|
||||
WHERE PcbId = @pcbIdVarchar
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Find and set meter size and frequency
|
||||
---------------------------------------------------------------------------------------------------
|
||||
SELECT @frequency = (SELECT TOP 1 CASE WHEN idn.Charcode = 'A'
|
||||
THEN 868
|
||||
WHEN idn.Charcode = 'B'
|
||||
THEN 433
|
||||
ELSE 0 END
|
||||
FROM AlleIdentNrVakoMerkmale AS idn
|
||||
WHERE idn.IdentNr = aap.IdentNr
|
||||
AND idn.Stelle = 43
|
||||
ORDER BY idn.Stelle)
|
||||
, @meterSize = (SELECT TOP 1 cms.Dn_InternalId
|
||||
FROM AlleIdentNrVakoMerkmale AS idn
|
||||
JOIN CordonelMeterSizes AS cms
|
||||
ON idn.Charcode = cms.Dn_VakoID
|
||||
WHERE idn.IdentNr = aap.IdentNr
|
||||
AND idn.Stelle = 4
|
||||
ORDER BY idn.Stelle)
|
||||
FROM MapPcbIdToSerialNumber AS map
|
||||
JOIN AuftragPositionSerienNr AS aps
|
||||
ON map.MapPcbIdToSerialNumber_SerialNumber = aps.SerienNr
|
||||
JOIN AlleAuftragPositionen AS aap
|
||||
ON aps.AuftragNr = aap.AuftragNr
|
||||
AND aps.PositionNr = aap.PositionNr
|
||||
WHERE map.MapPcbIdToSerialNumber_PcbId = @pcbIdVarchar
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Select all apps with their versions and crc
|
||||
---------------------------------------------------------------------------------------------------
|
||||
SELECT DISTINCT
|
||||
apps.PcbId AS AppsPcbId
|
||||
, apps.AppId AS AppsAppId
|
||||
, apps.Version AS AppsAppVersion
|
||||
, history.PcbId AS HistoryPcbId
|
||||
, history.HistoryAppVersion
|
||||
, history.HistoryAppCrc
|
||||
, files.FlexnetAppId
|
||||
, files.FlexnetVersion
|
||||
, files.MetrologyVersion
|
||||
, files.CoreRevisionMin
|
||||
, files.CoreRevisionMax
|
||||
, files.FilesAppId
|
||||
, files.FilesAppVersion
|
||||
, files.FilesAppCrc
|
||||
, files.ClusterFileId
|
||||
, files.FileName
|
||||
FROM (SELECT _progress.PcbId
|
||||
, RIGHT(CONVERT(VARCHAR(10), CONVERT(BINARY(1), _apps.AppId, 2), 2), 2) AS AppId
|
||||
, CASE WHEN LEN(_apps.Version) >= 4
|
||||
THEN RIGHT('0' + REPLACE(_apps.Version, '.', ''), 4)
|
||||
ELSE NULL END AS Version
|
||||
FROM CordonelProgress AS _progress
|
||||
JOIN CordonelAppVersion AS _apps
|
||||
ON _progress.Id = _apps.ProgressId
|
||||
WHERE _progress.Id = @progressId
|
||||
AND _apps.Version IS NOT NULL)
|
||||
AS apps
|
||||
LEFT JOIN(SELECT _history_.PcbId
|
||||
, RIGHT(_history_.HistoryAppVersion, 2) + LEFT(_history_.HistoryAppVersion, 2) AS HistoryAppVersion
|
||||
, RIGHT(_history_.HistoryAppCrc, 2) + LEFT(_history_.HistoryAppCrc, 2) AS HistoryAppCrc
|
||||
FROM (SELECT _history.PcbId
|
||||
, LEFT(REPLACE(_history.Version, '-', ''), 4) AS HistoryAppVersion
|
||||
, LEFT(REPLACE(_history.Crc, '-', ''), 4) AS HistoryAppCrc
|
||||
FROM (SELECT _left.PcbId
|
||||
, _left.Value AS Version
|
||||
, _right.Value AS Crc
|
||||
, ROW_NUMBER() OVER (PARTITION BY _left.Value ORDER BY _right.Value, _right.date DESC) AS RN
|
||||
FROM GenesisMeterRegisterHistory AS _left
|
||||
JOIN GenesisMeterRegisterHistory AS _right
|
||||
ON _left.PcbId = _right.PcbId
|
||||
AND _left.ID + 1 = _right.ID
|
||||
WHERE _left.PcbId = @pcbIdVarchar
|
||||
AND _left.Address = '00-01'
|
||||
AND _right.Address = '00-0D')
|
||||
AS _history
|
||||
WHERE _history.RN = 1)
|
||||
AS _history_)
|
||||
AS history
|
||||
ON apps.Version = history.HistoryAppVersion
|
||||
LEFT JOIN(SELECT _files.FlexnetAppId
|
||||
, _files.Version AS FlexnetVersion
|
||||
, _files.MetrologyVersion
|
||||
, _files.CoreRevisionMin
|
||||
, _files.CoreRevisionMax
|
||||
, _files.AppId AS FilesAppId
|
||||
, RIGHT(_files.AppVersion, 2) + LEFT(_files.AppVersion, 2) AS FilesAppVersion
|
||||
, RIGHT(_files.FileCrc, 2) + LEFT(_files.FileCrc, 2) AS FilesAppCrc
|
||||
, _files.ClusterFileId
|
||||
, _files.FileName
|
||||
, _files.FileContent
|
||||
FROM (SELECT DISTINCT
|
||||
cluster.FileId AS ClusterFileId
|
||||
, fw.FlexnetAppId
|
||||
, fw.Version
|
||||
, fw.CoreRevisionMin
|
||||
, fw.CoreRevisionMax
|
||||
, fw.MetrologyVersion
|
||||
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 81, 2) AS AppId
|
||||
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 13, 4) AS AppVersion
|
||||
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 9, 4) AS FileCrc
|
||||
, __files.FileName
|
||||
, CASE WHEN __files.FileName LIKE '%.txt'
|
||||
THEN CONVERT(VARCHAR(MAX), __files.FileContent, 0)
|
||||
ELSE CONVERT(VARCHAR(MAX), __files.FileContent, 2)
|
||||
END AS FileContent
|
||||
FROM Cordonel_CurrentFw AS fw
|
||||
JOIN FileClusterStore AS cluster
|
||||
ON cluster.FileId = fw.FileClusterStoreId
|
||||
JOIN FileMapToCluster AS filemap
|
||||
ON cluster.FileId = filemap.FileMapToCluster_FileClusterId
|
||||
LEFT JOIN [File] AS __files
|
||||
ON filemap.FileMapToCluster_FileId = __files.FileId
|
||||
WHERE fw.Name = @fwVersion)
|
||||
AS _files)
|
||||
AS files
|
||||
ON apps.AppId = files.FilesAppId
|
||||
WHERE apps.Version IS NOT NULL
|
||||
ORDER BY apps.AppId";
|
||||
|
||||
/// <summary>
|
||||
/// Contains placeholder for the pcbId variable name at positon: 0
|
||||
/// </summary>
|
||||
public const string LATEST_CALIBRATION_VALUES_BY_PCB = @"
|
||||
SELECT TOP 1
|
||||
ID
|
||||
, PcbId
|
||||
, CalFactor1
|
||||
, CalFactor2
|
||||
, CalFactor3
|
||||
, ZeroOffset1
|
||||
, ZeroOffset2
|
||||
, ZeroOffset3
|
||||
, FirstHitUpdatePeriod
|
||||
, FirstHitShift
|
||||
, FirstHitPercent1
|
||||
, FirstHitPercent2
|
||||
, FirstHitPercent3
|
||||
, ToFTempOffset1
|
||||
, ToFTempOffset2
|
||||
, ToFTempOffset3
|
||||
, MeterSize
|
||||
, date
|
||||
, successful
|
||||
FROM CordonelMeterCalibrationResults
|
||||
WHERE PcbId = @{0}
|
||||
AND successful = 1
|
||||
ORDER BY date DESC";
|
||||
|
||||
/// <summary>
|
||||
/// Contains placeholder for the pcbId variable name at positon: 0
|
||||
/// </summary>
|
||||
public const string LATEST_REGISTER_WITH_VALUES_BY_PCB = @"
|
||||
SELECT rh.Id
|
||||
, rh.Address
|
||||
, rh.Value
|
||||
FROM (SELECT gmrh.Id AS Id
|
||||
, gmrh.Address
|
||||
, gmrh.Value
|
||||
, ROW_NUMBER() OVER (PARTITION BY gmrh.Address ORDER BY gmrh.date DESC) AS Nr
|
||||
FROM GenesisMeterRegisterHistory AS gmrh
|
||||
WHERE gmrh.PcbId = @{0})
|
||||
AS rh
|
||||
WHERE rh.Nr = 1";
|
||||
|
||||
private const string PCB_PASSWORDS_HASHES = @"
|
||||
SELECT SUBSTRING(CONVERT(VARCHAR(MAX)
|
||||
, (SELECT '-' + ISNULL(x.Value, '')
|
||||
FROM (SELECT TOP 3 hashes.Value
|
||||
FROM (SELECT TOP 3
|
||||
rh.date
|
||||
, rh.Value
|
||||
FROM GenesisMeterRegisterHistory AS rh
|
||||
WHERE rh.PcbId = @{0}
|
||||
AND rh.Address = '04-04'
|
||||
AND LEN(rh.Value) > 15
|
||||
ORDER BY rh.date DESC)
|
||||
AS hashes
|
||||
ORDER BY hashes.date)
|
||||
AS x
|
||||
FOR XML PATH(''), TYPE)
|
||||
, 1)
|
||||
, 2, 1000) AS Hashes
|
||||
, (SELECT TOP 1 pwd.KitronSkeletonKey
|
||||
FROM Genesis_PcbPassword AS pwd
|
||||
WHERE pwd.PcbId = @{0}) AS Skeleton
|
||||
, (SELECT TOP 1 pwd.Password
|
||||
FROM Genesis_PcbPassword AS pwd
|
||||
WHERE pwd.PcbId = @{0}) AS Password";
|
||||
|
||||
/// <summary>
|
||||
/// Contains placeholder for the pcbId variable name at positon: 0
|
||||
/// </summary>
|
||||
private const string RSSI_SETUP_DEFAULTS_RESULTS_BY_PCB = @"
|
||||
SELECT settings.RadioAddress
|
||||
, settings.Frequency
|
||||
, settings.Nennweite
|
||||
, settings.Baulaenge
|
||||
, settings.PulseModule
|
||||
, settings.DruckSensor
|
||||
, rssiLimits.id AS LimitId
|
||||
, rssiLimits.RSSI_PAM_Min
|
||||
, rssiLimits.RSSI_PAM_Max
|
||||
, rssiLimits.RSSI_SEMI_Min
|
||||
, rssiLimits.RSSI_SEMI_Max
|
||||
, rssiHistory.id AS RadioId
|
||||
, rssiHistory.LimitId AS RadioLimitId
|
||||
, rssiHistory.RSSI_PAM
|
||||
, rssiHistory.RSSI_SEMI
|
||||
, rssiHistory.Datum
|
||||
FROM (SELECT DISTINCT TOP 1
|
||||
gm.Adresse % 10000000000 AS RadioAddress
|
||||
, ISNULL(idn.Nennweite, CAST(cms.Dn_RealSize AS INT)) AS Nennweite
|
||||
, ISNULL(idn.Baulaenge, CAST(_baulaengen.Wert AS INT)) AS Baulaenge
|
||||
, CASE WHEN _druckSensors.Charcode = 'X' THEN 0 ELSE 1 END AS DruckSensor
|
||||
, CASE WHEN _frequencies.Charcode = 'A' THEN 868 WHEN _frequencies.Charcode = 'B' THEN 433 ELSE NULL END AS Frequency
|
||||
, CASE WHEN _pulseModules.Charcode = 'X' THEN 0 ELSE 1 END AS PulseModule
|
||||
FROM MapPcbIdToSerialNumber AS map
|
||||
JOIN AuftragPositionSerienNr AS aps
|
||||
ON map.MapPcbIdToSerialNumber_SerialNumber = aps.SerienNr
|
||||
LEFT JOIN Genesis_Meter AS gm
|
||||
ON aps.SerienNr = gm.Seriennummer
|
||||
JOIN AlleAuftragPositionen AS aap
|
||||
ON aps.AuftragNr = aap.AuftragNr
|
||||
AND aps.PositionNr = aap.PositionNr
|
||||
JOIN Identnr AS idn
|
||||
ON aap.IdentNr = idn.IdentNr
|
||||
JOIN AlleIdentNrVakoMerkmale AS _nennweiten
|
||||
ON aap.IdentNr = _nennweiten.IdentNr
|
||||
AND _nennweiten.Stelle = 4
|
||||
JOIN CordonelMeterSizes AS cms
|
||||
ON _nennweiten.Charcode = cms.Dn_VakoID
|
||||
JOIN AlleIdentNrVakoMerkmale AS _baulaengen
|
||||
ON aap.IdentNr = _baulaengen.IdentNr
|
||||
AND _baulaengen.Stelle = 14
|
||||
JOIN AlleIdentNrVakoMerkmale AS _druckSensors
|
||||
ON aap.IdentNr = _druckSensors.IdentNr
|
||||
AND _druckSensors.Stelle = 22
|
||||
JOIN AlleIdentNrVakoMerkmale AS _frequencies
|
||||
ON aap.IdentNr = _frequencies.IdentNr
|
||||
AND _frequencies.Stelle = 43
|
||||
JOIN AlleIdentNrVakoMerkmale AS _pulseModules
|
||||
ON aap.IdentNr = _pulseModules.IdentNr
|
||||
AND _pulseModules.Stelle = 91
|
||||
WHERE map.MapPcbIdToSerialNumber_PcbId = @{0})
|
||||
AS settings
|
||||
JOIN Cordonel_Radio_RSSI_History AS rssiHistory --> RadioLimitId
|
||||
ON settings.RadioAddress = rssiHistory.RadioAdress
|
||||
JOIN Cordonel_Radio_RSSI_Limits AS rssiLimits --> LimitId
|
||||
ON rssiHistory.LimitId = rssiLimits.id
|
||||
-- AND rssiLimits.Baulaenge = settings.Baulaenge
|
||||
-- AND rssiLimits.Frequency = settings.Frequency
|
||||
-- AND rssiLimits.Nennweite = settings.Nennweite
|
||||
-- AND rssiLimits.Variant_o = settings.PulseModule
|
||||
-- AND rssiLimits.Variant_p = settings.DruckSensor
|
||||
ORDER BY rssiHistory.id DESC";
|
||||
}
|
||||
}
|
||||
@@ -1,275 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel
|
||||
{
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Data.Cordonel.Interfaces;
|
||||
using LaaProduction.Data.Cordonel.Repositories;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class CordonelDbContext
|
||||
{
|
||||
private readonly Action<string> errorsCallback;
|
||||
|
||||
public CordonelDbContext(string connectionString, Action<string> errorsCallback = null)
|
||||
{
|
||||
this.errorsCallback = errorsCallback;
|
||||
this.SqlConnection = new SqlConnection(connectionString, this.OnSqlErrors);
|
||||
this.EOLProgress = new EOLProgressRepository(this);
|
||||
this.ProductionOrders = new ProductionOrdersRepository(this);
|
||||
this.Requirements = new RequirementsRepository(this);
|
||||
this.SpecialRequirements = new SpecialRequirementsRepository(this);
|
||||
this.StandardRequirements = new StandardRequirementsRepository(this);
|
||||
}
|
||||
|
||||
public CordonelDbContext(SqlConnection sqlConnection, Action<string> errorsCallback = null)
|
||||
{
|
||||
this.SqlConnection = sqlConnection;
|
||||
this.EOLProgress = new EOLProgressRepository(this);
|
||||
this.ProductionOrders = new ProductionOrdersRepository(this);
|
||||
this.Requirements = new RequirementsRepository(this);
|
||||
this.SpecialRequirements = new SpecialRequirementsRepository(this);
|
||||
this.StandardRequirements = new StandardRequirementsRepository(this);
|
||||
}
|
||||
|
||||
internal SqlConnection SqlConnection { get; }
|
||||
|
||||
public IEOLProgressRepository<EOLProgressModel> EOLProgress { get; }
|
||||
|
||||
public IPORepository<CordonelProductionOrder> ProductionOrders { get; }
|
||||
|
||||
public IRequirementsRepository<CordonelRequirements> Requirements { get; set; }
|
||||
|
||||
public ISpecialRequirementsRepository<CordonelSpecialRequirement> SpecialRequirements { get; }
|
||||
|
||||
public IStandardRequirementRepository<CordonelStandardRequirement> StandardRequirements { get; }
|
||||
|
||||
public void OnSqlErrors(string error) => errorsCallback?.Invoke(error);
|
||||
|
||||
#region Virtual methods used from the Sentinel and Unit Testing
|
||||
|
||||
internal virtual IEnumerable<CordonelProductionData> GetProductionData(int pcbId)
|
||||
{
|
||||
var map = this.SqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
cap.CordonelAssignedPicking_FertigungsAuftragsNr
|
||||
, map.MapPcbIdToSerialNumber_SerialNumber
|
||||
, map.MapPcbIdToSerialNumber_PcbId
|
||||
FROM MapPcbIdToSerialNumber AS map
|
||||
LEFT JOIN Cordonel_AssignedPicking AS cap
|
||||
ON map.MapPcbIdToSerialNumber_PcbId = cap.CordonelAssignedPicking_PcbId
|
||||
WHERE map.MapPcbIdToSerialNumber_PcbId = @{nameof(pcbId)}
|
||||
AND map.MapPcbIdToSerialNumber_Deleted = 0
|
||||
AND cap.CordonelAssignedPicking_IsDeleted = 0")
|
||||
.SetParameter(nameof(pcbId), pcbId)
|
||||
.ExecuteReader(x => new
|
||||
{
|
||||
FertigungsauftragNr = x.GetValue<int>(0),
|
||||
SerienNr = x.GetValue<int>(1),
|
||||
PcbId = x.GetValue<int>(2),
|
||||
});
|
||||
var productionDataList = new List<CordonelProductionData>();
|
||||
|
||||
foreach (var item in map)
|
||||
{
|
||||
var productionData = this.SqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT TOP 1
|
||||
aps.AuftragNr
|
||||
, aps.PositionNr
|
||||
, aps.SerienNr
|
||||
, aps.KundeneigeneSerienNr
|
||||
, aps.StatusFertigung
|
||||
, aps.Pruefgangnr
|
||||
, aap.FertigungsauftragNr
|
||||
, aap.IdentNr
|
||||
, gm.Adresse % 10000000000
|
||||
, reg.Charcode
|
||||
, ms.Dn_Name
|
||||
, ms.Dn_InternalId
|
||||
, CASE WHEN fs.Charcode = 'X'
|
||||
THEN 'None'
|
||||
WHEN fs.Charcode = '1'
|
||||
THEN 'Standard'
|
||||
WHEN fs.Charcode = '2'
|
||||
THEN 'Random'
|
||||
WHEN fs.Charcode = '3'
|
||||
THEN 'CSD'
|
||||
END AS EncryptionKeyKind
|
||||
FROM AuftragPositionSerienNr AS aps
|
||||
LEFT JOIN AlleAuftragPositionen AS aap
|
||||
ON aps.AuftragNr = aap.AuftragNr
|
||||
AND aps.PositionNr = aap.PositionNr
|
||||
LEFT JOIN Genesis_Meter AS gm
|
||||
ON aps.SerienNr = gm.Seriennummer
|
||||
LEFT JOIN AlleIdentNrVakoMerkmale AS reg
|
||||
ON aap.IdentNr = reg.IdentNr
|
||||
AND reg.Stelle = 4
|
||||
AND reg.Laenge = 2
|
||||
LEFT JOIN CordonelMeterSizes AS ms
|
||||
ON reg.Charcode = ms.Dn_VakoID
|
||||
LEFT JOIN AlleIdentNrVakoMerkmale AS fs
|
||||
ON aap.IdentNr = fs.IdentNr
|
||||
AND fs.Stelle = 46
|
||||
AND fs.Laenge = 1
|
||||
WHERE aps.SerienNr = @{nameof(item.SerienNr)}
|
||||
ORDER BY aps.Pruefgangnr DESC")
|
||||
.SetParameter(nameof(item.SerienNr), item.SerienNr)
|
||||
.FirstOrDefault(x => new CordonelProductionData
|
||||
{
|
||||
PcbId = item.PcbId,
|
||||
AuftragNr = x.GetValue<int>(0),
|
||||
PositionNr = x.GetValue<int>(1),
|
||||
SerienNr = x.GetValue<int>(2),
|
||||
KundeneigeneSerienNr = x.GetValue<string>(3),
|
||||
StatusFertigung = x.GetValue<StatusFertigung>(4),
|
||||
PruefgangNr = x.GetValue<int>(5),
|
||||
FertigungsauftragNr = x.GetValue<int>(6),
|
||||
IdentNr = x.GetValue<int>(7),
|
||||
Address = x.GetValue<ulong>(8),
|
||||
RegionSizeKey = x.GetValue<string>(9),
|
||||
MeterSizeName = x.GetValue<string>(10),
|
||||
MeterSizeValue = x.GetValue<byte>(11),
|
||||
EncryptionKeyKind = x.GetValue<CordonelEncryptionKeyKind>(12)
|
||||
});
|
||||
|
||||
productionDataList.Add(productionData);
|
||||
}
|
||||
|
||||
return productionDataList;
|
||||
}
|
||||
|
||||
internal virtual EOLProgressModel GetEOLProgressModel(int pcbId)
|
||||
=> this.EOLProgress.Read(pcbId);
|
||||
|
||||
internal virtual CordonelRequirements GetRequirements(int pcbId)
|
||||
=> this.Requirements.FindByPcbIdFull(pcbId.ToString(), out _);
|
||||
|
||||
internal virtual IEnumerable<CordonelRegisterHistory> GetLatestRegistersWithValues(int pcbId)
|
||||
=> this.SqlConnection
|
||||
.CreateCommand(string.Format(LATEST_REGISTER_WITH_VALUES_BY_PCB, nameof(pcbId)))
|
||||
.SetParameter(nameof(pcbId), pcbId.ToString())
|
||||
.ExecuteReader(reader => new CordonelRegisterHistory
|
||||
{
|
||||
Id = reader.GetValue<long>(0),
|
||||
Address = reader.GetValue<string>(1),
|
||||
ValueHex = reader.GetValue<string>(2),
|
||||
});
|
||||
|
||||
internal virtual IEnumerable<CordonelAppVeriosnCrc> GetAppsWithVersions(int pcbId, string version)
|
||||
=> this.SqlConnection
|
||||
.CreateCommand(string.Format(APPS_VERSIONS_CRC_BY_PCB_V, nameof(pcbId), nameof(version)))
|
||||
.SetParameter(nameof(pcbId), pcbId)
|
||||
.SetParameter(nameof(version), version)
|
||||
.ExecuteReader(reader => new CordonelAppVeriosnCrc
|
||||
{
|
||||
AppsPcbId = reader.GetValue<int>(0),
|
||||
AppsAppId = reader.GetValue<string>(1),
|
||||
AppsAppVersion = reader.GetValue<string>(2),
|
||||
HistoryPcbId = reader.GetValue<int>(3),
|
||||
HistoryAppVersion = reader.GetValue<string>(4),
|
||||
HistoryAppCrc = reader.GetValue<string>(5),
|
||||
FlexnetAppId = reader.GetValue<string>(6),
|
||||
FlexnetVersion = reader.GetValue<string>(7),
|
||||
MetrologyVersion = reader.GetValue<int>(8),
|
||||
CoreRevisionMin = reader.GetValue<int>(9),
|
||||
CoreRevisionMax = reader.GetValue<int>(10),
|
||||
FilesAppId = reader.GetValue<string>(11),
|
||||
FilesAppVersion = reader.GetValue<string>(12),
|
||||
FilesAppCrc = reader.GetValue<string>(13),
|
||||
ClusterFileId = reader.GetValue<int>(14),
|
||||
FileName = reader.GetValue<string>(15),
|
||||
});
|
||||
|
||||
internal virtual IEnumerable<CordonelAppVeriosnCrc> GetLatestAppsWithVersions(int pcbId, string fwVersion, bool isSpecial)
|
||||
=> this.SqlConnection
|
||||
.CreateCommand(string.Format(LATEST_APPS_VERSIONS_CRC_BY_PCB, nameof(pcbId), nameof(fwVersion)))
|
||||
.SetParameter(nameof(pcbId), pcbId)
|
||||
.SetParameter(nameof(fwVersion), fwVersion)
|
||||
.ExecuteReader(reader => new CordonelAppVeriosnCrc
|
||||
{
|
||||
AppsPcbId = reader.GetValue<int>(0),
|
||||
AppsAppId = reader.GetValue<string>(1),
|
||||
AppsAppVersion = reader.GetValue<string>(2),
|
||||
HistoryPcbId = reader.GetValue<int>(3),
|
||||
HistoryAppVersion = reader.GetValue<string>(4),
|
||||
HistoryAppCrc = reader.GetValue<string>(5),
|
||||
FlexnetAppId = reader.GetValue<string>(6),
|
||||
FlexnetVersion = reader.GetValue<string>(7),
|
||||
MetrologyVersion = reader.GetValue<int>(8),
|
||||
CoreRevisionMin = reader.GetValue<int>(9),
|
||||
CoreRevisionMax = reader.GetValue<int>(10),
|
||||
FilesAppId = reader.GetValue<string>(11),
|
||||
FilesAppVersion = reader.GetValue<string>(12),
|
||||
FilesAppCrc = reader.GetValue<string>(13),
|
||||
ClusterFileId = reader.GetValue<int>(14),
|
||||
FileName = reader.GetValue<string>(15),
|
||||
});
|
||||
|
||||
internal virtual CordonelMetrologyValues GetLatestGenesisFlowValues(object pcbId)
|
||||
=> this.SqlConnection
|
||||
.CreateCommand(string.Format(LATEST_CALIBRATION_VALUES_BY_PCB, nameof(pcbId)))
|
||||
.SetParameter(nameof(pcbId), pcbId?.ToString())
|
||||
.FirstOrDefault(reader => new CordonelMetrologyValues
|
||||
{
|
||||
Id = reader.GetValue<int>(0),
|
||||
PcbId = reader.GetValue<int>(1),
|
||||
CalFactor1 = reader.GetValue<int>(2),
|
||||
CalFactor2 = reader.GetValue<int>(3),
|
||||
CalFactor3 = reader.GetValue<int>(4),
|
||||
ZeroOffset1 = reader.GetValue<int>(5),
|
||||
ZeroOffset2 = reader.GetValue<int>(6),
|
||||
ZeroOffset3 = reader.GetValue<int>(7),
|
||||
FirstHitUpdatePeriod = reader.GetValue<int>(8),
|
||||
FirstHitShift = reader.GetValue<int>(9),
|
||||
FirstHitPercent1 = reader.GetValue<int>(10),
|
||||
FirstHitPercent2 = reader.GetValue<int>(11),
|
||||
FirstHitPercent3 = reader.GetValue<int>(12),
|
||||
ToFTempOffset1 = reader.GetValue<int>(13),
|
||||
ToFTempOffset2 = reader.GetValue<int>(14),
|
||||
ToFTempOffset3 = reader.GetValue<int>(15),
|
||||
MeterSize = reader.GetValue<int>(16),
|
||||
Date = reader.GetValue<DateTime>(17),
|
||||
Succeeded = reader.GetValue<bool>(18),
|
||||
});
|
||||
|
||||
internal virtual CordonelRSSIValues GetLatestRssiValues(string pcbId)
|
||||
=> this.SqlConnection
|
||||
.CreateCommand(string.Format(RSSI_SETUP_DEFAULTS_RESULTS_BY_PCB, nameof(pcbId)))
|
||||
.SetParameter(nameof(pcbId), pcbId)
|
||||
.FirstOrDefault(reader => new CordonelRSSIValues
|
||||
{
|
||||
RadioAddress = reader.GetValue<int?>(0),
|
||||
Frequency = reader.GetValue<int?>(1),
|
||||
Nennweite = reader.GetValue<int?>(2),
|
||||
Baulaenge = reader.GetValue<int?>(3),
|
||||
PulseModule = reader.GetValue<bool?>(4),
|
||||
DruckSensor = reader.GetValue<bool?>(5),
|
||||
LimitId = reader.GetValue<int?>(6),
|
||||
RSSI_PAM_Min = reader.GetValue<int?>(7),
|
||||
RSSI_PAM_Max = reader.GetValue<int?>(8),
|
||||
RSSI_SEMI_Min = reader.GetValue<int?>(9),
|
||||
RSSI_SEMI_Max = reader.GetValue<int?>(10),
|
||||
RadioCheckId = reader.GetValue<int?>(11),
|
||||
RadioLimitId = reader.GetValue<int?>(12),
|
||||
RSSI_PAM = reader.GetValue<int?>(13),
|
||||
RSSI_SEMI = reader.GetValue<int?>(14),
|
||||
Datum = reader.GetValue<DateTime?>(15),
|
||||
});
|
||||
|
||||
internal CordonelPcbPasswordsHashes GetPasswordsHashes(int pcbId)
|
||||
=> this.SqlConnection
|
||||
.CreateCommand(string.Format(PCB_PASSWORDS_HASHES, nameof(pcbId)))
|
||||
.SetParameter(nameof(pcbId), pcbId.ToString())
|
||||
.FirstOrDefault(x => new CordonelPcbPasswordsHashes
|
||||
{
|
||||
Hashes = x.GetValue<string>(0),
|
||||
Skeleton = x.GetValue<string>(1),
|
||||
Password = x.GetValue<string>(2),
|
||||
});
|
||||
|
||||
#endregion Virtual methods used from the Sentinel and Unit Testing
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
public interface IEOLProgressRepository<T> : IRepositoryCreate<T>, IRepositoryRead<T>, IRepositoryUpdate<T>, IRepositoryDelete<T>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IFilterRepository<T> : IRepositoryEnumerable<T>
|
||||
{
|
||||
IEnumerable<T> Like(string pattern);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IPORepository<T> : IFilterRepository<T>
|
||||
{
|
||||
IEnumerable<string> GetPcbs(string ponr);
|
||||
|
||||
IEnumerable<RadioKeyEntry> HasRightRadioKey(ulong address);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
public interface IRepositoryCreate<T>
|
||||
{
|
||||
T Create(T model);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
public interface IRepositoryDelete<T>
|
||||
{
|
||||
T Delete(T model);
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IRepositoryEnumerable<T> : IEnumerable<T>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
public interface IRepositoryRead<T>
|
||||
{
|
||||
T Read(T model);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
public interface IRepositoryUpdate<T>
|
||||
{
|
||||
T Update(T model);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
public interface IRepository<T> : IRepositoryEnumerable<T>
|
||||
{
|
||||
T Add(T model);
|
||||
|
||||
T Delete(object id);
|
||||
|
||||
T FirstOrDefault(object id);
|
||||
|
||||
T FirstOrDefault(params object[] ids);
|
||||
|
||||
T Update(T model);
|
||||
}
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
using System;
|
||||
|
||||
public interface IRequirementsRepository<T>
|
||||
{
|
||||
T FindByPcbId(string pcbid);
|
||||
|
||||
T FindByPcbIdFull(string pcbid, out string error);
|
||||
|
||||
T FindByPoNo(string pono);
|
||||
}
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface ISpecialRequirementsRepository<T> : IRepository<T>
|
||||
{
|
||||
void Approve(int id, string name, string comment);
|
||||
|
||||
SpecialRequiremetnsFilter Filter();
|
||||
|
||||
IEnumerable<T> Filter(SpecialRequiremetnsFilter filter);
|
||||
|
||||
T Find(CordonelSpecialRequirement model);
|
||||
|
||||
T FirstOrDefaultByPO(string ponr);
|
||||
|
||||
T FindFirstOrDefault(int standardId, int pono, int? pcbId);
|
||||
|
||||
void Unapprove(int id);
|
||||
}
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IStandardRequirementRepository<T> : IRepository<T>
|
||||
{
|
||||
void Approve(int id, string name, string comment);
|
||||
|
||||
StandardRequiremetnsFilter Filter();
|
||||
|
||||
IEnumerable<T> Filter(StandardRequiremetnsFilter filter);
|
||||
|
||||
T FirstOrDefaultByKey(string key);
|
||||
|
||||
T FirstOrDefaultByPO(string ponr);
|
||||
|
||||
void Unapprove(int id);
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{03784923-1FD3-4535-80F5-286728DF62AB}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LaaProduction.Data.Cordonel</RootNamespace>
|
||||
<AssemblyName>LaaProduction.Data.Cordonel</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn>IDE0003;IDE0049;</NoWarn>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CordonelDbContext.cs" />
|
||||
<Compile Include="CordonelDbContext.Queries.cs" />
|
||||
<Compile Include="Interfaces\IEOLProgressRepository[T].cs" />
|
||||
<Compile Include="Interfaces\IFilterRepository[T].cs" />
|
||||
<Compile Include="Interfaces\IPORepository[T].cs" />
|
||||
<Compile Include="Interfaces\IRepositoryCreate[T].cs" />
|
||||
<Compile Include="Interfaces\IRepositoryDelete[T].cs" />
|
||||
<Compile Include="Interfaces\IRepositoryEnumerable[T].cs" />
|
||||
<Compile Include="Interfaces\IRepositoryRead[T].cs" />
|
||||
<Compile Include="Interfaces\IRepositoryUpdate[T].cs" />
|
||||
<Compile Include="Interfaces\IRequirementsRepository[T].cs" />
|
||||
<Compile Include="Interfaces\ISpecialRequirementsRepository[T].cs" />
|
||||
<Compile Include="Interfaces\IStandardRequirementRepository[T].cs" />
|
||||
<Compile Include="Interfaces\IRepository[T].cs" />
|
||||
<Compile Include="Sentinel\LocalhostHttpClient.cs" />
|
||||
<Compile Include="Sentinel\Sentinel.cs" />
|
||||
<Compile Include="Sentinel\SentinelHttpClient.cs" />
|
||||
<Compile Include="Sentinel\SentinelException.cs" />
|
||||
<Compile Include="Sentinel\SentinelResult.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Repositories\EOLProgressRepository.cs" />
|
||||
<Compile Include="Repositories\ProductionOrdersRepository.cs" />
|
||||
<Compile Include="Repositories\RequirementsRepository.cs" />
|
||||
<Compile Include="Repositories\SpecialRequirementsRepository.cs" />
|
||||
<Compile Include="Repositories\StandardRequirementsRepository.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\LaaPackages\LaaPackages.Features.Cordonel\LaaPackages.Features.Cordonel.csproj">
|
||||
<Project>{8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}</Project>
|
||||
<Name>LaaPackages.Features.Cordonel</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\LaaPackages\LaaPackages.HttpClient\LaaPackages.HttpClient.csproj">
|
||||
<Project>{C9816412-7752-4F7A-8BD2-765DB6D58B3C}</Project>
|
||||
<Name>LaaPackages.HttpClient</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\LaaPackages\LaaPackages.SqlClient\LaaPackages.SqlClient.csproj">
|
||||
<Project>{F90B940C-9A83-496D-AAE0-11CD02CE0A22}</Project>
|
||||
<Name>LaaPackages.SqlClient</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,37 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("LaaProduction.Data.Cordonel")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LaaProduction.Data.Cordonel")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("03784923-1fd3-4535-80f5-286728df62ab")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: InternalsVisibleTo("LaaProduction.Data.Cordonel.UnitTests")]
|
||||
-204
@@ -1,204 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Repositories
|
||||
{
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Data.Cordonel.Interfaces;
|
||||
|
||||
using System;
|
||||
|
||||
public class EOLProgressRepository : IEOLProgressRepository<EOLProgressModel>
|
||||
{
|
||||
private readonly CordonelDbContext dbContext;
|
||||
private readonly SqlConnection sqlConnection;
|
||||
|
||||
public EOLProgressRepository(CordonelDbContext dbContext)
|
||||
{
|
||||
this.dbContext = dbContext;
|
||||
this.sqlConnection = dbContext.SqlConnection;
|
||||
}
|
||||
|
||||
public EOLProgressModel Create(EOLProgressModel model)
|
||||
{
|
||||
this.sqlConnection
|
||||
.CreateCommand($@"INSERT INTO Cordonel_EOL_Progress (PcbId) VALUES (@{nameof(model.PcbId)})")
|
||||
.SetParameter(nameof(model.PcbId), model.PcbId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
return this.Read(model);
|
||||
}
|
||||
|
||||
public EOLProgressModel Read(EOLProgressModel model)
|
||||
{
|
||||
var pcbId = model.PcbId;
|
||||
|
||||
return this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT Id
|
||||
, PcbId
|
||||
, StartDate
|
||||
, StandardRequirementId
|
||||
, StandardRequirementVersion
|
||||
, SpecialRequirementId
|
||||
, SpecialRequirementVersion
|
||||
, RequirementRequestChecked
|
||||
, RequirementPcbIdChecked
|
||||
, RequirementOrderChecked
|
||||
, RequirementRegionChecked
|
||||
, ProductionStatusLutCrc
|
||||
, ProductionStatusFwVersion
|
||||
, ProductionStatusMeterSize
|
||||
, ProductionStatusDrainedBatteryLoad
|
||||
, ProductionStatusBatteryLoadChecked
|
||||
, ProductionStatusRemainingLifeTime
|
||||
, ProductionStatusRemainingLifeTimeChecked
|
||||
, MaxStorageMonths
|
||||
, MaxStorageMonthsChecked
|
||||
, ProductionStatusZeroFlowChecked
|
||||
, ProductionStatusCalibrationChecked
|
||||
, ParametrizationDoneChecked
|
||||
, StoreConfigurationDoneChecked
|
||||
, RebootDoneChecked
|
||||
, ParametrizationCompareChecked
|
||||
, RadioCheckId
|
||||
, FinalRadioSystemState
|
||||
, FinalRadioSystemStateCheck
|
||||
, PasswordFileInstalledCheck
|
||||
, AttachmentsChecked
|
||||
, EOLCompleteDate
|
||||
, EOLSoftwareNameAndVersion
|
||||
, SAPExportDone
|
||||
, SentinelCompleted
|
||||
, SentinelCompletedDate
|
||||
FROM Cordonel_EOL_Progress
|
||||
WHERE PcbId = @{nameof(pcbId)}")
|
||||
.SetParameter(nameof(pcbId), pcbId)
|
||||
.FirstOrDefault(reader => new EOLProgressModel
|
||||
{
|
||||
Id = reader.GetValue<int>(0),
|
||||
PcbId = reader.GetValue<int>(1),
|
||||
StartDate = reader.GetValue<DateTime>(2),
|
||||
StandardRequirementId = reader.GetValue<int?>(3),
|
||||
StandardRequirementVersion = reader.GetValue<int?>(4),
|
||||
SpecialRequirementId = reader.GetValue<int?>(5),
|
||||
SpecialRequirementVersion = reader.GetValue<int?>(6),
|
||||
RequirementRequestChecked = reader.GetValue<string>(7),
|
||||
RequirementPcbIdChecked = reader.GetValue<string>(8),
|
||||
RequirementOrderChecked = reader.GetValue<string>(9),
|
||||
RequirementRegionChecked = reader.GetValue<string>(10),
|
||||
ProductionStatusLutCrc = reader.GetValue<string>(11),
|
||||
ProductionStatusFwVersion = reader.GetValue<string>(12),
|
||||
ProductionStatusMeterSize = reader.GetValue<string>(13),
|
||||
ProductionStatusDrainedBatteryLoad = reader.GetValue<Double?>(14),
|
||||
ProductionStatusBatteryLoadChecked = reader.GetValue<string>(15),
|
||||
ProductionStatusRemainingLifeTime = reader.GetValue<Double?>(16),
|
||||
ProductionStatusRemainingLifeTimeChecked = reader.GetValue<string>(17),
|
||||
MaxStorageMonths = reader.GetValue<Double?>(18),
|
||||
MaxStorageMonthsChecked = reader.GetValue<string>(19),
|
||||
ProductionStatusZeroFlowChecked = reader.GetValue<string>(20),
|
||||
ProductionStatusCalibrationChecked = reader.GetValue<string>(21),
|
||||
ParametrizationDoneChecked = reader.GetValue<string>(22),
|
||||
StoreConfigurationDoneChecked = reader.GetValue<string>(23),
|
||||
RebootDoneChecked = reader.GetValue<string>(24),
|
||||
ParametrizationCompareChecked = reader.GetValue<string>(25),
|
||||
RadioCheckId = reader.GetValue<long?>(26),
|
||||
FinalRadioSystemState = reader.GetValue<long?>(27),
|
||||
FinalRadioSystemStateCheck = reader.GetValue<string>(28),
|
||||
PasswordFileInstalledCheck = reader.GetValue<string>(29),
|
||||
AttachmentsChecked = reader.GetValue<string>(30),
|
||||
EOLCompleteDate = reader.GetValue<DateTime?>(31),
|
||||
EOLSoftwareNameAndVersion = reader.GetValue<string>(32),
|
||||
SAPExportDone = reader.GetValue<string>(33),
|
||||
SentinelCompleted = reader.GetValue<string>(34),
|
||||
SentinelCompletedDate = reader.GetValue<DateTime?>(35),
|
||||
});
|
||||
}
|
||||
|
||||
public EOLProgressModel Update(EOLProgressModel model)
|
||||
{
|
||||
var result = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE Cordonel_EOL_Progress
|
||||
SET StandardRequirementId = @{nameof(model.StandardRequirementId)}
|
||||
, StandardRequirementVersion = @{nameof(model.StandardRequirementVersion)}
|
||||
, SpecialRequirementId = @{nameof(model.SpecialRequirementId)}
|
||||
, SpecialRequirementVersion = @{nameof(model.SpecialRequirementVersion)}
|
||||
, RequirementRequestChecked = @{nameof(model.RequirementRequestChecked)}
|
||||
, RequirementPcbIdChecked = @{nameof(model.RequirementPcbIdChecked)}
|
||||
, RequirementOrderChecked = @{nameof(model.RequirementOrderChecked)}
|
||||
, RequirementRegionChecked = @{nameof(model.RequirementRegionChecked)}
|
||||
, ProductionStatusLutCrc = @{nameof(model.ProductionStatusLutCrc)}
|
||||
, ProductionStatusFwVersion = @{nameof(model.ProductionStatusFwVersion)}
|
||||
, ProductionStatusMeterSize = @{nameof(model.ProductionStatusMeterSize)}
|
||||
, ProductionStatusDrainedBatteryLoad = @{nameof(model.ProductionStatusDrainedBatteryLoad)}
|
||||
, ProductionStatusBatteryLoadChecked = @{nameof(model.ProductionStatusBatteryLoadChecked)}
|
||||
, ProductionStatusRemainingLifeTime = @{nameof(model.ProductionStatusRemainingLifeTime)}
|
||||
, ProductionStatusRemainingLifeTimeChecked = @{nameof(model.ProductionStatusRemainingLifeTimeChecked)}
|
||||
, MaxStorageMonths = @{nameof(model.MaxStorageMonths)}
|
||||
, MaxStorageMonthsChecked = @{nameof(model.MaxStorageMonthsChecked)}
|
||||
, ProductionStatusZeroFlowChecked = @{nameof(model.ProductionStatusZeroFlowChecked)}
|
||||
, ProductionStatusCalibrationChecked = @{nameof(model.ProductionStatusCalibrationChecked)}
|
||||
, ParametrizationDoneChecked = @{nameof(model.ParametrizationDoneChecked)}
|
||||
, StoreConfigurationDoneChecked = @{nameof(model.StoreConfigurationDoneChecked)}
|
||||
, RebootDoneChecked = @{nameof(model.RebootDoneChecked)}
|
||||
, ParametrizationCompareChecked = @{nameof(model.ParametrizationCompareChecked)}
|
||||
, RadioCheckId = @{nameof(model.RadioCheckId)}
|
||||
, FinalRadioSystemState = @{nameof(model.FinalRadioSystemState)}
|
||||
, FinalRadioSystemStateCheck = @{nameof(model.FinalRadioSystemStateCheck)}
|
||||
, PasswordFileInstalledCheck = @{nameof(model.PasswordFileInstalledCheck)}
|
||||
, AttachmentsChecked = @{nameof(model.AttachmentsChecked)}
|
||||
, EOLCompleteDate = @{nameof(model.EOLCompleteDate)}
|
||||
, EOLSoftwareNameAndVersion = @{nameof(model.EOLSoftwareNameAndVersion)}
|
||||
WHERE PcbId = @{nameof(model.PcbId)}
|
||||
AND EOLCompleteDate IS NULL")
|
||||
.SetParameter(nameof(model.PcbId), model.PcbId)
|
||||
.SetParameter(nameof(model.StandardRequirementId), model.StandardRequirementId)
|
||||
.SetParameter(nameof(model.StandardRequirementVersion), model.StandardRequirementVersion)
|
||||
.SetParameter(nameof(model.SpecialRequirementId), model.SpecialRequirementId)
|
||||
.SetParameter(nameof(model.SpecialRequirementVersion), model.SpecialRequirementVersion)
|
||||
.SetParameter(nameof(model.RequirementRequestChecked), model.RequirementRequestChecked?.ToString())
|
||||
.SetParameter(nameof(model.RequirementPcbIdChecked), model.RequirementPcbIdChecked?.ToString())
|
||||
.SetParameter(nameof(model.RequirementOrderChecked), model.RequirementOrderChecked?.ToString())
|
||||
.SetParameter(nameof(model.RequirementRegionChecked), model.RequirementRegionChecked?.ToString())
|
||||
.SetParameter(nameof(model.ProductionStatusLutCrc), model.ProductionStatusLutCrc)
|
||||
.SetParameter(nameof(model.ProductionStatusFwVersion), model.ProductionStatusFwVersion)
|
||||
.SetParameter(nameof(model.ProductionStatusMeterSize), model.ProductionStatusMeterSize)
|
||||
.SetParameter(nameof(model.ProductionStatusDrainedBatteryLoad), model.ProductionStatusDrainedBatteryLoad)
|
||||
.SetParameter(nameof(model.ProductionStatusBatteryLoadChecked), model.ProductionStatusBatteryLoadChecked?.ToString())
|
||||
.SetParameter(nameof(model.ProductionStatusRemainingLifeTime), model.ProductionStatusRemainingLifeTime)
|
||||
.SetParameter(nameof(model.ProductionStatusRemainingLifeTimeChecked), model.ProductionStatusRemainingLifeTimeChecked?.ToString())
|
||||
.SetParameter(nameof(model.MaxStorageMonths), model.MaxStorageMonths)
|
||||
.SetParameter(nameof(model.MaxStorageMonthsChecked), model.MaxStorageMonthsChecked?.ToString())
|
||||
.SetParameter(nameof(model.ProductionStatusZeroFlowChecked), model.ProductionStatusZeroFlowChecked?.ToString())
|
||||
.SetParameter(nameof(model.ProductionStatusCalibrationChecked), model.ProductionStatusCalibrationChecked?.ToString())
|
||||
.SetParameter(nameof(model.ParametrizationDoneChecked), model.ParametrizationDoneChecked?.ToString())
|
||||
.SetParameter(nameof(model.StoreConfigurationDoneChecked), model.StoreConfigurationDoneChecked?.ToString())
|
||||
.SetParameter(nameof(model.RebootDoneChecked), model.RebootDoneChecked?.ToString())
|
||||
.SetParameter(nameof(model.ParametrizationCompareChecked), model.ParametrizationCompareChecked?.ToString())
|
||||
.SetParameter(nameof(model.RadioCheckId), model.RadioCheckId)
|
||||
.SetParameter(nameof(model.FinalRadioSystemState), model.FinalRadioSystemState)
|
||||
.SetParameter(nameof(model.FinalRadioSystemStateCheck), model.FinalRadioSystemStateCheck?.ToString())
|
||||
.SetParameter(nameof(model.PasswordFileInstalledCheck), model.PasswordFileInstalledCheck?.ToString())
|
||||
.SetParameter(nameof(model.AttachmentsChecked), model.AttachmentsChecked?.ToString())
|
||||
.SetParameter(nameof(model.EOLCompleteDate), model.EOLCompleteDate)
|
||||
.SetParameter(nameof(model.EOLSoftwareNameAndVersion), model.EOLSoftwareNameAndVersion)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
return this.Read(model);
|
||||
}
|
||||
|
||||
public EOLProgressModel Delete(EOLProgressModel model)
|
||||
{
|
||||
var deleted = this.Read(model);
|
||||
|
||||
if (deleted != null)
|
||||
{
|
||||
this.sqlConnection
|
||||
.CreateCommand($@"DELETE FROM Cordonel_EOL_Progress WHERE PcbId = @{nameof(model.PcbId)}")
|
||||
.SetParameter(nameof(model.PcbId), model.PcbId)
|
||||
.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
-161
@@ -1,161 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Repositories
|
||||
{
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Data.Cordonel.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ProductionOrdersRepository : IPORepository<CordonelProductionOrder>
|
||||
{
|
||||
private readonly CordonelDbContext dbContext;
|
||||
private readonly SqlConnection sqlConnection;
|
||||
|
||||
public ProductionOrdersRepository(CordonelDbContext dbContext)
|
||||
{
|
||||
this.dbContext = dbContext;
|
||||
this.sqlConnection = dbContext.SqlConnection;
|
||||
}
|
||||
|
||||
public IEnumerator<CordonelProductionOrder> GetEnumerator()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand(@"
|
||||
SELECT DISTINCT
|
||||
[VMM].[Charcode] AS [Key]
|
||||
, [REG].[Wert] AS [Region]
|
||||
, [CMS].[Dn_Name] AS [Size]
|
||||
, [IDN].[IdentNr] AS [IdentNr]
|
||||
, [AAP].[AuftragNr] AS [AuftragNr]
|
||||
, [AAP].[PositionNr] AS [PositionNr]
|
||||
, [AAP].[FertigungsauftragNr] AS [FertigungsauftragNr]
|
||||
FROM [VAKO_Merkmale] AS [VMM]
|
||||
LEFT JOIN (SELECT [Charcode]
|
||||
, [Wert]
|
||||
FROM [VAKO_Merkmale]
|
||||
WHERE [Basis] = 'GNS'
|
||||
AND [Stelle] = 5)
|
||||
AS [REG]
|
||||
ON [VMM].[Charcode] LIKE '_' + [REG].[Charcode]
|
||||
LEFT JOIN [Identnr] AS [IDN]
|
||||
ON [VMM].[Charcode] = SUBSTRING([IDN].[VakoCode], [VMM].[Stelle], [VMM].[Laenge])
|
||||
LEFT JOIN [CordonelMeterSizes] AS [CMS]
|
||||
ON [CMS].[Dn_VakoID] = [VMM].[Charcode]
|
||||
JOIN [AlleAuftragPositionen] AS [AAP]
|
||||
ON [AAP].[IdentNr] = [IDN].[IdentNr]
|
||||
WHERE [VMM].[Basis] = 'GNS'
|
||||
AND [VMM].[Bezeichnung] = 'NW')
|
||||
ORDER BY [AAP].[IdentNr] DESC
|
||||
, [AAP].[FertigungsauftragNr] DESC
|
||||
, [AAP].[AuftragNr] DESC")
|
||||
.ExecuteReader(x => new CordonelProductionOrder
|
||||
{
|
||||
Key = x.GetValue<string>(0),
|
||||
Region = x.GetValue<string>(1),
|
||||
Size = x.GetValue<string>(2),
|
||||
IdentNr = x.GetValue<string>(3),
|
||||
AuftragNr = x.GetValue<string>(4),
|
||||
PositionNr = x.GetValue<string>(5),
|
||||
FertigungsauftragNr = x.GetValue<string>(6),
|
||||
})
|
||||
.GetEnumerator();
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
=> this.GetEnumerator();
|
||||
|
||||
public IEnumerable<string> GetPcbs(string ponr)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT cap.CordonelAssignedPicking_PcbId
|
||||
FROM Cordonel_AssignedPicking AS cap
|
||||
LEFT JOIN Cordonel_Special_Requirements AS spl
|
||||
ON cap.CordonelAssignedPicking_FertigungsAuftragsNr = spl.ProductionOrderNo
|
||||
AND cap.CordonelAssignedPicking_PcbId = spl.PcbId
|
||||
WHERE cap.CordonelAssignedPicking_FertigungsAuftragsNr = @{nameof(ponr)}
|
||||
AND spl.PcbId IS NULL")
|
||||
.SetParameter(nameof(ponr), ponr)
|
||||
.ExecuteReader(x => x.GetValue<string>(0));
|
||||
|
||||
public IEnumerable<CordonelProductionOrder> Like(string pattern)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
[VMM].[Charcode] AS [Key]
|
||||
, [REG].[Wert] AS [Region]
|
||||
, [CMS].[Dn_Name] AS [Size]
|
||||
, [AAP].[IdentNr] AS [IdentNr]
|
||||
, [AAP].[AuftragNr] AS [AuftragNr]
|
||||
, [AAP].[PositionNr] AS [PositionNr]
|
||||
, [AAP].[FertigungsauftragNr] AS [FertigungsauftragNr]
|
||||
FROM [VAKO_Merkmale] AS [VMM]
|
||||
LEFT JOIN (SELECT [Charcode]
|
||||
, [Wert]
|
||||
FROM [VAKO_Merkmale]
|
||||
WHERE [Basis] = 'GNS'
|
||||
AND [Stelle] = 5)
|
||||
AS [REG]
|
||||
ON [VMM].[Charcode] LIKE '_' + [REG].[Charcode]
|
||||
LEFT JOIN [Identnr] AS [IDN]
|
||||
ON [VMM].[Charcode] = SUBSTRING([IDN].[VakoCode], [VMM].[Stelle], [VMM].[Laenge])
|
||||
LEFT JOIN [CordonelMeterSizes] AS [CMS]
|
||||
ON [CMS].[Dn_VakoID] = [VMM].[Charcode]
|
||||
JOIN [AlleAuftragPositionen] AS [AAP]
|
||||
ON [AAP].[IdentNr] = [IDN].[IdentNr]
|
||||
WHERE [VMM].[Basis] = 'GNS'
|
||||
AND [VMM].[Bezeichnung] = 'NW'
|
||||
AND ([AAP].[FertigungsauftragNr] LIKE @{nameof(pattern)}
|
||||
OR [AAP].[AuftragNr] LIKE @{nameof(pattern)}
|
||||
OR [AAP].[IdentNr] LIKE @{nameof(pattern)})
|
||||
ORDER BY [AAP].[IdentNr] DESC
|
||||
, [AAP].[FertigungsauftragNr] DESC
|
||||
, [AAP].[AuftragNr] DESC")
|
||||
.SetParameter(nameof(pattern), $"%{pattern}%")
|
||||
.ExecuteReader(x => new CordonelProductionOrder
|
||||
{
|
||||
Key = x.GetValue<string>(0),
|
||||
Region = x.GetValue<string>(1),
|
||||
Size = x.GetValue<string>(2),
|
||||
IdentNr = x.GetValue<string>(3),
|
||||
AuftragNr = x.GetValue<string>(4),
|
||||
PositionNr = x.GetValue<string>(5),
|
||||
FertigungsauftragNr = x.GetValue<string>(6),
|
||||
});
|
||||
|
||||
public IEnumerable<RadioKeyEntry> HasRightRadioKey(ulong address)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
apg.AuftragNr
|
||||
, apg.PositionNr
|
||||
, gm.Seriennummer
|
||||
, gm.FunkschluesselIndex
|
||||
, vmm.Wert
|
||||
, apg.IstDatum
|
||||
FROM Genesis_Meter AS gm
|
||||
JOIN AuftragPositionSerienNr AS aps
|
||||
ON gm.Seriennummer = aps.SerienNr
|
||||
JOIN AuftragPosition_Gesamt AS apg
|
||||
ON aps.AuftragNr = apg.AuftragNr
|
||||
AND aps.PositionNr = apg.PositionNr
|
||||
JOIN Identnr AS idn
|
||||
ON apg.IdentNr = idn.IdentNr
|
||||
JOIN VAKO_Merkmale AS vmm
|
||||
ON vmm.Basis = 'GNS'
|
||||
AND vmm.Stelle = 46
|
||||
AND vmm.Charcode = SUBSTRING(idn.VakoCode, vmm.Stelle, 1)
|
||||
WHERE gm.Adresse = @{nameof(address)}
|
||||
AND ((gm.FunkschluesselIndex IS NULL AND vmm.Charcode = '2')
|
||||
OR (gm.FunkschluesselIndex IS NOT NULL AND vmm.Charcode = '1'))")
|
||||
.SetParameter(nameof(address), $"10{address}")
|
||||
.ExecuteReader(x => new RadioKeyEntry
|
||||
{
|
||||
Auftrag = x.GetValue<int>(0),
|
||||
Position = x.GetValue<int>(1),
|
||||
SerienNr = x.GetValue<int>(2),
|
||||
KeyIndex = x.GetValue<string>(3),
|
||||
KeyType = x.GetValue<string>(4),
|
||||
IsDate = x.GetValue<DateTime>(5)
|
||||
});
|
||||
}
|
||||
}
|
||||
-301
@@ -1,301 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Repositories
|
||||
{
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Data.Cordonel.Interfaces;
|
||||
|
||||
using System;
|
||||
|
||||
public class RequirementsRepository : IRequirementsRepository<CordonelRequirements>
|
||||
{
|
||||
private readonly CordonelDbContext dbContext;
|
||||
private readonly SqlConnection sqlConnection;
|
||||
|
||||
public RequirementsRepository(CordonelDbContext dbContext)
|
||||
{
|
||||
this.dbContext = dbContext;
|
||||
this.sqlConnection = dbContext.SqlConnection;
|
||||
}
|
||||
|
||||
public CordonelRequirements FindByPcbId(string pcbid)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
cr.SpecialId
|
||||
, cr.SpecialVersion
|
||||
, cr.StandardId
|
||||
, cr.StandardVersion
|
||||
, cr.Region
|
||||
, cr.Size
|
||||
, cr.PoNr
|
||||
, aap.FertigungsauftragNr
|
||||
, cr.PcbId
|
||||
, map.MapPcbIdToSerialNumber_PcbId
|
||||
, cr.SkipCalibration
|
||||
, cr.SkipRadioCheck
|
||||
, cr.FwVersion
|
||||
, cr.LutCrc
|
||||
, cr.RLTYA
|
||||
, cr.RLTYS
|
||||
, cr.MDBLPA
|
||||
, cr.MDBLPS
|
||||
, CASE WHEN aap.Menge < 6
|
||||
THEN MSM
|
||||
ELSE MSMBO
|
||||
END AS MaxStorageMonths
|
||||
, cr.QuiescentCurrent_uA
|
||||
, cr.EPBLP
|
||||
, cr.Timestamp
|
||||
, cr.CreatedBy
|
||||
, cr.Comment
|
||||
, cr.IsSplActive
|
||||
, cr.IsStdActive
|
||||
, cr.IsSplApproved
|
||||
, cr.IsStdApproved
|
||||
, cr.RegionSizeKey
|
||||
FROM Cordonel_Requirements AS cr
|
||||
JOIN AlleAuftragPositionen AS aap
|
||||
ON cr.IdentNr = aap.IdentNr
|
||||
JOIN AuftragPositionSerienNr AS aps
|
||||
ON aap.AuftragNr = aps.AuftragNr
|
||||
AND aap.PositionNr = aps.PositionNr
|
||||
JOIN MapPcbIdToSerialNumber AS map
|
||||
ON aps.SerienNr = map.MapPcbIdToSerialNumber_SerialNumber
|
||||
WHERE map.MapPcbIdToSerialNumber_PcbId = @{nameof(pcbid)}
|
||||
AND (cr.PoNr = aap.FertigungsauftragNr OR cr.PoNr IS NULL)
|
||||
AND (cr.PcbId = map.MapPcbIdToSerialNumber_PcbId OR cr.PcbId IS NULL)
|
||||
ORDER BY cr.StandardId DESC
|
||||
, cr.SpecialId DESC")
|
||||
.SetParameter(nameof(pcbid), pcbid)
|
||||
.FirstOrDefault(this.ParseCordonelRequirements);
|
||||
|
||||
public CordonelRequirements FindByPcbIdFull(string pcbid, out string error)
|
||||
{
|
||||
error = default(string);
|
||||
|
||||
var requirements = default(CordonelRequirements);
|
||||
var pono = default(int?);
|
||||
var pcb = default(int?);
|
||||
|
||||
this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
cap.CordonelAssignedPicking_FertigungsAuftragsNr
|
||||
, map.MapPcbIdToSerialNumber_PcbId
|
||||
FROM Cordonel_AssignedPicking AS cap
|
||||
JOIN MapPcbIdToSerialNumber AS map
|
||||
ON cap.CordonelAssignedPicking_PcbId = map.MapPcbIdToSerialNumber_PcbId
|
||||
WHERE cap.CordonelAssignedPicking_PcbId = @{nameof(pcbid)}")
|
||||
.SetParameter(nameof(pcbid), pcbid)
|
||||
.FirstOrDefault(x =>
|
||||
{
|
||||
pono = x.GetValue<int?>(0);
|
||||
pcb = x.GetValue<int?>(1);
|
||||
});
|
||||
|
||||
if (pono is null)
|
||||
{
|
||||
error = $"Fertigungsauftragnr nicht gefunden für pcbId: {pcbid}";
|
||||
}
|
||||
else if (pcb is null)
|
||||
{
|
||||
error = $"PcbId: {pcbid} nicht gefunden";
|
||||
}
|
||||
|
||||
var identnr = default(int?);
|
||||
var menge = default(int?);
|
||||
var key = default(string);
|
||||
|
||||
this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT aap.IdentNr
|
||||
, aap.Menge
|
||||
, SUBSTRING(idn.VakoCode, 4, 1) + (CASE WHEN SUBSTRING(idn.VakoCode, 5, 1) = 'U' THEN 'U' ELSE 'E' END)
|
||||
FROM AlleAuftragPositionen AS aap
|
||||
JOIN Identnr AS idn
|
||||
ON aap.IdentNr = idn.IdentNr
|
||||
WHERE aap.FertigungsauftragNr = @{nameof(pono)}")
|
||||
.SetParameter(nameof(pono), pono)
|
||||
.FirstOrDefault(x =>
|
||||
{
|
||||
identnr = x.GetValue<int?>(0);
|
||||
menge = x.GetValue<int?>(1);
|
||||
key = x.GetValue<string>(2);
|
||||
});
|
||||
|
||||
if (identnr is null)
|
||||
{
|
||||
error = $"Identnr nicht gefunden für Fertigungsauftragnr: {pono}";
|
||||
|
||||
return requirements;
|
||||
}
|
||||
else if (menge is null)
|
||||
{
|
||||
error = $"Menge ist ungültig für Fertigungsauftragnr: {pono}";
|
||||
|
||||
return requirements;
|
||||
}
|
||||
else if (key is null)
|
||||
{
|
||||
error = $"Region-Size key ist ungültig für Fertigungsauftragnr: {pono}";
|
||||
|
||||
return requirements;
|
||||
}
|
||||
|
||||
var standardRequirement = this.dbContext.StandardRequirements.FirstOrDefaultByKey(key);
|
||||
var specialRequirement = this.dbContext.SpecialRequirements.FindFirstOrDefault(standardRequirement?.Id ?? 0, pono.Value, pcb);
|
||||
|
||||
if (specialRequirement?.ApprovedDate is null)
|
||||
{
|
||||
specialRequirement = default(CordonelSpecialRequirement);
|
||||
}
|
||||
|
||||
if (specialRequirement is null)
|
||||
{
|
||||
if (standardRequirement is null)
|
||||
{
|
||||
error = $"Standardfreigabe für Size-Region: {key} nicht gefunden";
|
||||
|
||||
return requirements;
|
||||
}
|
||||
else if (!standardRequirement.IsActive)
|
||||
{
|
||||
error = $"Standardfreigabe {standardRequirement.Id}.{standardRequirement.Version} nicht active";
|
||||
|
||||
return requirements;
|
||||
}
|
||||
else if (standardRequirement.ApprovedDate is null)
|
||||
{
|
||||
error = $"Standardfreigabe {standardRequirement.Id}.{standardRequirement.Version} nicht genehmigt";
|
||||
|
||||
return requirements;
|
||||
}
|
||||
}
|
||||
|
||||
requirements = new CordonelRequirements
|
||||
{
|
||||
ApprovalComment = specialRequirement?.Comment ?? standardRequirement?.Comment,
|
||||
ApprovalName = specialRequirement?.ApprovedBy ?? standardRequirement?.ApprovedBy,
|
||||
EstimatedProductionBatteryLoadPercent = specialRequirement?.EstimatedProductionBatteryLoadPercent ?? standardRequirement?.EstimatedProductionBatteryLoadPercent,
|
||||
FwVersion = specialRequirement?.FwVersion ?? standardRequirement?.FwVersion,
|
||||
IsSpecialApproved = specialRequirement?.ApprovedDate != null,
|
||||
IsSpecialActive = specialRequirement?.IsActive ?? default(bool?),
|
||||
IsStandardActive = standardRequirement?.IsActive,
|
||||
IsStandardApproved = standardRequirement?.ApprovedDate != null,
|
||||
LutCrc = specialRequirement?.LutCrc ?? standardRequirement?.LutCrc,
|
||||
MaxDrainedBatteryLoadPercentAssembly = specialRequirement?.MaxDrainedBatteryLoadPercentAssembly
|
||||
?? standardRequirement?.MaxDrainedBatteryLoadPercentAssembly,
|
||||
MaxDrainedBatteryLoadPercentShipping = specialRequirement?.MaxDrainedBatteryLoadPercentShipping
|
||||
?? standardRequirement?.MaxDrainedBatteryLoadPercentShipping,
|
||||
MaxStorageMonths = menge < 5
|
||||
? specialRequirement?.MaxStorageMonths ?? standardRequirement?.MaxStorageMonths
|
||||
: specialRequirement?.MaxStorageMonthsBigOrders ?? standardRequirement?.MaxStorageMonthsBigOrders,
|
||||
MeterSize = specialRequirement?.MeterSize ?? standardRequirement?.MeterSize,
|
||||
OuterPcbId = pcb,
|
||||
OuterProductionOrderNr = pono,
|
||||
PcbId = specialRequirement?.PcbId,
|
||||
ProductionOrderNr = specialRequirement?.ProductionOrderNr,
|
||||
QuiescentCurrent_uA = specialRequirement?.QuiescentCurrent_uA ?? standardRequirement?.QuiescentCurrent_uA,
|
||||
Region = specialRequirement?.Region ?? standardRequirement?.Region,
|
||||
RegionSizeKey = key,
|
||||
RequiredLifeTimeYearsAssembly = specialRequirement?.RequiredLifeTimeYearsAssembly ?? standardRequirement?.RequiredLifeTimeYearsAssembly,
|
||||
RequiredLifeTimeYearsShipping = specialRequirement?.RequiredLifeTimeYearsShipping ?? standardRequirement?.RequiredLifeTimeYearsShipping,
|
||||
RequirementTimestamp = specialRequirement?.Timestamp ?? standardRequirement?.Timestamp,
|
||||
SkipCalibration = specialRequirement?.SkipCalibration ?? standardRequirement?.SkipCalibration ?? false,
|
||||
SkipRadioCheck = specialRequirement?.SkipRadioCheck ?? standardRequirement?.SkipRadioCheck ?? false,
|
||||
SpecialId = specialRequirement?.Id,
|
||||
SpecialVersion = specialRequirement?.Version,
|
||||
StandardId = standardRequirement?.Id,
|
||||
StandardVersion = standardRequirement?.Version,
|
||||
};
|
||||
|
||||
return requirements;
|
||||
}
|
||||
|
||||
public CordonelRequirements FindByPoNo(string pono)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
cr.SpecialId
|
||||
, cr.SpecialVersion
|
||||
, cr.StandardId
|
||||
, cr.StandardVersion
|
||||
, cr.Region
|
||||
, cr.Size
|
||||
, cr.PoNr
|
||||
, aap.FertigungsauftragNr
|
||||
, cr.PcbId
|
||||
, map.MapPcbIdToSerialNumber_PcbId
|
||||
, cr.SkipCalibration
|
||||
, cr.SkipRadioCheck
|
||||
, cr.FwVersion
|
||||
, cr.LutCrc
|
||||
, cr.RLTYA
|
||||
, cr.RLTYS
|
||||
, cr.MDBLPA
|
||||
, cr.MDBLPS
|
||||
, CASE WHEN aap.Menge < 6
|
||||
THEN MSM
|
||||
ELSE MSMBO
|
||||
END AS MaxStorageMonths
|
||||
, cr.QuiescentCurrent_uA
|
||||
, cr.EPBLP
|
||||
, cr.Timestamp
|
||||
, cr.CreatedBy
|
||||
, cr.Comment
|
||||
, cr.IsSplActive
|
||||
, cr.IsStdActive
|
||||
, cr.IsSplApproved
|
||||
, cr.IsStdApproved
|
||||
, cr.RegionSizeKey
|
||||
FROM Cordonel_Requirements AS cr
|
||||
JOIN AlleAuftragPositionen AS aap
|
||||
ON cr.IdentNr = aap.IdentNr
|
||||
JOIN AuftragPositionSerienNr AS aps
|
||||
ON aap.AuftragNr = aps.AuftragNr
|
||||
AND aap.PositionNr = aps.PositionNr
|
||||
JOIN MapPcbIdToSerialNumber AS map
|
||||
ON aps.SerienNr = map.MapPcbIdToSerialNumber_SerialNumber
|
||||
WHERE aap.FertigungsauftragNr = @{nameof(pono)}
|
||||
AND (cr.PoNr = aap.FertigungsauftragNr OR cr.PoNr IS NULL)
|
||||
AND (cr.PcbId = map.MapPcbIdToSerialNumber_PcbId OR cr.PcbId IS NULL)
|
||||
ORDER BY cr.StandardId DESC
|
||||
, cr.SpecialId DESC")
|
||||
.SetParameter(nameof(pono), pono)
|
||||
.FirstOrDefault(this.ParseCordonelRequirements);
|
||||
|
||||
private CordonelRequirements ParseCordonelRequirements(SqlReader reader)
|
||||
=> new CordonelRequirements
|
||||
{
|
||||
SpecialId = reader.GetValue<int?>(0),
|
||||
SpecialVersion = reader.GetValue<int?>(1),
|
||||
StandardId = reader.GetValue<int?>(2),
|
||||
StandardVersion = reader.GetValue<int?>(3),
|
||||
Region = reader.GetValue<string>(4),
|
||||
MeterSize = reader.GetValue<string>(5),
|
||||
ProductionOrderNr = reader.GetValue<int?>(6),
|
||||
OuterProductionOrderNr = reader.GetValue<int?>(7),
|
||||
PcbId = reader.GetValue<int?>(8),
|
||||
OuterPcbId = reader.GetValue<int?>(9),
|
||||
SkipCalibration = reader.GetValue<bool>(10),
|
||||
SkipRadioCheck = reader.GetValue<bool>(11),
|
||||
FwVersion = reader.GetValue<string>(12),
|
||||
LutCrc = reader.GetValue<string>(13),
|
||||
RequiredLifeTimeYearsAssembly = reader.GetValue<Double?>(14),
|
||||
RequiredLifeTimeYearsShipping = reader.GetValue<Double?>(15),
|
||||
MaxDrainedBatteryLoadPercentAssembly = reader.GetValue<Double?>(16),
|
||||
MaxDrainedBatteryLoadPercentShipping = reader.GetValue<Double?>(17),
|
||||
MaxStorageMonths = reader.GetValue<Double?>(18),
|
||||
QuiescentCurrent_uA = reader.GetValue<Double?>(19),
|
||||
EstimatedProductionBatteryLoadPercent = reader.GetValue<Double?>(20),
|
||||
RequirementTimestamp = reader.GetValue<DateTime?>(21),
|
||||
ApprovalName = reader.GetValue<string>(22),
|
||||
ApprovalComment = reader.GetValue<string>(23),
|
||||
IsSpecialActive = reader.GetValue<bool?>(24),
|
||||
IsStandardActive = reader.GetValue<bool?>(25),
|
||||
IsSpecialApproved = reader.GetValue<bool?>(26),
|
||||
IsStandardApproved = reader.GetValue<bool?>(27),
|
||||
RegionSizeKey = reader.GetValue<string>(28)
|
||||
};
|
||||
}
|
||||
}
|
||||
-648
@@ -1,648 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Repositories
|
||||
{
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Data.Cordonel.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
public class SpecialRequirementsRepository : ISpecialRequirementsRepository<CordonelSpecialRequirement>
|
||||
{
|
||||
private readonly CordonelDbContext dbContext;
|
||||
private readonly SqlConnection sqlConnection;
|
||||
|
||||
public SpecialRequirementsRepository(CordonelDbContext dbContext)
|
||||
{
|
||||
this.dbContext = dbContext;
|
||||
this.sqlConnection = dbContext.SqlConnection;
|
||||
}
|
||||
|
||||
public CordonelSpecialRequirement Add(CordonelSpecialRequirement model)
|
||||
{
|
||||
var insertedId = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT
|
||||
INTO [Cordonel_Special_Requirements]
|
||||
( [Id]
|
||||
, [Version]
|
||||
, [StandardId]
|
||||
, [StandardVersion]
|
||||
, [ProductionOrderNo]
|
||||
, [PcbId]
|
||||
, [FwVersion]
|
||||
, [LutCrc]
|
||||
, [SkipCalibration]
|
||||
, [SkipRadioCheck]
|
||||
, [RequiredLifeTimeYearsAssembly]
|
||||
, [RequiredLifeTimeYearsShipping]
|
||||
, [MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [MaxDrainedBatteryLoadPercentShipping]
|
||||
, [MaxStorageMonths]
|
||||
, [MaxStorageMonthsBigOrders]
|
||||
, [QuiescentCurrent_uA]
|
||||
, [EstimatedProductionBatteryLoadPercent]
|
||||
, [Timestamp]
|
||||
, [CreatedBy]
|
||||
, [Comment]
|
||||
, [IsActive])
|
||||
VALUES ((SELECT ISNULL(MAX([Id]), 0) + 1 FROM [Cordonel_Special_Requirements])
|
||||
, 1
|
||||
, @{nameof(model.StandardId)}
|
||||
, @{nameof(model.StandardVersion)}
|
||||
, @{nameof(model.ProductionOrderNr)}
|
||||
, @{nameof(model.PcbId)}
|
||||
, @{nameof(model.FwVersion)}
|
||||
, @{nameof(model.LutCrc)}
|
||||
, @{nameof(model.SkipCalibration)}
|
||||
, @{nameof(model.SkipRadioCheck)}
|
||||
, @{nameof(model.RequiredLifeTimeYearsAssembly)}
|
||||
, @{nameof(model.RequiredLifeTimeYearsShipping)}
|
||||
, @{nameof(model.MaxDrainedBatteryLoadPercentAssembly)}
|
||||
, @{nameof(model.MaxDrainedBatteryLoadPercentShipping)}
|
||||
, @{nameof(model.MaxStorageMonths)}
|
||||
, @{nameof(model.MaxStorageMonthsBigOrders)}
|
||||
, @{nameof(model.QuiescentCurrent_uA)}
|
||||
, @{nameof(model.EstimatedProductionBatteryLoadPercent)}
|
||||
, GETUTCDATE()
|
||||
, @{nameof(model.CreatedBy)}
|
||||
, @{nameof(model.Comment)}
|
||||
, @{nameof(model.IsActive)})")
|
||||
.SetParameter(nameof(model.StandardId), model.StandardId)
|
||||
.SetParameter(nameof(model.StandardVersion), model.StandardVersion)
|
||||
.SetParameter(nameof(model.ProductionOrderNr), model.ProductionOrderNr)
|
||||
.SetParameter(nameof(model.PcbId), model.PcbId)
|
||||
.SetParameter(nameof(model.FwVersion), model.FwVersion)
|
||||
.SetParameter(nameof(model.LutCrc), model.LutCrc)
|
||||
.SetParameter(nameof(model.SkipCalibration), model.SkipCalibration)
|
||||
.SetParameter(nameof(model.SkipRadioCheck), model.SkipRadioCheck)
|
||||
.SetParameter(nameof(model.RequiredLifeTimeYearsAssembly), model.RequiredLifeTimeYearsAssembly)
|
||||
.SetParameter(nameof(model.RequiredLifeTimeYearsShipping), model.RequiredLifeTimeYearsShipping)
|
||||
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentAssembly), model.MaxDrainedBatteryLoadPercentAssembly)
|
||||
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentShipping), model.MaxDrainedBatteryLoadPercentShipping)
|
||||
.SetParameter(nameof(model.MaxStorageMonths), model.MaxStorageMonths)
|
||||
.SetParameter(nameof(model.MaxStorageMonthsBigOrders), model.MaxStorageMonthsBigOrders)
|
||||
.SetParameter(nameof(model.QuiescentCurrent_uA), model.QuiescentCurrent_uA)
|
||||
.SetParameter(nameof(model.EstimatedProductionBatteryLoadPercent), model.EstimatedProductionBatteryLoadPercent)
|
||||
.SetParameter(nameof(model.Timestamp), model.Timestamp)
|
||||
.SetParameter(nameof(model.CreatedBy), model.CreatedBy)
|
||||
.SetParameter(nameof(model.Comment), model.Comment)
|
||||
.SetParameter(nameof(model.IsActive), model.IsActive)
|
||||
.ExecuteScalar(x => x.GetValue<int>(0));
|
||||
|
||||
var id = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Id]
|
||||
FROM [Cordonel_Special_Requirements]
|
||||
WHERE [ProductionOrderNo] = @{nameof(model.ProductionOrderNr)}
|
||||
AND ([PcbId] = @{nameof(model.PcbId)} OR [PcbId] IS NULL)")
|
||||
.SetParameter(nameof(model.ProductionOrderNr), model.ProductionOrderNr)
|
||||
.SetParameter(nameof(model.PcbId), model.PcbId)
|
||||
.FirstOrDefault(x => x.GetValue<int>(0));
|
||||
|
||||
return this.FirstOrDefault(id);
|
||||
}
|
||||
|
||||
public void Approve(int requirementId, string approval, string comment)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE Cordonel_Special_Requirements
|
||||
SET ApprovedBy = @{nameof(approval)}
|
||||
, ApprovedDate = GETDATE()
|
||||
, Comment = ISNULL(Comment, '')
|
||||
+ CHAR(13) + CHAR(10)
|
||||
+ ISNULL(@{nameof(comment)}, '')
|
||||
FROM Cordonel_Special_Requirements AS splup
|
||||
JOIN (SELECT TOP 1 spl.Id, spl.Version
|
||||
FROM Cordonel_Special_Requirements AS spl
|
||||
WHERE spl.Id = @{nameof(requirementId)}
|
||||
AND spl.CreatedBy <> @{nameof(approval)}
|
||||
ORDER BY spl.Version DESC) AS idv
|
||||
ON splup.Id = idv.Id
|
||||
AND splup.Version = idv.Version")
|
||||
.SetParameter(nameof(requirementId), requirementId)
|
||||
.SetParameter(nameof(approval), approval)
|
||||
.SetParameter(nameof(comment), comment)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public CordonelSpecialRequirement Delete(object id)
|
||||
=> throw new NotImplementedException($"{nameof(CordonelSpecialRequirement)} could not be deleted");
|
||||
|
||||
public SpecialRequiremetnsFilter Filter()
|
||||
{
|
||||
var xmlFilter = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
DECLARE @spl TABLE(
|
||||
Region VARCHAR(20)
|
||||
, MeterSize VARCHAR(20)
|
||||
, ProductionOrder INT
|
||||
, PcbId INT
|
||||
, IsActive BIT
|
||||
, IsApproved BIT)
|
||||
INSERT INTO @spl
|
||||
SELECT std.Region
|
||||
, std.MeterSize
|
||||
, spl.ProductionOrderNo
|
||||
, spl.PcbId
|
||||
, spl.IsActive
|
||||
, CAST(CASE WHEN spl.ApprovedDate IS NOT NULL THEN 1 ELSE 0 END AS BIT)
|
||||
FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY Id ORDER BY Version DESC) AS RowNr
|
||||
FROM Cordonel_Special_Requirements) AS spl
|
||||
JOIN Cordonel_Standard_Requirements AS std
|
||||
ON spl.StandardId = std.Id
|
||||
AND spl.StandardVersion = std.Version
|
||||
WHERE spl.RowNr = 1
|
||||
SELECT CAST((SELECT (SELECT DISTINCT Region AS 'Region/@Value'
|
||||
FROM @spl
|
||||
FOR XML PATH(''), TYPE) AS Regions
|
||||
, (SELECT DISTINCT MeterSize AS 'MeterSize/@Value'
|
||||
FROM @spl
|
||||
FOR XML PATH(''), TYPE) AS MeterSizes
|
||||
, (SELECT DISTINCT ProductionOrder AS 'ProductionOrder/@Value'
|
||||
FROM @spl
|
||||
FOR XML PATH(''), TYPE) AS ProductionOrders
|
||||
, (SELECT DISTINCT PcbId AS 'PcbId/@Value'
|
||||
FROM @spl
|
||||
FOR XML PATH(''), TYPE) AS PcbIds
|
||||
, (SELECT DISTINCT IsActive AS 'Active/@Value'
|
||||
FROM @spl
|
||||
FOR XML PATH(''), TYPE) AS ActiveRequirements
|
||||
, (SELECT DISTINCT IsApproved AS 'Approved/@Value'
|
||||
FROM @spl
|
||||
FOR XML PATH(''), TYPE) AS ApprovedRequirements
|
||||
FOR XML PATH(''), ROOT('SpecialRequiremetnsFilter'), TYPE) AS XML)")
|
||||
.FirstOrDefault(x => x.GetValue<string>(0));
|
||||
var filter = default(SpecialRequiremetnsFilter);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(xmlFilter))
|
||||
{
|
||||
var xmlSerializer = new XmlSerializer(typeof(SpecialRequiremetnsFilter));
|
||||
var xmlReader = new StringReader(xmlFilter);
|
||||
|
||||
try
|
||||
{
|
||||
filter = xmlSerializer.Deserialize(xmlReader) as SpecialRequiremetnsFilter;
|
||||
}
|
||||
catch // TODO: (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return filter ?? new SpecialRequiremetnsFilter();
|
||||
}
|
||||
|
||||
public IEnumerable<CordonelSpecialRequirement> Filter(SpecialRequiremetnsFilter filter)
|
||||
{
|
||||
var query = $@"
|
||||
SELECT *
|
||||
FROM (SELECT [Latest].[Id]
|
||||
, [Latest].[Version]
|
||||
, [Latest].[StandardId]
|
||||
, [Latest].[StandardVersion]
|
||||
, [Standards].[Key]
|
||||
, [Standards].[Region]
|
||||
, [Standards].[MeterSize]
|
||||
, [Latest].[ProductionOrderNo]
|
||||
, [Latest].[PcbId]
|
||||
, [Latest].[FwVersion]
|
||||
, [Latest].[LutCrc]
|
||||
, [Latest].[SkipCalibration]
|
||||
, [Latest].[SkipRadioCheck]
|
||||
, [Latest].[RequiredLifeTimeYearsAssembly]
|
||||
, [Latest].[RequiredLifeTimeYearsShipping]
|
||||
, [Latest].[MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [Latest].[MaxDrainedBatteryLoadPercentShipping]
|
||||
, [Latest].[MaxStorageMonths]
|
||||
, [Latest].[MaxStorageMonthsBigOrders]
|
||||
, [Latest].[QuiescentCurrent_uA]
|
||||
, [Latest].[EstimatedProductionBatteryLoadPercent]
|
||||
, [Latest].[Timestamp]
|
||||
, [Latest].[CreatedBy]
|
||||
, [Latest].[ApprovedBy]
|
||||
, [Latest].[ApprovedDate]
|
||||
, [Latest].[Comment]
|
||||
, [Latest].[IsActive]
|
||||
, [Standards].[ProductGroup]
|
||||
FROM (SELECT *, RANK() OVER (PARTITION BY [Id]
|
||||
ORDER BY [Version] DESC) AS [RowNr]
|
||||
FROM [Cordonel_Special_Requirements])
|
||||
AS [Latest]
|
||||
LEFT JOIN [Cordonel_Standard_Requirements]
|
||||
AS [Standards]
|
||||
ON [Standards].[Id] = [Latest].[StandardId]
|
||||
AND [Standards].[Version] = [Latest].[StandardVersion]
|
||||
WHERE [Latest].[RowNr] = 1)
|
||||
AS [req]
|
||||
{filter?.SqlConditions("req", "WHERE")}
|
||||
ORDER BY [req].[ProductGroup] ASC
|
||||
, LEN(SUBSTRING([req].[MeterSize], 1, CASE WHEN CHARINDEX(' ', [req].[MeterSize]) > 0 THEN CHARINDEX(' ', [req].[MeterSize]) - 1 ELSE LEN([req].[MeterSize]) END))
|
||||
, SUBSTRING([req].[MeterSize], 1, CASE WHEN CHARINDEX(' ', [req].[MeterSize]) > 0 THEN CHARINDEX(' ', [req].[MeterSize]) - 1 ELSE LEN([req].[MeterSize]) END)
|
||||
, [req].[MeterSize]";
|
||||
|
||||
return this.sqlConnection
|
||||
.CreateCommand(query)
|
||||
.ExecuteReader(this.ParseSpecialRequirement);
|
||||
}
|
||||
|
||||
public CordonelSpecialRequirement Find(CordonelSpecialRequirement model)
|
||||
{
|
||||
var requirement = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Special].[Id]
|
||||
, [Special].[Version]
|
||||
, [Special].[StandardId]
|
||||
, [Special].[StandardVersion]
|
||||
, [Standard].[Key]
|
||||
, [Standard].[Region]
|
||||
, [Standard].[MeterSize]
|
||||
, [Special].[ProductionOrderNo]
|
||||
, [Special].[PcbId]
|
||||
, [Special].[FwVersion]
|
||||
, [Special].[LutCrc]
|
||||
, [Special].[SkipCalibration]
|
||||
, [Special].[SkipRadioCheck]
|
||||
, [Special].[RequiredLifeTimeYearsAssembly]
|
||||
, [Special].[RequiredLifeTimeYearsShipping]
|
||||
, [Special].[MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [Special].[MaxDrainedBatteryLoadPercentShipping]
|
||||
, [Special].[MaxStorageMonths]
|
||||
, [Special].[MaxStorageMonthsBigOrders]
|
||||
, [Special].[QuiescentCurrent_uA]
|
||||
, [Special].[EstimatedProductionBatteryLoadPercent]
|
||||
, [Special].[Timestamp]
|
||||
, [Special].[CreatedBy]
|
||||
, [Special].[ApprovedBy]
|
||||
, [Special].[ApprovedDate]
|
||||
, [Special].[Comment]
|
||||
, [Special].[IsActive]
|
||||
, [Standard].[ProductGroup]
|
||||
FROM [Cordonel_Special_Requirements] AS [Special]
|
||||
LEFT JOIN [Cordonel_Standard_Requirements] AS [Standard]
|
||||
ON [Standard].[Id] = [Special].[StandardId]
|
||||
AND [Standard].[Version] = [Special].[StandardVersion]
|
||||
WHERE ISNULL([Special].[ProductionOrderNo], '') = ISNULL(@{nameof(model.ProductionOrderNr)}, '')
|
||||
AND ISNULL([Special].[PcbId], '') = ISNULL(@{nameof(model.PcbId)}, '')
|
||||
ORDER BY [Special].[Version] DESC")
|
||||
.SetParameter(nameof(model.ProductionOrderNr), model.ProductionOrderNr)
|
||||
.SetParameter(nameof(model.PcbId), model.PcbId)
|
||||
.FirstOrDefault(this.ParseSpecialRequirement);
|
||||
|
||||
if (requirement != null)
|
||||
{
|
||||
requirement.StandardRequirement = this.StandardRequirement(requirement.StandardId);
|
||||
requirement.History = this.Hostory(requirement.Id, requirement.Version);
|
||||
}
|
||||
|
||||
return requirement;
|
||||
}
|
||||
|
||||
public CordonelSpecialRequirement FirstOrDefault(object id)
|
||||
{
|
||||
var requirement = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Special].[Id]
|
||||
, [Special].[Version]
|
||||
, [Special].[StandardId]
|
||||
, [Special].[StandardVersion]
|
||||
, [Standard].[Key]
|
||||
, [Standard].[Region]
|
||||
, [Standard].[MeterSize]
|
||||
, [Special].[ProductionOrderNo]
|
||||
, [Special].[PcbId]
|
||||
, [Special].[FwVersion]
|
||||
, [Special].[LutCrc]
|
||||
, [Special].[SkipCalibration]
|
||||
, [Special].[SkipRadioCheck]
|
||||
, [Special].[RequiredLifeTimeYearsAssembly]
|
||||
, [Special].[RequiredLifeTimeYearsShipping]
|
||||
, [Special].[MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [Special].[MaxDrainedBatteryLoadPercentShipping]
|
||||
, [Special].[MaxStorageMonths]
|
||||
, [Special].[MaxStorageMonthsBigOrders]
|
||||
, [Special].[QuiescentCurrent_uA]
|
||||
, [Special].[EstimatedProductionBatteryLoadPercent]
|
||||
, [Special].[Timestamp]
|
||||
, [Special].[CreatedBy]
|
||||
, [Special].[ApprovedBy]
|
||||
, [Special].[ApprovedDate]
|
||||
, [Special].[Comment]
|
||||
, [Special].[IsActive]
|
||||
, [Standard].[ProductGroup]
|
||||
FROM [Cordonel_Special_Requirements] AS [Special]
|
||||
LEFT JOIN [Cordonel_Standard_Requirements] AS [Standard]
|
||||
ON [Standard].[Id] = [Special].[StandardId]
|
||||
AND [Standard].[Version] = [Special].[StandardVersion]
|
||||
WHERE [Special].[Id] = @{nameof(id)}
|
||||
ORDER BY [Special].[Version] DESC")
|
||||
.SetParameter(nameof(id), id)
|
||||
.FirstOrDefault(this.ParseSpecialRequirement);
|
||||
|
||||
if (requirement != null)
|
||||
{
|
||||
requirement.StandardRequirement = this.StandardRequirement(requirement.StandardId);
|
||||
requirement.History = this.Hostory(requirement.Id, requirement.Version);
|
||||
}
|
||||
|
||||
return requirement;
|
||||
}
|
||||
|
||||
public CordonelSpecialRequirement FirstOrDefault(params object[] ids)
|
||||
{
|
||||
var requirement = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Special].[Id]
|
||||
, [Special].[Version]
|
||||
, [Special].[StandardId]
|
||||
, [Special].[StandardVersion]
|
||||
, [Standard].[Key]
|
||||
, [Standard].[Region]
|
||||
, [Standard].[MeterSize]
|
||||
, [Special].[ProductionOrderNo]
|
||||
, [Special].[PcbId]
|
||||
, [Special].[FwVersion]
|
||||
, [Special].[LutCrc]
|
||||
, [Special].[SkipCalibration]
|
||||
, [Special].[SkipRadioCheck]
|
||||
, [Special].[RequiredLifeTimeYearsAssembly]
|
||||
, [Special].[RequiredLifeTimeYearsShipping]
|
||||
, [Special].[MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [Special].[MaxDrainedBatteryLoadPercentShipping]
|
||||
, [Special].[MaxStorageMonths]
|
||||
, [Special].[MaxStorageMonthsBigOrders]
|
||||
, [Special].[QuiescentCurrent_uA]
|
||||
, [Special].[EstimatedProductionBatteryLoadPercent]
|
||||
, [Special].[Timestamp]
|
||||
, [Special].[CreatedBy]
|
||||
, [Special].[ApprovedBy]
|
||||
, [Special].[ApprovedDate]
|
||||
, [Special].[Comment]
|
||||
, [Special].[IsActive]
|
||||
, [Standard].[ProductGroup]
|
||||
FROM [Cordonel_Special_Requirements] AS [Special]
|
||||
LEFT JOIN [Cordonel_Standard_Requirements] AS [Standard]
|
||||
ON [Standard].[Id] = [Special].[StandardId]
|
||||
AND [Standard].[Version] = [Special].[StandardVersion]
|
||||
WHERE [Special].[Id] = @{nameof(CordonelSpecialRequirement.Id)}
|
||||
AND [Special].[Version] = @{nameof(CordonelSpecialRequirement.Version)}
|
||||
ORDER BY [Special].[Version] DESC")
|
||||
.SetParameter(nameof(CordonelSpecialRequirement.Id), ids[0])
|
||||
.SetParameter(nameof(CordonelSpecialRequirement.Version), ids[1])
|
||||
.FirstOrDefault(this.ParseSpecialRequirement);
|
||||
|
||||
if (requirement != null)
|
||||
{
|
||||
requirement.StandardRequirement = this.StandardRequirement(requirement.StandardId);
|
||||
requirement.History = this.Hostory(requirement.Id, requirement.Version);
|
||||
}
|
||||
|
||||
return requirement;
|
||||
}
|
||||
|
||||
public CordonelSpecialRequirement FindFirstOrDefault(int standardId, int pono, int? pcbId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Special].[Id]
|
||||
, [Special].[Version]
|
||||
, [Special].[StandardId]
|
||||
, [Special].[StandardVersion]
|
||||
, NULL
|
||||
, NULL
|
||||
, NULL
|
||||
, [Special].[ProductionOrderNo]
|
||||
, [Special].[PcbId]
|
||||
, [Special].[FwVersion]
|
||||
, [Special].[LutCrc]
|
||||
, [Special].[SkipCalibration]
|
||||
, [Special].[SkipRadioCheck]
|
||||
, [Special].[RequiredLifeTimeYearsAssembly]
|
||||
, [Special].[RequiredLifeTimeYearsShipping]
|
||||
, [Special].[MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [Special].[MaxDrainedBatteryLoadPercentShipping]
|
||||
, [Special].[MaxStorageMonths]
|
||||
, [Special].[MaxStorageMonthsBigOrders]
|
||||
, [Special].[QuiescentCurrent_uA]
|
||||
, [Special].[EstimatedProductionBatteryLoadPercent]
|
||||
, [Special].[Timestamp]
|
||||
, [Special].[CreatedBy]
|
||||
, [Special].[ApprovedBy]
|
||||
, [Special].[ApprovedDate]
|
||||
, [Special].[Comment]
|
||||
, [Special].[IsActive]
|
||||
, NULL
|
||||
FROM [Cordonel_Special_Requirements] AS [Special]
|
||||
WHERE [Special].[StandardId] = @{nameof(standardId)}
|
||||
AND [Special].[ProductionOrderNo] = @{nameof(pono)}
|
||||
AND ([Special].[PcbId] = @{nameof(pcbId)} OR [Special].[PcbId] IS NULL)
|
||||
ORDER BY [Special].[Version] DESC")
|
||||
.SetParameter(nameof(standardId), standardId)
|
||||
.SetParameter(nameof(pono), pono)
|
||||
.SetParameter(nameof(pcbId), pcbId)
|
||||
.FirstOrDefault(this.ParseSpecialRequirement);
|
||||
|
||||
public CordonelSpecialRequirement FirstOrDefaultByPO(string ponr)
|
||||
{
|
||||
var id = default(int?);
|
||||
var nr = default(int?);
|
||||
_ = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Id]
|
||||
, [Version]
|
||||
FROM [Cordonel_Special_Requirements]
|
||||
WHERE [ProductionOrderNo] = @{nameof(ponr)}
|
||||
AND [PcbId] IS NULL")
|
||||
.SetParameter(nameof(ponr), ponr)
|
||||
.FirstOrDefault(x =>
|
||||
{
|
||||
id = x.GetValue<int?>(0);
|
||||
nr = x.GetValue<int?>(0);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
return this.FirstOrDefault(id, nr);
|
||||
}
|
||||
|
||||
public IEnumerator<CordonelSpecialRequirement> GetEnumerator()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand(@"
|
||||
SELECT [Latest].[Id]
|
||||
, [Latest].[Version]
|
||||
, [Latest].[StandardId]
|
||||
, [Latest].[StandardVersion]
|
||||
, [Standards].[Key]
|
||||
, [Standards].[Region]
|
||||
, [Standards].[MeterSize]
|
||||
, [Latest].[ProductionOrderNo]
|
||||
, [Latest].[PcbId]
|
||||
, [Latest].[FwVersion]
|
||||
, [Latest].[LutCrc]
|
||||
, [Latest].[SkipCalibration]
|
||||
, [Latest].[SkipRadioCheck]
|
||||
, [Latest].[RequiredLifeTimeYearsAssembly]
|
||||
, [Latest].[RequiredLifeTimeYearsShipping]
|
||||
, [Latest].[MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [Latest].[MaxDrainedBatteryLoadPercentShipping]
|
||||
, [Latest].[MaxStorageMonths]
|
||||
, [Latest].[MaxStorageMonthsBigOrders]
|
||||
, [Latest].[QuiescentCurrent_uA]
|
||||
, [Latest].[EstimatedProductionBatteryLoadPercent]
|
||||
, [Latest].[Timestamp]
|
||||
, [Latest].[CreatedBy]
|
||||
, [Latest].[ApprovedBy]
|
||||
, [Latest].[ApprovedDate]
|
||||
, [Latest].[Comment]
|
||||
, [Latest].[IsActive]
|
||||
, [Standards].[ProductGroup]
|
||||
FROM (SELECT *, RANK() OVER (PARTITION BY [Id]
|
||||
ORDER BY [Version] DESC) AS [RowNr]
|
||||
FROM [Cordonel_Special_Requirements])
|
||||
AS [Latest]
|
||||
LEFT JOIN [Cordonel_Standard_Requirements]
|
||||
AS [Standards]
|
||||
ON [Standards].[Id] = [Latest].[StandardId]
|
||||
AND [Standards].[Version] = [Latest].[StandardVersion]
|
||||
WHERE [Latest].[RowNr] = 1
|
||||
ORDER BY [Standards].[Region] ASC
|
||||
, LEN([Standards].[MeterSize]) ASC
|
||||
, [Standards].[MeterSize] ASC")
|
||||
.ExecuteReader(this.ParseSpecialRequirement)
|
||||
.GetEnumerator();
|
||||
|
||||
public void Unapprove(int requirementId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE Cordonel_Special_Requirements
|
||||
SET ApprovedBy = NULL
|
||||
, ApprovedDate = NULL
|
||||
FROM Cordonel_Special_Requirements AS splup
|
||||
JOIN (SELECT TOP 1 spl.Id, spl.Version
|
||||
FROM Cordonel_Special_Requirements AS spl
|
||||
WHERE spl.Id = @{nameof(requirementId)}
|
||||
ORDER BY spl.Version DESC) AS idv
|
||||
ON splup.Id = idv.Id
|
||||
AND splup.Version = idv.Version")
|
||||
.SetParameter(nameof(requirementId), requirementId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public CordonelSpecialRequirement Update(CordonelSpecialRequirement model)
|
||||
{
|
||||
this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE [Cordonel_Special_Requirements]
|
||||
SET [FwVersion] = @{nameof(model.FwVersion)}
|
||||
, [LutCrc] = @{nameof(model.LutCrc)}
|
||||
, [SkipCalibration] = @{nameof(model.SkipCalibration)}
|
||||
, [SkipRadioCheck] = @{nameof(model.SkipRadioCheck)}
|
||||
, [RequiredLifeTimeYearsAssembly] = @{nameof(model.RequiredLifeTimeYearsAssembly)}
|
||||
, [RequiredLifeTimeYearsShipping] = @{nameof(model.RequiredLifeTimeYearsShipping)}
|
||||
, [MaxDrainedBatteryLoadPercentAssembly] = @{nameof(model.MaxDrainedBatteryLoadPercentAssembly)}
|
||||
, [MaxDrainedBatteryLoadPercentShipping] = @{nameof(model.MaxDrainedBatteryLoadPercentShipping)}
|
||||
, [MaxStorageMonths] = @{nameof(model.MaxStorageMonths)}
|
||||
, [MaxStorageMonthsBigOrders] = @{nameof(model.MaxStorageMonthsBigOrders)}
|
||||
, [QuiescentCurrent_uA] = @{nameof(model.QuiescentCurrent_uA)}
|
||||
, [EstimatedProductionBatteryLoadPercent] = @{nameof(model.EstimatedProductionBatteryLoadPercent)}
|
||||
, [Timestamp] = @{nameof(model.Timestamp)}
|
||||
, [CreatedBy] = @{nameof(model.CreatedBy)}
|
||||
, [Comment] = @{nameof(model.Comment)}
|
||||
, [IsActive] = @{nameof(model.IsActive)}
|
||||
, [ApprovedBy] = NULL
|
||||
, [ApprovedDate] = NULL
|
||||
WHERE [Id] = @{nameof(model.Id)}
|
||||
AND [Version] = (SELECT MAX([Version])
|
||||
FROM [Cordonel_Special_Requirements]
|
||||
WHERE [Id] = @{nameof(model.Id)})")
|
||||
.SetParameter(nameof(model.FwVersion), model.FwVersion)
|
||||
.SetParameter(nameof(model.LutCrc), model.LutCrc)
|
||||
.SetParameter(nameof(model.SkipCalibration), model.SkipCalibration)
|
||||
.SetParameter(nameof(model.SkipRadioCheck), model.SkipRadioCheck)
|
||||
.SetParameter(nameof(model.RequiredLifeTimeYearsAssembly), model.RequiredLifeTimeYearsAssembly)
|
||||
.SetParameter(nameof(model.RequiredLifeTimeYearsShipping), model.RequiredLifeTimeYearsShipping)
|
||||
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentAssembly), model.MaxDrainedBatteryLoadPercentAssembly)
|
||||
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentShipping), model.MaxDrainedBatteryLoadPercentShipping)
|
||||
.SetParameter(nameof(model.MaxStorageMonths), model.MaxStorageMonths)
|
||||
.SetParameter(nameof(model.MaxStorageMonthsBigOrders), model.MaxStorageMonthsBigOrders)
|
||||
.SetParameter(nameof(model.QuiescentCurrent_uA), model.QuiescentCurrent_uA)
|
||||
.SetParameter(nameof(model.EstimatedProductionBatteryLoadPercent), model.EstimatedProductionBatteryLoadPercent)
|
||||
.SetParameter(nameof(model.Timestamp), model.Timestamp)
|
||||
.SetParameter(nameof(model.CreatedBy), model.CreatedBy)
|
||||
.SetParameter(nameof(model.Comment), model.Comment)
|
||||
.SetParameter(nameof(model.IsActive), model.IsActive)
|
||||
.SetParameter(nameof(model.Id), model.Id)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
return this.FirstOrDefault(model.Id);
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
=> this.GetEnumerator();
|
||||
|
||||
private IEnumerable<CordonelRequirementsChange> Hostory(int id, int nr)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Id]
|
||||
, [Version]
|
||||
, [Timestamp]
|
||||
, [CreatedBy]
|
||||
, [ApprovedBy]
|
||||
, [ApprovedDate]
|
||||
, [Comment]
|
||||
, [IsActive]
|
||||
FROM [Cordonel_Special_Requirements]
|
||||
WHERE [Id] = @{nameof(id)}
|
||||
AND [Version] <> @{nameof(nr)}
|
||||
ORDER BY [Version] DESC")
|
||||
.SetParameter(nameof(id), id)
|
||||
.SetParameter(nameof(nr), nr)
|
||||
.ExecuteReader(x => new CordonelRequirementsChange
|
||||
{
|
||||
Id = x.GetValue<int>(0),
|
||||
Version = x.GetValue<int>(1),
|
||||
Timestamp = x.GetValue<DateTime>(2),
|
||||
CreatedBy = x.GetValue<string>(3),
|
||||
ApprovedBy = x.GetValue<string>(4),
|
||||
ApprovedDate = x.GetValue<DateTime?>(5),
|
||||
Comment = x.GetValue<string>(6),
|
||||
IsActive = x.GetValue<bool>(7),
|
||||
});
|
||||
|
||||
private CordonelSpecialRequirement ParseSpecialRequirement(SqlReader reader)
|
||||
=> new CordonelSpecialRequirement
|
||||
{
|
||||
Id = reader.GetValue<int>(0),
|
||||
Version = reader.GetValue<int>(1),
|
||||
StandardId = reader.GetValue<int>(2),
|
||||
StandardVersion = reader.GetValue<int>(3),
|
||||
Key = reader.GetValue<string>(4),
|
||||
Region = reader.GetValue<string>(5),
|
||||
MeterSize = reader.GetValue<string>(6),
|
||||
ProductionOrderNr = reader.GetValue<int?>(7),
|
||||
PcbId = reader.GetValue<int?>(8),
|
||||
FwVersion = reader.GetValue<string>(9),
|
||||
LutCrc = reader.GetValue<string>(10),
|
||||
SkipCalibration = reader.GetValue<bool>(11),
|
||||
SkipRadioCheck = reader.GetValue<bool>(12),
|
||||
RequiredLifeTimeYearsAssembly = reader.GetValue<Double?>(13),
|
||||
RequiredLifeTimeYearsShipping = reader.GetValue<Double?>(14),
|
||||
MaxDrainedBatteryLoadPercentAssembly = reader.GetValue<Double?>(15),
|
||||
MaxDrainedBatteryLoadPercentShipping = reader.GetValue<Double?>(16),
|
||||
MaxStorageMonths = reader.GetValue<Double?>(17),
|
||||
MaxStorageMonthsBigOrders = reader.GetValue<Double?>(18),
|
||||
QuiescentCurrent_uA = reader.GetValue<Double?>(19),
|
||||
EstimatedProductionBatteryLoadPercent = reader.GetValue<Double?>(20),
|
||||
Timestamp = reader.GetValue<DateTime>(21),
|
||||
CreatedBy = reader.GetValue<string>(22),
|
||||
ApprovedBy = reader.GetValue<string>(23),
|
||||
ApprovedDate = reader.GetValue<DateTime?>(24),
|
||||
Comment = reader.GetValue<string>(25),
|
||||
IsActive = reader.GetValue<bool>(26),
|
||||
ProductGroup = reader.GetValue<string>(27),
|
||||
};
|
||||
|
||||
private CordonelStandardRequirement StandardRequirement(int? standardId)
|
||||
=> this.dbContext.StandardRequirements.FirstOrDefault(standardId);
|
||||
}
|
||||
}
|
||||
-465
@@ -1,465 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Repositories
|
||||
{
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Data.Cordonel.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
public class StandardRequirementsRepository : IStandardRequirementRepository<CordonelStandardRequirement>
|
||||
{
|
||||
private readonly CordonelDbContext dbContext;
|
||||
private readonly SqlConnection sqlConnection;
|
||||
|
||||
public StandardRequirementsRepository(CordonelDbContext dbContext)
|
||||
{
|
||||
this.dbContext = dbContext;
|
||||
this.sqlConnection = dbContext.SqlConnection;
|
||||
}
|
||||
|
||||
public CordonelStandardRequirement Add(CordonelStandardRequirement _)
|
||||
=> throw new NotImplementedException($"{nameof(CordonelStandardRequirement)} could not be created.");
|
||||
|
||||
public void Approve(int requirementId, string approval, string comment)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE Cordonel_Standard_Requirements
|
||||
SET ApprovedBy = @{nameof(approval)}
|
||||
, ApprovedDate = GETDATE()
|
||||
, Comment = ISNULL(Comment, '')
|
||||
+ CASE WHEN @{nameof(comment)} IS NOT NULL
|
||||
THEN CHAR(13) + CHAR(10) + ISNULL(@{nameof(comment)}, '')
|
||||
ELSE '' END
|
||||
FROM Cordonel_Standard_Requirements AS stdup
|
||||
JOIN (SELECT TOP 1 std.Id, std.Version
|
||||
FROM Cordonel_Standard_Requirements AS std
|
||||
WHERE std.Id = @{nameof(requirementId)}
|
||||
AND std.CreatedBy <> @{nameof(approval)}
|
||||
ORDER BY std.Version DESC) AS idv
|
||||
ON stdup.Id = idv.Id
|
||||
AND stdup.Version = idv.Version
|
||||
WHERE stdup.IsActive = 1")
|
||||
.SetParameter(nameof(requirementId), requirementId)
|
||||
.SetParameter(nameof(approval), approval)
|
||||
.SetParameter(nameof(comment), comment)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public CordonelStandardRequirement Delete(object id)
|
||||
=> throw new NotImplementedException($"{nameof(CordonelStandardRequirement)} could not be deleted");
|
||||
|
||||
public CordonelStandardRequirement FirstOrDefault(object id)
|
||||
{
|
||||
var requirement = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Id]
|
||||
, [Version]
|
||||
, [Key]
|
||||
, [Region]
|
||||
, [ProductGroup]
|
||||
, [MeterSize]
|
||||
, [FwVersion]
|
||||
, [LutCrc]
|
||||
, [SkipCalibration]
|
||||
, [SkipRadioCheck]
|
||||
, [RequiredLifeTimeYearsAssembly]
|
||||
, [RequiredLifeTimeYearsShipping]
|
||||
, [MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [MaxDrainedBatteryLoadPercentShipping]
|
||||
, [MaxStorageMonths]
|
||||
, [MaxStorageMonthsBigOrders]
|
||||
, [QuiescentCurrent_uA]
|
||||
, [EstimatedProductionBatteryLoadPercent]
|
||||
, [Timestamp]
|
||||
, [CreatedBy]
|
||||
, [ApprovedBy]
|
||||
, [ApprovedDate]
|
||||
, [Comment]
|
||||
, [IsActive]
|
||||
FROM [Cordonel_Standard_Requirements]
|
||||
WHERE [Id] = @{nameof(id)}
|
||||
ORDER BY [Version] DESC")
|
||||
.SetParameter(nameof(id), id)
|
||||
.FirstOrDefault(this.ParseStandardRequirement);
|
||||
|
||||
if (requirement != null)
|
||||
{
|
||||
requirement.History = this.History(requirement.Id, requirement.Version);
|
||||
}
|
||||
|
||||
return requirement;
|
||||
}
|
||||
|
||||
public CordonelStandardRequirement FirstOrDefault(params object[] ids)
|
||||
{
|
||||
var requirement = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT TOP 1
|
||||
[Id]
|
||||
, [Version]
|
||||
, [Key]
|
||||
, [Region]
|
||||
, [ProductGroup]
|
||||
, [MeterSize]
|
||||
, [FwVersion]
|
||||
, [LutCrc]
|
||||
, [SkipCalibration]
|
||||
, [SkipRadioCheck]
|
||||
, [RequiredLifeTimeYearsAssembly]
|
||||
, [RequiredLifeTimeYearsShipping]
|
||||
, [MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [MaxDrainedBatteryLoadPercentShipping]
|
||||
, [MaxStorageMonths]
|
||||
, [MaxStorageMonthsBigOrders]
|
||||
, [QuiescentCurrent_uA]
|
||||
, [EstimatedProductionBatteryLoadPercent]
|
||||
, [Timestamp]
|
||||
, [CreatedBy]
|
||||
, [ApprovedBy]
|
||||
, [ApprovedDate]
|
||||
, [Comment]
|
||||
, [IsActive]
|
||||
FROM [Cordonel_Standard_Requirements]
|
||||
WHERE [Id] = @{nameof(CordonelStandardRequirement.Id)}
|
||||
AND [Version] = @{nameof(CordonelStandardRequirement.Version)}")
|
||||
.SetParameter(nameof(CordonelStandardRequirement.Id), ids[0])
|
||||
.SetParameter(nameof(CordonelStandardRequirement.Version), ids[1])
|
||||
.FirstOrDefault(this.ParseStandardRequirement);
|
||||
|
||||
if (requirement != null)
|
||||
{
|
||||
requirement.History = this.History(requirement.Id, requirement.Version);
|
||||
}
|
||||
|
||||
return requirement;
|
||||
}
|
||||
|
||||
public CordonelStandardRequirement FirstOrDefaultByPO(string ponr)
|
||||
{
|
||||
var requirement = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT TOP 1
|
||||
[STD].[Id]
|
||||
, [STD].[Version]
|
||||
, [STD].[Key]
|
||||
, [STD].[Region]
|
||||
, [STD].[ProductGroup]
|
||||
, [STD].[MeterSize]
|
||||
, [STD].[FwVersion]
|
||||
, [STD].[LutCrc]
|
||||
, [STD].[SkipCalibration]
|
||||
, [STD].[SkipRadioCheck]
|
||||
, [STD].[RequiredLifeTimeYearsAssembly]
|
||||
, [STD].[RequiredLifeTimeYearsShipping]
|
||||
, [STD].[MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [STD].[MaxDrainedBatteryLoadPercentShipping]
|
||||
, [STD].[MaxStorageMonths]
|
||||
, [STD].[MaxStorageMonthsBigOrders]
|
||||
, [STD].[QuiescentCurrent_uA]
|
||||
, [STD].[EstimatedProductionBatteryLoadPercent]
|
||||
, [STD].[Timestamp]
|
||||
, [STD].[CreatedBy]
|
||||
, [STD].[ApprovedBy]
|
||||
, [STD].[ApprovedDate]
|
||||
, [STD].[Comment]
|
||||
, [STD].[IsActive]
|
||||
FROM [Cordonel_Standard_Requirements] AS [STD]
|
||||
JOIN (SELECT [REG].[RegionSize]
|
||||
FROM [AlleAuftragPositionen] AS [AAP]
|
||||
JOIN [AllRegionsByIdentNr] AS [REG]
|
||||
ON [REG].[IdentNr] = [AAP].[IdentNr]
|
||||
WHERE [FertigungsauftragNr] = @{nameof(ponr)})
|
||||
AS [Regions]
|
||||
ON [Regions].[RegionSize] = [STD].[Key]
|
||||
ORDER BY [Version] DESC")
|
||||
.SetParameter(nameof(ponr), ponr)
|
||||
.FirstOrDefault(this.ParseStandardRequirement);
|
||||
|
||||
return requirement;
|
||||
}
|
||||
|
||||
public IEnumerator<CordonelStandardRequirement> GetEnumerator()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand(@"
|
||||
SELECT [Id]
|
||||
, [Version]
|
||||
, [Key]
|
||||
, [Region]
|
||||
, [ProductGroup]
|
||||
, [MeterSize]
|
||||
, [FwVersion]
|
||||
, [LutCrc]
|
||||
, [SkipCalibration]
|
||||
, [SkipRadioCheck]
|
||||
, [RequiredLifeTimeYearsAssembly]
|
||||
, [RequiredLifeTimeYearsShipping]
|
||||
, [MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [MaxDrainedBatteryLoadPercentShipping]
|
||||
, [MaxStorageMonths]
|
||||
, [MaxStorageMonthsBigOrders]
|
||||
, [QuiescentCurrent_uA]
|
||||
, [EstimatedProductionBatteryLoadPercent]
|
||||
, [Timestamp]
|
||||
, [CreatedBy]
|
||||
, [ApprovedBy]
|
||||
, [ApprovedDate]
|
||||
, [Comment]
|
||||
, [IsActive]
|
||||
FROM (SELECT *, RANK() OVER (PARTITION BY [Id]
|
||||
ORDER BY [Version] DESC) AS [RowNr]
|
||||
FROM [Cordonel_Standard_Requirements])
|
||||
AS [Latest]
|
||||
WHERE [Latest].[RowNr] = 1
|
||||
ORDER BY [ProductGroup] ASC
|
||||
, LEN(SUBSTRING([MeterSize], 1, CASE WHEN CHARINDEX(' ', [MeterSize]) > 0 THEN CHARINDEX(' ', [MeterSize]) - 1 ELSE LEN([MeterSize]) END))
|
||||
, SUBSTRING([MeterSize], 1, CASE WHEN CHARINDEX(' ', [MeterSize]) > 0 THEN CHARINDEX(' ', [MeterSize]) - 1 ELSE LEN([MeterSize]) END)
|
||||
, [MeterSize] ASC")
|
||||
.ExecuteReader(this.ParseStandardRequirement)
|
||||
.GetEnumerator();
|
||||
|
||||
public CordonelStandardRequirement Update(CordonelStandardRequirement model)
|
||||
{
|
||||
var rowsAffected = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE [Cordonel_Standard_Requirements]
|
||||
SET [FwVersion] = @{nameof(model.FwVersion)}
|
||||
, [LutCrc] = @{nameof(model.LutCrc)}
|
||||
, [SkipCalibration] = @{nameof(model.SkipCalibration)}
|
||||
, [SkipRadioCheck] = @{nameof(model.SkipRadioCheck)}
|
||||
, [RequiredLifeTimeYearsAssembly] = @{nameof(model.RequiredLifeTimeYearsAssembly)}
|
||||
, [RequiredLifeTimeYearsShipping] = @{nameof(model.RequiredLifeTimeYearsShipping)}
|
||||
, [MaxDrainedBatteryLoadPercentAssembly] = @{nameof(model.MaxDrainedBatteryLoadPercentAssembly)}
|
||||
, [MaxDrainedBatteryLoadPercentShipping] = @{nameof(model.MaxDrainedBatteryLoadPercentShipping)}
|
||||
, [MaxStorageMonths] = @{nameof(model.MaxStorageMonths)}
|
||||
, [MaxStorageMonthsBigOrders] = @{nameof(model.MaxStorageMonthsBigOrders)}
|
||||
, [QuiescentCurrent_uA] = @{nameof(model.QuiescentCurrent_uA)}
|
||||
, [EstimatedProductionBatteryLoadPercent] = @{nameof(model.EstimatedProductionBatteryLoadPercent)}
|
||||
, [Timestamp] = @{nameof(model.Timestamp)}
|
||||
, [CreatedBy] = @{nameof(model.CreatedBy)}
|
||||
, [Comment] = @{nameof(model.Comment)}
|
||||
, [IsActive] = @{nameof(model.IsActive)}
|
||||
, [ApprovedBy] = NULL
|
||||
, [ApprovedDate] = NULL
|
||||
WHERE [Id] = @{nameof(model.Id)}
|
||||
AND [Version] = (SELECT MAX([Version])
|
||||
FROM [Cordonel_Standard_Requirements]
|
||||
WHERE [Id] = @{nameof(model.Id)})")
|
||||
.SetParameter(nameof(model.FwVersion), model.FwVersion)
|
||||
.SetParameter(nameof(model.LutCrc), model.LutCrc)
|
||||
.SetParameter(nameof(model.SkipCalibration), model.SkipCalibration)
|
||||
.SetParameter(nameof(model.SkipRadioCheck), model.SkipRadioCheck)
|
||||
.SetParameter(nameof(model.RequiredLifeTimeYearsAssembly), model.RequiredLifeTimeYearsAssembly)
|
||||
.SetParameter(nameof(model.RequiredLifeTimeYearsShipping), model.RequiredLifeTimeYearsShipping)
|
||||
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentAssembly), model.MaxDrainedBatteryLoadPercentAssembly)
|
||||
.SetParameter(nameof(model.MaxDrainedBatteryLoadPercentShipping), model.MaxDrainedBatteryLoadPercentShipping)
|
||||
.SetParameter(nameof(model.MaxStorageMonths), model.MaxStorageMonths)
|
||||
.SetParameter(nameof(model.MaxStorageMonthsBigOrders), model.MaxStorageMonthsBigOrders)
|
||||
.SetParameter(nameof(model.QuiescentCurrent_uA), model.QuiescentCurrent_uA)
|
||||
.SetParameter(nameof(model.EstimatedProductionBatteryLoadPercent), model.EstimatedProductionBatteryLoadPercent)
|
||||
.SetParameter(nameof(model.Timestamp), model.Timestamp)
|
||||
.SetParameter(nameof(model.CreatedBy), model.CreatedBy)
|
||||
.SetParameter(nameof(model.Comment), model.Comment)
|
||||
.SetParameter(nameof(model.IsActive), model.IsActive)
|
||||
.SetParameter(nameof(model.Id), model.Id)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
return this.FirstOrDefault(model.Id);
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
=> this.GetEnumerator();
|
||||
|
||||
private CordonelStandardRequirement ParseStandardRequirement(SqlReader reader)
|
||||
=> new CordonelStandardRequirement
|
||||
{
|
||||
Id = reader.GetValue<int>(0),
|
||||
Version = reader.GetValue<int>(1),
|
||||
Key = reader.GetValue<string>(2),
|
||||
Region = reader.GetValue<string>(3),
|
||||
ProductGroup = reader.GetValue<string>(4),
|
||||
MeterSize = reader.GetValue<string>(5),
|
||||
FwVersion = reader.GetValue<string>(6),
|
||||
LutCrc = reader.GetValue<string>(7),
|
||||
SkipCalibration = reader.GetValue<bool?>(8),
|
||||
SkipRadioCheck = reader.GetValue<bool?>(9),
|
||||
RequiredLifeTimeYearsAssembly = reader.GetValue<Double>(10),
|
||||
RequiredLifeTimeYearsShipping = reader.GetValue<Double>(11),
|
||||
MaxDrainedBatteryLoadPercentAssembly = reader.GetValue<Double>(12),
|
||||
MaxDrainedBatteryLoadPercentShipping = reader.GetValue<Double>(13),
|
||||
MaxStorageMonths = reader.GetValue<Double>(14),
|
||||
MaxStorageMonthsBigOrders = reader.GetValue<Double>(15),
|
||||
QuiescentCurrent_uA = reader.GetValue<Double?>(16),
|
||||
EstimatedProductionBatteryLoadPercent = reader.GetValue<Double?>(17),
|
||||
Timestamp = reader.GetValue<DateTime>(18),
|
||||
CreatedBy = reader.GetValue<string>(19),
|
||||
ApprovedBy = reader.GetValue<string>(20),
|
||||
ApprovedDate = reader.GetValue<DateTime?>(21),
|
||||
Comment = reader.GetValue<string>(22),
|
||||
IsActive = reader.GetValue<bool>(23),
|
||||
};
|
||||
|
||||
private IEnumerable<CordonelRequirementsChange> History(int id, int nr)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Id]
|
||||
, [Version]
|
||||
, [Timestamp]
|
||||
, [CreatedBy]
|
||||
, [Comment]
|
||||
, [IsActive]
|
||||
FROM [Cordonel_Standard_Requirements]
|
||||
WHERE [Id] = @{nameof(id)}
|
||||
AND [Version] <> @{nameof(nr)}
|
||||
ORDER BY [Version] DESC")
|
||||
.SetParameter(nameof(id), id)
|
||||
.SetParameter(nameof(nr), nr)
|
||||
.ExecuteReader(reader => new CordonelRequirementsChange
|
||||
{
|
||||
Id = reader.GetValue<int>(0),
|
||||
Version = reader.GetValue<int>(1),
|
||||
Timestamp = reader.GetValue<DateTime>(2),
|
||||
CreatedBy = reader.GetValue<string>(3),
|
||||
ApprovedBy = reader.GetValue<string>(4),
|
||||
ApprovedDate = reader.GetValue<DateTime?>(5),
|
||||
Comment = reader.GetValue<string>(6),
|
||||
IsActive = reader.GetValue<bool>(7),
|
||||
});
|
||||
|
||||
public void Unapprove(int requirementId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE Cordonel_Standard_Requirements
|
||||
SET ApprovedBy = NULL
|
||||
, ApprovedDate = NULL
|
||||
FROM Cordonel_Standard_Requirements AS stdup
|
||||
JOIN (SELECT TOP 1 std.Id, std.Version
|
||||
FROM Cordonel_Standard_Requirements AS std
|
||||
WHERE std.Id = @{nameof(requirementId)}
|
||||
ORDER BY std.Version DESC) AS idv
|
||||
ON stdup.Id = idv.Id
|
||||
AND stdup.Version = idv.Version
|
||||
WHERE stdup.IsActive = 1")
|
||||
.SetParameter(nameof(requirementId), requirementId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public StandardRequiremetnsFilter Filter()
|
||||
{
|
||||
var xmlFilter = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT CAST((SELECT (SELECT DISTINCT Region AS 'Region/@Value'
|
||||
FROM Cordonel_Standard_Requirements
|
||||
FOR XML PATH(''), TYPE) AS Regions
|
||||
, (SELECT DISTINCT MeterSize AS 'MeterSize/@Value'
|
||||
FROM Cordonel_Standard_Requirements
|
||||
FOR XML PATH(''), TYPE) AS MeterSizes
|
||||
, (SELECT DISTINCT IsActive AS 'Active/@Value'
|
||||
FROM Cordonel_Standard_Requirements
|
||||
FOR XML PATH(''), TYPE) AS ActiveRequirements
|
||||
, (SELECT DISTINCT CAST(CASE WHEN ApprovedDate IS NULL THEN 0 ELSE 1 END AS BIT) AS 'Approved/@Value'
|
||||
FROM Cordonel_Standard_Requirements
|
||||
FOR XML PATH(''), TYPE) AS ApprovedRequirements
|
||||
FOR XML PATH(''), ROOT('StandardRequiremetnsFilter'), TYPE) AS XML)")
|
||||
.FirstOrDefault(x => x.GetValue<string>(0));
|
||||
var filter = default(StandardRequiremetnsFilter);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(xmlFilter))
|
||||
{
|
||||
var xmlSerializer = new XmlSerializer(typeof(StandardRequiremetnsFilter));
|
||||
var xmlReader = new StringReader(xmlFilter);
|
||||
|
||||
try
|
||||
{
|
||||
filter = xmlSerializer.Deserialize(xmlReader) as StandardRequiremetnsFilter;
|
||||
}
|
||||
catch // TODO: (Exception _)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return filter ?? new StandardRequiremetnsFilter();
|
||||
}
|
||||
|
||||
public IEnumerable<CordonelStandardRequirement> Filter(StandardRequiremetnsFilter filter)
|
||||
{
|
||||
var query = $@"
|
||||
SELECT *
|
||||
FROM (SELECT [Id]
|
||||
, [Version]
|
||||
, [Key]
|
||||
, [Region]
|
||||
, [ProductGroup]
|
||||
, [MeterSize]
|
||||
, [FwVersion]
|
||||
, [LutCrc]
|
||||
, [SkipCalibration]
|
||||
, [SkipRadioCheck]
|
||||
, [RequiredLifeTimeYearsAssembly]
|
||||
, [RequiredLifeTimeYearsShipping]
|
||||
, [MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [MaxDrainedBatteryLoadPercentShipping]
|
||||
, [MaxStorageMonths]
|
||||
, [MaxStorageMonthsBigOrders]
|
||||
, [QuiescentCurrent_uA]
|
||||
, [EstimatedProductionBatteryLoadPercent]
|
||||
, [Timestamp]
|
||||
, [CreatedBy]
|
||||
, [ApprovedBy]
|
||||
, [ApprovedDate]
|
||||
, [Comment]
|
||||
, [IsActive]
|
||||
FROM (SELECT *, RANK() OVER (PARTITION BY [Id]
|
||||
ORDER BY [Version] DESC) AS [RowNr]
|
||||
FROM [Cordonel_Standard_Requirements])
|
||||
AS [Latest]
|
||||
WHERE [Latest].[RowNr] = 1)
|
||||
AS [req]
|
||||
{filter?.SqlConditions("req", "WHERE")}
|
||||
ORDER BY [req].[ProductGroup] ASC
|
||||
, LEN(SUBSTRING([req].[MeterSize], 1, CASE WHEN CHARINDEX(' ', [req].[MeterSize]) > 0 THEN CHARINDEX(' ', [req].[MeterSize]) - 1 ELSE LEN([req].[MeterSize]) END))
|
||||
, SUBSTRING([req].[MeterSize], 1, CASE WHEN CHARINDEX(' ', [req].[MeterSize]) > 0 THEN CHARINDEX(' ', [req].[MeterSize]) - 1 ELSE LEN([req].[MeterSize]) END)
|
||||
, [req].[MeterSize] ASC";
|
||||
|
||||
return this.sqlConnection
|
||||
.CreateCommand(query)
|
||||
.ExecuteReader(this.ParseStandardRequirement);
|
||||
}
|
||||
|
||||
public CordonelStandardRequirement FirstOrDefaultByKey(string key)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT TOP 1
|
||||
[STD].[Id]
|
||||
, [STD].[Version]
|
||||
, [STD].[Key]
|
||||
, [STD].[Region]
|
||||
, [STD].[ProductGroup]
|
||||
, [STD].[MeterSize]
|
||||
, [STD].[FwVersion]
|
||||
, [STD].[LutCrc]
|
||||
, [STD].[SkipCalibration]
|
||||
, [STD].[SkipRadioCheck]
|
||||
, [STD].[RequiredLifeTimeYearsAssembly]
|
||||
, [STD].[RequiredLifeTimeYearsShipping]
|
||||
, [STD].[MaxDrainedBatteryLoadPercentAssembly]
|
||||
, [STD].[MaxDrainedBatteryLoadPercentShipping]
|
||||
, [STD].[MaxStorageMonths]
|
||||
, [STD].[MaxStorageMonthsBigOrders]
|
||||
, [STD].[QuiescentCurrent_uA]
|
||||
, [STD].[EstimatedProductionBatteryLoadPercent]
|
||||
, [STD].[Timestamp]
|
||||
, [STD].[CreatedBy]
|
||||
, [STD].[ApprovedBy]
|
||||
, [STD].[ApprovedDate]
|
||||
, [STD].[Comment]
|
||||
, [STD].[IsActive]
|
||||
FROM [Cordonel_Standard_Requirements] AS [STD]
|
||||
WHERE [STD].[Key] = @{nameof(key)}
|
||||
ORDER BY [STD].[Version] DESC")
|
||||
.SetParameter(nameof(key), key)
|
||||
.FirstOrDefault(this.ParseStandardRequirement);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Sentinel
|
||||
{
|
||||
using LaaPackages.Features.Cordonel;
|
||||
using LaaPackages.HttpClient;
|
||||
|
||||
internal class LocalhostHttpClient
|
||||
{
|
||||
private readonly HttpConnection httpConnection;
|
||||
|
||||
public LocalhostHttpClient(HttpConnection httpConnection)
|
||||
=> this.httpConnection = httpConnection;
|
||||
|
||||
internal virtual CordonelAppsDictionary GetCordonelAppsDictionaryDefaults()
|
||||
{
|
||||
var response = this.httpConnection.Get<CordonelAppsDictionary>(request => request.SetPath("/laaproductionweb/api/resources/cordonelappsdictionary"));
|
||||
|
||||
if (response.HasValue)
|
||||
{
|
||||
return response.Value;
|
||||
}
|
||||
|
||||
var exception = response.Exception;
|
||||
|
||||
if (exception != null)
|
||||
{
|
||||
throw new SentinelException(exception.GetType().Name, exception.Message);
|
||||
}
|
||||
|
||||
throw new SentinelException(nameof(CordonelAppsDictionary), $"{nameof(CordonelAppsDictionary)} kann nicht geladen werden");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Sentinel
|
||||
{
|
||||
using System;
|
||||
|
||||
public class SentinelException : Exception
|
||||
{
|
||||
public SentinelException(string key, string message)
|
||||
: base(message)
|
||||
=> this.Key = key;
|
||||
|
||||
public string Key { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Sentinel
|
||||
{
|
||||
using LaaPackages.Features.Cordonel;
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
using LaaPackages.HttpClient;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class SentinelHttpClient
|
||||
{
|
||||
private readonly HttpConnection httpConnection;
|
||||
|
||||
public SentinelHttpClient(HttpConnection httpConnection)
|
||||
=> this.httpConnection = httpConnection;
|
||||
|
||||
internal CordonelPasswordFile GetCordonelPasswordFile(int pcbId)
|
||||
{
|
||||
var response = this.httpConnection.Get<CordonelPasswordFile>(request => request
|
||||
.SetPath("/MeterProcessState/api/Password/GetPasswordHashFileContent")
|
||||
.SetQueryParameter(nameof(pcbId), pcbId));
|
||||
|
||||
if (response.HasValue)
|
||||
{
|
||||
return response.Value;
|
||||
}
|
||||
|
||||
var exception = response.Exception;
|
||||
|
||||
if (exception != null)
|
||||
{
|
||||
throw new SentinelException(exception.GetType().Name, exception.Message);
|
||||
}
|
||||
|
||||
throw new SentinelException(nameof(CordonelAppsDictionary), $"{nameof(CordonelAppsDictionary)} kann nicht geladen werden");
|
||||
}
|
||||
|
||||
internal virtual IEnumerable<CordonelProgrammingParameter> GetCordonelProgrammingParameters(int pcbId)
|
||||
{
|
||||
var response = this.httpConnection.Get<CordonelProgrammingParameter[]>(request => request
|
||||
.SetPath("/MeterProcessState/api/FinalCheck/GetProgrammingParameters")
|
||||
.SetQueryParameter(nameof(pcbId), pcbId));
|
||||
|
||||
if (response.HasValue)
|
||||
{
|
||||
return response.Value;
|
||||
}
|
||||
|
||||
var exception = response.Exception;
|
||||
|
||||
if (exception != null)
|
||||
{
|
||||
throw new SentinelException(exception.GetType().Name, exception.Message);
|
||||
}
|
||||
|
||||
throw new SentinelException(nameof(CordonelAppsDictionary), $"{nameof(CordonelAppsDictionary)} kann nicht geladen werden");
|
||||
}
|
||||
|
||||
internal virtual int GetLastState(int pcbId)
|
||||
{
|
||||
var response = this.httpConnection.Get<int>(request => request
|
||||
.SetPath("/MeterProcessState/api/ProccesState/GetLastState")
|
||||
.SetQueryParameter(nameof(pcbId), pcbId));
|
||||
|
||||
if (response.HasValue)
|
||||
{
|
||||
return response.Value;
|
||||
}
|
||||
|
||||
var exception = response.Exception;
|
||||
|
||||
if (exception != null)
|
||||
{
|
||||
throw new SentinelException(nameof(SentinelHttpClient), exception.Message);
|
||||
}
|
||||
|
||||
throw new SentinelException(nameof(SentinelHttpClient), $"Last meter process state kann nicht geladen werden");
|
||||
}
|
||||
|
||||
internal virtual bool MakeSAPExport(int pcbId, int state, string version)
|
||||
{
|
||||
var response = this.httpConnection.Get<int>(request => request
|
||||
.SetPath("/MeterProcessState/api/ProccesState/SetState")
|
||||
.SetQueryParameter(nameof(pcbId), pcbId)
|
||||
.SetQueryParameter(nameof(state), state)
|
||||
.SetQueryParameter(nameof(version), version));
|
||||
|
||||
var exception = response.Exception;
|
||||
|
||||
if (exception != null)
|
||||
{
|
||||
throw new SentinelException(nameof(SentinelHttpClient), exception.Message);
|
||||
}
|
||||
|
||||
return response.Succeeded;
|
||||
}
|
||||
|
||||
internal CordonelMetrologyValues GetLatestGenesisFlowValues(int pcbId)
|
||||
=> this.httpConnection.Get<CordonelMetrologyValues>(request => request
|
||||
.SetPath($"/MeterProcessState/api/FinalCheck/CalibrationResults/{pcbId}"))
|
||||
.Value;
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.Sentinel
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class SentinelResult : Dictionary<string, object>
|
||||
{
|
||||
public SentinelResult(int? pcbId = null)
|
||||
{
|
||||
this.PcbId = pcbId;
|
||||
this.Succeeded = this.PcbId != null;
|
||||
|
||||
if (!this.Succeeded)
|
||||
{
|
||||
this[nameof(PcbId)] = $"{this.PcbId} ist ungültig";
|
||||
}
|
||||
}
|
||||
|
||||
public int? PcbId
|
||||
{
|
||||
get => this.TryGetValue(nameof(PcbId), out var value)
|
||||
&& value is int pcbId
|
||||
? pcbId
|
||||
: default(int?);
|
||||
set => this[nameof(PcbId)] = value;
|
||||
}
|
||||
|
||||
public bool Succeeded
|
||||
{
|
||||
get => this.TryGetValue(nameof(Succeeded), out var value)
|
||||
&& value is bool succeeded
|
||||
? succeeded
|
||||
: false;
|
||||
set => this[nameof(Succeeded)] = value;
|
||||
}
|
||||
|
||||
internal void Add(IDictionary<string, object> dictionary)
|
||||
{
|
||||
if (dictionary is null || dictionary.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var kvp in dictionary)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(kvp.Key))
|
||||
{
|
||||
this[kvp.Key] = kvp.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net40" requireReinstallation="true" />
|
||||
</packages>
|
||||
@@ -1,44 +0,0 @@
|
||||
namespace LaaProduction.Data.Inspection
|
||||
{
|
||||
public class InspectionDbContext
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pruefgang
|
||||
* |_ PruefgangNr
|
||||
* |_ PruefstationNr
|
||||
* |_ Pruefstation
|
||||
* |_ Nr
|
||||
* |_ Typ
|
||||
* |_ Gesperrt
|
||||
* |_ Bemerkung
|
||||
* |_ PrueferNr
|
||||
* |_ Pruefer
|
||||
* |_ Nr
|
||||
* |_ Name
|
||||
* |_ Vorname
|
||||
* |_ IstPruefer
|
||||
* |_ Pruefzeit
|
||||
* |_ PruefgangLang
|
||||
* |_ Datum
|
||||
* |_ Typ
|
||||
* |_ Nennweite
|
||||
* |_ Nenntemperatur
|
||||
* |_ Lufttemperatur
|
||||
* |_ LuftDruck
|
||||
* |_ RelativeFeuchte
|
||||
* |_ Vorlauftemperatur
|
||||
* |_ Einbaulage_alt
|
||||
* |_ Anzahl
|
||||
* |_ Bemerkung
|
||||
* |_ DBasePruefgangNr
|
||||
* |_ KalibrierID
|
||||
* |_ Metrolog
|
||||
* |_ FPP
|
||||
* |_ Korrigiert
|
||||
* |_ Typzusatz
|
||||
* |_ Baulaenge
|
||||
* |_ Pruefpunkte[1..10]
|
||||
*/
|
||||
-60
@@ -1,60 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{25BACE1B-1961-411A-8AC0-1375A1898F8F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LaaProduction.Data.Inspection</RootNamespace>
|
||||
<AssemblyName>LaaProduction.Data.Inspection</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn>IDE0003;IDE0049;</NoWarn>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="InspectionDbContext.cs" />
|
||||
<Compile Include="Pruefer.cs" />
|
||||
<Compile Include="Prueffehler.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="PruefgangPP.cs" />
|
||||
<Compile Include="Pruefgang.cs" />
|
||||
<Compile Include="Pruefklasse.cs" />
|
||||
<Compile Include="Pruefstation.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("LaaProduction.Data.Inspection")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LaaProduction.Data.Inspection")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("25bace1b-1961-411a-8ac0-1375a1898f8f")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace LaaProduction.Data.Inspection
|
||||
{
|
||||
using System;
|
||||
|
||||
public class Pruefer
|
||||
{
|
||||
public short PrueferNr { get; set; }
|
||||
|
||||
public string Vorname { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public bool IstPruefer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
namespace LaaProduction.Data.Inspection
|
||||
{
|
||||
using System;
|
||||
|
||||
public class Prueffehler
|
||||
{
|
||||
public int SerienNr { get; set; }
|
||||
|
||||
public int PruefgangNr { get; set; }
|
||||
|
||||
public Pruefgang Pruefgang { get; set; }
|
||||
|
||||
public Single?[] PP_Fehler { get; } = new Single?[10];
|
||||
|
||||
public DateTime PruefDatum { get; set; }
|
||||
|
||||
public DateTime PruefprotokollGedrucktDatum { get; set; }
|
||||
|
||||
public DateTime AusdruckPruefstationDatum { get; set; }
|
||||
|
||||
public string Info { get; set; }
|
||||
|
||||
public string Metrolog { get; set; }
|
||||
|
||||
public int FreigabeMitarbeiter { get; set; }
|
||||
|
||||
public DateTime FreigabeDatum { get; set; }
|
||||
|
||||
public short _LWL { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
namespace LaaProduction.Data.Inspection
|
||||
{
|
||||
using System;
|
||||
|
||||
public class Pruefgang
|
||||
{
|
||||
public int PruefgangNr { get; set; }
|
||||
|
||||
public short PruefstationNr { get; set; }
|
||||
|
||||
public Pruefstation Pruefstation { get; set; }
|
||||
|
||||
public short PrueferNr { get; set; }
|
||||
|
||||
public Pruefer Pruefer { get; set; }
|
||||
|
||||
public int Pruefzeit { get; set; }
|
||||
|
||||
public bool PruefgangLang { get; set; }
|
||||
|
||||
public DateTime Datum { get; set; }
|
||||
|
||||
public string Typ { get; set; }
|
||||
|
||||
public short Nennweite { get; set; }
|
||||
|
||||
public byte Nenntemperatur { get; set; }
|
||||
|
||||
public Double Lufttemperatur { get; set; }
|
||||
|
||||
public Double LuftDruck { get; set; }
|
||||
|
||||
public Double RelativeFeuchte { get; set; }
|
||||
|
||||
public Double Vorlauftemperatur { get; set; }
|
||||
|
||||
public char Einbaulage_alt { get; set; }
|
||||
|
||||
public byte Anzahl { get; set; }
|
||||
|
||||
public string Bemerkung { get; set; }
|
||||
|
||||
public int DBasePruefgangNr { get; set; }
|
||||
|
||||
public byte KalibrierID { get; set; }
|
||||
|
||||
public string Metrolog { get; set; }
|
||||
|
||||
public string FPP { get; set; }
|
||||
|
||||
public bool Korrigiert { get; set; }
|
||||
|
||||
public string Typzusatz { get; set; }
|
||||
|
||||
public short Baulaenge { get; set; }
|
||||
|
||||
public PruefgangPP[] Pruefpunkte { get; } = new PruefgangPP[10];
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
namespace LaaProduction.Data.Inspection
|
||||
{
|
||||
using System;
|
||||
|
||||
public class PruefgangPP
|
||||
{
|
||||
public int Nr { get; set; }
|
||||
|
||||
public int PruefgangNr { get; set; }
|
||||
|
||||
public int PruefpunktNr { get; set; }
|
||||
|
||||
public Double Zeit { get; set; }
|
||||
|
||||
public Double Soll { get; set; }
|
||||
|
||||
public Double Ist { get; set; }
|
||||
|
||||
public int RefZSerienNr { get; set; }
|
||||
|
||||
public Double RefFehl { get; set; }
|
||||
|
||||
public Double Ist_V { get; set; }
|
||||
|
||||
public byte Waage { get; set; }
|
||||
|
||||
public char Info { get; set; }
|
||||
|
||||
public Double T_Start { get; set; }
|
||||
|
||||
public Double T_Ende { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace LaaProduction.Data.Inspection
|
||||
{
|
||||
public class Pruefklasse
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace LaaProduction.Data.Inspection
|
||||
{
|
||||
using System;
|
||||
|
||||
public class Pruefstation
|
||||
{
|
||||
public short PruefstationNr { get; set; }
|
||||
|
||||
public short PruefstationTyp { get; set; }
|
||||
|
||||
public short ScanKennung { get; set; }
|
||||
|
||||
public string Bemerkung { get; set; }
|
||||
|
||||
public bool Gesperrt { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,66 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{CB91E680-2715-4E94-988A-401C0F4A0707}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LaaProduction.Data.Omni</RootNamespace>
|
||||
<AssemblyName>LaaProduction.Data.Omni</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn>IDE0003;IDE0049;</NoWarn>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Models\InspectionOrder.cs" />
|
||||
<Compile Include="Models\TestedPoint.cs" />
|
||||
<Compile Include="Models\TestedRun.cs" />
|
||||
<Compile Include="Models\TestMeter.cs" />
|
||||
<Compile Include="Models\TestPoint.cs" />
|
||||
<Compile Include="Models\TestRun.cs" />
|
||||
<Compile Include="OmniDbContext.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\LaaPackages\LaaPackages.SqlClient\LaaPackages.SqlClient.csproj">
|
||||
<Project>{F90B940C-9A83-496D-AAE0-11CD02CE0A22}</Project>
|
||||
<Name>LaaPackages.SqlClient</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,88 +0,0 @@
|
||||
namespace LaaProduction.Data.Omni.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class InspectionOrder
|
||||
{
|
||||
public short Id { get; set; }
|
||||
|
||||
public int? Orderno { get; set; }
|
||||
|
||||
public short? Posno { get; set; }
|
||||
|
||||
public int? Pono { get; set; }
|
||||
|
||||
public int IdentNr { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Variant { get; set; }
|
||||
|
||||
public string SizeName { get; set; }
|
||||
|
||||
public byte Size { get; set; }
|
||||
|
||||
public byte Range { get; set; }
|
||||
|
||||
public byte Direction { get; set; }
|
||||
|
||||
public byte IntPart { get; set; }
|
||||
|
||||
public int Fraction { get; set; }
|
||||
|
||||
public short Crf { get; set; }
|
||||
|
||||
public byte Ppr { get; set; }
|
||||
|
||||
public byte MeterUnits { get; set; }
|
||||
|
||||
public byte FlowUnits { get; set; }
|
||||
|
||||
public byte FlowRate { get; set; }
|
||||
|
||||
public byte PulseWeight { get; set; }
|
||||
|
||||
public byte PulseWidth { get; set; }
|
||||
|
||||
public byte PulseUpdate { get; set; }
|
||||
|
||||
public byte AlarmPercistancePeriodDays { get; set; }
|
||||
|
||||
public int DataLogIntervalMinutes { get; set; }
|
||||
|
||||
public short NumberOfReadingDigits { get; set; }
|
||||
|
||||
public int OptionalUniDirFields { get; set; }
|
||||
|
||||
public string ReadingPreset { get; set; }
|
||||
|
||||
public string DeviceID { get; set; }
|
||||
|
||||
public Single LeakAlarmGPM { get; set; }
|
||||
|
||||
public long LeakAlarmTime { get; set; }
|
||||
|
||||
public Single HighFlowAlarmGPM { get; set; }
|
||||
|
||||
public long HighFlowAlarmTime { get; set; }
|
||||
|
||||
public Single ReverseFlowAlarmGPM { get; set; }
|
||||
|
||||
public long ReverseFlowAlarmTime { get; set; }
|
||||
|
||||
public string PartNr { get; set; }
|
||||
|
||||
public string Configiguration { get; set; }
|
||||
|
||||
public string DescriptionL1 { get; set; }
|
||||
|
||||
public string DescriptionL2 { get; set; }
|
||||
|
||||
public string DescriptionL3 { get; set; }
|
||||
|
||||
public string TestClass { get; set; }
|
||||
|
||||
public List<TestPoint> TestPoints { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace LaaProduction.Data.Omni.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class TestMeter
|
||||
{
|
||||
public int RunId { get; set; }
|
||||
|
||||
public short DefaultId { get; set; }
|
||||
|
||||
public string PsNr { get; set; }
|
||||
|
||||
public int SlotNr { get; set; }
|
||||
|
||||
public string BuildInfo { get; set; }
|
||||
|
||||
public DateTime AddDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
namespace LaaProduction.Data.Omni.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class TestPoint
|
||||
{
|
||||
public short Id { get; set; }
|
||||
|
||||
public int Nr { get; set; }
|
||||
|
||||
public Single GPM { get; set; }
|
||||
|
||||
public short Rotations { get; set; }
|
||||
|
||||
public short Duration { get; set; }
|
||||
|
||||
public Single MinAcc { get; set; }
|
||||
|
||||
public Single MaxAcc { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace LaaProduction.Data.Omni.Models
|
||||
{
|
||||
public class TestRun
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Pruefgang { get; set; }
|
||||
|
||||
public int Pruefer { get; set; }
|
||||
|
||||
public string Pruefklasse { get; set; }
|
||||
|
||||
public short DefaultId { get; set; }
|
||||
|
||||
public string PSNO { get; set; }
|
||||
|
||||
public byte Slot { get; set; }
|
||||
|
||||
public string Pcb { get; set; }
|
||||
|
||||
public DateTime AddDate { get; set; }
|
||||
|
||||
public DateTime ManifacturingDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
namespace LaaProduction.Data.Omni.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class TestedPoint
|
||||
{
|
||||
public int RunId { get; set; }
|
||||
|
||||
public string Pcb { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Nr{ get; set; }
|
||||
|
||||
public int Rotations { get; set; }
|
||||
|
||||
public Double Duration { get; set; }
|
||||
|
||||
public Double M3S { get; set; }
|
||||
|
||||
public Double M3SRef { get; set; }
|
||||
|
||||
public Double ACC { get; set; }
|
||||
|
||||
public string Debug { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace LaaProduction.Data.Omni.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class TestedRun
|
||||
{
|
||||
public int RunId { get; set; }
|
||||
|
||||
public string Pcb { get; set; }
|
||||
|
||||
public Double[] ACC { get; set; }
|
||||
|
||||
public Double CrrF { get; set; }
|
||||
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string Debug { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,432 +0,0 @@
|
||||
namespace LaaProduction.Data.Omni
|
||||
{
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Data.Omni.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class OmniDbContext
|
||||
{
|
||||
private readonly SqlConnection sql;
|
||||
|
||||
public OmniDbContext(string connectionString, Action<string> sqlErrorHandler)
|
||||
=> this.sql = new SqlConnection(connectionString, sqlErrorHandler);
|
||||
|
||||
public TestRun CreateTestRun(TestRun testRun)
|
||||
{
|
||||
var created = this.sql
|
||||
.CreateCommand($@"
|
||||
INSERT
|
||||
INTO [OmniTestRuns]
|
||||
( [Id]
|
||||
, [PsNr]
|
||||
, [SlotNr]
|
||||
, [BuildInfo]
|
||||
, [DefaultId]
|
||||
, [Pruefgang]
|
||||
, [Pruefklasse]
|
||||
, [Pruefer]
|
||||
, [ManifacturingTime])
|
||||
OUTPUT [inserted].[Id]
|
||||
, [inserted].[AddDate]
|
||||
, [inserted].[ManifacturingTime]
|
||||
VALUES ((SELECT MAX([Id]) + 1 FROM [OmniTestRuns])
|
||||
, @{nameof(testRun.PSNO)}
|
||||
, @{nameof(testRun.Slot)}
|
||||
, @{nameof(testRun.Pcb)}
|
||||
, @{nameof(testRun.DefaultId)}
|
||||
, @{nameof(testRun.Pruefgang)}
|
||||
, @{nameof(testRun.Pruefklasse)}
|
||||
, @{nameof(testRun.Pruefer)}
|
||||
, @{nameof(testRun.ManifacturingDate)})")
|
||||
.SetParameter(nameof(testRun.Id), testRun.Id)
|
||||
.SetParameter(nameof(testRun.PSNO), testRun.PSNO)
|
||||
.SetParameter(nameof(testRun.Slot), testRun.Slot)
|
||||
.SetParameter(nameof(testRun.Pcb), testRun.Pcb)
|
||||
.SetParameter(nameof(testRun.DefaultId), testRun.DefaultId)
|
||||
.SetParameter(nameof(testRun.Pruefgang), testRun.Pruefgang)
|
||||
.SetParameter(nameof(testRun.Pruefklasse), testRun.Pruefklasse)
|
||||
.SetParameter(nameof(testRun.Pruefer), testRun.Pruefer)
|
||||
.SetParameter(nameof(testRun.ManifacturingDate), testRun.ManifacturingDate)
|
||||
.FirstOrDefault(x =>
|
||||
{
|
||||
testRun.Id = x.GetValue<int>(0);
|
||||
testRun.AddDate = x.GetValue<DateTime>(1);
|
||||
testRun.ManifacturingDate = x.GetValue<DateTime>(2);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
return testRun;
|
||||
}
|
||||
|
||||
public int CreateTestRun(int psno, int tester, string @class, int count)
|
||||
{
|
||||
if (psno == 0)
|
||||
{
|
||||
psno = 1000;
|
||||
}
|
||||
|
||||
var like = $"{psno}%";
|
||||
var pruefgang = this.sql
|
||||
.CreateCommand($@"
|
||||
INSERT
|
||||
INTO [Pruefgang]
|
||||
( [PruefgangNr]
|
||||
, [PruefstationNr]
|
||||
, [PrueferNr]
|
||||
, [Datum]
|
||||
, [Typ]
|
||||
, [Nennweite]
|
||||
, [Anzahl])
|
||||
OUTPUT [inserted].[PruefgangNr]
|
||||
SELECT [x].[PruefgangNr]
|
||||
, [x].[PruefstationNr]
|
||||
, [x].[PrueferNr]
|
||||
, [x].[Datum]
|
||||
, [x].[Typ]
|
||||
, [x].[Nennweite]
|
||||
, [x].[Anzahl]
|
||||
FROM (SELECT TOP 1
|
||||
(SELECT TOP 1 [PruefgangNr] + 1
|
||||
FROM [Pruefgang]
|
||||
WHERE [PruefgangNr] LIKE @{nameof(like)}
|
||||
ORDER BY 1 DESC) AS [PruefgangNr]
|
||||
, @{nameof(psno)} AS [PruefstationNr]
|
||||
, @{nameof(tester)} AS [PrueferNr]
|
||||
, GETDATE() AS [Datum]
|
||||
, [id].[Typ] AS [Typ]
|
||||
, [id].[Nennweite] AS [Nennweite]
|
||||
, @{nameof(count)} AS [Anzahl]
|
||||
FROM [OmniTestPoints] AS [tp]
|
||||
JOIN [OmniDefaults] AS [od]
|
||||
ON [tp].[DefaultId] = [od].[Id]
|
||||
JOIN [Identnr] AS [id]
|
||||
ON [od].[IdentNr] = [id].[IdentNr]
|
||||
WHERE [TestClass] = @{nameof(@class)})
|
||||
AS [x]")
|
||||
.SetParameter(nameof(psno), (short)psno)
|
||||
.SetParameter(nameof(tester), (short)tester)
|
||||
.SetParameter(nameof(@class), @class)
|
||||
.SetParameter(nameof(like), like)
|
||||
.SetParameter(nameof(count), (byte)count)
|
||||
.FirstOrDefault(x => x.GetValue<int>(0));
|
||||
|
||||
return pruefgang;
|
||||
}
|
||||
|
||||
public InspectionOrder GetInspectionOrderForClass(string search)
|
||||
{
|
||||
var inspectionOrder = default(InspectionOrder);
|
||||
var inspectionOrderRows = this.sql
|
||||
.CreateCommand($@"
|
||||
SELECT [od].[Id]
|
||||
, [od].[IdentNr]
|
||||
, [od].[Name]
|
||||
, [od].[Variant]
|
||||
, [od].[SizeName]
|
||||
, [od].[Size]
|
||||
, [od].[Range]
|
||||
, [od].[Direction]
|
||||
, [od].[IntPart]
|
||||
, [od].[Fraction]
|
||||
, [od].[Crf]
|
||||
, [od].[Ppr]
|
||||
, [od].[MeterUnits]
|
||||
, [od].[FlowUnits]
|
||||
, [od].[FlowRate]
|
||||
, [od].[PulseWeight]
|
||||
, [od].[PulseWidth]
|
||||
, [od].[PulseUpdate]
|
||||
, [od].[AlarmPercistancePeriodDays]
|
||||
, [od].[DataLogIntervalMinutes]
|
||||
, [od].[NumberOfReadingDigits]
|
||||
, [od].[OptionalUniDirFields]
|
||||
, [od].[ReadingPreset]
|
||||
, [od].[DeviceID]
|
||||
, [od].[LeakAlarmGPM]
|
||||
, [od].[LeakAlarmTime]
|
||||
, [od].[HighFlowAlarmGPM]
|
||||
, [od].[HighFlowAlarmTime]
|
||||
, [od].[ReverseFlowAlarmGPM]
|
||||
, [od].[ReverseFlowAlarmTime]
|
||||
, [od].[DescriptionL1]
|
||||
, [od].[DescriptionL2]
|
||||
, [od].[DescriptionL3]
|
||||
, [tp].[TestClass]
|
||||
, [tp].[Id]
|
||||
, ROW_NUMBER() OVER (PARTITION BY [od].[Id] ORDER BY [tp].[GPM]) AS [Nr]
|
||||
, [tp].[GPM]
|
||||
, [tp].[Rotations]
|
||||
, [tp].[Duration]
|
||||
, [tp].[MinAcc]
|
||||
, [tp].[MaxAcc]
|
||||
FROM [OmniDefaults] AS [od]
|
||||
JOIN [OmniTestPoints] AS [tp]
|
||||
ON [od].[Id] = [tp].[DefaultId]
|
||||
WHERE [tp].[TestClass] = @{nameof(search)}
|
||||
ORDER BY[tp].[GPM] DESC")
|
||||
.SetParameter(nameof(search), search)
|
||||
.ExecuteReader(x =>
|
||||
{
|
||||
if (inspectionOrder is null)
|
||||
{
|
||||
inspectionOrder = new InspectionOrder
|
||||
{
|
||||
Id = x.GetValue<short>(0),
|
||||
IdentNr = x.GetValue<int>(1),
|
||||
Name = x.GetValue<string>(2),
|
||||
Variant = x.GetValue<string>(3),
|
||||
SizeName = x.GetValue<string>(4),
|
||||
Size = x.GetValue<byte>(5),
|
||||
Range = x.GetValue<byte>(6),
|
||||
Direction = x.GetValue<byte>(7),
|
||||
IntPart = x.GetValue<byte>(8),
|
||||
Fraction = x.GetValue<int>(9),
|
||||
Crf = x.GetValue<short>(10),
|
||||
Ppr = x.GetValue<byte>(11),
|
||||
MeterUnits = x.GetValue<byte>(12),
|
||||
FlowUnits = x.GetValue<byte>(13),
|
||||
FlowRate = x.GetValue<byte>(14),
|
||||
PulseWeight = x.GetValue<byte>(15),
|
||||
PulseWidth = x.GetValue<byte>(16),
|
||||
PulseUpdate = x.GetValue<byte>(17),
|
||||
AlarmPercistancePeriodDays = x.GetValue<byte>(18),
|
||||
DataLogIntervalMinutes = x.GetValue<int>(19),
|
||||
NumberOfReadingDigits = x.GetValue<short>(20),
|
||||
OptionalUniDirFields = x.GetValue<int>(21),
|
||||
ReadingPreset = x.GetValue<string>(22),
|
||||
DeviceID = x.GetValue<string>(23),
|
||||
LeakAlarmGPM = x.GetValue<Single>(24),
|
||||
LeakAlarmTime = x.GetValue<long>(25),
|
||||
HighFlowAlarmGPM = x.GetValue<Single>(26),
|
||||
HighFlowAlarmTime = x.GetValue<long>(27),
|
||||
ReverseFlowAlarmGPM = x.GetValue<Single>(28),
|
||||
ReverseFlowAlarmTime = x.GetValue<long>(29),
|
||||
DescriptionL1 = x.GetValue<string>(30),
|
||||
DescriptionL2 = x.GetValue<string>(31),
|
||||
DescriptionL3 = x.GetValue<string>(32),
|
||||
TestClass = x.GetValue<string>(33)
|
||||
};
|
||||
}
|
||||
|
||||
if (inspectionOrder.TestPoints is null)
|
||||
{
|
||||
inspectionOrder.TestPoints = new List<TestPoint>();
|
||||
}
|
||||
|
||||
inspectionOrder.TestPoints.Add(new TestPoint
|
||||
{
|
||||
Id = x.GetValue<short>(34),
|
||||
Nr = x.GetValue<int>(35),
|
||||
GPM = x.GetValue<Single>(36),
|
||||
Rotations = x.GetValue<short>(37),
|
||||
Duration = x.GetValue<short>(38),
|
||||
MinAcc = x.GetValue<Single>(39),
|
||||
MaxAcc = x.GetValue<Single>(40),
|
||||
});
|
||||
|
||||
return true;
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return inspectionOrder;
|
||||
}
|
||||
|
||||
public InspectionOrder GetInspectionOrderForPO(int pono)
|
||||
{
|
||||
var inspectionOrder = default(InspectionOrder);
|
||||
var inspectionOrderRows = this.sql
|
||||
.CreateCommand($@"
|
||||
SELECT [d].[Id]
|
||||
, [aap].[AuftragNr]
|
||||
, [aap].[PositionNr]
|
||||
, [aap].[FertigungsauftragNr]
|
||||
, [d].[IdentNr]
|
||||
, [d].[Name]
|
||||
, [d].[Variant]
|
||||
, [d].[SizeName]
|
||||
, [d].[Size]
|
||||
, [d].[Range]
|
||||
, [d].[Direction]
|
||||
, [d].[IntPart]
|
||||
, [d].[Fraction]
|
||||
, [d].[Crf]
|
||||
, [d].[Ppr]
|
||||
, [d].[MeterUnits]
|
||||
, [d].[FlowUnits]
|
||||
, [d].[FlowRate]
|
||||
, [d].[PulseWeight]
|
||||
, [d].[PulseWidth]
|
||||
, [d].[PulseUpdate]
|
||||
, [d].[AlarmPercistancePeriodDays]
|
||||
, [d].[DataLogIntervalMinutes]
|
||||
, [d].[NumberOfReadingDigits]
|
||||
, [d].[OptionalUniDirFields]
|
||||
, [d].[ReadingPreset]
|
||||
, [d].[DeviceID]
|
||||
, [d].[LeakAlarmGPM]
|
||||
, [d].[LeakAlarmTime]
|
||||
, [d].[HighFlowAlarmGPM]
|
||||
, [d].[HighFlowAlarmTime]
|
||||
, [d].[ReverseFlowAlarmGPM]
|
||||
, [d].[ReverseFlowAlarmTime]
|
||||
, [d].[DescriptionL1]
|
||||
, [d].[DescriptionL2]
|
||||
, [d].[DescriptionL3]
|
||||
, [tp].[TestClass]
|
||||
, [tp].[Id]
|
||||
, ROW_NUMBER() OVER (PARTITION BY [d].[Id] ORDER BY [tp].[GPM]) AS [Nr]
|
||||
, [tp].[GPM]
|
||||
, [tp].[Rotations]
|
||||
, [tp].[Duration]
|
||||
, [tp].[MinAcc]
|
||||
, [tp].[MaxAcc]
|
||||
FROM [OmniDefaults] AS [d]
|
||||
JOIN [OmniTestPoints] AS [tp]
|
||||
ON [d].[Id] = [tp].[DefaultId]
|
||||
JOIN [AlleAuftragPositionen] AS [aap]
|
||||
ON [d].[IdentNr] = [aap].[IdentNr]
|
||||
WHERE [aap].[FertigungsauftragNr] = @pono
|
||||
ORDER BY [tp].[GPM] DESC")
|
||||
.SetParameter(nameof(pono), pono)
|
||||
.ExecuteReader(x =>
|
||||
{
|
||||
if (inspectionOrder is null)
|
||||
{
|
||||
inspectionOrder = new InspectionOrder
|
||||
{
|
||||
Id = x.GetValue<short>(0),
|
||||
Orderno = x.GetValue<int?>(1),
|
||||
Posno = x.GetValue<short?>(2),
|
||||
Pono = x.GetValue<int?>(3),
|
||||
IdentNr = x.GetValue<int>(4),
|
||||
Name = x.GetValue<string>(5),
|
||||
Variant = x.GetValue<string>(6),
|
||||
SizeName = x.GetValue<string>(7),
|
||||
Size = x.GetValue<byte>(8),
|
||||
Range = x.GetValue<byte>(9),
|
||||
Direction = x.GetValue<byte>(10),
|
||||
IntPart = x.GetValue<byte>(11),
|
||||
Fraction = x.GetValue<int>(12),
|
||||
Crf = x.GetValue<short>(13),
|
||||
Ppr = x.GetValue<byte>(14),
|
||||
MeterUnits = x.GetValue<byte>(15),
|
||||
FlowUnits = x.GetValue<byte>(16),
|
||||
FlowRate = x.GetValue<byte>(17),
|
||||
PulseWeight = x.GetValue<byte>(18),
|
||||
PulseWidth = x.GetValue<byte>(19),
|
||||
PulseUpdate = x.GetValue<byte>(20),
|
||||
AlarmPercistancePeriodDays = x.GetValue<byte>(21),
|
||||
DataLogIntervalMinutes = x.GetValue<int>(22),
|
||||
NumberOfReadingDigits = x.GetValue<short>(23),
|
||||
OptionalUniDirFields = x.GetValue<int>(24),
|
||||
ReadingPreset = x.GetValue<string>(25),
|
||||
DeviceID = x.GetValue<string>(26),
|
||||
LeakAlarmGPM = x.GetValue<Single>(27),
|
||||
LeakAlarmTime = x.GetValue<long>(28),
|
||||
HighFlowAlarmGPM = x.GetValue<Single>(29),
|
||||
HighFlowAlarmTime = x.GetValue<long>(30),
|
||||
ReverseFlowAlarmGPM = x.GetValue<Single>(31),
|
||||
ReverseFlowAlarmTime = x.GetValue<long>(32),
|
||||
DescriptionL1 = x.GetValue<string>(33),
|
||||
DescriptionL2 = x.GetValue<string>(34),
|
||||
DescriptionL3 = x.GetValue<string>(35),
|
||||
TestClass = x.GetValue<string>(36)
|
||||
};
|
||||
}
|
||||
|
||||
if (inspectionOrder.TestPoints is null)
|
||||
{
|
||||
inspectionOrder.TestPoints = new List<TestPoint>();
|
||||
}
|
||||
|
||||
inspectionOrder.TestPoints.Add(new TestPoint
|
||||
{
|
||||
Id = x.GetValue<short>(37),
|
||||
Nr = x.GetValue<int>(38),
|
||||
GPM = x.GetValue<Single>(39),
|
||||
Rotations = x.GetValue<short>(40),
|
||||
Duration = x.GetValue<short>(41),
|
||||
MinAcc = x.GetValue<Single>(42),
|
||||
MaxAcc = x.GetValue<Single>(43),
|
||||
});
|
||||
|
||||
return true;
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return inspectionOrder;
|
||||
}
|
||||
|
||||
public bool UpdateTestRun(TestedPoint point)
|
||||
=> this.sql
|
||||
.CreateCommand($@"
|
||||
UPDATE [OmniTestRuns]
|
||||
SET [Q{point.Nr}_TpId] = @{nameof(point.Id)}
|
||||
, [Q{point.Nr}_Rotations] = @{nameof(point.Rotations)}
|
||||
, [Q{point.Nr}_Duration] = @{nameof(point.Duration)}
|
||||
, [Q{point.Nr}_MeterM3S] = @{nameof(point.M3S)}
|
||||
, [Q{point.Nr}_RefM3S] = @{nameof(point.M3SRef)}
|
||||
, [Q{point.Nr}_Accuracy] = @{nameof(point.ACC)}
|
||||
, [Debug] = @{nameof(point.Debug)}
|
||||
WHERE [Id] = @{nameof(point.RunId)}
|
||||
AND [BuildInfo] = @{nameof(point.Pcb)}")
|
||||
.SetParameter(nameof(point.Id), point.Id)
|
||||
.SetParameter(nameof(point.Rotations), point.Rotations)
|
||||
.SetParameter(nameof(point.Duration), point.Duration)
|
||||
.SetParameter(nameof(point.M3S), point.M3S)
|
||||
.SetParameter(nameof(point.M3SRef), point.M3SRef)
|
||||
.SetParameter(nameof(point.ACC), point.ACC)
|
||||
.SetParameter(nameof(point.RunId), point.RunId)
|
||||
.SetParameter(nameof(point.Pcb), point.Pcb)
|
||||
.SetParameter(nameof(point.Debug), point.Debug)
|
||||
.ExecuteNonQuery() == 1;
|
||||
|
||||
public bool UpdateTestRun(TestedRun run)
|
||||
{
|
||||
var accuracies = new Dictionary<string, Double>();
|
||||
var length = run.ACC?.Length ?? 0;
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
accuracies[$"Q{i + 1}_Acc"] = run.ACC[i];
|
||||
}
|
||||
|
||||
var updateTestRunQuery = $@"
|
||||
UPDATE [OmniTestRuns]
|
||||
SET [CrrfAfter] = @{nameof(run.CrrF)}
|
||||
, [Succeeded] = @{nameof(run.Succeeded)}
|
||||
, [Debug] = @{nameof(run.Debug)}
|
||||
, [EndDate] = GETDATE()";
|
||||
|
||||
foreach (var key in accuracies.Keys)
|
||||
{
|
||||
updateTestRunQuery += $@"
|
||||
, [{key}] = @{key}";
|
||||
}
|
||||
|
||||
updateTestRunQuery += $@"
|
||||
WHERE [Id] = @{nameof(run.RunId)}
|
||||
AND [BuildInfo] = @{nameof(run.Pcb)}";
|
||||
|
||||
|
||||
var updateCommand = this.sql
|
||||
.CreateCommand(updateTestRunQuery)
|
||||
.SetParameter(nameof(run.RunId), run.RunId)
|
||||
.SetParameter(nameof(run.Pcb), run.Pcb)
|
||||
.SetParameter(nameof(run.CrrF), run.CrrF)
|
||||
.SetParameter(nameof(run.Succeeded), run.Succeeded)
|
||||
.SetParameter(nameof(run.Debug), run.Debug);
|
||||
|
||||
foreach (var kvp in accuracies)
|
||||
{
|
||||
updateCommand.SetParameter(kvp.Key, kvp.Value);
|
||||
}
|
||||
|
||||
return updateCommand.ExecuteNonQuery() == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("LaaProduction.Data.Omni")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LaaProduction.Data.Omni")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("cb91e680-2715-4e94-988a-401c0f4a0707")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,121 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E8FCD0A3-714D-4436-9A20-B098E6A5537D}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>LaaProduction.Console</RootNamespace>
|
||||
<AssemblyName>LaaProduction.Console</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<NoWarn>IDE0003;IDE0049;</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Data.Sqlite, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Data.Sqlite.Core.9.0.0\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.batteries_v2, Version=2.1.10.2445, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.bundle_e_sqlite3.2.1.10\lib\net461\SQLitePCLRaw.batteries_v2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.core, Version=2.1.10.2445, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.core.2.1.10\lib\netstandard2.0\SQLitePCLRaw.core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.provider.dynamic_cdecl, Version=2.1.10.2445, Culture=neutral, PublicKeyToken=b68184102cba0b3b, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.provider.dynamic_cdecl.2.1.10\lib\netstandard2.0\SQLitePCLRaw.provider.dynamic_cdecl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Data\LaaProduction.Data.Cordonel\LaaProduction.Data.Cordonel.csproj">
|
||||
<Project>{03784923-1FD3-4535-80F5-286728DF62AB}</Project>
|
||||
<Name>LaaProduction.Data.Cordonel</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\LaaPackages\LaaPackages.HttpClient\LaaPackages.HttpClient.csproj">
|
||||
<Project>{C9816412-7752-4F7A-8BD2-765DB6D58B3C}</Project>
|
||||
<Name>LaaPackages.HttpClient</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\LaaPackages\LaaPackages.SqlClient\LaaPackages.SqlClient.csproj">
|
||||
<Project>{F90B940C-9A83-496D-AAE0-11CD02CE0A22}</Project>
|
||||
<Name>LaaPackages.SqlClient</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>del "$(TargetDir)*.pdb"
|
||||
del "$(TargetDir)*.xml"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,209 +0,0 @@
|
||||
namespace LaaProduction.Console
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class Program
|
||||
{
|
||||
static Dictionary<string, Dictionary<string, HashSet<Charcode>>> charcodesDictionary = new Dictionary<string, Dictionary<string, HashSet<Charcode>>>();
|
||||
|
||||
private static void Main()
|
||||
{
|
||||
SetUp();
|
||||
|
||||
var actualPatterns = new List<string>();
|
||||
|
||||
foreach (var chacodeKVP in charcodesDictionary)
|
||||
{
|
||||
var basis = chacodeKVP.Key;
|
||||
var codesDictionary = chacodeKVP
|
||||
.Value
|
||||
.SelectMany(x => x.Value)
|
||||
.OrderBy(x => x.Stelle)
|
||||
.ThenBy(x => x.Laenge)
|
||||
.ThenBy(x => x.Code)
|
||||
.GroupBy(x => x.Stelle)
|
||||
.ToDictionary(x => x.Key, x => x.ToList());
|
||||
var patterns = new List<string> { basis };
|
||||
|
||||
foreach (var codeKVP in codesDictionary)
|
||||
{
|
||||
var stelle = codeKVP.Key;
|
||||
var codes = codeKVP.Value;
|
||||
var tempPatterns = new List<string>();
|
||||
|
||||
foreach (var code in codes)
|
||||
{
|
||||
foreach (var pattern in patterns)
|
||||
{
|
||||
tempPatterns.Add($"{pattern}{new string('_', code.Stelle - 1 - pattern.Length)}{code.Code}");
|
||||
}
|
||||
}
|
||||
|
||||
patterns.Clear();
|
||||
patterns.AddRange(tempPatterns);
|
||||
tempPatterns.Clear();
|
||||
}
|
||||
|
||||
actualPatterns.AddRange(patterns);
|
||||
}
|
||||
|
||||
foreach (var pattern in actualPatterns)
|
||||
{
|
||||
Console.WriteLine(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
static void SetUp()
|
||||
{
|
||||
charcodesDictionary["MS"] = new Dictionary<string, HashSet<Charcode>>();
|
||||
charcodesDictionary["MS"]["Baulänge"] = new HashSet<Charcode>
|
||||
{
|
||||
new Charcode { Stelle = 12, Laenge = 1, Code = "E" },
|
||||
new Charcode { Stelle = 12, Laenge = 1, Code = "F" },
|
||||
new Charcode { Stelle = 12, Laenge = 1, Code = "D" },
|
||||
new Charcode { Stelle = 12, Laenge = 1, Code = "H" },
|
||||
};
|
||||
charcodesDictionary["MS"]["Nennweite"] = new HashSet<Charcode>
|
||||
{
|
||||
new Charcode { Stelle = 5, Laenge = 1, Code = "F" },
|
||||
new Charcode { Stelle = 5, Laenge = 1, Code = "G" },
|
||||
new Charcode { Stelle = 5, Laenge = 1, Code = "K" },
|
||||
new Charcode { Stelle = 5, Laenge = 1, Code = "H" },
|
||||
new Charcode { Stelle = 5, Laenge = 1, Code = "I" },
|
||||
};
|
||||
charcodesDictionary["MS"]["Funkfrequenz"] = new HashSet<Charcode>
|
||||
{
|
||||
new Charcode { Stelle = 37, Laenge = 1, Code = "A" },
|
||||
new Charcode { Stelle = 37, Laenge = 1, Code = "B" },
|
||||
};
|
||||
charcodesDictionary["GNS"] = new Dictionary<string, HashSet<Charcode>>();
|
||||
charcodesDictionary["GNS"]["Baulänge"] = new HashSet<Charcode>
|
||||
{
|
||||
new Charcode { Stelle = 14, Laenge = 2, Code = "A1" },
|
||||
new Charcode { Stelle = 14, Laenge = 2, Code = "A2" },
|
||||
new Charcode { Stelle = 14, Laenge = 2, Code = "A3" },
|
||||
new Charcode { Stelle = 14, Laenge = 2, Code = "A5" },
|
||||
};
|
||||
charcodesDictionary["GNS"]["NW"] = new HashSet<Charcode>
|
||||
{
|
||||
new Charcode { Stelle = 4, Laenge = 2, Code = "FC" },
|
||||
new Charcode { Stelle = 4, Laenge = 2, Code = "FD" },
|
||||
new Charcode { Stelle = 4, Laenge = 2, Code = "FE" },
|
||||
new Charcode { Stelle = 4, Laenge = 2, Code = "FU" },
|
||||
};
|
||||
charcodesDictionary["GNS"]["Funkfrequenz"] = new HashSet<Charcode>
|
||||
{
|
||||
new Charcode { Stelle = 43, Laenge = 1, Code = "B" },
|
||||
new Charcode { Stelle = 43, Laenge = 1, Code = "A" },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class Charcode
|
||||
{
|
||||
public string Basis { get; set; }
|
||||
|
||||
public string Bezeichnung { get; set; }
|
||||
|
||||
public int Stelle { get; set; }
|
||||
|
||||
public int Laenge { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
public bool Selected { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//public static void _____Main()
|
||||
//{
|
||||
// Console.WriteLine(-14 * 24 * 60 * 60);
|
||||
|
||||
// //var sentinel = new Sentinel(
|
||||
// // new HttpConnection("http://10.49.40.25/")
|
||||
// // , new HttpConnection("localhost")
|
||||
// // , new CordonelDbContext(
|
||||
// // new SqlConnection("Server=SLASQL01.emea.sensus.net; Database=Auftrag; User ID=sa; Password=sqlserver;")));
|
||||
// //var sentinelDataFile = @"..\..\sentinel-data.json";
|
||||
// //var result = sentinel.CheckVFMStatus(182100041);
|
||||
|
||||
// //Console.WriteLine("=========================================================");
|
||||
// //foreach (var kvp in result)
|
||||
// //{
|
||||
// // Console.WriteLine($"{kvp.Key}: {kvp.Value}");
|
||||
// //}
|
||||
// //Console.WriteLine("=========================================================");
|
||||
|
||||
// //if (result.Succeeded && result.ContainsKey("UsedData"))
|
||||
// //{
|
||||
// // var jsonSerializerSettings = new JsonSerializerSettings
|
||||
// // {
|
||||
// // Formatting = Formatting.Indented,
|
||||
// // TypeNameHandling = TypeNameHandling.Objects | TypeNameHandling.Arrays,
|
||||
// // TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple
|
||||
// // };
|
||||
|
||||
// // var json = JsonConvert.SerializeObject(result["UsedData"], jsonSerializerSettings);
|
||||
// // File.WriteAllText(sentinelDataFile, json);
|
||||
// //}
|
||||
//}
|
||||
|
||||
//const string URL_PATTERN = "https://nodes.sms-esaap.com/keygenproxy/api/v2/keys/devices?orderNumber={0}&radioaddress={1}";
|
||||
//const string X_NODE_TOKEN_HEADER = "X-Node-Token";
|
||||
//const string X_NODE_TOKEN = "d5b8c0b2-81f6-4421-80d0-44eb2093e616";
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("LaaProduction.Console")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LaaProduction.Console")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("e8fcd0a3-714d-4436-9a20-b098e6a5537d")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" /></startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net481" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
|
||||
<package id="Microsoft.Data.Sqlite" version="9.0.0" targetFramework="net481" />
|
||||
<package id="Microsoft.Data.Sqlite.Core" version="9.0.0" targetFramework="net481" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net481" />
|
||||
<package id="SQLitePCLRaw.bundle_e_sqlite3" version="2.1.10" targetFramework="net481" />
|
||||
<package id="SQLitePCLRaw.core" version="2.1.10" targetFramework="net481" />
|
||||
<package id="SQLitePCLRaw.lib.e_sqlite3" version="2.1.10" targetFramework="net481" />
|
||||
<package id="SQLitePCLRaw.provider.dynamic_cdecl" version="2.1.10" targetFramework="net481" />
|
||||
<package id="System.Buffers" version="4.6.0" targetFramework="net481" />
|
||||
<package id="System.Memory" version="4.6.0" targetFramework="net481" />
|
||||
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net481" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net481" />
|
||||
</packages>
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
<linker>
|
||||
<assembly fullname="System.Diagnostics.DiagnosticSource">
|
||||
<type fullname="System.Diagnostics.Metrics.MetricsEventSource">
|
||||
<!-- Used by System.Private.CoreLib via reflection to init the EventSource -->
|
||||
<method name="GetInstance" />
|
||||
</type>
|
||||
</assembly>
|
||||
</linker>
|
||||
-168
@@ -1,168 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.props')" />
|
||||
<Import Project="..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.0\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props" Condition="Exists('..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.0\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props')" />
|
||||
<Import Project="..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.props" Condition="Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.props')" />
|
||||
<Import Project="..\packages\Microsoft.Testing.Platform.1.5.0\build\netstandard2.0\Microsoft.Testing.Platform.props" Condition="Exists('..\packages\Microsoft.Testing.Platform.1.5.0\build\netstandard2.0\Microsoft.Testing.Platform.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{75C5ABF8-3D1C-43A2-961C-BCD54A3DF1CF}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LaaProduction.Data.Cordonel.UnitTests</RootNamespace>
|
||||
<AssemblyName>LaaProduction.Data.Cordonel.UnitTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.ApplicationInsights, Version=2.22.0.997, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.ApplicationInsights.2.22.0\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Testing.Extensions.MSBuild, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\lib\netstandard2.0\Microsoft.Testing.Extensions.MSBuild.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Testing.Extensions.Telemetry, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.0\lib\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Testing.Extensions.TrxReport.Abstractions, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Testing.Extensions.TrxReport.Abstractions.1.5.0\lib\netstandard2.0\Microsoft.Testing.Extensions.TrxReport.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Testing.Extensions.VSTestBridge, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Testing.Extensions.VSTestBridge.1.5.0\lib\netstandard2.0\Microsoft.Testing.Extensions.VSTestBridge.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Testing.Platform, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Testing.Platform.1.5.0\lib\netstandard2.0\Microsoft.Testing.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.TestPlatform.CoreUtilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.TestPlatform.CoreUtilities.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.TestPlatform.PlatformAbstractions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.TestPlatform.PlatformAbstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.3.7.0\lib\net462\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.3.7.0\lib\net462\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Collections.Immutable.9.0.0\lib\net462\System.Collections.Immutable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.9.0.0\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Reflection.Metadata, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Reflection.Metadata.9.0.0\lib\net462\System.Reflection.Metadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.0\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Mock\SentinelMockDbContext.cs" />
|
||||
<Compile Include="Mock\SentinelMockHttpClient.cs" />
|
||||
<Compile Include="Mock\SentinelTestCase.cs" />
|
||||
<Compile Include="Mock\SentinelTestContext.cs" />
|
||||
<Compile Include="Mock\SentinelTestContextExtensions.cs" />
|
||||
<Compile Include="SentinelTestClass.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ILLink\ILLink.Descriptors.LibraryBuild.xml" />
|
||||
<None Include="Mock\sentinel-data.json" />
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Data\LaaProduction.Data.Cordonel\LaaProduction.Data.Cordonel.csproj">
|
||||
<Project>{03784923-1fd3-4535-80f5-286728df62ab}</Project>
|
||||
<Name>LaaProduction.Data.Cordonel</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\LaaPackages\LaaPackages.Features.Cordonel\LaaPackages.Features.Cordonel.csproj">
|
||||
<Project>{8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}</Project>
|
||||
<Name>LaaPackages.Features.Cordonel</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\LaaPackages\LaaPackages.HttpClient\LaaPackages.HttpClient.csproj">
|
||||
<Project>{C9816412-7752-4F7A-8BD2-765DB6D58B3C}</Project>
|
||||
<Name>LaaPackages.HttpClient</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\LaaPackages\LaaPackages.SqlClient\LaaPackages.SqlClient.csproj">
|
||||
<Project>{f90b940c-9a83-496d-aae0-11cd02ce0a22}</Project>
|
||||
<Name>LaaPackages.SqlClient</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\MSTest.Analyzers.3.7.0\analyzers\dotnet\cs\MSTest.Analyzers.CodeFixes.dll" />
|
||||
<Analyzer Include="..\packages\MSTest.Analyzers.3.7.0\analyzers\dotnet\MSTest.Analyzers.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.1.5.0\build\netstandard2.0\Microsoft.Testing.Platform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.1.5.0\build\netstandard2.0\Microsoft.Testing.Platform.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.0\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.0\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.targets" Condition="Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.0\build\Microsoft.Testing.Platform.MSBuild.targets')" />
|
||||
<Import Project="..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.3.7.0\build\net462\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
||||
@@ -1,45 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.UnitTests.Mock
|
||||
{
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class SentinelMockDbContext : CordonelDbContext
|
||||
{
|
||||
private readonly SentinelTestContext sentinelTestContext;
|
||||
|
||||
private CordonelAppVeriosnCrc[] appsVersionsCrcs;
|
||||
private CordonelRegisterHistory[] registerHistory;
|
||||
private CordonelMetrologyValues metrologyValues;
|
||||
private CordonelRSSIValues rssiValues;
|
||||
private CordonelRequirements requirements;
|
||||
private EOLProgressModel eolProgressModel;
|
||||
private CordonelProductionData[] productionData;
|
||||
|
||||
public SentinelMockDbContext(SentinelTestContext sentinelTestContext) : base(string.Empty, null)
|
||||
{
|
||||
this.sentinelTestContext = sentinelTestContext;
|
||||
this.sentinelTestContext.RegisterHistoryChanged += appsDictionary => this.registerHistory = appsDictionary;
|
||||
this.sentinelTestContext.AppsVersionsCrcsChanged += appsVersionsCrcs => this.appsVersionsCrcs = appsVersionsCrcs;
|
||||
this.sentinelTestContext.EOLProgressModelChanged += eolProgressModel => this.eolProgressModel = eolProgressModel;
|
||||
this.sentinelTestContext.MetroloryValuesChanged += metrologyValues => this.metrologyValues = metrologyValues;
|
||||
this.sentinelTestContext.ProductionDataChanged += productionData => this.productionData = productionData;
|
||||
this.sentinelTestContext.RequirementsChanged += requirements => this.requirements = requirements;
|
||||
this.sentinelTestContext.RSSIValuesChanged += rssiValues => this.rssiValues = rssiValues;
|
||||
}
|
||||
|
||||
internal override EOLProgressModel GetEOLProgressModel(int _) => this.eolProgressModel;
|
||||
|
||||
internal override IEnumerable<CordonelAppVeriosnCrc> GetLatestAppsWithVersions(int pcbId, string fwVersion, bool isSpecial) => this.appsVersionsCrcs;
|
||||
|
||||
internal override CordonelMetrologyValues GetLatestGenesisFlowValues(object pcbId) => this.metrologyValues;
|
||||
|
||||
internal override IEnumerable<CordonelRegisterHistory> GetLatestRegistersWithValues(int pcbId) => this.registerHistory;
|
||||
|
||||
internal override CordonelRSSIValues GetLatestRssiValues(string pcbId) => this.rssiValues;
|
||||
|
||||
internal override IEnumerable<CordonelProductionData> GetProductionData(int _) => this.productionData;
|
||||
|
||||
internal override CordonelRequirements GetRequirements(int pcbId) => this.requirements;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.UnitTests.Mock
|
||||
{
|
||||
using LaaPackages.Features.Cordonel;
|
||||
using LaaPackages.HttpClient;
|
||||
using LaaProduction.Data.Cordonel.Sentinel;
|
||||
|
||||
public class SentinelMockHttpClient : SentinelHttpClient
|
||||
{
|
||||
private readonly SentinelTestContext testContext;
|
||||
private CordonelAppsDictionary appsDictionaryDefaults;
|
||||
|
||||
public SentinelMockHttpClient(SentinelTestContext testContext)
|
||||
: base(new HttpConnection("http://localhost"))
|
||||
{
|
||||
this.testContext = testContext;
|
||||
this.testContext.AppsDictionaryDefaultsChanged += appsDictionary => this.appsDictionaryDefaults = appsDictionary;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.UnitTests.Mock
|
||||
{
|
||||
public class SentinelTestCase
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.UnitTests.Mock
|
||||
{
|
||||
using LaaPackages.Features.Cordonel;
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
using LaaProduction.Data.Cordonel.Sentinel;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
public class SentinelTestContext
|
||||
{
|
||||
private readonly CordonelAppVeriosnCrc[] appsVersionsCrcs;
|
||||
private readonly CordonelAppsDictionary appsDictionary;
|
||||
private readonly CordonelMetrologyValues metrologyValues;
|
||||
private readonly CordonelRSSIValues rssiValues;
|
||||
private readonly CordonelRegisterHistory[] registerHistory;
|
||||
private readonly CordonelRequirements requirements;
|
||||
private readonly EOLProgressModel eolProgressModel;
|
||||
private readonly CordonelProductionData productionData;
|
||||
private readonly CordonelAppsDictionary appsDictionaryDefaults;
|
||||
|
||||
public SentinelTestContext(string jsonFile)
|
||||
{
|
||||
var data = JsonConvert.DeserializeObject<Dictionary<string, object>>(
|
||||
value: File.ReadAllText(jsonFile),
|
||||
settings: new JsonSerializerSettings
|
||||
{
|
||||
Formatting = Formatting.Indented,
|
||||
TypeNameHandling = TypeNameHandling.Objects,
|
||||
TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple
|
||||
});
|
||||
this.appsVersionsCrcs = data.TryGetValue<CordonelAppVeriosnCrc[]>(nameof(Sentinel.TryGetCordonelAppsAndFWVersionValues));
|
||||
this.appsDictionary = data.TryGetValue<CordonelAppsDictionary>(nameof(Sentinel.TryGetCordonelAppsAndRegisterValues));
|
||||
this.metrologyValues = data.TryGetValue<CordonelMetrologyValues>(nameof(Sentinel.TryGetCordonelMetrologyValues));
|
||||
this.rssiValues = data.TryGetValue<CordonelRSSIValues>(nameof(Sentinel.TryGetCordonelRadioDefaults));
|
||||
this.registerHistory = data.TryGetValue<CordonelRegisterHistory[]>(nameof(CordonelDbContext.GetLatestRegistersWithValues));
|
||||
this.requirements = data.TryGetValue<CordonelRequirements>(nameof(Sentinel.TryGetCordonelRequirements));
|
||||
this.eolProgressModel = data.TryGetValue<EOLProgressModel>(nameof(Sentinel.TryGetEOLProgressModel));
|
||||
this.productionData = data.TryGetValue<CordonelProductionData>(nameof(Sentinel.TryGetUniqueProductionData));
|
||||
this.appsDictionaryDefaults = data.TryGetValue<CordonelAppsDictionary>(nameof(CordonelAppsDictionary));
|
||||
this.Sentinel = new Sentinel(
|
||||
httpClient: new SentinelMockHttpClient(this),
|
||||
cordonelDbContext: new SentinelMockDbContext(this));
|
||||
}
|
||||
|
||||
internal event Action<CordonelAppVeriosnCrc[]> AppsVersionsCrcsChanged;
|
||||
internal event Action<CordonelRegisterHistory[]> RegisterHistoryChanged;
|
||||
internal event Action<CordonelAppsDictionary> AppsDictionaryDefaultsChanged;
|
||||
internal event Action<CordonelMetrologyValues> MetroloryValuesChanged;
|
||||
internal event Action<CordonelRSSIValues> RSSIValuesChanged;
|
||||
internal event Action<CordonelRequirements> RequirementsChanged;
|
||||
internal event Action<EOLProgressModel> EOLProgressModelChanged;
|
||||
internal event Action<CordonelProductionData[]> ProductionDataChanged;
|
||||
|
||||
public Sentinel Sentinel { get; }
|
||||
|
||||
internal void PrepareNullProductionData() => this.ProductionDataChanged?.Invoke(default(CordonelProductionData[]));
|
||||
|
||||
internal void PrepareEmptyProductionData() => this.ProductionDataChanged?.Invoke(new CordonelProductionData[0]);
|
||||
|
||||
internal void PrepareMultipleProductionData() => this.ProductionDataChanged?.Invoke(new CordonelProductionData[] { null, null });
|
||||
|
||||
internal void PrepareUniqueProductionData() => this.ProductionDataChanged?.Invoke(new CordonelProductionData[] { this.productionData });
|
||||
|
||||
internal void PrepareNullEOLProgressModel() => this.EOLProgressModelChanged?.Invoke(null);
|
||||
|
||||
internal void PrepareEmptyEOLProgressModel() => this.EOLProgressModelChanged?.Invoke(new EOLProgressModel());
|
||||
|
||||
internal void PrepareNullRequirements() => this.RequirementsChanged?.Invoke(null);
|
||||
|
||||
internal void PrepareEOLProgressModel() => this.EOLProgressModelChanged?.Invoke(this.eolProgressModel);
|
||||
|
||||
internal void PrepareRequiremnets() => this.RequirementsChanged?.Invoke(this.requirements);
|
||||
|
||||
internal void PrepareNullRegisterHistory() => this.RegisterHistoryChanged?.Invoke(null);
|
||||
|
||||
internal void PrepareEmptyRegisterHistory() => this.RegisterHistoryChanged?.Invoke(new CordonelRegisterHistory[0]);
|
||||
|
||||
internal void PrepareRegisterHistory() => this.RegisterHistoryChanged?.Invoke(this.registerHistory);
|
||||
|
||||
internal void PrepareNullAppsDictionary() => this.AppsDictionaryDefaultsChanged?.Invoke(null);
|
||||
|
||||
internal void PrepareDefaultAppsDictionary() => this.AppsDictionaryDefaultsChanged?.Invoke(this.appsDictionaryDefaults);
|
||||
|
||||
internal void PrepareNullAppsVersionsCrcs() => this.AppsVersionsCrcsChanged?.Invoke(null);
|
||||
|
||||
internal void PrepareAppsVersionsCrcs() => this.AppsVersionsCrcsChanged?.Invoke(this.appsVersionsCrcs);
|
||||
|
||||
internal void PrepareEmptyAppsVersionsCrcs() => this.AppsVersionsCrcsChanged?.Invoke(new CordonelAppVeriosnCrc[0]);
|
||||
|
||||
internal void PrepareNullMetrologyValues() => this.MetroloryValuesChanged?.Invoke(null);
|
||||
|
||||
internal void PrepareMetrologyValues() => this.MetroloryValuesChanged?.Invoke(this.metrologyValues);
|
||||
|
||||
internal void PrepareNullRSSIValues() => this.RSSIValuesChanged?.Invoke(null);
|
||||
|
||||
internal void PrepareRSSIValues() => this.RSSIValuesChanged?.Invoke(this.rssiValues);
|
||||
|
||||
internal Tuple<EOLProgressModel, CordonelRequirements> TryCompareRequirementsIdAndVersionTestCase(int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8)
|
||||
=> new Tuple<EOLProgressModel, CordonelRequirements>(
|
||||
item1: new EOLProgressModel
|
||||
{
|
||||
RequirementRequestChecked = EOLStatus.OK,
|
||||
StandardRequirementId = v1,
|
||||
StandardRequirementVersion = v2,
|
||||
SpecialRequirementId = v3,
|
||||
SpecialRequirementVersion = v4
|
||||
},
|
||||
item2: new CordonelRequirements
|
||||
{
|
||||
StandardId = v5,
|
||||
StandardVersion = v6,
|
||||
SpecialId = v7,
|
||||
SpecialVersion = v8,
|
||||
});
|
||||
}
|
||||
}
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.UnitTests.Mock
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal static class SentinelTestContextExtensions
|
||||
{
|
||||
public static T TryGetValue<T>(this Dictionary<string, object> data, string key)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(key))
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(key)} ist erforderlich");
|
||||
}
|
||||
else if (!data.TryGetValue(key, out var t))
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(key)}: {typeof(T).Name} ist nicht vorhanden");
|
||||
}
|
||||
else if (t is T _object)
|
||||
{
|
||||
return _object;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(key)}: value ist nicht von typ {typeof(T).Name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,20 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("LaaProduction.Data.Cordonel.UnitTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LaaProduction.Data.Cordonel.UnitTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("75c5abf8-3d1c-43a2-961c-bcd54a3df1cf")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,415 +0,0 @@
|
||||
namespace LaaProduction.Data.Cordonel.UnitTests
|
||||
{
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
using LaaProduction.Data.Cordonel.Sentinel;
|
||||
using LaaProduction.Data.Cordonel.UnitTests.Mock;
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
[TestClass]
|
||||
public class SentinelTestClass
|
||||
{
|
||||
private readonly SentinelTestContext sentinelTestContext;
|
||||
private readonly Sentinel sentinel;
|
||||
private readonly int pcbId;
|
||||
|
||||
public SentinelTestClass()
|
||||
{
|
||||
var jsonFile = @"..\..\Mock\sentinel-data.json";
|
||||
this.sentinelTestContext = new SentinelTestContext(jsonFile);
|
||||
this.sentinel = this.sentinelTestContext.Sentinel;
|
||||
this.pcbId = 212120036;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetUniqueProductionData_ShouldThrowWhenDataIsNull()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareNullProductionData();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetUniqueProductionData(this.pcbId, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetUniqueProductionData_ShouldThrowWhenNoData()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareEmptyProductionData();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetUniqueProductionData(this.pcbId, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetUniqueProductionData_ShouldThrowOnMultipleData()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareMultipleProductionData();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetUniqueProductionData(this.pcbId, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetUniqueProductionData_ShouldGetUniqueProductionData()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareUniqueProductionData();
|
||||
|
||||
// Act
|
||||
this.sentinel.TryGetUniqueProductionData(this.pcbId, out var productionData);
|
||||
|
||||
// Assert
|
||||
Assert.IsNotNull(productionData);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetEOLProgressModel_ShouldThrowWhenModelIsNull()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareNullEOLProgressModel();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetEOLProgressModel(this.pcbId, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetEOLProgressModel_ShouldThrowWhenModelDoseNotValidates()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareEmptyEOLProgressModel();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetEOLProgressModel(this.pcbId, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetEOLProgressModel_ShouldGetEOLProgressModel()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareEOLProgressModel();
|
||||
|
||||
// Act
|
||||
this.sentinel.TryGetEOLProgressModel(this.pcbId, out var eolProgressModel);
|
||||
|
||||
// Assert
|
||||
Assert.IsNotNull(eolProgressModel);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelRequirements_ShouldThrowWhenRequierementsModelIsNull()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareNullRequirements();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelRequirements(this.pcbId, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelRequirements_ShouldGetRequirementsModel()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareRequiremnets();
|
||||
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelRequirements(this.pcbId, out var requirements);
|
||||
|
||||
// Assert
|
||||
Assert.IsNotNull(requirements);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelAppsAndRegisterValues_ShouldThrowWhenAppsDictionaryIsNull()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareNullAppsDictionary();
|
||||
this.sentinelTestContext.PrepareNullRegisterHistory();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelAppsAndRegisterValues(this.pcbId, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelAppsAndRegisterValues_ShouldThrowWhenRegisterHistoryIsNull()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareDefaultAppsDictionary();
|
||||
this.sentinelTestContext.PrepareNullRegisterHistory();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelAppsAndRegisterValues(this.pcbId, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelAppsAndRegisterValues_ShouldThrowWhenRegisterHistoryIsEmpty()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareDefaultAppsDictionary();
|
||||
this.sentinelTestContext.PrepareEmptyRegisterHistory();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelAppsAndRegisterValues(this.pcbId, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelAppsAndRegisterValues_ShouldGetRegisterHistory()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareDefaultAppsDictionary();
|
||||
this.sentinelTestContext.PrepareRegisterHistory();
|
||||
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelAppsAndRegisterValues(this.pcbId, out var appsDictionary);
|
||||
|
||||
// Assert
|
||||
Assert.IsNotNull(appsDictionary);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelAppsAndFWVersionValues_ShouldThrowWhenAppsVersionsIsNull()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareNullAppsVersionsCrcs();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelAppsAndFWVersionValues(this.pcbId, null, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelAppsAndFWVersionValues_ShouldThrowWhenAppsVersionsIsEmpty()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareEmptyAppsVersionsCrcs();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelAppsAndFWVersionValues(this.pcbId, null, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelAppsAndFWVersionValues_ShouldThrowGetAppsVersionsCrcs()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareAppsVersionsCrcs();
|
||||
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelAppsAndFWVersionValues(this.pcbId, null, out var appsVersionsCrcs);
|
||||
|
||||
// Assert
|
||||
Assert.IsNotNull(appsVersionsCrcs);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelMetrologyValues_ShouldThrowWhenMetrologyValuesIsNull()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareNullMetrologyValues();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelMetrologyValues(this.pcbId, true, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelMetrologyValues_ShouldGetMetrologyValues()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareMetrologyValues();
|
||||
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelMetrologyValues(this.pcbId, true, out var metrologyValues);
|
||||
|
||||
// Assert
|
||||
Assert.IsNotNull(metrologyValues);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelRadioDefaults_ShouldThrowWhenRSSIValuesIsNull()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareNullRSSIValues();
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelRadioDefaults(this.pcbId, true, out var _);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryGetCordonelRadioDefaults_ShouldGetRSSIValues()
|
||||
{
|
||||
// Arrange
|
||||
this.sentinelTestContext.PrepareRSSIValues();
|
||||
|
||||
// Act
|
||||
this.sentinel.TryGetCordonelRadioDefaults(this.pcbId, true, out var rssiValues);
|
||||
|
||||
// Assert
|
||||
Assert.IsNotNull(rssiValues);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryCompareRequirementsIdAndVersion_ShouldNotCompareWhenEOLStatusNA()
|
||||
=> this.sentinel.TryCompareRequirementsIdAndVersion(new EOLProgressModel { RequirementRequestChecked = EOLStatus.NA }, null);
|
||||
|
||||
[TestMethod]
|
||||
public void TryCompareRequirementsIdAndVersion_ShouldThrowByDifferentStandardIds()
|
||||
{
|
||||
// Arrange
|
||||
var args = this.sentinelTestContext.TryCompareRequirementsIdAndVersionTestCase(1, 2, 3, 4, 2, 2, 3, 4);
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryCompareRequirementsIdAndVersion(args.Item1, args.Item2);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryCompareRequirementsIdAndVersion_ShouldThrowByDifferentStandardVersions()
|
||||
{
|
||||
// Arrange
|
||||
var args = this.sentinelTestContext.TryCompareRequirementsIdAndVersionTestCase(1, 2, 3, 4, 1, 3, 3, 4);
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryCompareRequirementsIdAndVersion(args.Item1, args.Item2);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryCompareRequirementsIdAndVersion_ShouldThrowByDifferentSpecialIds()
|
||||
{
|
||||
// Arrange
|
||||
var args = this.sentinelTestContext.TryCompareRequirementsIdAndVersionTestCase(1, 2, 3, 4, 1, 2, 4, 4);
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryCompareRequirementsIdAndVersion(args.Item1, args.Item2);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryCompareRequirementsIdAndVersion_ShouldThrowByDifferentSpecialVersions()
|
||||
{
|
||||
// Arrange
|
||||
var args = this.sentinelTestContext.TryCompareRequirementsIdAndVersionTestCase(1, 2, 3, 4, 1, 2, 3, 5);
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryCompareRequirementsIdAndVersion(args.Item1, args.Item2);
|
||||
});
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryCompareRequirementsIdAndVersion_ShouldDoNothingWhenIdAndVersionAreSame()
|
||||
{
|
||||
// Arrange
|
||||
var args = this.sentinelTestContext.TryCompareRequirementsIdAndVersionTestCase(1, 2, 3, 4, 1, 2, 3, 4);
|
||||
|
||||
// Act
|
||||
this.sentinel.TryCompareRequirementsIdAndVersion(args.Item1, args.Item2);
|
||||
|
||||
// Assert OK
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryCompareRegionSizeKey_ShouldDoNothingWhenNA()
|
||||
{
|
||||
// Arrange
|
||||
var eolProgress = new EOLProgressModel { RequirementRegionChecked = EOLStatus.NA };
|
||||
|
||||
// Act
|
||||
this.sentinel.TryCompareRegionSizeKey(null, null, eolProgress);
|
||||
|
||||
// Assert
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryCompareRegionSizeKey_ShouldDoNothingWhenRegionSizeKeyAreSame()
|
||||
{
|
||||
// Arrange
|
||||
var eolProgress = new EOLProgressModel { RequirementRegionChecked = EOLStatus.OK };
|
||||
var productionData = new CordonelProductionData { RegionSizeKey = "AB" };
|
||||
var requirements = new CordonelRequirements { RegionSizeKey = "AB" };
|
||||
|
||||
// Act
|
||||
this.sentinel.TryCompareRegionSizeKey(productionData, requirements, eolProgress);
|
||||
|
||||
// Assert
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TryCompareRegionSizeKey_ShouldThrowWhenRegionSizeKeyAreDifferent()
|
||||
{
|
||||
// Arrange
|
||||
var eolProgress = new EOLProgressModel { RequirementRegionChecked = EOLStatus.OK };
|
||||
var productionData = new CordonelProductionData { RegionSizeKey = "AB" };
|
||||
var requirements = new CordonelRequirements { RegionSizeKey = "CD" };
|
||||
|
||||
// Assert
|
||||
Assert.ThrowsException<SentinelException>(() =>
|
||||
{
|
||||
// Act
|
||||
this.sentinel.TryCompareRegionSizeKey(productionData, requirements, eolProgress);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.ApplicationInsights" version="2.22.0" targetFramework="net481" />
|
||||
<package id="Microsoft.Testing.Extensions.Telemetry" version="1.5.0" targetFramework="net481" />
|
||||
<package id="Microsoft.Testing.Extensions.TrxReport.Abstractions" version="1.5.0" targetFramework="net481" />
|
||||
<package id="Microsoft.Testing.Extensions.VSTestBridge" version="1.5.0" targetFramework="net481" />
|
||||
<package id="Microsoft.Testing.Platform" version="1.5.0" targetFramework="net481" />
|
||||
<package id="Microsoft.Testing.Platform.MSBuild" version="1.5.0" targetFramework="net481" />
|
||||
<package id="Microsoft.TestPlatform.ObjectModel" version="17.12.0" targetFramework="net481" />
|
||||
<package id="MSTest.Analyzers" version="3.7.0" targetFramework="net481" developmentDependency="true" />
|
||||
<package id="MSTest.TestAdapter" version="3.7.0" targetFramework="net481" />
|
||||
<package id="MSTest.TestFramework" version="3.7.0" targetFramework="net481" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net481" />
|
||||
<package id="System.Buffers" version="4.6.0" targetFramework="net481" />
|
||||
<package id="System.Collections.Immutable" version="9.0.0" targetFramework="net481" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="9.0.0" targetFramework="net481" />
|
||||
<package id="System.Memory" version="4.6.0" targetFramework="net481" />
|
||||
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net481" />
|
||||
<package id="System.Reflection.Metadata" version="9.0.0" targetFramework="net481" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net481" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.6.0" targetFramework="net481" />
|
||||
</packages>
|
||||
@@ -1,225 +0,0 @@
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
using LaaProduction.Personalization.Models;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
using LaaProduction.SharedModels;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Principal;
|
||||
|
||||
public class AccountManager : IAccountManager
|
||||
{
|
||||
private static readonly IIdentity anonymous
|
||||
= new ClaimsIdentity(
|
||||
claims: Array.Empty<Claim>(),
|
||||
authenticationType: string.Empty,
|
||||
nameType: string.Empty,
|
||||
roleType: string.Empty);
|
||||
|
||||
private readonly IEmployeesRepository employeesRepository;
|
||||
private readonly ISoftwareRepository softwareRepository;
|
||||
|
||||
public AccountManager(IEmployeesRepository employeesRepository, ISoftwareRepository softwareRepository)
|
||||
{
|
||||
this.employeesRepository = employeesRepository;
|
||||
this.softwareRepository = softwareRepository;
|
||||
}
|
||||
|
||||
public bool ChangePassword(string password, string bearer)
|
||||
{
|
||||
var tokenData = this.employeesRepository.GetTokenData(bearer);
|
||||
|
||||
if (tokenData is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.employeesRepository.SetPassword(tokenData.EmployeeId, password);
|
||||
}
|
||||
|
||||
public IPrincipal GetClaimsPrincipal(string token)
|
||||
{
|
||||
var claimsIdentity = anonymous;
|
||||
var tokenData = this.employeesRepository.GetTokenData(token);
|
||||
|
||||
if (tokenData != null)
|
||||
{
|
||||
var employee = this.employeesRepository.Find(tokenData.EmployeeId);
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new Claim(nameof(EmployeeToken.AppId), tokenData.AppId.ToString()),
|
||||
new Claim(nameof(Employee.EmployeeId), employee.EmployeeId.ToString()),
|
||||
new Claim(nameof(Employee.FullName), employee.FullName),
|
||||
new Claim(nameof(Employee.Username), employee.Username),
|
||||
new Claim(ClaimTypes.NameIdentifier, token),
|
||||
};
|
||||
|
||||
var userRoles = this.employeesRepository
|
||||
.GetUserRoles(token)
|
||||
.Intersect(Enum.GetNames(typeof(EmployeesRoles)));
|
||||
|
||||
foreach (var role in userRoles)
|
||||
{
|
||||
claims.Add(new Claim(nameof(EmployeesRoles), role));
|
||||
}
|
||||
|
||||
var functions = this.softwareRepository
|
||||
.GetSoftwareFunctions(token)
|
||||
.Intersect(Enum.GetNames(typeof(SoftwareFunctions)));
|
||||
|
||||
foreach (var func in functions)
|
||||
{
|
||||
claims.Add(new Claim(nameof(SoftwareFunctions), func));
|
||||
}
|
||||
|
||||
claimsIdentity = new ClaimsIdentity(
|
||||
claims: claims,
|
||||
authenticationType: nameof(ClaimsIdentity),
|
||||
nameType: nameof(Employee.EmployeeId),
|
||||
roleType: nameof(EmployeesRoles));
|
||||
}
|
||||
|
||||
return new ClaimsPrincipal(claimsIdentity);
|
||||
}
|
||||
|
||||
public bool? Login(LDAPLoginModel model, out string bearer)
|
||||
{
|
||||
bearer = default(string);
|
||||
|
||||
var softwareId = this.GetOrCreateSoftwareId(
|
||||
model.Assembly,
|
||||
model.MajorV,
|
||||
model.MinorV,
|
||||
model.BuildV);
|
||||
|
||||
if (softwareId <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var employeeNr = this.employeesRepository.FindEmployeeNr(model.EmployeeId);
|
||||
|
||||
if (employeeNr <= 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
bearer = this.GetOrCreateAuthToken(softwareId, employeeNr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public string Login(UserLoginModel model)
|
||||
{
|
||||
var softwareId = this.GetOrCreateSoftwareId(
|
||||
model.Assembly,
|
||||
model.MajorV,
|
||||
model.MinorV,
|
||||
model.BuildV);
|
||||
|
||||
if (softwareId <= 0)
|
||||
{
|
||||
return default(string);
|
||||
}
|
||||
|
||||
var employeeNr = this.employeesRepository.FindEmployeeNr(model.Username, model.Password);
|
||||
|
||||
if (employeeNr <= 0)
|
||||
{
|
||||
return default(string);
|
||||
}
|
||||
|
||||
return this.GetOrCreateAuthToken(softwareId, employeeNr);
|
||||
}
|
||||
|
||||
public void ResetPassword(short employeeId)
|
||||
{
|
||||
this.employeesRepository.ResetPassword(employeeId);
|
||||
this.employeesRepository.ResetTokens(employeeId);
|
||||
}
|
||||
|
||||
public void SetPassword(short employeeId, string password)
|
||||
=> this.employeesRepository.SetPassword(employeeId, password);
|
||||
|
||||
private short GetOrCreateSoftwareId(string assembly, int major, int minor, int build)
|
||||
{
|
||||
/// Gets the app id for provided assembly name
|
||||
var softwareId = this.softwareRepository.SoftwareId(assembly);
|
||||
|
||||
/// In case that the software dose not exists wird hinzugefügt.
|
||||
if (softwareId <= 0)
|
||||
{
|
||||
softwareId = this.softwareRepository.Insert(assembly, major, minor, build);
|
||||
}
|
||||
|
||||
/// softwareId = [VersionSoftwareAccess].[AppID]
|
||||
return softwareId;
|
||||
}
|
||||
|
||||
public string GetOrCreateAuthToken(short appId, short userId)
|
||||
{
|
||||
var token = default(string);
|
||||
|
||||
if (appId > 0 && userId > 0)
|
||||
{
|
||||
this.employeesRepository.CreateToken(appId, userId);
|
||||
|
||||
token = this.employeesRepository.GetToken(appId, userId);
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
public bool? Register(LDAPRegisterModel model, out string bearer)
|
||||
{
|
||||
bearer = default(string);
|
||||
|
||||
var softwareId = this.GetOrCreateSoftwareId(
|
||||
model.Assembly,
|
||||
model.MajorV,
|
||||
model.MinorV,
|
||||
model.BuildV);
|
||||
|
||||
if (softwareId <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var employeeNr = this.employeesRepository.Update(
|
||||
model.EmployeeId,
|
||||
model.FirstName,
|
||||
model.LastName,
|
||||
model.Phone,
|
||||
model.Email,
|
||||
model.Username,
|
||||
model.DomainName,
|
||||
model.Password);
|
||||
|
||||
if (employeeNr < 0)
|
||||
{
|
||||
employeeNr = this.employeesRepository.Insert(
|
||||
model.EmployeeId,
|
||||
model.FirstName,
|
||||
model.LastName,
|
||||
model.Phone,
|
||||
model.Email,
|
||||
model.Username,
|
||||
model.DomainName,
|
||||
model.Password);
|
||||
}
|
||||
|
||||
if (employeeNr <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bearer = this.GetOrCreateAuthToken(softwareId, employeeNr);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
-76
@@ -1,76 +0,0 @@
|
||||
namespace LaaProduction.Personalization.ComponentModel.DataAnnotations
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Reflection;
|
||||
|
||||
public class DateTimeAttribute : ValidationAttribute
|
||||
{
|
||||
private readonly DateTimeOptions option;
|
||||
private readonly string otherProperty;
|
||||
|
||||
public DateTimeAttribute(DateTimeOptions option, string otherProperty)
|
||||
{
|
||||
this.option = option;
|
||||
this.otherProperty = $"{otherProperty}";
|
||||
}
|
||||
|
||||
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
|
||||
{
|
||||
var validationMessage = default(string);
|
||||
|
||||
if (value is DateTime currentDate)
|
||||
{
|
||||
var property = validationContext
|
||||
?.ObjectType
|
||||
?.GetProperty(this.otherProperty, BindingFlags.Public | BindingFlags.Instance);
|
||||
|
||||
if (property is null)
|
||||
{
|
||||
validationMessage = $"The '{this.otherProperty}' is invalid.";
|
||||
}
|
||||
else
|
||||
{
|
||||
var otherValue = property
|
||||
.GetValue(validationContext?.ObjectInstance);
|
||||
var otherDisplayName = property
|
||||
.GetCustomAttribute<DisplayAttribute>()
|
||||
?.GetName() ?? this.otherProperty;
|
||||
|
||||
if (otherValue is DateTime otherDate)
|
||||
{
|
||||
if (this.option == DateTimeOptions.GreaterThan && currentDate <= otherDate)
|
||||
{
|
||||
validationMessage = $"The '{validationContext.DisplayName}' should be greater than '{otherDisplayName}'";
|
||||
}
|
||||
else if (this.option == DateTimeOptions.SmallerThan && currentDate >= otherDate)
|
||||
{
|
||||
validationMessage = $"The '{validationContext.DisplayName}' should be smaller than '{otherDisplayName}'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
validationMessage = $"The '{otherDisplayName}' is invalid.";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
validationMessage = $"The '{validationContext?.DisplayName}' is invalid.";
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(validationMessage))
|
||||
{
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
|
||||
return new ValidationResult(validationMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public enum DateTimeOptions
|
||||
{
|
||||
GreaterThan,
|
||||
SmallerThan,
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
using LaaProduction.Personalization.Models;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class EmployeesManager : IEmployeesManager
|
||||
{
|
||||
private readonly IEmployeesRepository employeesRepository;
|
||||
private readonly IFunctionsRepository functionsRepository;
|
||||
private readonly IRolesRepository rolesRepository;
|
||||
|
||||
public EmployeesManager(IEmployeesRepository employeesRepository, IFunctionsRepository functionsRepository, IRolesRepository rolesRepository)
|
||||
{
|
||||
this.employeesRepository = employeesRepository;
|
||||
this.functionsRepository = functionsRepository;
|
||||
this.rolesRepository = rolesRepository;
|
||||
}
|
||||
|
||||
public object GetEmployee(short employeeId)
|
||||
{
|
||||
var employee = this.employeesRepository.Find(employeeId);
|
||||
|
||||
if (employee != null)
|
||||
{
|
||||
employee.Roles = this.rolesRepository.All(employeeId) ?? Array.Empty<string>();
|
||||
employee.Functions = this.functionsRepository.EmployeeAll(employeeId) ?? Array.Empty<string>();
|
||||
}
|
||||
|
||||
return employee ?? new object { };
|
||||
}
|
||||
|
||||
public IEnumerable<object> GetEmployees()
|
||||
=> this.employeesRepository.All()
|
||||
?? Array.Empty<Employee>();
|
||||
|
||||
public IEnumerable<object> GetRoles()
|
||||
=> this.rolesRepository
|
||||
.All()
|
||||
.GroupBy(x => x.Name)
|
||||
.Select(x => new
|
||||
{
|
||||
Name = x.Key,
|
||||
Employees = x.Select(e => e.EmployeeId)
|
||||
});
|
||||
|
||||
public IEnumerable<string> GetRoles(short employeeId)
|
||||
=> this.rolesRepository.All(employeeId) ?? Array.Empty<string>();
|
||||
|
||||
public IEnumerable<object> ListEmployees()
|
||||
=> this.employeesRepository
|
||||
.All()
|
||||
.Select(x => new { x.EmployeeId, x.FullName });
|
||||
|
||||
public void UpdateEmployeeFunctions(short employeeId, IEnumerable<string> functions)
|
||||
{
|
||||
this.functionsRepository.Delete(employeeId);
|
||||
|
||||
if (functions != null && functions.Any())
|
||||
{
|
||||
this.functionsRepository.Insert(employeeId, functions);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateEmployeeRoles(short employeeId, IEnumerable<string> roles)
|
||||
{
|
||||
this.rolesRepository.Delete(employeeId);
|
||||
|
||||
if (roles != null && roles.Any())
|
||||
{
|
||||
this.rolesRepository.Insert(employeeId, roles);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateRoleEmployees(string role, IEnumerable<short> employees)
|
||||
{
|
||||
this.rolesRepository.Delete(role);
|
||||
|
||||
if (employees != null && employees.Any())
|
||||
{
|
||||
this.rolesRepository.Insert(role, employees);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
public enum EmployeesRoles
|
||||
{
|
||||
AV_ABFRAGE_GEPRUEFTE,
|
||||
AV_ABFRAGEN6SIGMA,
|
||||
AV_ABGEBROCHENEPRUEFGAENGE,
|
||||
AV_AUFTRAGPOSITION,
|
||||
AV_AUFTRAGSTORNO,
|
||||
AV_CDLWIN_VERWALTEN,
|
||||
AV_EICHSCHEIN,
|
||||
AV_eRegister,
|
||||
AV_FEHLERGRENZEN,
|
||||
AV_FERTIGMELDEN,
|
||||
AV_FREMDGERAETE,
|
||||
AV_LISTEPLOMBEN,
|
||||
AV_LIZENZEN_VERWALTEN,
|
||||
AV_MITTEILUNGEN,
|
||||
AV_PREUFSTATAUSLAST,
|
||||
AV_PRUEFERGEBNISSE,
|
||||
AV_PRUEFERGEBNISSEUMSCHREIBEN,
|
||||
AV_PRUEFFEHLER_FREIGABE,
|
||||
AV_PRUEFPUNKTEAENDERN,
|
||||
AV_RECHTE,
|
||||
AV_REGULIERERINFOS,
|
||||
AV_REPARATUR,
|
||||
AV_RUECKLAEUFER,
|
||||
AV_RZDATEN,
|
||||
AV_RZFEHLER,
|
||||
AV_SENSUSREAD_LESEN,
|
||||
AV_SENSUSREAD_VERWALTEN,
|
||||
AV_SENSUSREADLIZENZEN,
|
||||
AV_SERIENDRUCK,
|
||||
AV_SONDERAUFTRAEGE,
|
||||
AV_SQL_1,
|
||||
AV_SQL_4,
|
||||
AV_SQL_7,
|
||||
AV_SQL_8,
|
||||
AV_SQLAbfragen,
|
||||
AV_TERMINTREUE,
|
||||
AV_TERMINVERZOEGERUNGEN,
|
||||
AV_TREFFERQUOTE,
|
||||
AV_VAKODECODE,
|
||||
AV_VERSANDINFO,
|
||||
AV_VORGANGSNR,
|
||||
DRUCKPRUEFER,
|
||||
eRegister_Freigabe,
|
||||
PDA_EICHUNG,
|
||||
PREUFSTATAUSLAST,
|
||||
PROT_DRUCK_BEI_ABWEICHUNG,
|
||||
PRUEFSTELLENLEITUNG,
|
||||
SUPERUSER,
|
||||
TEST,
|
||||
WEB_Admin,
|
||||
WEB_API,
|
||||
WEB_Approvals,
|
||||
WEB_Equipments,
|
||||
WEB_QAP,
|
||||
WEB_Reports,
|
||||
WEB_Shipment,
|
||||
WEB_Wildcard,
|
||||
WEB_Passwords,
|
||||
WEB_Requirements_Approve,
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
using LaaProduction.Personalization.Models;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public class EquipmentsManager : IEquipmentsManager
|
||||
{
|
||||
private readonly IEquipmentsRepository equipments;
|
||||
|
||||
public EquipmentsManager(IEquipmentsRepository equipments)
|
||||
{
|
||||
this.equipments = equipments;
|
||||
}
|
||||
|
||||
public int Add(PruefmittelPruefung model)
|
||||
{
|
||||
model.PruefdatumSoll = model.PruefdatumIst.AddDays(model.Pruefintervall);
|
||||
|
||||
return this.equipments.Add(model);
|
||||
}
|
||||
|
||||
public PruefmittelPruefung FindById(int pruefmittelId)
|
||||
=> this.equipments.FindById(pruefmittelId)
|
||||
?? new PruefmittelPruefung();
|
||||
|
||||
public IEnumerable<int> GetDaysInSchedule(PruefmittelPruefung equipment)
|
||||
{
|
||||
var matches = Regex.Matches($"{equipment?.Schedule}", "\\d+", RegexOptions.Multiline);
|
||||
var daysInSchedule = new List<int>();
|
||||
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
if (match.Success && int.TryParse(match.Value, out var day))
|
||||
{
|
||||
daysInSchedule.Add(day);
|
||||
}
|
||||
}
|
||||
|
||||
return daysInSchedule;
|
||||
}
|
||||
|
||||
public int Remove(int pruefmittelId)
|
||||
=> this.equipments.Remove(pruefmittelId);
|
||||
|
||||
public IEnumerable<PruefmittelPruefung> SelectAll()
|
||||
=> this.equipments.SelectAll();
|
||||
|
||||
public IEnumerable<PruefmittelPruefung> SelectAll(int softwareId)
|
||||
{
|
||||
var equipments = this.equipments
|
||||
.SelectAll(softwareId)
|
||||
.ToList();
|
||||
|
||||
foreach (var equipment in equipments)
|
||||
{
|
||||
var daysInSchedule = this.GetDaysInSchedule(equipment);
|
||||
|
||||
equipment.DaysLeft = equipment.PruefdatumSoll.Subtract(DateTime.Now).Days;
|
||||
|
||||
if (daysInSchedule.Any())
|
||||
{
|
||||
equipment.InSchedule = daysInSchedule.Max(x => x) >= equipment.DaysLeft;
|
||||
}
|
||||
}
|
||||
|
||||
return equipments;
|
||||
}
|
||||
|
||||
public void SetInspected(int pruefmittelId)
|
||||
{
|
||||
var existing = this.equipments.FindById(pruefmittelId);
|
||||
|
||||
if (existing is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
existing.PruefdatumIst = DateTime.Now;
|
||||
existing.PruefdatumSoll = existing.PruefdatumIst.AddDays(existing.Pruefintervall);
|
||||
|
||||
this.equipments.Update(existing);
|
||||
}
|
||||
|
||||
public int Update(PruefmittelPruefung model)
|
||||
=> this.equipments.Update(model);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Interfaces
|
||||
{
|
||||
using LaaProduction.SharedModels;
|
||||
|
||||
using System;
|
||||
using System.Security.Principal;
|
||||
|
||||
public interface IAccountManager
|
||||
{
|
||||
bool ChangePassword(string password, string bearer);
|
||||
|
||||
IPrincipal GetClaimsPrincipal(string token);
|
||||
|
||||
bool? Login(LDAPLoginModel model, out string bearer);
|
||||
|
||||
string Login(UserLoginModel model);
|
||||
|
||||
void ResetPassword(short employeeId);
|
||||
|
||||
void SetPassword(short employeeId, string password);
|
||||
|
||||
bool? Register(LDAPRegisterModel model, out string bearer);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Interfaces
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IEmployeesManager
|
||||
{
|
||||
object GetEmployee(short employeeId);
|
||||
|
||||
IEnumerable<object> GetEmployees();
|
||||
|
||||
IEnumerable<object> GetRoles();
|
||||
|
||||
IEnumerable<string> GetRoles(short employeeId);
|
||||
|
||||
IEnumerable<object> ListEmployees();
|
||||
|
||||
void UpdateEmployeeFunctions(short employeeId, IEnumerable<string> functions);
|
||||
|
||||
void UpdateEmployeeRoles(short employeeId, IEnumerable<string> roles);
|
||||
|
||||
void UpdateRoleEmployees(string role, IEnumerable<short> employees);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Interfaces
|
||||
{
|
||||
using LaaProduction.Personalization.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IEquipmentsManager
|
||||
{
|
||||
int Add(PruefmittelPruefung model);
|
||||
|
||||
PruefmittelPruefung FindById(int pruefmittelId);
|
||||
|
||||
IEnumerable<int> GetDaysInSchedule(PruefmittelPruefung equipment);
|
||||
|
||||
int Remove(int pruefmittelId);
|
||||
|
||||
IEnumerable<PruefmittelPruefung> SelectAll();
|
||||
|
||||
IEnumerable<PruefmittelPruefung> SelectAll(int softwareId);
|
||||
|
||||
void SetInspected(int pruefmittelId);
|
||||
|
||||
int Update(PruefmittelPruefung model);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Interfaces
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface ISoftwareManager
|
||||
{
|
||||
void AddVersion(short softwareId, string assemblyName, int majorV, int minorV, int buildV, DateTime validUntil, string description);
|
||||
|
||||
void DeleteVersion(int versionId);
|
||||
|
||||
void EditVersion(int versionId, DateTime? validUntil, string description);
|
||||
|
||||
IEnumerable<string> GetFunctions();
|
||||
|
||||
IEnumerable<string> GetFunctions(string token);
|
||||
|
||||
IEnumerable<object> ListSoftwares();
|
||||
|
||||
object SoftwareDeteils(int versionId);
|
||||
|
||||
void UpdateFunction(short softwareId, int functionId, string function, IEnumerable<short> employees);
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LaaProduction.Personalization</RootNamespace>
|
||||
<AssemblyName>LaaProduction.Personalization</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn>IDE0003;IDE0049;</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AccountManager.cs" />
|
||||
<Compile Include="ComponentModel.DataAnnotations\DateTimeAttribute.cs" />
|
||||
<Compile Include="EmployeesManager.cs" />
|
||||
<Compile Include="EquipmentsManager.cs" />
|
||||
<Compile Include="Interfaces\IEmployeesManager.cs" />
|
||||
<Compile Include="Interfaces\IEquipmentsManager.cs" />
|
||||
<Compile Include="Interfaces\ISoftwareManager.cs" />
|
||||
<Compile Include="Models\EmployeeToken.cs" />
|
||||
<Compile Include="Models\EmployeeFunction.cs" />
|
||||
<Compile Include="Models\EmployeeRole.cs" />
|
||||
<Compile Include="Models\Role.cs" />
|
||||
<Compile Include="Models\SoftwareDetails.cs" />
|
||||
<Compile Include="Models\SoftwareFunction.cs" />
|
||||
<Compile Include="Models\SoftwareItem.cs" />
|
||||
<Compile Include="Models\SoftwareVersion.cs" />
|
||||
<Compile Include="PersonalizationExtensions.cs" />
|
||||
<Compile Include="Interfaces\IAccountManager.cs" />
|
||||
<Compile Include="Models\Employee.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Models\PruefmittelPruefung.cs" />
|
||||
<Compile Include="Repositories\EmployeesRepository.cs" />
|
||||
<Compile Include="Repositories\EquipmentsRepository.cs" />
|
||||
<Compile Include="Repositories\FunctionsRepository.cs" />
|
||||
<Compile Include="Repositories\Interfaces\IEmployeesRepository.cs" />
|
||||
<Compile Include="Repositories\Interfaces\IEquipmentsRepository.cs" />
|
||||
<Compile Include="Repositories\Interfaces\IFunctionsRepository.cs" />
|
||||
<Compile Include="Repositories\Interfaces\IRolesRepository.cs" />
|
||||
<Compile Include="Repositories\Interfaces\ISoftwareRepository.cs" />
|
||||
<Compile Include="Repositories\RolesRepository.cs" />
|
||||
<Compile Include="Repositories\SoftwareRepository.cs" />
|
||||
<Compile Include="SoftwareFunctions.cs" />
|
||||
<Compile Include="SoftwareManager.cs" />
|
||||
<Compile Include="EmployeesRoles.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LaaPackages\LaaPackages.SqlClient\LaaPackages.SqlClient.csproj">
|
||||
<Project>{F90B940C-9A83-496D-AAE0-11CD02CE0A22}</Project>
|
||||
<Name>LaaPackages.SqlClient</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\LaaProduction.SharedModels\LaaProduction.SharedModels.csproj">
|
||||
<Project>{0BF77588-2684-459D-8C71-DBBC6B05E9EE}</Project>
|
||||
<Name>LaaProduction.SharedModels</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BouncyCastle.Cryptography">
|
||||
<Version>2.5.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MailKit">
|
||||
<Version>4.9.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions">
|
||||
<Version>9.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MimeKit">
|
||||
<Version>4.9.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Buffers">
|
||||
<Version>4.6.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Formats.Asn1">
|
||||
<Version>9.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Memory">
|
||||
<Version>4.6.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Numerics.Vectors">
|
||||
<Version>4.6.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.ValueTuple">
|
||||
<Version>4.5.0</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>del "$(TargetDir)*.pdb"
|
||||
del "$(TargetDir)*.xml"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,33 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class Employee
|
||||
{
|
||||
public short EmployeeId { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
|
||||
public string Username { get; set; }
|
||||
|
||||
public bool HasPassword { get; set; }
|
||||
|
||||
public int RolesCount { get; set; }
|
||||
|
||||
public IEnumerable<string> Roles { get; set; }
|
||||
|
||||
public int FunctionsCount { get; set; }
|
||||
|
||||
public IEnumerable<string> Functions { get; set; }
|
||||
}
|
||||
|
||||
public class EmployeeComparer : IEqualityComparer<Employee>
|
||||
{
|
||||
public bool Equals(Employee x, Employee y)
|
||||
=> x?.EmployeeId == y?.EmployeeId;
|
||||
|
||||
public int GetHashCode(Employee obj)
|
||||
=> obj?.EmployeeId ?? default(int);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class EmployeeFunction
|
||||
{
|
||||
public short EmployeeId { get; set; }
|
||||
|
||||
public string Function { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class EmployeeRole
|
||||
{
|
||||
public int EmployeeId { get; set; }
|
||||
|
||||
public string Role { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class EmployeeToken
|
||||
{
|
||||
public short AppId { get; set; }
|
||||
|
||||
public short EmployeeId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Models
|
||||
{
|
||||
using LaaProduction.Personalization.ComponentModel.DataAnnotations;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public class PruefmittelPruefung
|
||||
{
|
||||
public int PruefmittelId { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue)]
|
||||
[Display(Name = "Prüfsoftware")]
|
||||
public short SoftwareId { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
[Display(Name = "Prüfmittel Bezeichnung")]
|
||||
public string Pruefmittel { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(30)]
|
||||
[Display(Name = "Prüfmittelnummer")]
|
||||
public string PruefmittelNr { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue)]
|
||||
[Display(Name = "Prüfintervall in Tagen")]
|
||||
public int Pruefintervall { get; set; } = 1;
|
||||
|
||||
[Display(Name = "Ist die Prüfung erforderlich?")]
|
||||
public bool Erforderlich { get; set; } = true;
|
||||
|
||||
[Display(Name = "Zuletzt geprüft am (yyyy-MM-dd)")]
|
||||
[DateTime(DateTimeOptions.SmallerThan, nameof(PruefdatumSoll))]
|
||||
public DateTime PruefdatumIst { get; set; } = DateTime.Now;
|
||||
|
||||
[Display(Name = "Nächste Prüfung am (yyyy-MM-dd)")]
|
||||
[DateTime(DateTimeOptions.GreaterThan, nameof(PruefdatumIst))]
|
||||
public DateTime PruefdatumSoll { get; set; } = DateTime.Now;
|
||||
|
||||
[Required]
|
||||
[StringLength(250)]
|
||||
[Display(Name = "Bemerkung zu der Prüfmittelprüfung.")]
|
||||
public string Bemerkung { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(250)]
|
||||
[Display(Name = "Sender E-Mail")]
|
||||
public string EmailFrom { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(500)]
|
||||
[Display(Name = "E-Mail-An liste")]
|
||||
public string EmailAn { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(500)]
|
||||
[Display(Name = "E-Mail-CC liste")]
|
||||
public string InCcAn { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(150)]
|
||||
[Display(Name = "Betreff")]
|
||||
public string Betreff { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(500)]
|
||||
[Display(Name = "Nachrichtentext")]
|
||||
public string Nachricht { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(500)]
|
||||
[Display(Name = "Softwaremeldungstext")]
|
||||
public string Meldung { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
[Display(Name = "E-Mailversand Zeitplan")]
|
||||
public string Schedule { get; set; } = "14, 7, 3, 1";
|
||||
|
||||
public int DaysLeft { get; set; }
|
||||
|
||||
public bool InSchedule { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class Role
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public short EmployeeId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class SoftwareDetails
|
||||
{
|
||||
public short SoftwareId { get; set; }
|
||||
|
||||
public int VersionId { get; set; }
|
||||
|
||||
public string VersionNr { get; set; }
|
||||
|
||||
public string ValidUntil { get; set; }
|
||||
|
||||
public string AssemblyName { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public IEnumerable<SoftwareVersion> Versions { get; set; }
|
||||
|
||||
public IEnumerable<SoftwareFunction> Functions { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class SoftwareFunction
|
||||
{
|
||||
public short SoftwareId { get; set; }
|
||||
|
||||
public int FunctionId { get; set; }
|
||||
|
||||
public string Function { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class SoftwareItem
|
||||
{
|
||||
public short SoftwareId { get; set; }
|
||||
|
||||
public int VersionId { get; set; }
|
||||
|
||||
public string AssemblyName { get; set; }
|
||||
|
||||
public string CurrentVersion { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public string ValidUntil { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class SoftwareVersion
|
||||
{
|
||||
public int VersionId { get; set; }
|
||||
|
||||
public string VersionNr { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public string ValidUntil { get; set; }
|
||||
|
||||
public short SoftwareId { get; set; }
|
||||
|
||||
public string AssemblyName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
using LaaProduction.Personalization.Repositories;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
public static class PersonalizationExtensions
|
||||
{
|
||||
public static IServiceCollection AddAdministration(this IServiceCollection services)
|
||||
=> services
|
||||
.AddScoped<IEmployeesRepository, EmployeesRepository>()
|
||||
.AddScoped<IEquipmentsRepository, EquipmentsRepository>()
|
||||
.AddScoped<IFunctionsRepository, FunctionsRepository>()
|
||||
.AddScoped<IRolesRepository, RolesRepository>()
|
||||
.AddScoped<ISoftwareRepository, SoftwareRepository>()
|
||||
.AddScoped<IAccountManager, AccountManager>()
|
||||
.AddScoped<IEmployeesManager, EmployeesManager>()
|
||||
.AddScoped<IEquipmentsManager, EquipmentsManager>()
|
||||
.AddScoped<ISoftwareManager, SoftwareManager>();
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("LaaProduction.Administration")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LaaProduction.Administration")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("4c17fd42-7002-431a-8d6e-c57dd7d7c2d2")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,37 +0,0 @@
|
||||
Database table dependencies
|
||||
---
|
||||
[Auftrag].[dbo].[Mitarbeiter]
|
||||
[Auftrag].[dbo].[MitarbeiterRechte]
|
||||
[Auftrag].[dbo].[MitarbeiterTokens]
|
||||
[Auftrag].[dbo].[MitarbeiterTokens]
|
||||
[Auftrag].[dbo].[SoftwareFunctions]
|
||||
[Auftrag].[dbo].[SoftwareFunctionsLog]
|
||||
[Auftrag].[dbo].[UsersFunctions]
|
||||
[Auftrag].[dbo].[VersionSoftwareAccess]
|
||||
|
||||
DROP TABLE [PruefmittelPruefung]
|
||||
GO
|
||||
|
||||
CREATE TABLE [PruefmittelPruefung] (
|
||||
[PruefmittelId] INT NOT NULL PRIMARY KEY IDENTITY(1, 1),
|
||||
[SoftwareId] SMALLINT NOT NULL,
|
||||
[Pruefmittel] VARCHAR(100) NOT NULL,
|
||||
[PruefmittelNr] VARCHAR(30) NOT NULL,
|
||||
[Pruefintervall] INT NOT NULL,
|
||||
[Erforderlich] BIT NOT NULL,
|
||||
[PruefdatumIst] DATETIME NOT NULL,
|
||||
[PruefdatumSoll] DATETIME NOT NULL,
|
||||
[Bemerkung] NVARCHAR(250) NOT NULL,
|
||||
[EmailFrom] NVARCHAR(250) NOT NULL,
|
||||
[EmailAn] NVARCHAR(500) NOT NULL,
|
||||
[InCcAn] NVARCHAR(500) NOT NULL,
|
||||
[Betreff] NVARCHAR(150) NOT NULL,
|
||||
[Nachricht] NVARCHAR(500) NOT NULL,
|
||||
[Meldung] NVARCHAR(500) NOT NULL,
|
||||
[Schedule] VARCHAR(50) NOT NULL
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX [UX_PruefmittelPruefung]
|
||||
ON [PruefmittelPruefung] (
|
||||
[SoftwareId]
|
||||
, [PruefmittelNr]);
|
||||
@@ -1,320 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Repositories
|
||||
{
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Personalization.Models;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class EmployeesRepository : IEmployeesRepository
|
||||
{
|
||||
private readonly SqlConnection sqlConnection;
|
||||
|
||||
public EmployeesRepository(SqlConnection sqlConnection)
|
||||
=> this.sqlConnection = sqlConnection;
|
||||
|
||||
public IEnumerable<Employee> All()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [M].[MitarbeiterNr] AS [EmployeeId]
|
||||
, [M].[Vorname] + ' ' + [M].[Name] AS [FullName]
|
||||
, [M].[Benutzername] AS [Username]
|
||||
, [M].[PasswordHash] AS [Password]
|
||||
, [MR].[Recht] AS [Role]
|
||||
, [SF].[Function] AS [Function]
|
||||
FROM [Mitarbeiter] AS [M]
|
||||
LEFT JOIN [MitarbeiterRechte] AS [MR]
|
||||
ON [MR].[MitarbeiterNr] = [M].[MitarbeiterNr]
|
||||
LEFT JOIN [UsersFunctions] AS [UF]
|
||||
ON [UF].[UserId] = [M].[MitarbeiterNr]
|
||||
LEFT JOIN [SoftwareFunctions] AS [SF]
|
||||
ON [SF].[Id] = [UF].[SoftwareFunctionId]
|
||||
ORDER BY [FullName], [Username]")
|
||||
.ExecuteReader(x => new
|
||||
{
|
||||
EmployeeId = x.GetValue<short>(0),
|
||||
FullName = x.GetValue<string>(1),
|
||||
Username = x.GetValue<string>(2),
|
||||
HasPassword = !string.IsNullOrWhiteSpace(x.GetValue<string>(3)),
|
||||
Role = x.GetValue<string>(4),
|
||||
Function = x.GetValue<string>(5)
|
||||
})
|
||||
.GroupBy(x => new Employee
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
FullName = x.FullName,
|
||||
Username = x.Username,
|
||||
HasPassword = x.HasPassword,
|
||||
}, new EmployeeComparer())
|
||||
.Select(x =>
|
||||
{
|
||||
x.Key.Roles = x.Select(r => r.Role).Distinct().Where(r => !string.IsNullOrWhiteSpace(r));
|
||||
x.Key.RolesCount = x.Key.Roles.Count();
|
||||
x.Key.Functions = x.Select(f => f.Function).Distinct().Where(r => !string.IsNullOrWhiteSpace(r));
|
||||
x.Key.FunctionsCount = x.Key.Functions.Count();
|
||||
|
||||
return x.Key;
|
||||
})
|
||||
.ToList();
|
||||
|
||||
public void CreateToken(short appId, short userId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [MitarbeiterTokens] (
|
||||
[AppId]
|
||||
, [UserId])
|
||||
VALUES (@{nameof(appId)}
|
||||
, @{nameof(userId)})")
|
||||
.SetParameter(nameof(appId), appId)
|
||||
.SetParameter(nameof(userId), userId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public short FindEmployeeNr(int employeeId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MitarbeiterNr]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE [EmployeeId] = @{nameof(employeeId)}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.FirstOrDefault(x => x.GetValue<short>(0));
|
||||
|
||||
public short FindEmployeeNr(string username, string password)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MitarbeiterNr]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE ([Benutzername] = @{nameof(username)}
|
||||
OR [DomainUser] = @{nameof(username)})
|
||||
AND [PasswordHash] = @{nameof(password)}")
|
||||
.SetParameter(nameof(username), username)
|
||||
.SetParameter(nameof(password), password)
|
||||
.FirstOrDefault(x => x.GetValue<short>(0));
|
||||
|
||||
public Employee Find(short employeeId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [M].[MitarbeiterNr] AS [EmployeeId]
|
||||
, [M].[Vorname] + ' ' + [M].[Name] AS [FullName]
|
||||
, [M].[Benutzername] AS [Username]
|
||||
, [M].[PasswordHash] AS [Password]
|
||||
FROM [Mitarbeiter] AS [M]
|
||||
WHERE [M].[MitarbeiterNr] = @{nameof(employeeId)}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.FirstOrDefault(x => new Employee
|
||||
{
|
||||
EmployeeId = x.GetValue<short>(0),
|
||||
FullName = x.GetValue<string>(1),
|
||||
Username = x.GetValue<string>(2),
|
||||
HasPassword = !string.IsNullOrWhiteSpace(x.GetValue<string>(3))
|
||||
});
|
||||
|
||||
public Employee GetEmployee(string token)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [M].[MitarbeiterNr]
|
||||
, [M].[Vorname] + ' ' + [M].[Name]
|
||||
, [M].[Benutzername]
|
||||
FROM [MitarbeiterTokens] AS [MT]
|
||||
JOIN [Mitarbeiter] AS [M]
|
||||
ON [M].[MitarbeiterNr] = [MT].[UserId]
|
||||
WHERE [MT].[Token] = @{nameof(token)}")
|
||||
.SetParameter(nameof(token), token)
|
||||
.FirstOrDefault(x => new Employee
|
||||
{
|
||||
EmployeeId = x.GetValue<short>(0),
|
||||
FullName = x.GetValue<string>(1),
|
||||
Username = x.GetValue<string>(2)
|
||||
});
|
||||
|
||||
public string GetToken(short appId, short userId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Token]
|
||||
FROM [MitarbeiterTokens]
|
||||
WHERE [AppId] = @{nameof(appId)}
|
||||
AND [UserId] = @{nameof(userId)}")
|
||||
.SetParameter(nameof(appId), appId)
|
||||
.SetParameter(nameof(userId), userId)
|
||||
.FirstOrDefault(x => x.GetValue<string>(0));
|
||||
|
||||
public EmployeeToken GetTokenData(string token)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [AppId]
|
||||
, [UserId]
|
||||
FROM [MitarbeiterTokens]
|
||||
WHERE [Token] = @{nameof(token)}")
|
||||
.SetParameter(nameof(token), token)
|
||||
.FirstOrDefault(x => new EmployeeToken
|
||||
{
|
||||
AppId = x.GetValue<short>(0),
|
||||
EmployeeId = x.GetValue<short>(1)
|
||||
});
|
||||
|
||||
public IEnumerable<string> GetUserRoles(string token)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MR].[Recht]
|
||||
FROM [MitarbeiterTokens] AS [MT]
|
||||
JOIN [MitarbeiterRechte] AS [MR]
|
||||
ON [MR].[MitarbeiterNr] = [MT].[UserId]
|
||||
WHERE [MT].[Token] = @{nameof(token)}")
|
||||
.SetParameter(nameof(token), token)
|
||||
.ExecuteReader(x => x.GetValue<string>(0));
|
||||
|
||||
public short Insert(int employeeId, string firstName, string lastName, string phone, string email, string username, string domainname, string password)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [Mitarbeiter] (
|
||||
[MitarbeiterNr]
|
||||
, [EmployeeId]
|
||||
, [Vorname]
|
||||
, [Name]
|
||||
, [Telefon]
|
||||
, [Benutzername]
|
||||
, [AnlageDatum]
|
||||
, [eMail]
|
||||
, [DomainUser]
|
||||
, [PasswordHash])
|
||||
OUTPUT [inserted].[MitarbeiterNr]
|
||||
VALUES ((SELECT MAX([MitarbeiterNr]) + 1 FROM [Mitarbeiter])
|
||||
, @{nameof(employeeId)}
|
||||
, @{nameof(firstName)}
|
||||
, @{nameof(lastName)}
|
||||
, @{nameof(phone)}
|
||||
, @{nameof(username)}
|
||||
, GETDATE()
|
||||
, @{nameof(email)}
|
||||
, @{nameof(domainname)}
|
||||
, @{nameof(password)})")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.SetParameter(nameof(firstName), firstName)
|
||||
.SetParameter(nameof(lastName), lastName)
|
||||
.SetParameter(nameof(phone), phone)
|
||||
.SetParameter(nameof(email), email)
|
||||
.SetParameter(nameof(username), username)
|
||||
.SetParameter(nameof(domainname), domainname)
|
||||
.SetParameter(nameof(password), password)
|
||||
.ExecuteScalar(x => x.GetValue<short>(0));
|
||||
|
||||
public void ResetPassword(short employeeId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE [Mitarbeiter]
|
||||
SET [PasswordHash] = NULL
|
||||
WHERE [MitarbeiterNr] = @{nameof(employeeId)}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public void ResetTokens(short employeeId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
DELETE FROM [MitarbeiterTokens]
|
||||
WHERE [UserId] = @{nameof(employeeId)}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public bool SetPassword(short employeeId, string password)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE [Mitarbeiter]
|
||||
SET [PasswordHash] = @{nameof(password)}
|
||||
WHERE [MitarbeiterNr] = @{nameof(employeeId)}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.SetParameter(nameof(password), password)
|
||||
.ExecuteNonQuery() == 1;
|
||||
|
||||
public short Update(int employeeId, string firstName, string lastName, string phone, string email, string username, string domainname, string password)
|
||||
{
|
||||
var employeeNr = this.FindEmployeeNr(firstName, lastName, email, domainname);
|
||||
|
||||
if (employeeNr > 0)
|
||||
{
|
||||
this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE [Mitarbeiter]
|
||||
SET [EmployeeId] = @{nameof(employeeId)}
|
||||
, [eMail] = @{nameof(email)}
|
||||
, [Telefon] = @{nameof(phone)}
|
||||
, [Benutzername] = @{nameof(username)}
|
||||
, [DomainUser] = @{nameof(domainname)}
|
||||
, [PasswordHash] = @{nameof(password)}
|
||||
WHERE [MitarbeiterNr] = @{nameof(employeeNr)}")
|
||||
.SetParameter(nameof(employeeNr), employeeNr)
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.SetParameter(nameof(firstName), firstName)
|
||||
.SetParameter(nameof(lastName), lastName)
|
||||
.SetParameter(nameof(phone), phone)
|
||||
.SetParameter(nameof(email), email)
|
||||
.SetParameter(nameof(username), username)
|
||||
.SetParameter(nameof(domainname), domainname)
|
||||
.SetParameter(nameof(password), password)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
return employeeNr.Value;
|
||||
}
|
||||
|
||||
if (employeeNr is null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return default(short);
|
||||
}
|
||||
}
|
||||
|
||||
private short? FindEmployeeNr(string firstName, string lastName, string email, string domainname)
|
||||
{
|
||||
var employeeNumbers = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MitarbeiterNr]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE [Name] = @{nameof(lastName)}
|
||||
AND [Vorname] = @{nameof(firstName)}")
|
||||
.SetParameter(nameof(lastName), lastName)
|
||||
.SetParameter(nameof(firstName), firstName)
|
||||
.ExecuteReader(x => x.GetValue<short>(0))
|
||||
.ToList();
|
||||
|
||||
if (employeeNumbers.Count != 1)
|
||||
{
|
||||
employeeNumbers = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MitarbeiterNr]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE [eMail] = @{nameof(email)}")
|
||||
.SetParameter(nameof(email), email)
|
||||
.ExecuteReader(x => x.GetValue<short>(0))
|
||||
.ToList();
|
||||
|
||||
if (employeeNumbers.Count != 1)
|
||||
{
|
||||
employeeNumbers = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MitarbeiterNr]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE [DomainUser] = @{nameof(domainname)}")
|
||||
.SetParameter(nameof(domainname), domainname)
|
||||
.ExecuteReader(x => x.GetValue<short>(0))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
if (employeeNumbers.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (employeeNumbers.Count > 1)
|
||||
{
|
||||
return default(short);
|
||||
}
|
||||
else
|
||||
{
|
||||
return employeeNumbers.First();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,241 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Repositories
|
||||
{
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Personalization.Models;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class EquipmentsRepository : IEquipmentsRepository
|
||||
{
|
||||
private readonly SqlConnection sqlConnection;
|
||||
|
||||
public EquipmentsRepository(SqlConnection sqlConnection)
|
||||
=> this.sqlConnection = sqlConnection;
|
||||
|
||||
public int Add(PruefmittelPruefung model)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT
|
||||
INTO [PruefmittelPruefung]
|
||||
( [SoftwareId]
|
||||
, [Pruefmittel]
|
||||
, [PruefmittelNr]
|
||||
, [Pruefintervall]
|
||||
, [Erforderlich]
|
||||
, [PruefdatumIst]
|
||||
, [PruefdatumSoll]
|
||||
, [Bemerkung]
|
||||
, [EmailFrom]
|
||||
, [EmailAn]
|
||||
, [InCcAn]
|
||||
, [Betreff]
|
||||
, [Nachricht]
|
||||
, [Meldung]
|
||||
, [Schedule])
|
||||
OUTPUT [inserted].[PruefmittelId]
|
||||
VALUES (@{nameof(model.SoftwareId)}
|
||||
, @{nameof(model.Pruefmittel)}
|
||||
, @{nameof(model.PruefmittelNr)}
|
||||
, @{nameof(model.Pruefintervall)}
|
||||
, @{nameof(model.Erforderlich)}
|
||||
, @{nameof(model.PruefdatumIst)}
|
||||
, @{nameof(model.PruefdatumSoll)}
|
||||
, @{nameof(model.Bemerkung)}
|
||||
, @{nameof(model.EmailFrom)}
|
||||
, @{nameof(model.EmailAn)}
|
||||
, @{nameof(model.InCcAn)}
|
||||
, @{nameof(model.Betreff)}
|
||||
, @{nameof(model.Nachricht)}
|
||||
, @{nameof(model.Meldung)}
|
||||
, @{nameof(model.Schedule)})")
|
||||
.SetParameter(nameof(model.SoftwareId), model.SoftwareId)
|
||||
.SetParameter(nameof(model.Pruefmittel), model.Pruefmittel)
|
||||
.SetParameter(nameof(model.PruefmittelNr), model.PruefmittelNr)
|
||||
.SetParameter(nameof(model.Pruefintervall), model.Pruefintervall)
|
||||
.SetParameter(nameof(model.Erforderlich), model.Erforderlich)
|
||||
.SetParameter(nameof(model.PruefdatumIst), model.PruefdatumIst)
|
||||
.SetParameter(nameof(model.PruefdatumSoll), model.PruefdatumSoll)
|
||||
.SetParameter(nameof(model.Bemerkung), model.Bemerkung)
|
||||
.SetParameter(nameof(model.EmailFrom), model.EmailFrom)
|
||||
.SetParameter(nameof(model.EmailAn), model.EmailAn)
|
||||
.SetParameter(nameof(model.InCcAn), model.InCcAn)
|
||||
.SetParameter(nameof(model.Betreff), model.Betreff)
|
||||
.SetParameter(nameof(model.Nachricht), model.Nachricht)
|
||||
.SetParameter(nameof(model.Meldung), model.Meldung)
|
||||
.SetParameter(nameof(model.Schedule), model.Schedule)
|
||||
.ExecuteScalar(x => x.GetValue<int>(0));
|
||||
|
||||
public PruefmittelPruefung FindById(int pruefmittelId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [PruefmittelId]
|
||||
, [SoftwareId]
|
||||
, [Pruefmittel]
|
||||
, [PruefmittelNr]
|
||||
, [Pruefintervall]
|
||||
, [Erforderlich]
|
||||
, [PruefdatumIst]
|
||||
, [PruefdatumSoll]
|
||||
, [Bemerkung]
|
||||
, [EmailFrom]
|
||||
, [EmailAn]
|
||||
, [InCcAn]
|
||||
, [Betreff]
|
||||
, [Nachricht]
|
||||
, [Meldung]
|
||||
, [Schedule]
|
||||
FROM [PruefmittelPruefung]
|
||||
WHERE [PruefmittelId] = @{nameof(pruefmittelId)}")
|
||||
.SetParameter(nameof(pruefmittelId), pruefmittelId)
|
||||
.FirstOrDefault(x => new PruefmittelPruefung
|
||||
{
|
||||
PruefmittelId = x.GetValue<int>(0),
|
||||
SoftwareId = x.GetValue<short>(1),
|
||||
Pruefmittel = x.GetValue<string>(2),
|
||||
PruefmittelNr = x.GetValue<string>(3),
|
||||
Pruefintervall = x.GetValue<int>(4),
|
||||
Erforderlich = x.GetValue<bool>(5),
|
||||
PruefdatumIst = x.GetValue<DateTime>(6),
|
||||
PruefdatumSoll = x.GetValue<DateTime>(7),
|
||||
Bemerkung = x.GetValue<string>(8),
|
||||
EmailFrom = x.GetValue<string>(9),
|
||||
EmailAn = x.GetValue<string>(10),
|
||||
InCcAn = x.GetValue<string>(11),
|
||||
Betreff = x.GetValue<string>(12),
|
||||
Nachricht = x.GetValue<string>(13),
|
||||
Meldung = x.GetValue<string>(14),
|
||||
Schedule = x.GetValue<string>(15)
|
||||
});
|
||||
|
||||
public IEnumerable<PruefmittelPruefung> SelectAll(int softwareId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [PruefmittelId]
|
||||
, [SoftwareId]
|
||||
, [Pruefmittel]
|
||||
, [PruefmittelNr]
|
||||
, [Pruefintervall]
|
||||
, [Erforderlich]
|
||||
, [PruefdatumIst]
|
||||
, [PruefdatumSoll]
|
||||
, [Bemerkung]
|
||||
, [EmailFrom]
|
||||
, [EmailAn]
|
||||
, [InCcAn]
|
||||
, [Betreff]
|
||||
, [Nachricht]
|
||||
, [Meldung]
|
||||
, [Schedule]
|
||||
FROM [PruefmittelPruefung]
|
||||
WHERE [SoftwareId] = @{nameof(softwareId)}")
|
||||
.SetParameter(nameof(softwareId), softwareId)
|
||||
.ExecuteReader(x => new PruefmittelPruefung
|
||||
{
|
||||
PruefmittelId = x.GetValue<int>(0),
|
||||
SoftwareId = x.GetValue<short>(1),
|
||||
Pruefmittel = x.GetValue<string>(2),
|
||||
PruefmittelNr = x.GetValue<string>(3),
|
||||
Pruefintervall = x.GetValue<int>(4),
|
||||
Erforderlich = x.GetValue<bool>(5),
|
||||
PruefdatumIst = x.GetValue<DateTime>(6),
|
||||
PruefdatumSoll = x.GetValue<DateTime>(7),
|
||||
Bemerkung = x.GetValue<string>(8),
|
||||
EmailFrom = x.GetValue<string>(9),
|
||||
EmailAn = x.GetValue<string>(10),
|
||||
InCcAn = x.GetValue<string>(11),
|
||||
Betreff = x.GetValue<string>(12),
|
||||
Nachricht = x.GetValue<string>(13),
|
||||
Meldung = x.GetValue<string>(14),
|
||||
Schedule = x.GetValue<string>(15)
|
||||
});
|
||||
|
||||
public int Remove(int pruefmittelId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
DELETE
|
||||
FROM [PruefmittelPruefung]
|
||||
WHERE [PruefmittelId] = @{nameof(pruefmittelId)}")
|
||||
.SetParameter(nameof(pruefmittelId), pruefmittelId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public IEnumerable<PruefmittelPruefung> SelectAll()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand(@"
|
||||
SELECT [PruefmittelId]
|
||||
, [SoftwareId]
|
||||
, [Pruefmittel]
|
||||
, [PruefmittelNr]
|
||||
, [Pruefintervall]
|
||||
, [Erforderlich]
|
||||
, [PruefdatumIst]
|
||||
, [PruefdatumSoll]
|
||||
, [Bemerkung]
|
||||
, [EmailFrom]
|
||||
, [EmailAn]
|
||||
, [InCcAn]
|
||||
, [Betreff]
|
||||
, [Nachricht]
|
||||
, [Meldung]
|
||||
, [Schedule]
|
||||
FROM [PruefmittelPruefung]")
|
||||
.ExecuteReader(x => new PruefmittelPruefung
|
||||
{
|
||||
PruefmittelId = x.GetValue<int>(0),
|
||||
SoftwareId = x.GetValue<short>(1),
|
||||
Pruefmittel = x.GetValue<string>(2),
|
||||
PruefmittelNr = x.GetValue<string>(3),
|
||||
Pruefintervall = x.GetValue<int>(4),
|
||||
Erforderlich = x.GetValue<bool>(5),
|
||||
PruefdatumIst = x.GetValue<DateTime>(6),
|
||||
PruefdatumSoll = x.GetValue<DateTime>(7),
|
||||
Bemerkung = x.GetValue<string>(8),
|
||||
EmailFrom = x.GetValue<string>(9),
|
||||
EmailAn = x.GetValue<string>(10),
|
||||
InCcAn = x.GetValue<string>(11),
|
||||
Betreff = x.GetValue<string>(12),
|
||||
Nachricht = x.GetValue<string>(13),
|
||||
Meldung = x.GetValue<string>(14),
|
||||
Schedule = x.GetValue<string>(15)
|
||||
});
|
||||
|
||||
public int Update(PruefmittelPruefung model)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE [PruefmittelPruefung]
|
||||
SET [SoftwareId] = @{nameof(model.SoftwareId)}
|
||||
, [Pruefmittel] = @{nameof(model.Pruefmittel)}
|
||||
, [PruefmittelNr] = @{nameof(model.PruefmittelNr)}
|
||||
, [Pruefintervall] = @{nameof(model.Pruefintervall)}
|
||||
, [Erforderlich] = @{nameof(model.Erforderlich)}
|
||||
, [PruefdatumIst] = @{nameof(model.PruefdatumIst)}
|
||||
, [PruefdatumSoll] = @{nameof(model.PruefdatumSoll)}
|
||||
, [Bemerkung] = @{nameof(model.Bemerkung)}
|
||||
, [EmailFrom] = @{nameof(model.EmailFrom)}
|
||||
, [EmailAn] = @{nameof(model.EmailAn)}
|
||||
, [InCcAn] = @{nameof(model.InCcAn)}
|
||||
, [Betreff] = @{nameof(model.Betreff)}
|
||||
, [Nachricht] = @{nameof(model.Nachricht)}
|
||||
, [Meldung] = @{nameof(model.Meldung)}
|
||||
, [Schedule] = @{nameof(model.Schedule)}
|
||||
WHERE [PruefmittelId] = @{nameof(model.PruefmittelId)}")
|
||||
.SetParameter(nameof(model.SoftwareId), model.SoftwareId)
|
||||
.SetParameter(nameof(model.PruefmittelId), model.PruefmittelId)
|
||||
.SetParameter(nameof(model.Pruefmittel), model.Pruefmittel)
|
||||
.SetParameter(nameof(model.PruefmittelNr), model.PruefmittelNr)
|
||||
.SetParameter(nameof(model.Pruefintervall), model.Pruefintervall)
|
||||
.SetParameter(nameof(model.Erforderlich), model.Erforderlich)
|
||||
.SetParameter(nameof(model.PruefdatumIst), model.PruefdatumIst)
|
||||
.SetParameter(nameof(model.PruefdatumSoll), model.PruefdatumSoll)
|
||||
.SetParameter(nameof(model.Bemerkung), model.Bemerkung)
|
||||
.SetParameter(nameof(model.EmailFrom), model.EmailFrom)
|
||||
.SetParameter(nameof(model.EmailAn), model.EmailAn)
|
||||
.SetParameter(nameof(model.InCcAn), model.InCcAn)
|
||||
.SetParameter(nameof(model.Betreff), model.Betreff)
|
||||
.SetParameter(nameof(model.Nachricht), model.Nachricht)
|
||||
.SetParameter(nameof(model.Meldung), model.Meldung)
|
||||
.SetParameter(nameof(model.Schedule), model.Schedule)
|
||||
.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Repositories
|
||||
{
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class FunctionsRepository : IFunctionsRepository
|
||||
{
|
||||
private readonly SqlConnection sqlConnection;
|
||||
|
||||
public FunctionsRepository(SqlConnection sqlConnection)
|
||||
=> this.sqlConnection = sqlConnection;
|
||||
|
||||
public void AddEmployeesFunctions(int functionId, IEnumerable<short> employees)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [UsersFunctions] ([UserId], [SoftwareFunctionId])
|
||||
VALUES {string.Join(", ", employees.Select((x, i) => $"({new System.Data.SqlClient.SqlParameter($"p{i}", x).SqlValue}, @{nameof(functionId)})"))}")
|
||||
.SetParameter(nameof(functionId), functionId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public int AddFunction(short softwareId, string function)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [SoftwareFunctions] ([AppId], [Function])
|
||||
OUTPUT [inserted].[Id]
|
||||
VALUES (@{nameof(softwareId)}, @{nameof(function)})")
|
||||
.SetParameter(nameof(softwareId), softwareId)
|
||||
.SetParameter(nameof(function), function)
|
||||
.ExecuteScalar(x => x.GetValue<int>(0));
|
||||
|
||||
public IEnumerable<string> All()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT [SF].[Function]
|
||||
FROM [SoftwareFunctions] AS [SF]")
|
||||
.ExecuteReader(x => x.GetValue<string>(0));
|
||||
|
||||
public IEnumerable<string> All(short appId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [SF].[Function]
|
||||
FROM [SoftwareFunctions] AS [SF]
|
||||
WHERE [SF].[AppId] = @{nameof(appId)}")
|
||||
.SetParameter(nameof(appId), appId)
|
||||
.ExecuteReader(x => x.GetValue<string>(0));
|
||||
|
||||
public void Delete(short employeeId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
DELETE FROM [UsersFunctions]
|
||||
WHERE [UserId] = @{nameof(employeeId)}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public void DeleteEmployeesFunctions(int functionId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
DELETE
|
||||
FROM [UsersFunctions]
|
||||
WHERE [SoftwareFunctionId] = @{nameof(functionId)}")
|
||||
.SetParameter(nameof(functionId), functionId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public void DeleteFunction(int functionId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
DELETE
|
||||
FROM [SoftwareFunctions]
|
||||
WHERE [Id] = @{nameof(functionId)}")
|
||||
.SetParameter(nameof(functionId), functionId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public IEnumerable<string> EmployeeAll(short employeeId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [SF].[Function]
|
||||
FROM [UsersFunctions] AS [UF]
|
||||
JOIN [SoftwareFunctions] AS [SF]
|
||||
ON [SF].[Id] = [UF].[SoftwareFunctionId]
|
||||
WHERE [UF].[UserId] = @{nameof(employeeId)}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.ExecuteReader(x => x.GetValue<string>(0));
|
||||
|
||||
public bool Exists(int softwareId, int functionId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT COUNT(1)
|
||||
FROM [SoftwareFunctions]
|
||||
WHERE [AppId] = @{nameof(softwareId)}
|
||||
AND [Id] = @{nameof(functionId)}")
|
||||
.SetParameter(nameof(softwareId), softwareId)
|
||||
.SetParameter(nameof(functionId), functionId)
|
||||
.FirstOrDefault(x => x.GetValue<int>(0) > 0);
|
||||
|
||||
public IEnumerable<string> Find(string token)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [SF].[Function]
|
||||
FROM [UsersFunctions] AS [UF]
|
||||
JOIN [SoftwareFunctions] AS [SF]
|
||||
ON [SF].[Id] = [UF].[SoftwareFunctionId]
|
||||
JOIN [MitarbeiterTokens] AS [MT]
|
||||
ON [MT].[UserId] = [UF].[UserId]
|
||||
AND [MT].[AppId] = [SF].[AppId]
|
||||
AND [MT].[Token] = @{nameof(token)}")
|
||||
.SetParameter(nameof(token), token)
|
||||
.ExecuteReader(x => x.GetValue<string>(0));
|
||||
|
||||
public void Insert(short employeeId, IEnumerable<string> functions)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [UsersFunctions] (
|
||||
[UserId]
|
||||
, [SoftwareFunctionId])
|
||||
SELECT @{nameof(employeeId)}
|
||||
, [Id]
|
||||
FROM [SoftwareFunctions]
|
||||
WHERE [Function] IN ({string.Join(", ", functions.Select(x => $"'{x}'"))})")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public void UpdateFunction(int functionId, string function)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE [SoftwareFunctions]
|
||||
SET [Function] = @{nameof(function)}
|
||||
WHERE [Id] = @{nameof(functionId)}")
|
||||
.SetParameter(nameof(functionId), functionId)
|
||||
.SetParameter(nameof(function), function)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public IEnumerable<KeyValuePair<short, int>> UserFunctionsCount()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
[UF].[UserId] AS [EmployeeId]
|
||||
, COUNT([SF].[Function]) AS [Functions]
|
||||
FROM [UsersFunctions] AS [UF]
|
||||
JOIN [SoftwareFunctions] AS [SF]
|
||||
ON [SF].[Id] = [UF].[SoftwareFunctionId]
|
||||
GROUP BY [UF].[UserId]")
|
||||
.ExecuteReader(x => new KeyValuePair<short, int>(x.GetValue<short>(0), x.GetValue<int>(1)));
|
||||
}
|
||||
}
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Repositories.Interfaces
|
||||
{
|
||||
using LaaProduction.Personalization.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IEmployeesRepository
|
||||
{
|
||||
IEnumerable<Employee> All();
|
||||
|
||||
void CreateToken(short appId, short userId);
|
||||
|
||||
short FindEmployeeNr(int employeeId);
|
||||
|
||||
short FindEmployeeNr(string username, string password);
|
||||
|
||||
Employee Find(short employeeId);
|
||||
|
||||
Employee GetEmployee(string token);
|
||||
|
||||
string GetToken(short appId, short userId);
|
||||
|
||||
EmployeeToken GetTokenData(string token);
|
||||
|
||||
IEnumerable<string> GetUserRoles(string token);
|
||||
|
||||
short Insert(int employeeId, string firstName, string lastName, string phone, string email, string username, string domainname, string password);
|
||||
|
||||
void ResetPassword(short employeeId);
|
||||
|
||||
void ResetTokens(short employeeId);
|
||||
|
||||
bool SetPassword(short employeeId, string password);
|
||||
|
||||
short Update(int employeeId, string firstName, string lastName, string phone, string email, string username, string domainname, string password);
|
||||
}
|
||||
}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Repositories.Interfaces
|
||||
{
|
||||
using LaaProduction.Personalization.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IEquipmentsRepository
|
||||
{
|
||||
int Add(PruefmittelPruefung model);
|
||||
|
||||
PruefmittelPruefung FindById(int pruefmittelId);
|
||||
|
||||
int Remove(int pruefmittelId);
|
||||
|
||||
IEnumerable<PruefmittelPruefung> SelectAll();
|
||||
|
||||
IEnumerable<PruefmittelPruefung> SelectAll(int softwareId);
|
||||
|
||||
int Update(PruefmittelPruefung model);
|
||||
}
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Repositories.Interfaces
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IFunctionsRepository
|
||||
{
|
||||
void AddEmployeesFunctions(int functionId, IEnumerable<short> employees);
|
||||
|
||||
int AddFunction(short softwareId, string function);
|
||||
|
||||
IEnumerable<string> All();
|
||||
|
||||
IEnumerable<string> All(short appId);
|
||||
|
||||
void Delete(short employeeId);
|
||||
|
||||
void DeleteEmployeesFunctions(int functionId);
|
||||
|
||||
void DeleteFunction(int functionId);
|
||||
|
||||
IEnumerable<string> EmployeeAll(short employeeId);
|
||||
|
||||
bool Exists(int softwareId, int functionId);
|
||||
|
||||
IEnumerable<string> Find(string token);
|
||||
|
||||
void Insert(short employeeId, IEnumerable<string> functions);
|
||||
|
||||
void UpdateFunction(int functionId, string function);
|
||||
|
||||
IEnumerable<KeyValuePair<short, int>> UserFunctionsCount();
|
||||
}
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Repositories.Interfaces
|
||||
{
|
||||
using LaaProduction.Personalization.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IRolesRepository
|
||||
{
|
||||
IEnumerable<Role> All();
|
||||
|
||||
IEnumerable<string> All(short employeeId);
|
||||
|
||||
void Delete(short employeeId);
|
||||
|
||||
void Insert(short employeeId, IEnumerable<string> roles);
|
||||
|
||||
void Insert(string role, IEnumerable<short> employees);
|
||||
|
||||
void Delete(string role);
|
||||
|
||||
IEnumerable<KeyValuePair<int, int>> UsersRolesCount();
|
||||
}
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Repositories.Interfaces
|
||||
{
|
||||
using LaaProduction.Personalization.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface ISoftwareRepository
|
||||
{
|
||||
void AddVersion(short softwareId, string assemblyName, int majorV, int minorV, int buildV, DateTime validUntil, string description);
|
||||
|
||||
short AppId(string software);
|
||||
|
||||
void Delete(int versionId);
|
||||
|
||||
SoftwareDetails Details(int versionId);
|
||||
|
||||
void EditVersion(int versionId, DateTime? validUntil, string description);
|
||||
|
||||
IEnumerable<SoftwareFunction> Functions(short softwareId);
|
||||
|
||||
IEnumerable<string> GetSoftwareFunctions(string token);
|
||||
|
||||
short Insert(string assembly, int major, int minor, int build);
|
||||
|
||||
IEnumerable<SoftwareItem> List();
|
||||
|
||||
short SoftwareId(string assembly);
|
||||
|
||||
IEnumerable<SoftwareVersion> Versions(short softwareId);
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Repositories
|
||||
{
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Personalization.Models;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class RolesRepository : IRolesRepository
|
||||
{
|
||||
private readonly SqlConnection sqlConnection;
|
||||
|
||||
public RolesRepository(SqlConnection sqlConnection)
|
||||
=> this.sqlConnection = sqlConnection;
|
||||
|
||||
public IEnumerable<Role> All()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand(@"
|
||||
SELECT [Recht]
|
||||
, [MitarbeiterNr]
|
||||
FROM [MitarbeiterRechte]")
|
||||
.ExecuteReader(x => new Role
|
||||
{
|
||||
Name = x.GetValue<string>(0),
|
||||
EmployeeId = (short)x.GetValue<int>(1)
|
||||
});
|
||||
|
||||
public IEnumerable<string> All(short employeeId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT [Recht]
|
||||
FROM [MitarbeiterRechte]
|
||||
WHERE [MitarbeiterNr] = @{nameof(employeeId)}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.ExecuteReader(x => x.GetValue<string>(0));
|
||||
|
||||
public void Delete(short employeeId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
DELETE FROM [MitarbeiterRechte]
|
||||
WHERE [MitarbeiterNr] = @{nameof(employeeId)}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public void Insert(short employeeId, IEnumerable<string> roles)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [MitarbeiterRechte] ([MitarbeiterNr], [Recht])
|
||||
VALUES {string.Join(", ", roles.Select((x, i) => $"(@{nameof(employeeId)}, '{new System.Data.SqlClient.SqlParameter(i.ToString(), x).SqlValue}')"))}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public void Insert(string role, IEnumerable<short> employees)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [MitarbeiterRechte] ([MitarbeiterNr], [Recht])
|
||||
VALUES {string.Join(", ", employees.Select((x, i) => $"('{new System.Data.SqlClient.SqlParameter(i.ToString(), x).SqlValue}', @{nameof(role)})"))}")
|
||||
.SetParameter(nameof(role), role)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public void Delete(string role)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
DELETE FROM [MitarbeiterRechte]
|
||||
WHERE [Recht] = @{nameof(role)}")
|
||||
.SetParameter(nameof(role), role)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public IEnumerable<KeyValuePair<int, int>> UsersRolesCount()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
[MitarbeiterNr]
|
||||
, COUNT([Recht])
|
||||
FROM [MitarbeiterRechte]
|
||||
GROUP BY [MitarbeiterNr]")
|
||||
.ExecuteReader(x => new KeyValuePair<int, int>(x.GetValue<int>(0), x.GetValue<int>(1)));
|
||||
}
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
namespace LaaProduction.Personalization.Repositories
|
||||
{
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProduction.Personalization.Models;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class SoftwareRepository : ISoftwareRepository
|
||||
{
|
||||
private readonly SqlConnection sqlConnection;
|
||||
|
||||
public SoftwareRepository(SqlConnection sqlConnection)
|
||||
=> this.sqlConnection = sqlConnection;
|
||||
|
||||
public void AddVersion(short softwareId, string assemblyName, int majorV, int minorV, int buildV, DateTime validUntil, string description)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [VersionSoftwareAccess] (
|
||||
[AppID]
|
||||
, [SoftwareAccess_Program]
|
||||
, [SoftwareAccess_MajorVersion]
|
||||
, [SoftwareAccess_MinorVersion]
|
||||
, [SoftwareAccess_BuildVersion]
|
||||
, [SoftwareAccess_VaildTo]
|
||||
, [SoftwareAccess_Desc])
|
||||
VALUES (@{nameof(softwareId)}
|
||||
, @{nameof(assemblyName)}
|
||||
, @{nameof(majorV)}
|
||||
, @{nameof(minorV)}
|
||||
, @{nameof(buildV)}
|
||||
, @{nameof(validUntil)}
|
||||
, @{nameof(description)})")
|
||||
.SetParameter(nameof(softwareId), softwareId)
|
||||
.SetParameter(nameof(assemblyName), assemblyName)
|
||||
.SetParameter(nameof(majorV), majorV)
|
||||
.SetParameter(nameof(minorV), minorV)
|
||||
.SetParameter(nameof(buildV), buildV)
|
||||
.SetParameter(nameof(validUntil), validUntil)
|
||||
.SetParameter(nameof(description), description)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public short AppId(string software)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [AppID]
|
||||
FROM [VersionSoftwareAccess]
|
||||
WHERE [SoftwareAccess_Program] = @{nameof(software)}")
|
||||
.SetParameter(nameof(software), software)
|
||||
.FirstOrDefault(x => x.GetValue<short>(0));
|
||||
|
||||
public void Delete(int versionId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
DELETE FROM [VersionSoftwareAccess]
|
||||
WHERE [SoftwareAccess_ID] = @{nameof(versionId)}")
|
||||
.SetParameter(nameof(versionId), versionId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public SoftwareDetails Details(int versionId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [AppID]
|
||||
, [SoftwareAccess_Program]
|
||||
, [SoftwareAccess_MajorVersion]
|
||||
, [SoftwareAccess_MinorVersion]
|
||||
, [SoftwareAccess_BuildVersion]
|
||||
, [SoftwareAccess_ID]
|
||||
, [SoftwareAccess_VaildTo]
|
||||
, [SoftwareAccess_Desc]
|
||||
FROM [VersionSoftwareAccess]
|
||||
WHERE [SoftwareAccess_ID] = @{nameof(versionId)}")
|
||||
.SetParameter(nameof(versionId), versionId)
|
||||
.FirstOrDefault(x => new SoftwareDetails
|
||||
{
|
||||
SoftwareId = x.GetValue<short>(0),
|
||||
AssemblyName = x.GetValue<string>(1),
|
||||
VersionNr = $"{x.GetValue<int>(2)}.{x.GetValue<int>(3)}.{x.GetValue<int>(4)}",
|
||||
VersionId = x.GetValue<int>(5),
|
||||
ValidUntil = $"{x.GetValue<DateTime>(6):yyyy-MM-dd}",
|
||||
Description = x.GetValue<string>(7),
|
||||
});
|
||||
|
||||
public void EditVersion(int versionId, DateTime? validUntil, string description)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE [VersionSoftwareAccess]
|
||||
SET [SoftwareAccess_VaildTo] = @{nameof(validUntil)}
|
||||
, [SoftwareAccess_Desc] = @{nameof(description)}
|
||||
WHERE [SoftwareAccess_ID] = @{nameof(versionId)}")
|
||||
.SetParameter(nameof(versionId), versionId)
|
||||
.SetParameter(nameof(validUntil), validUntil)
|
||||
.SetParameter(nameof(description), description)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public IEnumerable<SoftwareFunction> Functions(short softwareId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [AppId]
|
||||
, [Id]
|
||||
, [Function]
|
||||
FROM [SoftwareFunctions]
|
||||
WHERE [AppId] = @{nameof(softwareId)}")
|
||||
.SetParameter(nameof(softwareId), softwareId)
|
||||
.ExecuteReader(x => new SoftwareFunction
|
||||
{
|
||||
SoftwareId = x.GetValue<short>(0),
|
||||
FunctionId = x.GetValue<int>(1),
|
||||
Function = x.GetValue<string>(2)
|
||||
});
|
||||
|
||||
public IEnumerable<string> GetSoftwareFunctions(string token)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [SF].[Function]
|
||||
FROM [MitarbeiterTokens] AS [MT]
|
||||
JOIN [SoftwareFunctions] AS [SF]
|
||||
ON [SF].[AppId] = [MT].[AppId]
|
||||
WHERE [MT].[Token] = @{nameof(token)}")
|
||||
.SetParameter(nameof(token), token)
|
||||
.ExecuteReader(x => x.GetValue<string>(0));
|
||||
|
||||
public short Insert(string assembly, int major, int minor, int build)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [VersionSoftwareAccess] (
|
||||
[SoftwareAccess_Program]
|
||||
, [SoftwareAccess_MajorVersion]
|
||||
, [SoftwareAccess_MinorVersion]
|
||||
, [SoftwareAccess_BuildVersion]
|
||||
, [SoftwareAccess_VaildTo]
|
||||
, [SoftwareAccess_Desc]
|
||||
, [AppID])
|
||||
OUTPUT [inserted].[AppId]
|
||||
VALUES (@{nameof(assembly)}
|
||||
, @{nameof(major)}
|
||||
, @{nameof(minor)}
|
||||
, @{nameof(build)}
|
||||
, GETDATE()
|
||||
, 'Automatically created on first use.'
|
||||
, (SELECT MAX([AppId]) + 1 FROM [VersionSoftwareAccess]))")
|
||||
.SetParameter(nameof(assembly), assembly)
|
||||
.SetParameter(nameof(major), major)
|
||||
.SetParameter(nameof(minor), minor)
|
||||
.SetParameter(nameof(build), build)
|
||||
.ExecuteScalar(x => x.GetValue<short>(0));
|
||||
|
||||
public IEnumerable<SoftwareItem> List()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Software].[SoftwareId]
|
||||
, [Software].[AssemblyName]
|
||||
, [Software].[MajorV]
|
||||
, [Software].[MinorV]
|
||||
, [Software].[Build]
|
||||
, [Software].[VersionId]
|
||||
, [Software].[ValidUntil]
|
||||
, [Software].[Description]
|
||||
FROM (SELECT [AppID] AS [SoftwareId]
|
||||
, [SoftwareAccess_Program] AS [AssemblyName]
|
||||
, [SoftwareAccess_MajorVersion] AS [MajorV]
|
||||
, [SoftwareAccess_MinorVersion] AS [MinorV]
|
||||
, [SoftwareAccess_BuildVersion] AS [Build]
|
||||
, [SoftwareAccess_ID] AS [VersionId]
|
||||
, [SoftwareAccess_VaildTo] AS [ValidUntil]
|
||||
, [SoftwareAccess_Desc] AS [Description]
|
||||
, ROW_NUMBER()
|
||||
OVER (PARTITION BY [AppID]
|
||||
ORDER BY [SoftwareAccess_VaildTo] DESC) AS [RowNumber]
|
||||
FROM [VersionSoftwareAccess])
|
||||
AS [Software]
|
||||
WHERE [Software].[RowNumber] <= 1
|
||||
ORDER BY [Software].[AssemblyName]")
|
||||
.ExecuteReader(x => new SoftwareItem
|
||||
{
|
||||
SoftwareId = x.GetValue<short>(0),
|
||||
AssemblyName = x.GetValue<string>(1),
|
||||
CurrentVersion = $"{x.GetValue<int>(2)}.{x.GetValue<int>(3)}.{x.GetValue<int>(4)}",
|
||||
VersionId = x.GetValue<int>(5),
|
||||
ValidUntil = $"{x.GetValue<DateTime>(6):yyyy-MM-dd}",
|
||||
Description = x.GetValue<string>(7),
|
||||
});
|
||||
|
||||
public short SoftwareId(string assembly)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [AppId]
|
||||
FROM [VersionSoftwareAccess]
|
||||
WHERE [SoftwareAccess_Program] = @{nameof(assembly)}")
|
||||
.SetParameter(nameof(assembly), assembly)
|
||||
.FirstOrDefault(x => x.GetValue<short>(0));
|
||||
|
||||
public IEnumerable<SoftwareVersion> Versions(short softwareId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [AppId]
|
||||
, [SoftwareAccess_Program]
|
||||
, [SoftwareAccess_ID]
|
||||
, [SoftwareAccess_MajorVersion]
|
||||
, [SoftwareAccess_MinorVersion]
|
||||
, [SoftwareAccess_BuildVersion]
|
||||
, [SoftwareAccess_VaildTo]
|
||||
, [SoftwareAccess_Desc]
|
||||
FROM [VersionSoftwareAccess]
|
||||
WHERE [AppId] = @{nameof(softwareId)}")
|
||||
.SetParameter(nameof(softwareId), softwareId)
|
||||
.ExecuteReader(x => new SoftwareVersion
|
||||
{
|
||||
SoftwareId = x.GetValue<short>(0),
|
||||
AssemblyName = x.GetValue<string>(1),
|
||||
VersionId = x.GetValue<int>(2),
|
||||
VersionNr = $"{x.GetValue<int>(3)}.{x.GetValue<int>(4)}.{x.GetValue<int>(5)}",
|
||||
ValidUntil = $"{x.GetValue<DateTime>(6):yyyy-MM-dd}",
|
||||
Description = x.GetValue<string>(7),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
public enum SoftwareFunctions
|
||||
{
|
||||
DEV_FILE_CONTROL,
|
||||
DEV_FILE_SPLIT,
|
||||
DEV_LEGACY_TEST_APP,
|
||||
DEV_LOW_LEVEL_TOOLS,
|
||||
GENERAL_ALARM,
|
||||
GENERAL_FIRMWARE_UPDATE,
|
||||
GENERAL_LUT_MANAGEMENT,
|
||||
GENERAL_LUT_UPDATE,
|
||||
GENERAL_PRESSURE_LOG,
|
||||
GENERAL_PULS_CONFIG,
|
||||
GENERAL_REGISTER_STORE,
|
||||
GENERAL_SETUP,
|
||||
GENERAL_STREAM_QUALITY,
|
||||
GENERAL_TEMP_METER,
|
||||
LAA_MAPPING_NA,
|
||||
LAA_PARAMETERIZATION,
|
||||
LAA_PASSWORD,
|
||||
LAA_PROCESS_PARAMETER,
|
||||
LAA_REGISTER_HISTORY,
|
||||
LAA_ADMIN,
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user