Multiple Tool Types for Run Headers
This commit is contained in:
@ -669,9 +669,12 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
return ds;
|
||||
}
|
||||
|
||||
public IEnumerable<HeaderCommon> GetHeaderTitles(int toolTypeId, int? pageNo, int? pageSize, out long totalRecords)
|
||||
public HeaderCommon[] GetHeaderTitles(int? toolTypeId, int? pageNo, int? pageSize, out long totalRecords)
|
||||
{
|
||||
ToolType tt = GetToolTypeByID(toolTypeId);
|
||||
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");
|
||||
|
||||
@ -680,17 +683,17 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
{
|
||||
string sql = $"SELECT ID, InsertDate, AttachmentID, Title, [Date] FROM {tt.HeaderTableName} ORDER BY [Date] DESC ";
|
||||
|
||||
IEnumerable<HeaderCommon> headers;
|
||||
HeaderCommon[] headers;
|
||||
|
||||
if (pageNo.HasValue && pageSize.HasValue)
|
||||
{
|
||||
sql += "OFFSET @PageNum * @PageSize ROWS FETCH NEXT @PageSize ROWS ONLY";
|
||||
|
||||
headers = conn.Query<HeaderCommon>(sql, param: new { PageNum = pageNo.Value, PageSize = pageSize.Value }).ToList();
|
||||
headers = conn.Query<HeaderCommon>(sql, param: new { PageNum = pageNo.Value, PageSize = pageSize.Value }).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
headers = conn.Query<HeaderCommon>(sql).ToList();
|
||||
headers = conn.Query<HeaderCommon>(sql).ToArray();
|
||||
}
|
||||
|
||||
sql = $"SELECT COUNT(*) FROM [{tt.HeaderTableName}] ";
|
||||
|
Reference in New Issue
Block a user