json Bugs from Newtonsoft.Json to System.Text.Json
This commit is contained in:
parent
b155863645
commit
c832b63f2f
@ -273,6 +273,8 @@ public class MetrologyRepo : IMetrologyRepo
|
||||
public DataTable ExportData(string spName, DateTime startTime, DateTime endTime)
|
||||
{
|
||||
DataTable dt = new();
|
||||
DateTime endTimeLocal = endTime.ToLocalTime();
|
||||
DateTime startTimeLocal = startTime.ToLocalTime();
|
||||
using (DbConnection conn = GetDbConnection())
|
||||
{
|
||||
DbProviderFactory factory = GetDbProviderFactory(conn);
|
||||
@ -281,9 +283,8 @@ public class MetrologyRepo : IMetrologyRepo
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = spName;
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandTimeout = 600;
|
||||
AddParameter(cmd, "@StartTime", startTime);
|
||||
AddParameter(cmd, "@EndTime", endTime);
|
||||
AddParameter(cmd, "@StartTime", startTimeLocal);
|
||||
AddParameter(cmd, "@EndTime", endTimeLocal);
|
||||
|
||||
DbDataAdapter da = factory.CreateDataAdapter();
|
||||
da.SelectCommand = cmd;
|
||||
@ -357,17 +358,22 @@ public class MetrologyRepo : IMetrologyRepo
|
||||
if (startTime.HasValue)
|
||||
{
|
||||
whereClause = "[Date] >= @StartTime ";
|
||||
|
||||
AddParameter(cmd, "@StartTime", startTime.Value);
|
||||
DateTime startTimeLocal = startTime.Value.ToLocalTime();
|
||||
AddParameter(cmd, "@StartTime", startTimeLocal);
|
||||
}
|
||||
|
||||
if (endTime.HasValue)
|
||||
{
|
||||
DateTime endTimeLocal = endTime.Value.ToLocalTime();
|
||||
TimeSpan timeSpan = new(DateTime.Now.Ticks - endTimeLocal.Ticks);
|
||||
if (timeSpan.TotalMinutes > 5)
|
||||
{
|
||||
if (whereClause.Length > 0)
|
||||
whereClause += "AND ";
|
||||
whereClause += "[Date] <= @EndTime ";
|
||||
|
||||
AddParameter(cmd, "@EndTime", endTime.Value);
|
||||
AddParameter(cmd, "@EndTime", endTimeLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
}
|
||||
<style>
|
||||
#HeaderGridDiv,
|
||||
# Div {
|
||||
#DetailsGridDiv {
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
@ -96,7 +96,6 @@
|
||||
else {
|
||||
toolType = r.Results.ToolType;
|
||||
toolTypeMetaData = r.Results.Metadata;
|
||||
|
||||
RequestHeaderData();
|
||||
}
|
||||
},
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace OI.Metrology.Viewer.ApiContollers;
|
||||
|
||||
using OI.Metrology.Shared.Repositories;
|
||||
using System.Text.Json;
|
||||
|
||||
// this controller is for the Awaiting Dispo functionality
|
||||
|
||||
@ -23,7 +24,7 @@ public class AwaitingDispoController : Controller
|
||||
{
|
||||
Results = _Repo.GetAwaitingDispo()
|
||||
};
|
||||
return Json(r);
|
||||
return Json(r, new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||
}
|
||||
|
||||
// this endpoint is used to set the ReviewDate column, causing the header to no longer show in Awaiting Dispo
|
||||
|
@ -11,6 +11,7 @@ using OI.Metrology.Shared.Repositories;
|
||||
using OI.Metrology.Shared.Services;
|
||||
using OI.Metrology.Viewer.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
|
||||
// using System.Data.Common;
|
||||
|
||||
@ -39,7 +40,7 @@ public class ToolTypesController : Controller
|
||||
{
|
||||
Results = _Repo.GetToolTypes().Select(tt => new { tt.ToolTypeName, tt.ID })
|
||||
};
|
||||
return Json(r);
|
||||
return Json(r, new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||
}
|
||||
|
||||
// Gets the metadata for a tooltype, accepts a parameter which sorts the results
|
||||
@ -63,7 +64,7 @@ public class ToolTypesController : Controller
|
||||
Metadata = md
|
||||
}
|
||||
};
|
||||
return Json(r);
|
||||
return Json(r, new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
|
||||
}
|
||||
|
||||
// Gets headers, request/response format is to allow paging with igniteUI
|
||||
|
@ -276,6 +276,8 @@ public class MetrologyRepo : IMetrologyRepo
|
||||
public DataTable ExportData(string spName, DateTime startTime, DateTime endTime)
|
||||
{
|
||||
DataTable dt = new();
|
||||
DateTime endTimeLocal = endTime.ToLocalTime();
|
||||
DateTime startTimeLocal = startTime.ToLocalTime();
|
||||
using (DbConnection conn = GetDbConnection())
|
||||
{
|
||||
DbProviderFactory factory = GetDbProviderFactory(conn);
|
||||
@ -284,8 +286,8 @@ public class MetrologyRepo : IMetrologyRepo
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = spName;
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
AddParameter(cmd, "@StartTime", startTime);
|
||||
AddParameter(cmd, "@EndTime", endTime);
|
||||
AddParameter(cmd, "@StartTime", startTimeLocal);
|
||||
AddParameter(cmd, "@EndTime", endTimeLocal);
|
||||
|
||||
DbDataAdapter da = factory.CreateDataAdapter();
|
||||
da.SelectCommand = cmd;
|
||||
@ -357,17 +359,22 @@ public class MetrologyRepo : IMetrologyRepo
|
||||
if (startTime.HasValue)
|
||||
{
|
||||
whereClause = "[Date] >= @StartTime ";
|
||||
|
||||
AddParameter(cmd, "@StartTime", startTime.Value);
|
||||
DateTime startTimeLocal = startTime.Value.ToLocalTime();
|
||||
AddParameter(cmd, "@StartTime", startTimeLocal);
|
||||
}
|
||||
|
||||
if (endTime.HasValue)
|
||||
{
|
||||
DateTime endTimeLocal = endTime.Value.ToLocalTime();
|
||||
TimeSpan timeSpan = new(DateTime.Now.Ticks - endTimeLocal.Ticks);
|
||||
if (timeSpan.TotalMinutes > 5)
|
||||
{
|
||||
if (whereClause.Length > 0)
|
||||
whereClause += "AND ";
|
||||
whereClause += "[Date] <= @EndTime ";
|
||||
|
||||
AddParameter(cmd, "@EndTime", endTime.Value);
|
||||
AddParameter(cmd, "@EndTime", endTimeLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user