rowData isn't HeaderCommon
This commit is contained in:
@ -18,7 +18,7 @@ public class PinController : Controller, IPinController<IActionResult>
|
||||
_PinRepository = pinRepository;
|
||||
}
|
||||
|
||||
[HttpPost("/api/pin/markAsPinned")]
|
||||
[HttpPost("{toolTypeId}/markAsPinned")]
|
||||
public IActionResult MarkAsPinned(Shared.DataModels.HeaderCommon headerCommon)
|
||||
{
|
||||
_PinRepository.SetPinnedTable(headerCommon);
|
||||
@ -26,8 +26,8 @@ public class PinController : Controller, IPinController<IActionResult>
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{id}/pinned")]
|
||||
public IActionResult GetPinnedTable(int id, string? biorad_id = null, string? cde_id = null, string? rds = null) =>
|
||||
Json(_PinRepository.GetPinnedTable(_MetrologyRepository, id, biorad_id, cde_id, rds), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||
[Route("{toolTypeId}/pinned")]
|
||||
public IActionResult GetPinnedTable(int toolTypeId, string? biorad_id = null, string? cde_id = null, string? rds = null) =>
|
||||
Json(_PinRepository.GetPinnedTable(_MetrologyRepository, toolTypeId, biorad_id, cde_id, rds), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||
|
||||
}
|
@ -38,9 +38,6 @@ public class PinRepository : IPinRepository
|
||||
|
||||
private (HeaderCommon?, HeaderCommon?) GetBoth(string rds, long bioRadId, long cdeId)
|
||||
{
|
||||
HeaderCommon? cdeHeader, bioRadHeader;
|
||||
cdeHeader = null;
|
||||
bioRadHeader = null;
|
||||
Dictionary<long, HeaderCommon>? toolIdToHeader;
|
||||
if (!_RdsToHeaderCommonCollection.TryGetValue(rds, out toolIdToHeader))
|
||||
{
|
||||
@ -48,10 +45,8 @@ public class PinRepository : IPinRepository
|
||||
if (!_RdsToHeaderCommonCollection.TryGetValue(rds, out toolIdToHeader))
|
||||
throw new Exception();
|
||||
}
|
||||
if (cdeHeader is null && toolIdToHeader.ContainsKey(cdeId))
|
||||
cdeHeader = toolIdToHeader[cdeId];
|
||||
if (bioRadHeader is null && toolIdToHeader.ContainsKey(bioRadId))
|
||||
bioRadHeader = toolIdToHeader[bioRadId];
|
||||
_ = toolIdToHeader.TryGetValue(cdeId, out HeaderCommon? cdeHeader);
|
||||
_ = toolIdToHeader.TryGetValue(bioRadId, out HeaderCommon? bioRadHeader);
|
||||
return new(bioRadHeader, cdeHeader);
|
||||
}
|
||||
|
||||
@ -79,31 +74,6 @@ public class PinRepository : IPinRepository
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Pinned? GetCDE(IMetrologyRepository metrologyRepository, int points, HeaderCommon bioRadHeader)
|
||||
{
|
||||
Pinned? result;
|
||||
List<string> values;
|
||||
const int thickness = 5;
|
||||
System.Data.DataTable dataTable = metrologyRepository.GetData((int)bioRadHeader.ToolTypeID, bioRadHeader.ID);
|
||||
if (dataTable.Rows.Count <= points || dataTable.Columns.Count <= thickness)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
values = new();
|
||||
for (int i = 0; i < dataTable.Rows.Count - 1; i++)
|
||||
{
|
||||
if (dataTable.Rows[i]?.ItemArray[thickness] is null)
|
||||
break;
|
||||
values.Add(string.Concat(dataTable.Rows[i].ItemArray[thickness]));
|
||||
}
|
||||
if (values.Count <= points)
|
||||
result = null;
|
||||
else
|
||||
result = new(bioRadHeader, values);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Result<Pinned[]> IPinRepository.GetPinnedTable(IMetrologyRepository metrologyRepository, int id, string? biorad_id, string? cde_id, string? rds)
|
||||
{
|
||||
Result<Pinned[]>? r;
|
||||
|
@ -460,18 +460,19 @@ function reviewButtonRunInfo() {
|
||||
}
|
||||
|
||||
function pinButtonRunInfo() {
|
||||
var toolTypeId = $("#ToolTypeID").text();
|
||||
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
|
||||
if (selectedRow !== null) {
|
||||
$("#PinButton").prop("disabled", true);
|
||||
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: _apiUrl + "/pin/markAsPinned",
|
||||
url: _apiUrl + '/pin/' + toolTypeId + "/markAsPinned",
|
||||
data: rowData,
|
||||
success: function (e) {
|
||||
DisplayWSMessage("info", "Marked as pinned", e);
|
||||
$("#PinButton").prop("disabled", false);
|
||||
$.getJSON(_apiUrl + "/pin/" + rowData.ToolTypeID + "/pinned?biorad_id=" + _BioRadId + "&cde_id=" + _CdeId + "&rds=" + rowData.RDS, function (data) {
|
||||
$.getJSON(_apiUrl + '/pin/' + toolTypeId + "/pinned?biorad_id=" + _BioRadId + "&cde_id=" + _CdeId + "&rds=" + rowData.RDS, function (data) {
|
||||
$("#PinnedGrid").igGrid({
|
||||
dataSource: data,
|
||||
responseDataKey: "Results",
|
||||
|
Reference in New Issue
Block a user