init
This commit is contained in:
272
DataPRO/DbAPI/TestSetups/CalculatedChannels.cs
Normal file
272
DataPRO/DbAPI/TestSetups/CalculatedChannels.cs
Normal file
@@ -0,0 +1,272 @@
|
||||
using DbAPI.Connections;
|
||||
using DbAPI.Errors;
|
||||
using DbAPI.Logging;
|
||||
using DTS.Common.Classes;
|
||||
using DTS.Common.Classes.TestSetups;
|
||||
using DTS.Common.Interface.Database;
|
||||
using DTS.Common.Interface.TestSetups;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DbAPI.TestSetups
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles calculated channel functions
|
||||
/// <inheritdoc cref="ICalculatedChannels"/>
|
||||
/// </summary>
|
||||
internal class CalculatedChannels : ICalculatedChannels
|
||||
{
|
||||
/// <summary>
|
||||
/// removes calculated channel from database
|
||||
/// </summary>
|
||||
/// <param name="user">user committing delete</param>
|
||||
/// <param name="connection">connection over which to delete</param>
|
||||
/// <param name="calculatedChannelId">database id of calculated channel to delete</param>
|
||||
/// <returns></returns>
|
||||
public ulong CalculatedChannelsDelete(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int calculatedChannelId)
|
||||
{
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
var ret = ConnectionManager.GetSqlCommand(connection, out var cmd, "sp_CalculatedChannelsDelete");
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.Parameters.Add(new SqlParameter("@CalculatedChannelsId", SqlDbType.Int) { Value = calculatedChannelId });
|
||||
var errorNumber = new SqlParameter("@errorNumber", SqlDbType.Int)
|
||||
{ Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorNumber);
|
||||
var errorMessage = new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250)
|
||||
{ Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorMessage);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
if (!DBNull.Value.Equals(errorNumber.Value) && 0 != Convert.ToInt32(errorNumber.Value))
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.CalculatedChannels, $"sp_CalculatedChannelsDelete failed: {errorNumber.Value} : {errorMessage.Value}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.CalculatedChannels, $"sp_CalculatedChannelsDelete failed: {ex.Message}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
cmd.Dispose();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// inserts a new calculated channel into the database
|
||||
/// original record is modified with database id after insert is complete
|
||||
/// </summary>
|
||||
/// <param name="user">user adding record</param>
|
||||
/// <param name="connection">connection record is being added on</param>
|
||||
/// <param name="record">record being added</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
public ulong CalculatedChannelsInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ref ICalculatedChannelRecord record)
|
||||
{
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
if (null == record)
|
||||
{
|
||||
return ErrorCodes.ERROR_MISSING_PARAMETER;
|
||||
}
|
||||
var ret = ConnectionManager.GetSqlCommand(connection, out var cmd, "sp_CalculatedChannelsInsert");
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.Parameters.Add(new SqlParameter("@Operation", SqlDbType.Int) { Value = (int)record.Operation });
|
||||
cmd.Parameters.Add(new SqlParameter("@CalculatedChannelValueCode", SqlDbType.NVarChar, 255)
|
||||
{ Value = record.CalculatedValueCode });
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@InputChannelIds", SqlDbType.VarBinary)
|
||||
{
|
||||
Value = Utility.GetBytesFromStringArray(record.InputChannelIds,
|
||||
CultureInfo.InvariantCulture.TextInfo.ListSeparator)
|
||||
});
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@CFCForInputChannels", SqlDbType.NVarChar, 255) { Value = record.CFCForInputChannels });
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@CFCForOutput", SqlDbType.NVarChar, 255)
|
||||
{ Value = record.ChannelFilterClassForOutput });
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("TestSetupName", SqlDbType.NVarChar, 255)
|
||||
{ Value = record.TestSetupName });
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@CCName", SqlDbType.NVarChar, 255) { Value = record.Name });
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@ViewInRealtime", SqlDbType.Bit) { Value = record.ViewInRealtime });
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@ClipLength", SqlDbType.Int) { Value = record.ClipLength });
|
||||
|
||||
var newId = new SqlParameter("@new_id", SqlDbType.Int) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(newId);
|
||||
|
||||
var errorNumber = new SqlParameter("@errorNumber", SqlDbType.Int)
|
||||
{ Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorNumber);
|
||||
|
||||
var errorMessage = new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250)
|
||||
{ Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorMessage);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
if (null != errorNumber.Value && 0 != Convert.ToInt32(errorNumber.Value))
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.CalculatedChannels, $"sp_CalculatedChannelsInsert failed: {errorNumber.Value} : {errorMessage.Value}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
record.Id = Convert.ToInt32(newId.Value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.CalculatedChannels, $"sp_CalculatedChannelsInsert failed: {ex.Message}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
cmd.Dispose();
|
||||
}
|
||||
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
/// <summary>
|
||||
/// updates calculated channel in the database
|
||||
/// </summary>
|
||||
/// <param name="user">user updating record</param>
|
||||
/// <param name="connection">connection record is being updated on</param>
|
||||
/// <param name="record">record to be updated</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
public ulong CalculatedChannelsUpdate(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ICalculatedChannelRecord record)
|
||||
{
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
if (null == record)
|
||||
{
|
||||
return ErrorCodes.ERROR_MISSING_PARAMETER;
|
||||
}
|
||||
var ret = ConnectionManager.GetSqlCommand(connection, out var cmd, "sp_CalculatedChannelsUpdate");
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Int) { Value = record.Id });
|
||||
cmd.Parameters.Add(new SqlParameter("@Operation", SqlDbType.Int) { Value = (int)record.Operation });
|
||||
cmd.Parameters.Add(new SqlParameter("@CalculatedChannelValueCode", SqlDbType.NVarChar, 255)
|
||||
{ Value = record.CalculatedValueCode });
|
||||
cmd.Parameters.Add(new SqlParameter("@InputChannelIds", SqlDbType.VarBinary)
|
||||
{ Value = Utility.GetBytesFromStringArray(record.InputChannelIds, CultureInfo.InvariantCulture.TextInfo.ListSeparator) });
|
||||
cmd.Parameters.Add(new SqlParameter("@CFCForInputChannels", SqlDbType.NVarChar) { Value = record.CFCForInputChannels });
|
||||
cmd.Parameters.Add(new SqlParameter("@CFCForOutput", SqlDbType.NVarChar, 255)
|
||||
{ Value = record.ChannelFilterClassForOutput });
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupName", SqlDbType.NVarChar, 255)
|
||||
{ Value = record.TestSetupName });
|
||||
cmd.Parameters.Add(new SqlParameter("@CCName", SqlDbType.NVarChar, 255) { Value = record.Name });
|
||||
cmd.Parameters.Add(new SqlParameter("@ViewInRealtime", SqlDbType.Bit) { Value = record.ViewInRealtime });
|
||||
cmd.Parameters.Add(new SqlParameter("@ClipLength", SqlDbType.Int) { Value = record.ClipLength });
|
||||
var errorNumber = new SqlParameter("@errorNumber", SqlDbType.Int) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorNumber);
|
||||
var errorMessage = new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250)
|
||||
{ Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorMessage);
|
||||
cmd.ExecuteNonQuery();
|
||||
if (null != errorNumber.Value && 0 != Convert.ToInt32(errorNumber.Value))
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.CalculatedChannels, $"sp_CalculatedChannelsUpdate failed: {errorNumber.Value} : {errorMessage.Value}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.CalculatedChannels, $"sp_CalculatedChannelsUpdate failed: {ex.Message}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
cmd.Dispose();
|
||||
}
|
||||
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
/// <summary>
|
||||
/// retrieves all CalculatedChannel records matching search criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user making query</param>
|
||||
/// <param name="connection">connection query is being made on</param>
|
||||
/// <param name="calculatedChannelId">database id of calculated channel (can be null)</param>
|
||||
/// <param name="testSetupName">test setup calculated channel(s) belong to (can be empty)</param>
|
||||
/// <param name="records">all matching records found</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
public ulong CalculatedChannelsGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? calculatedChannelId,
|
||||
string testSetupName,
|
||||
out ICalculatedChannelRecord[] records)
|
||||
{
|
||||
records = new ICalculatedChannelRecord[0];
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
var ret = ConnectionManager.GetSqlCommand(connection, out var cmd, "sp_CalculatedChannelsGet");
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
if (null == calculatedChannelId)
|
||||
{
|
||||
cmd.Parameters.Add(new SqlParameter("@CalculatedChannelsId", SqlDbType.Int) { Value = null });
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.Parameters.Add(new SqlParameter("@CalculatedChannelsId", SqlDbType.Int) { Value = (int)calculatedChannelId });
|
||||
}
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupName", SqlDbType.NVarChar, 50) { Value = testSetupName });
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
var list = new List<ICalculatedChannelRecord>();
|
||||
while (reader.Read())
|
||||
{
|
||||
list.Add(new CalculatedChannelRecord(reader));
|
||||
}
|
||||
records = list.ToArray();
|
||||
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.Graphs, $"sp_CalculatedChannelsGet failed: {ex.Message}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
cmd.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
275
DataPRO/DbAPI/TestSetups/Graphs.cs
Normal file
275
DataPRO/DbAPI/TestSetups/Graphs.cs
Normal file
@@ -0,0 +1,275 @@
|
||||
using DbAPI.Connections;
|
||||
using DbAPI.Errors;
|
||||
using DbAPI.Logging;
|
||||
using DTS.Common.Classes.TestSetups;
|
||||
using DTS.Common.Interface.Database;
|
||||
using DTS.Common.Interface.Graphs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace DbAPI.TestSetups
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles graph functions
|
||||
/// <inheritdoc cref="IGraphs"/>
|
||||
/// </summary>
|
||||
internal class Graphs : IGraphs
|
||||
{
|
||||
/// <summary>
|
||||
/// removes a record from the db
|
||||
/// </summary>
|
||||
/// <param name="user">user removing record</param>
|
||||
/// <param name="connection">connection record is being removed on</param>
|
||||
/// <param name="graphId">database id of record being removed</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
public ulong GraphsDelete(IUserDbRecord user, IConnectionDetails connection, int graphId)
|
||||
{
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
var ret = ConnectionManager.GetSqlCommand(connection, out var cmd, "sp_TestGraphsDelete");
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupId", SqlDbType.Int) { Value = null });
|
||||
cmd.Parameters.Add(new SqlParameter("@GraphId", SqlDbType.Int) { Value = graphId });
|
||||
var errorNumber = new SqlParameter("@errorNumber", SqlDbType.Int)
|
||||
{ Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorNumber);
|
||||
|
||||
var errorMessage = new SqlParameter("@errorMessage", SqlDbType.NVarChar, 255)
|
||||
{ Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorMessage);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
if (null != errorNumber.Value && 0 != Convert.ToInt32(errorNumber.Value))
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.Graphs, $"GraphsDelete error: {errorNumber.Value} - {errorMessage.Value}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.Graphs, $"GraphsInsert exception {ex.Message}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
/// <summary>
|
||||
/// inserts a record into the db, updates GraphId of record after insert with database id
|
||||
/// </summary>
|
||||
/// <param name="user">user inserting record</param>
|
||||
/// <param name="connection">connection record is being inserted on</param>
|
||||
/// <param name="record">record being inserted</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
public ulong GraphsInsert(IUserDbRecord user, IConnectionDetails connection, ref IGraphRecord record)
|
||||
{
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
var ret = ConnectionManager.GetSqlCommand(connection, out var cmd, "sp_TestGraphsInsert");
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
if (null == record)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.Graphs, $"GraphsUpdate no record supplied to update");
|
||||
cmd.Connection.Dispose();
|
||||
return ErrorCodes.ERROR_MISSING_PARAMETER;
|
||||
}
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupId", SqlDbType.Int) { Value = record.TestSetupId });
|
||||
cmd.Parameters.Add(new SqlParameter("@GraphName", SqlDbType.NVarChar, 50)
|
||||
{ Value = record.GraphName });
|
||||
cmd.Parameters.Add(new SqlParameter("@GraphDescription", SqlDbType.NVarChar, 50)
|
||||
{ Value = record.GraphDescription });
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@Channels", SqlDbType.NVarChar, 2048) { Value = record.ChannelsString });
|
||||
cmd.Parameters.Add(new SqlParameter("@UseDomainMin", SqlDbType.Bit) { Value = record.UseDomainMin });
|
||||
cmd.Parameters.Add(new SqlParameter("@DomainMin", SqlDbType.Float) { Value = record.DomainMin });
|
||||
cmd.Parameters.Add(new SqlParameter("@UseDomainMax", SqlDbType.Bit) { Value = record.UseDomainMax });
|
||||
cmd.Parameters.Add(new SqlParameter("@DomainMax", SqlDbType.Float) { Value = record.DomainMax });
|
||||
cmd.Parameters.Add(new SqlParameter("@UseRangeMin", SqlDbType.Bit) { Value = record.UseRangeMin });
|
||||
cmd.Parameters.Add(new SqlParameter("@RangeMin", SqlDbType.Float) { Value = record.RangeMin });
|
||||
cmd.Parameters.Add(new SqlParameter("@UseRangeMax", SqlDbType.Bit) { Value = record.UseRangeMax });
|
||||
cmd.Parameters.Add(new SqlParameter("@RangeMax", SqlDbType.Float) { Value = record.RangeMax });
|
||||
cmd.Parameters.Add(
|
||||
new SqlParameter("@Thresholds", SqlDbType.NVarChar, 2048) { Value = record.ThresholdsString });
|
||||
cmd.Parameters.Add(new SqlParameter("@LocalOnly", SqlDbType.Bit) { Value = record.LocalOnly });
|
||||
|
||||
var newId = new SqlParameter("@new_id", SqlDbType.Int) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(newId);
|
||||
|
||||
var errorNumber = new SqlParameter("@errorNumber", SqlDbType.Int)
|
||||
{ Direction = ParameterDirection.Output };
|
||||
|
||||
cmd.Parameters.Add(errorNumber);
|
||||
|
||||
var errorMessage = new SqlParameter("@errorMessage", SqlDbType.NVarChar, 255)
|
||||
{ Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorMessage);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
if (null != errorNumber.Value && 0 != Convert.ToInt32(errorNumber.Value))
|
||||
{
|
||||
throw new Exception((string)errorMessage.Value);
|
||||
}
|
||||
|
||||
record.GraphId = Convert.ToInt32(newId.Value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.Graphs, $"GraphsInsert exception {ex.Message}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
/// <summary>
|
||||
/// updates a record in the database
|
||||
/// </summary>
|
||||
/// <param name="user">user updating record</param>
|
||||
/// <param name="connection">connection record is being updated on</param>
|
||||
/// <param name="record">record to update</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
public ulong GraphsUpdate(IUserDbRecord user, IConnectionDetails connection, IGraphRecord record)
|
||||
{
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
var ret = ConnectionManager.GetSqlCommand(connection, out var cmd, "sp_TestGraphsUpdate");
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
try
|
||||
{
|
||||
if (null == record)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.Graphs, $"GraphsUpdate no record supplied to update");
|
||||
return ErrorCodes.ERROR_MISSING_PARAMETER;
|
||||
}
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.Parameters.Add(new SqlParameter("@GraphId", SqlDbType.Int) { Value = record.GraphId });
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupId", SqlDbType.Int) { Value = record.TestSetupId });
|
||||
cmd.Parameters.Add(new SqlParameter("@GraphName", SqlDbType.NVarChar, 50)
|
||||
{ Value = record.GraphName });
|
||||
cmd.Parameters.Add(new SqlParameter("@GraphDescription", SqlDbType.NVarChar, 50)
|
||||
{ Value = record.GraphDescription });
|
||||
cmd.Parameters.Add(new SqlParameter("@Channels", SqlDbType.NVarChar, 2048) { Value = record.ChannelsString });
|
||||
cmd.Parameters.Add(new SqlParameter("@UseDomainMin", SqlDbType.Bit) { Value = record.UseDomainMin });
|
||||
cmd.Parameters.Add(new SqlParameter("@DomainMin", SqlDbType.Float) { Value = record.DomainMin });
|
||||
cmd.Parameters.Add(new SqlParameter("@UseDomainMax", SqlDbType.Bit) { Value = record.UseDomainMax });
|
||||
cmd.Parameters.Add(new SqlParameter("@DomainMax", SqlDbType.Float) { Value = record.DomainMax });
|
||||
cmd.Parameters.Add(new SqlParameter("@UseRangeMin", SqlDbType.Bit) { Value = record.UseRangeMin });
|
||||
cmd.Parameters.Add(new SqlParameter("@RangeMin", SqlDbType.Float) { Value = record.RangeMin });
|
||||
cmd.Parameters.Add(new SqlParameter("@UseRangeMax", SqlDbType.Bit) { Value = record.UseRangeMax });
|
||||
cmd.Parameters.Add(new SqlParameter("@RangeMax", SqlDbType.Float) { Value = record.RangeMax });
|
||||
cmd.Parameters.Add(
|
||||
new SqlParameter("@Thresholds", SqlDbType.NVarChar, 2048) { Value = record.ThresholdsString });
|
||||
cmd.Parameters.Add(new SqlParameter("@LocalOnly", SqlDbType.Bit) { Value = record.LocalOnly });
|
||||
|
||||
var errorNumber = new SqlParameter("@errorNumber", SqlDbType.Int)
|
||||
{ Direction = ParameterDirection.Output };
|
||||
|
||||
cmd.Parameters.Add(errorNumber);
|
||||
|
||||
var errorMessage = new SqlParameter("@errorMessage", SqlDbType.NVarChar, 255)
|
||||
{ Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorMessage);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
if (null != errorNumber.Value && 0 != Convert.ToInt32(errorNumber.Value))
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.Graphs, $"GraphsUpdate exception {errorNumber.Value} - {errorMessage.Value}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.Graphs, $"GraphsUpdate exception {ex.Message}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
/// <summary>
|
||||
/// retrieves all graph records matching search criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user making query</param>
|
||||
/// <param name="connection">connection query is being made on</param>
|
||||
/// <param name="graphId">graph to query for (can be null)</param>
|
||||
/// <param name="testSetupId">test setup graph belongs to</param>
|
||||
/// <param name="records">all matching records found</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
public ulong GraphsGet(IUserDbRecord user, IConnectionDetails connection,
|
||||
int? graphId,
|
||||
int? testSetupId,
|
||||
out IGraphRecord[] records)
|
||||
{
|
||||
records = new IGraphRecord[0];
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
var ret = ConnectionManager.GetSqlCommand(connection, out var cmd, "sp_TestGraphsGet");
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
if (null == graphId)
|
||||
{
|
||||
cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int) { Value = null });
|
||||
}
|
||||
else { cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int) { Value = (int)graphId }); }
|
||||
|
||||
if (null == testSetupId)
|
||||
{
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupId", SqlDbType.Int) { Value = null });
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupId", SqlDbType.Int) { Value = (int)testSetupId });
|
||||
}
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
var list = new List<IGraphRecord>();
|
||||
while (reader.Read())
|
||||
{
|
||||
var graph = new GraphRecord(reader);
|
||||
list.Add(graph);
|
||||
}
|
||||
records = list.ToArray();
|
||||
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.Graphs, $"sp_GraphsGet failed: {ex.Message}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
58
DataPRO/DbAPI/TestSetups/ICalculatedChannels.cs
Normal file
58
DataPRO/DbAPI/TestSetups/ICalculatedChannels.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using DbAPI.Connections;
|
||||
using DTS.Common.Interface.Database;
|
||||
using DTS.Common.Interface.TestSetups;
|
||||
|
||||
namespace DbAPI.TestSetups
|
||||
{
|
||||
/// <summary>
|
||||
/// defines functions to create, retrieve, update, delete graphs
|
||||
/// </summary>
|
||||
public interface ICalculatedChannels
|
||||
{
|
||||
/// <summary>
|
||||
/// removes calculated channel from database
|
||||
/// </summary>
|
||||
/// <param name="user">user committing delete</param>
|
||||
/// <param name="connection">connection over which to delete</param>
|
||||
/// <param name="calculatedChannelId">database id of calculated channel to delete</param>
|
||||
/// <returns></returns>
|
||||
ulong CalculatedChannelsDelete(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int calculatedChannelId);
|
||||
/// <summary>
|
||||
/// retrieves all CalculatedChannel records matching search criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user making query</param>
|
||||
/// <param name="connection">connection query is being made on</param>
|
||||
/// <param name="calculatedChannelId">database id of calculated channel (can be null)</param>
|
||||
/// <param name="testSetupName">test setup calculated channel(s) belong to (can be empty)</param>
|
||||
/// <param name="records">all matching records found</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong CalculatedChannelsGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? calculatedChannelId,
|
||||
string testSetupName,
|
||||
out ICalculatedChannelRecord[] records);
|
||||
/// <summary>
|
||||
/// inserts a new calculated channel into the database
|
||||
/// original record is modified with database id after insert is complete
|
||||
/// </summary>
|
||||
/// <param name="user">user adding record</param>
|
||||
/// <param name="connection">connection record is being added on</param>
|
||||
/// <param name="record">record being added</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong CalculatedChannelsInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ref ICalculatedChannelRecord record);
|
||||
/// <summary>
|
||||
/// updates calculated channel in the database
|
||||
/// </summary>
|
||||
/// <param name="user">user updating record</param>
|
||||
/// <param name="connection">connection record is being updated on</param>
|
||||
/// <param name="record">record to be updated</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong CalculatedChannelsUpdate(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ICalculatedChannelRecord record);
|
||||
}
|
||||
}
|
||||
47
DataPRO/DbAPI/TestSetups/IGraphs.cs
Normal file
47
DataPRO/DbAPI/TestSetups/IGraphs.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using DbAPI.Connections;
|
||||
using DTS.Common.Interface.Database;
|
||||
using DTS.Common.Interface.Graphs;
|
||||
|
||||
namespace DbAPI.TestSetups
|
||||
{
|
||||
/// <summary>
|
||||
/// defines functions to create, retrieve, update, delete graphs
|
||||
/// </summary>
|
||||
public interface IGraphs
|
||||
{
|
||||
/// <summary>
|
||||
/// retrieves all graph records matching search criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user making query</param>
|
||||
/// <param name="connection">connection query is being made on</param>
|
||||
/// <param name="graphId">graph id to retrieve (can be null)</param>
|
||||
/// <param name="testSetupId">test setup graph belongs to</param>
|
||||
/// <param name="records">all matching records found</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong GraphsGet(IUserDbRecord user, IConnectionDetails connection, int? graphId, int? testSetupId, out IGraphRecord[] records);
|
||||
/// <summary>
|
||||
/// updates a record in the database
|
||||
/// </summary>
|
||||
/// <param name="user">user updating record</param>
|
||||
/// <param name="connection">connection record is being updated on</param>
|
||||
/// <param name="record">record to update</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong GraphsUpdate(IUserDbRecord user, IConnectionDetails connection, IGraphRecord record);
|
||||
/// <summary>
|
||||
/// inserts a record into the db, updates GraphId of record after insert with database id
|
||||
/// </summary>
|
||||
/// <param name="user">user inserting record</param>
|
||||
/// <param name="connection">connection record is being inserted on</param>
|
||||
/// <param name="record">record being inserted</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong GraphsInsert(IUserDbRecord user, IConnectionDetails connection, ref IGraphRecord record);
|
||||
/// <summary>
|
||||
/// removes a record from the db
|
||||
/// </summary>
|
||||
/// <param name="user">user removing record</param>
|
||||
/// <param name="connection">connection record is being removed on</param>
|
||||
/// <param name="graphId">database id of record being removed</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong GraphsDelete(IUserDbRecord user, IConnectionDetails connection, int graphId);
|
||||
}
|
||||
}
|
||||
72
DataPRO/DbAPI/TestSetups/IRegionsOfInterest.cs
Normal file
72
DataPRO/DbAPI/TestSetups/IRegionsOfInterest.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using DbAPI.Connections;
|
||||
using DTS.Common.Interface.Database;
|
||||
using DTS.Common.Interface.TestSetups;
|
||||
|
||||
namespace DbAPI.TestSetups
|
||||
{
|
||||
/// <summary>
|
||||
/// defines functions to create, retrieve, update, delete graphs
|
||||
/// </summary>
|
||||
public interface IRegionsOfInterest
|
||||
{
|
||||
/// <summary>
|
||||
/// Removes records from the TestSetupROIs and ROIPeriodChannels tables
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="testSetupId">The value that matches the Primary key of the TestSetups table</param>
|
||||
/// <returns></returns>
|
||||
ulong RegionsOfInterestDelete(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int testSetupId);
|
||||
/// <summary>
|
||||
/// Inserts records into the TestSetupROIs and ROIPeriodChannels tables
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="testSetupId">The value that matches the Primary key of the TestSetups table</param>
|
||||
/// <param name="regionOfInterest">The class that is split between the TestSetupROIs and ROIPeriodChannels tables</param>
|
||||
/// <returns></returns>
|
||||
ulong RegionsOfInterestInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
int testSetupId,
|
||||
DTS.Common.Interface.RegionOfInterest.IRegionOfInterest regionOfInterest);
|
||||
/// <summary>
|
||||
/// Gets records from the TestSetupROIs and ROIPeriodChannels tables
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="testSetupId">The value that matches the Primary key of the TestSetups table</param>
|
||||
/// <param name="records">The array of records combined from the TetSetupROIs and ROIPeriodChannels tables</param>
|
||||
/// <returns></returns>
|
||||
ulong RegionsOfInterestGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
int testSetupId,
|
||||
out DTS.Common.Interface.RegionOfInterest.IRegionOfInterest[] records);
|
||||
ulong TestSetupROIsDelete(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int testSetupId);
|
||||
ulong TestSetupROIsInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int testSetupId,
|
||||
DTS.Common.Interface.RegionOfInterest.IRegionOfInterest regionOfInterest,
|
||||
out int testSetupROIId);
|
||||
ulong TestSetupROIsGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int testSetupId,
|
||||
out ITestSetupROIRecord[] records);
|
||||
ulong ROIPeriodChannelsInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
int testSetupROIId,
|
||||
string channelName,
|
||||
long channelId);
|
||||
ulong ROIPeriodChannelsGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
int testSetupROIId,
|
||||
out IROIPeriodChannelRecord[] roiPeriodChannelRecords);
|
||||
}
|
||||
}
|
||||
204
DataPRO/DbAPI/TestSetups/ITestSetups.cs
Normal file
204
DataPRO/DbAPI/TestSetups/ITestSetups.cs
Normal file
@@ -0,0 +1,204 @@
|
||||
using DbAPI.Connections;
|
||||
using DTS.Common.Interface.Database;
|
||||
using DTS.Common.Interface.Groups;
|
||||
using DTS.Common.Interface.TestSetups;
|
||||
using DTS.Common.Interface.TestSetups.TestSetupsList;
|
||||
using System;
|
||||
|
||||
namespace DbAPI.TestSetups
|
||||
{
|
||||
/// <summary>
|
||||
/// defines functions to create, retrieve, update, delete test setups
|
||||
/// </summary>
|
||||
public interface ITestSetups
|
||||
{
|
||||
/// <summary>
|
||||
/// deletes matching test setup hardware record
|
||||
/// at least one parameter (id/dasid/testsetupid) must be specified
|
||||
/// </summary>
|
||||
/// <param name="user">user making request</param>
|
||||
/// <param name="connection">connection request is being made on</param>
|
||||
/// <param name="Id">id of test setup hardware record (null for all)</param>
|
||||
/// <param name="dasId">id of das (null for all)</param>
|
||||
/// <param name="testSetupId">id of test setup (null for all)</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong TestSetupHardwareDelete(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? Id,
|
||||
int? dasId,
|
||||
int? testSetupId
|
||||
);
|
||||
/// <summary>
|
||||
/// updates a test setup hardware record
|
||||
/// </summary>
|
||||
/// <param name="user">user committing update</param>
|
||||
/// <param name="connection">connection update is being made on</param>
|
||||
/// <param name="record">updated record</param>
|
||||
/// <returns>0 on success, all other values are error codes</returns>
|
||||
ulong TestSetupHardwareUpdate(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ITestSetupHardwareRecord record);
|
||||
/// <summary>
|
||||
/// inserts a new record
|
||||
/// </summary>
|
||||
/// <param name="user">user inserting record</param>
|
||||
/// <param name="connection">connection being inserted on</param>
|
||||
/// <param name="record">record being inserted</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong TestSetupHardwareInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ITestSetupHardwareRecord record);
|
||||
/// <summary>
|
||||
/// retrieves all hardware meta data associated with test
|
||||
/// [sample rate, aaf, etc]
|
||||
/// </summary>
|
||||
/// <param name="user">user retrieving hardware</param>
|
||||
/// <param name="connection">connecting hardware is retrieved on</param>
|
||||
/// <param name="testSetupId">id of test setup (use null for all)</param>
|
||||
/// <param name="records">all matching records</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong TestSetupHardwareGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
int? testSetupId,
|
||||
out ITestSetupHardwareRecord[] records);
|
||||
/// <summary>
|
||||
/// inserts a new group/test setup association into db
|
||||
/// </summary>
|
||||
/// <param name="user">user making request</param>
|
||||
/// <param name="connection">connection request is being made on</param>
|
||||
/// <param name="record">record to insert</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong TestSetupGroupsInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ITestSetupGroupRecord record);
|
||||
/// <summary>
|
||||
/// updates a group/test setup association in db
|
||||
/// </summary>
|
||||
/// <param name="user">user making request</param>
|
||||
/// <param name="connection">connection is being made on</param>
|
||||
/// <param name="record">updated record</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong TestSetupGroupsUpdate(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ITestSetupGroupRecord record);
|
||||
|
||||
/// <summary>
|
||||
/// retrieves all group records matching search criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user making request</param>
|
||||
/// <param name="connection">connection request is being made on</param>
|
||||
/// <param name="groupId">database id of group (use null for all)</param>
|
||||
/// <param name="testSetupId">database id of test setup (use null for all)</param>
|
||||
/// <param name="testSetupName">test setup name for test setup (use null for all)</param>
|
||||
/// <param name="groups">matching groups</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong TestSetupGroupsGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? groupId,
|
||||
int? testSetupId,
|
||||
string testSetupName,
|
||||
out ITestSetupGroupRecord[] groups
|
||||
);
|
||||
/// <summary>
|
||||
/// Commits a change to the IsDirty or IsComplete flags in the db for a test
|
||||
/// </summary>
|
||||
/// <param name="user">user committing change</param>
|
||||
/// <param name="connection">connection change is being committed on</param>
|
||||
/// <param name="name">name of test setup to modify</param>
|
||||
/// <param name="dirty">whether to set dirty flag or not. Dirty flag indicates
|
||||
/// whether the test setup has been checked for completeness and readiness to run</param>
|
||||
/// <param name="complete">whether the test setup is ready to run or not</param>
|
||||
/// <param name="error">error message(s) associated with test setup, if any</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong TestSetupsMarkIsDirtyIsComplete(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
string name,
|
||||
bool dirty,
|
||||
bool complete,
|
||||
string error);
|
||||
/// <summary>
|
||||
/// deletes all test setups matching criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user deleting test setups</param>
|
||||
/// <param name="connection">connection tests are being deleted on</param>
|
||||
/// <param name="date">date of oldest allowed test setup</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success. All other values are error codes.</returns>
|
||||
ulong TestSetupsDeleteByDate(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
DateTime date);
|
||||
/// <summary>
|
||||
/// deletes all test setups and groups
|
||||
/// </summary>
|
||||
/// <param name="user">user requesting deletes</param>
|
||||
/// <param name="connection">connection to delete on</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success. All other values are error codes</returns>
|
||||
ulong TestSetupsAndGroupsDeleteAll(IUserDbRecord user,
|
||||
IConnectionDetails connection);
|
||||
/// <summary>
|
||||
/// Deletes all test setups that match the search criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user deleting test setups</param>
|
||||
/// <param name="connection">connection to delete test setups on</param>
|
||||
/// <param name="ids">ids of test setups to delete</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong TestSetupsDeleteById(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int[] ids);
|
||||
|
||||
/// <summary>
|
||||
/// deletes all test setups that match the search criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user deleting test setups</param>
|
||||
/// <param name="connection">connection to delete test setups on</param>
|
||||
/// <param name="names">names of test setups to delete</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong TestSetupsDeleteByName(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
string[] names);
|
||||
/// <summary>
|
||||
/// commits a test setup into the database
|
||||
/// </summary>
|
||||
/// <param name="user">user committing record</param>
|
||||
/// <param name="connection">connection record is being committed on</param>
|
||||
/// <param name="clientDbVersion">the database version of the client code</param>
|
||||
/// <param name="record">record being committed</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are errors</returns>
|
||||
ulong TestSetupsUpdateInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
ref ITestSetupRecord record);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all test setups which match given search criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user making query</param>
|
||||
/// <param name="connection">connection over which query is to be made</param>
|
||||
/// <param name="clientDbVersion">the database version of the client code</param>
|
||||
/// <param name="testSetupId">database id of test setup (can be null)</param>
|
||||
/// <param name="testSetupName">name of test setup (can be null or empty)</param>
|
||||
/// <param name="defaultROIStart">start time for any ROIs that have to be generated
|
||||
/// some old test setups may not have ROIs specified for every event</param>
|
||||
/// <param name="defaultROIEnd">end time for any ROIs that have to be generated
|
||||
/// some old test setups may not have ROIs specified for every event</param>
|
||||
/// <param name="defaultIgnoreShortedStart">whether or not to ignore a shorted start
|
||||
/// since we may be using a Version 91 database that doesn't store this</param>
|
||||
/// <param name="defaultIgnoreShortedTrigger">whether or not to ignore a shorted trigger
|
||||
/// since we may be using a Version 91 database that doesn't store this</param>
|
||||
/// <param name="records">matching records</param>
|
||||
/// <param name="errors">any errors encountered while retrieving test setups</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are errors</returns>
|
||||
ulong TestSetupsGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
int? testSetupId,
|
||||
string testSetupName,
|
||||
double defaultROIStart,
|
||||
double defaultROIEnd,
|
||||
bool defaultIgnoreShortedStart,
|
||||
bool defaultIgnoreShortedTrigger,
|
||||
out ITestSetupRecord[] records,
|
||||
out string[] errors);
|
||||
|
||||
}
|
||||
}
|
||||
418
DataPRO/DbAPI/TestSetups/RegionsOfInterest.cs
Normal file
418
DataPRO/DbAPI/TestSetups/RegionsOfInterest.cs
Normal file
@@ -0,0 +1,418 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using DbAPI.Connections;
|
||||
using DbAPI.Errors;
|
||||
using DTS.Common.Classes.TestSetups;
|
||||
using DTS.Common.Interface.Database;
|
||||
using DTS.Common.Interface.TestSetups;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System;
|
||||
using DbAPI.Logging;
|
||||
using System.Diagnostics;
|
||||
using DTS.Common;
|
||||
|
||||
namespace DbAPI.TestSetups
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles RegionsOfInterest functions
|
||||
/// </summary>
|
||||
internal class RegionsOfInterest : IRegionsOfInterest
|
||||
{
|
||||
/// <summary>
|
||||
/// Removes records from the TestSetupROIs and ROIPeriodChannels tables
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="testSetupId">The value that matches the Primary key of the TestSetups table</param>
|
||||
/// <returns></returns>
|
||||
public ulong RegionsOfInterestDelete(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int testSetupId)
|
||||
{
|
||||
return TestSetupROIsDelete(user, connection, testSetupId);
|
||||
}
|
||||
/// <summary>
|
||||
/// Inserts records into the TestSetupROIs and ROIPeriodChannels tables
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="testSetupId">The value that matches the Primary key of the TestSetups table</param>
|
||||
/// <param name="regionOfInterest">The class that is split between the TestSetupROIs and ROIPeriodChannels tables</param>
|
||||
/// <returns></returns>
|
||||
public ulong RegionsOfInterestInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
int testSetupId,
|
||||
DTS.Common.Interface.RegionOfInterest.IRegionOfInterest regionOfInterest)
|
||||
{
|
||||
var hResult = TestSetupROIsInsert(user, connection, testSetupId, regionOfInterest, out int testSetupROIId);
|
||||
if (hResult == ErrorCodes.ERROR_SUCCESS && testSetupROIId > 0)
|
||||
{
|
||||
var channelIndex = 0;
|
||||
foreach (var channelId in regionOfInterest.ChannelIds)
|
||||
{
|
||||
if( channelIndex >= regionOfInterest.ChannelNames.Length) { continue; }
|
||||
var channelName = regionOfInterest.ChannelNames[channelIndex];
|
||||
hResult = ROIPeriodChannelsInsert(user, connection, clientDbVersion, testSetupROIId, channelName, channelId);
|
||||
if (hResult != ErrorCodes.ERROR_SUCCESS)
|
||||
{
|
||||
return hResult;
|
||||
}
|
||||
channelIndex++;
|
||||
}
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets records from the TestSetupROIs and ROIPeriodChannels tables
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="testSetupId">The value that matches the Primary key of the TestSetups table</param>
|
||||
/// <param name="records">The array of records combined from the TetSetupROIs and ROIPeriodChannels tables</param>
|
||||
/// <returns></returns>
|
||||
public ulong RegionsOfInterestGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
int testSetupId,
|
||||
out DTS.Common.Interface.RegionOfInterest.IRegionOfInterest[] records)
|
||||
{
|
||||
records = new DTS.Common.Interface.RegionOfInterest.IRegionOfInterest[0];
|
||||
var list = new List<DTS.Common.Interface.RegionOfInterest.IRegionOfInterest>();
|
||||
|
||||
TestSetupROIsGet(user, connection, testSetupId, out var testSetupROIRecords);
|
||||
foreach (var testSetupROIRecord in testSetupROIRecords)
|
||||
{
|
||||
ROIPeriodChannelsGet(user, connection, clientDbVersion, testSetupROIRecord.TestSetupROIId, out var roiPeriodChannelRecords);
|
||||
var channelNameList = new List<string>();
|
||||
var channelIdList = new List<long>();
|
||||
foreach (var roiPeriodChannelRecord in roiPeriodChannelRecords)
|
||||
{
|
||||
var serialNumberIndex = roiPeriodChannelRecord.ChannelName.LastIndexOf("\\");
|
||||
if (serialNumberIndex > -1)
|
||||
{
|
||||
var serialNumber = roiPeriodChannelRecord.ChannelName.Substring(serialNumberIndex + 1);
|
||||
var hardwareChannelName = roiPeriodChannelRecord.ChannelName.Substring(0, serialNumberIndex);
|
||||
var newChannelName = RegionOfInterest.GetChanName(serialNumber, hardwareChannelName);
|
||||
channelNameList.Add(newChannelName);
|
||||
}
|
||||
else
|
||||
{
|
||||
channelNameList.Add(roiPeriodChannelRecord.ChannelName);
|
||||
}
|
||||
channelIdList.Add(roiPeriodChannelRecord.ChannelId);
|
||||
}
|
||||
|
||||
list.Add(new RegionOfInterest()
|
||||
{
|
||||
Suffix = testSetupROIRecord.Suffix,
|
||||
Start = testSetupROIRecord.ROIStart,
|
||||
End = testSetupROIRecord.ROIEnd,
|
||||
IsEnabled = testSetupROIRecord.IsEnabled,
|
||||
IsDefault = testSetupROIRecord.IsDefault,
|
||||
ChannelNames = channelNameList.ToArray(),
|
||||
ChannelIds = channelIdList.ToArray()
|
||||
});
|
||||
}
|
||||
records = list.ToArray();
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
/// <summary>
|
||||
/// Removes records from the TestSetupROIs and ROIPeriodChannels tables
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="testSetupId">The value that matches the Primary key of the TestSetups table</param>
|
||||
/// <returns></returns>
|
||||
public ulong TestSetupROIsDelete(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int testSetupId)
|
||||
{
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
var ret = ConnectionManager.GetSqlCommand(connection, out var cmd, "sp_TestSetupROIsDelete");
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
#region params
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupId", SqlDbType.Int) { Value = testSetupId });
|
||||
|
||||
var errorNumber = new SqlParameter("@errorNumber", SqlDbType.Int) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorNumber);
|
||||
var errorMessage = new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorMessage);
|
||||
|
||||
#endregion params
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
if (!DBNull.Value.Equals(errorNumber.Value) && 0 != Convert.ToInt32(errorNumber.Value))
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.RegionsOfInterest, $"sp_TestSetupROIsDelete failed: {errorNumber.Value} : {errorMessage.Value}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.RegionsOfInterest, $"sp_TestSetupROIsDelete failed: {ex.Message}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
cmd.Dispose();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Inserts records into the TestSetupROIs table
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="testSetupId">The value that matches the Primary key of the TestSetups table</param>
|
||||
/// <param name="regionOfInterest">The class that will have a portion stored in the TestSetupROIs table</param>
|
||||
/// <param name="testSetupROIId">The new value of the Primary key of the TestSetupROIs table</param>
|
||||
/// <returns></returns>
|
||||
public ulong TestSetupROIsInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int testSetupId,
|
||||
DTS.Common.Interface.RegionOfInterest.IRegionOfInterest regionOfInterest,
|
||||
out int testSetupROIId)
|
||||
{
|
||||
testSetupROIId = 0;
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
if (null == regionOfInterest)
|
||||
{
|
||||
return ErrorCodes.ERROR_MISSING_PARAMETER;
|
||||
}
|
||||
var ret = ConnectionManager.GetSqlCommand(connection, out var cmd, "sp_TestSetupROIsInsert");
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
#region params
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupId", SqlDbType.Int) { Value = testSetupId });
|
||||
cmd.Parameters.Add(new SqlParameter("@Suffix", SqlDbType.NVarChar, 50) { Value = regionOfInterest.Suffix });
|
||||
cmd.Parameters.Add(new SqlParameter("@ROIStart", SqlDbType.Float) { Value = regionOfInterest.Start });
|
||||
cmd.Parameters.Add(new SqlParameter("@ROIEnd", SqlDbType.Float) { Value = regionOfInterest.End });
|
||||
cmd.Parameters.Add(new SqlParameter("@IsEnabled", SqlDbType.Bit) { Value = regionOfInterest.IsEnabled });
|
||||
cmd.Parameters.Add(new SqlParameter("@IsDefault", SqlDbType.Bit) { Value = regionOfInterest.IsDefault });
|
||||
|
||||
var newIdParam = new SqlParameter("@new_id", SqlDbType.Int) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(newIdParam);
|
||||
var errorNumberParam = new SqlParameter("@errorNumber", SqlDbType.Int) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorNumberParam);
|
||||
var errorMessageParam = new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorMessageParam);
|
||||
|
||||
#endregion params
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
if (int.Parse(errorNumberParam.Value.ToString()) != 0)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.RegionsOfInterest, errorMessageParam.Value.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
//Return the new id so that it can be used to enter this ROI period's channels into the ROIPeriodChannels table
|
||||
testSetupROIId = int.Parse(newIdParam.Value.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.RegionsOfInterest, ex.Message);
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
cmd.Dispose();
|
||||
}
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets records from the TestSetupROIs table
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="testSetupId">The value that matches the Primary key of the TestSetups table</param>
|
||||
/// <param name="records">The array of records from the TestSetupROIs table</param>
|
||||
/// <returns></returns>
|
||||
public ulong TestSetupROIsGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int testSetupId,
|
||||
out ITestSetupROIRecord[] records)
|
||||
{
|
||||
records = new ITestSetupROIRecord[0];
|
||||
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
var ret = ConnectionManager.GetSqlCommand(connection, out var cmd, "sp_TestSetupROIsGet");
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupId", SqlDbType.BigInt) { Value = testSetupId });
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
var list = new List<TestSetupROIsRecord>();
|
||||
while (reader.Read())
|
||||
{
|
||||
list.Add(new TestSetupROIsRecord(reader));
|
||||
}
|
||||
records = list.ToArray();
|
||||
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.RegionsOfInterest, $"sp_TestSetupROIsGet failed: {ex.Message}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
cmd.Dispose();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Inserts records into the ROIPeriodChannels table
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="testSetupROIId">The value of the Primary key of the TestSetupROIs table</param>
|
||||
/// <param name="channelName">The name of a channel to be stored in the ROIPeriodChannels table</param>
|
||||
/// <param name="channelId">The id of a channel to be stored in the ROIPeriodChannels table</param>
|
||||
/// <returns></returns>
|
||||
public ulong ROIPeriodChannelsInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
int testSetupROIId,
|
||||
string channelName,
|
||||
long channelId)
|
||||
{
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
if (testSetupROIId == 0 || null == channelName)
|
||||
{
|
||||
return ErrorCodes.ERROR_MISSING_PARAMETER;
|
||||
}
|
||||
SqlCommand cmd;
|
||||
var storedProcedureVersionToUse = 0;
|
||||
var ret = Database.Database.PrepareForDbAccess(user, connection, clientDbVersion,
|
||||
"sp_ROIPeriodChannelsInsert", out storedProcedureVersionToUse, out cmd);
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
#region params
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupROIId", SqlDbType.Int) { Value = testSetupROIId });
|
||||
cmd.Parameters.Add(new SqlParameter("@ChannelName", SqlDbType.NVarChar, 4000) { Value = channelName });
|
||||
if (storedProcedureVersionToUse >= Constants.ROIPERIODCHANNELS_CHANNELID_DB_VERSION)
|
||||
{
|
||||
cmd.Parameters.Add(new SqlParameter("@ChannelId", SqlDbType.BigInt) { Value = channelId });
|
||||
}
|
||||
|
||||
var errorNumberParam = new SqlParameter("@errorNumber", SqlDbType.Int) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorNumberParam);
|
||||
var errorMessageParam = new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorMessageParam);
|
||||
|
||||
#endregion params
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
if (int.Parse(errorNumberParam.Value.ToString()) != 0)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.RegionsOfInterest, errorMessageParam.Value.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.RegionsOfInterest, ex.Message);
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
cmd.Dispose();
|
||||
}
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets records from the ROIPeriodChannels table
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="testSetupROIId">The value of the Primary key of the TestSetupROIs table</param>
|
||||
/// <param name="roiPeriodChannelRecords">The array of records from the ROIPeriodChannels table</param>
|
||||
/// <returns></returns>
|
||||
public ulong ROIPeriodChannelsGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
int testSetupROIId,
|
||||
out IROIPeriodChannelRecord[] roiPeriodChannelRecords)
|
||||
{
|
||||
roiPeriodChannelRecords = new IROIPeriodChannelRecord[0];
|
||||
|
||||
if (!DbAPI.Connections.IsUserLoggedIn(user, connection))
|
||||
{
|
||||
return ErrorCodes.ERROR_ACCESS_DENIED;
|
||||
}
|
||||
SqlCommand cmd;
|
||||
var storedProcedureVersionToUse = 0;
|
||||
var ret = Database.Database.PrepareForDbAccess(user, connection, clientDbVersion,
|
||||
"sp_ROIPeriodChannelsGet", out storedProcedureVersionToUse, out cmd);
|
||||
if (ret != ErrorCodes.ERROR_SUCCESS) { return ret; }
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@TestSetupROIId", SqlDbType.BigInt) { Value = testSetupROIId });
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
var list = new List<ROIPeriodChannelRecord>();
|
||||
while (reader.Read())
|
||||
{
|
||||
var newROIPeriodChannelRecord = new ROIPeriodChannelRecord(reader, storedProcedureVersionToUse);
|
||||
var cleanROIPeriodChannelName = RegionOfInterest.RemoveAssignedByIDFromHardwareString(newROIPeriodChannelRecord.ChannelName);
|
||||
cleanROIPeriodChannelName = RegionOfInterest.RemoveParentDASName(cleanROIPeriodChannelName);
|
||||
newROIPeriodChannelRecord.ChannelName = cleanROIPeriodChannelName;
|
||||
list.Add(newROIPeriodChannelRecord);
|
||||
}
|
||||
roiPeriodChannelRecords = list.ToArray();
|
||||
|
||||
return ErrorCodes.ERROR_SUCCESS;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Log(TraceEventType.Error, LogManager.LogEvents.Graphs, $"sp_TestSetupROIsGet failed: {ex.Message}");
|
||||
return ErrorCodes.ERROR_UNKNOWN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
cmd.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1178
DataPRO/DbAPI/TestSetups/TestSetups.cs
Normal file
1178
DataPRO/DbAPI/TestSetups/TestSetups.cs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user