Spreading Resistance Profile with ChartJS,
Copy-On-Get and nuget bump (Serilog)
This commit is contained in:
@ -314,13 +314,9 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal 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();
|
||||
using (DbConnection conn = _DBConnectionFactory.GetDbConnection())
|
||||
@ -407,13 +403,9 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal 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();
|
||||
using (DbConnection conn = _DBConnectionFactory.GetDbConnection())
|
||||
@ -502,9 +494,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal 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 = _DBConnectionFactory.GetDbConnection();
|
||||
string sql =
|
||||
@ -514,9 +504,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
}
|
||||
internal string GetHeaderInsertDate(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 = _DBConnectionFactory.GetDbConnection();
|
||||
string sql =
|
||||
@ -546,9 +534,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal 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 = _DBConnectionFactory.GetDbConnection();
|
||||
string sql =
|
||||
@ -559,9 +545,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
// J Ouellette Added
|
||||
internal string GetDataInsertDate(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 = _DBConnectionFactory.GetDbConnection();
|
||||
string sql = "";
|
||||
@ -592,9 +576,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal 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);
|
||||
@ -657,9 +639,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
return headers;
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
using DbConnection conn = _DBConnectionFactory.GetDbConnection();
|
||||
string sql = $"SELECT ID, InsertDate, AttachmentID, Title, [Date], {tt.ID} AS ToolTypeID, '{tt.ToolTypeName}' AS ToolTypeName, Reactor, RDS, PSN FROM {tt.HeaderTableName} ORDER BY [Date] DESC ";
|
||||
@ -684,13 +664,9 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal 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();
|
||||
|
||||
@ -749,9 +725,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal 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 = _DBConnectionFactory.GetDbConnection();
|
||||
if (clearDate)
|
||||
@ -771,9 +745,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal 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 = _DBConnectionFactory.GetDbConnection();
|
||||
string sql =
|
||||
@ -783,9 +755,7 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
internal 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 = _DBConnectionFactory.GetDbConnection();
|
||||
string sql =
|
||||
|
@ -179,7 +179,8 @@ public class ToolTypesRepository : IToolTypesRepository
|
||||
Stream? stream = null;
|
||||
string? message = null;
|
||||
Guid attachmentIdParsed;
|
||||
string? contenttype = null;
|
||||
string? contentType = null;
|
||||
string filenameLowerThenTrim = filename.ToLower().TrimEnd();
|
||||
ToolType tt = metrologyRepository.GetToolTypeByID(toolTypeId);
|
||||
bool header = !string.Equals(tabletype.Trim(), "data", StringComparison.OrdinalIgnoreCase);
|
||||
if (!Guid.TryParse(attachmentId, out attachmentIdParsed))
|
||||
@ -189,15 +190,18 @@ public class ToolTypesRepository : IToolTypesRepository
|
||||
try
|
||||
{
|
||||
// figure out what content type to use. this is very simple because there are only two types being used
|
||||
contenttype = "application/pdf";
|
||||
if (filename.ToLower().TrimEnd().EndsWith(".txt"))
|
||||
contenttype = "text/plain";
|
||||
if (filenameLowerThenTrim.EndsWith(".txt"))
|
||||
contentType = "text/plain";
|
||||
else if (filenameLowerThenTrim.EndsWith(".json"))
|
||||
contentType = "application/json";
|
||||
else
|
||||
contentType = "application/pdf";
|
||||
// Get attachment stream and feed it to the client
|
||||
stream = attachmentsService.GetAttachmentStreamByAttachmentId(tt, header, attachmentIdParsed, filename);
|
||||
}
|
||||
catch (Exception ex) { message = ex.Message; }
|
||||
}
|
||||
return new(message, contenttype, stream);
|
||||
return new(message, contentType, stream);
|
||||
}
|
||||
|
||||
// This endpoint triggers writing of the OI Export file
|
||||
|
Reference in New Issue
Block a user