PDSF (Process Data Standard Format) to use EAF for

pushing to OI
This commit is contained in:
2023-07-24 13:29:13 -07:00
parent 6668806432
commit 4cc5219409
28 changed files with 268 additions and 329 deletions

View File

@ -308,13 +308,9 @@ public class MetrologyRepository : IMetrologyRepository
public DataTable GetHeaders(int toolTypeId, DateTime? startTime, DateTime? endTime, int? pageNo, int? pageSize, long? headerId, out long totalRecords)
{
ToolType tt = GetToolTypeByID(toolTypeId);
if (tt is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
if (md is null)
throw new Exception("Invalid tool type metadata");
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
DataTable dt = new();
@ -404,13 +400,9 @@ public class MetrologyRepository : IMetrologyRepository
// Go Here Next
public DataTable GetData(int toolTypeId, long headerid)
{
ToolType tt = GetToolTypeByID(toolTypeId);
if (tt is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
if (md is null)
throw new Exception("Invalid tool type metadata");
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
DataTable dt = new();
@ -515,13 +507,9 @@ public class MetrologyRepository : IMetrologyRepository
}
public DataTable GetDataSharePoint(int toolTypeId, string headerid)
{
ToolType tt = GetToolTypeByID(toolTypeId);
if (tt is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
if (md is null)
throw new Exception("Invalid tool type metadata");
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
DataTable dt = new();
@ -610,9 +598,7 @@ public class MetrologyRepository : IMetrologyRepository
}
public Guid GetHeaderAttachmentID(int toolTypeId, long headerId)
{
ToolType tt = GetToolTypeByID(toolTypeId);
if (tt is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
using DbConnection conn = GetDbConnection();
string sql =
@ -623,9 +609,7 @@ public class MetrologyRepository : IMetrologyRepository
public Guid GetDataAttachmentID(int toolTypeId, long headerId, string title)
{
ToolType tt = GetToolTypeByID(toolTypeId);
if (tt is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
using DbConnection conn = GetDbConnection();
string sql =
@ -642,9 +626,7 @@ public class MetrologyRepository : IMetrologyRepository
public DataSet GetOIExportData(int toolTypeId, long headerid)
{
ToolType tt = GetToolTypeByID(toolTypeId);
if (tt is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
if (string.IsNullOrWhiteSpace(tt.OIExportSPName))
throw new Exception("OpenInsight export not available for " + tt.ToolTypeName);
@ -674,9 +656,7 @@ public class MetrologyRepository : IMetrologyRepository
if (toolTypeId is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId.Value);
if (tt is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId.Value) ?? throw new Exception("Invalid tool type ID");
DbConnection conn = GetDbConnection();
using (conn)
@ -706,13 +686,9 @@ public class MetrologyRepository : IMetrologyRepository
public IEnumerable<KeyValuePair<string, string>> GetHeaderFields(int toolTypeId, long headerid)
{
ToolType tt = GetToolTypeByID(toolTypeId);
if (tt is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId);
if (md is null)
throw new Exception("Invalid tool type metadata");
IEnumerable<ToolTypeMetadata> md = GetToolTypeMetadataByToolTypeID(toolTypeId) ?? throw new Exception("Invalid tool type metadata");
List<KeyValuePair<string, string>> r = new();
@ -760,9 +736,7 @@ public class MetrologyRepository : IMetrologyRepository
// Jonathan changed this to remove the reviewDate update on the database.
public int UpdateReviewDate(int toolTypeId, long headerId, bool clearDate)
{
ToolType tt = GetToolTypeByID(toolTypeId);
if (tt is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
using DbConnection conn = GetDbConnection();
if (clearDate)
@ -781,9 +755,7 @@ public class MetrologyRepository : IMetrologyRepository
public Guid GetHeaderAttachmentIDByTitle(int toolTypeId, string title)
{
ToolType tt = GetToolTypeByID(toolTypeId);
if (tt is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
using DbConnection conn = GetDbConnection();
string sql =
@ -793,9 +765,7 @@ public class MetrologyRepository : IMetrologyRepository
public Guid GetDataAttachmentIDByTitle(int toolTypeId, string title)
{
ToolType tt = GetToolTypeByID(toolTypeId);
if (tt is null)
throw new Exception("Invalid tool type ID");
ToolType tt = GetToolTypeByID(toolTypeId) ?? throw new Exception("Invalid tool type ID");
using DbConnection conn = GetDbConnection();
string sql =