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)
|
public DataTable ExportData(string spName, DateTime startTime, DateTime endTime)
|
||||||
{
|
{
|
||||||
DataTable dt = new();
|
DataTable dt = new();
|
||||||
|
DateTime endTimeLocal = endTime.ToLocalTime();
|
||||||
|
DateTime startTimeLocal = startTime.ToLocalTime();
|
||||||
using (DbConnection conn = GetDbConnection())
|
using (DbConnection conn = GetDbConnection())
|
||||||
{
|
{
|
||||||
DbProviderFactory factory = GetDbProviderFactory(conn);
|
DbProviderFactory factory = GetDbProviderFactory(conn);
|
||||||
@ -281,9 +283,8 @@ public class MetrologyRepo : IMetrologyRepo
|
|||||||
cmd.Connection = conn;
|
cmd.Connection = conn;
|
||||||
cmd.CommandText = spName;
|
cmd.CommandText = spName;
|
||||||
cmd.CommandType = CommandType.StoredProcedure;
|
cmd.CommandType = CommandType.StoredProcedure;
|
||||||
cmd.CommandTimeout = 600;
|
AddParameter(cmd, "@StartTime", startTimeLocal);
|
||||||
AddParameter(cmd, "@StartTime", startTime);
|
AddParameter(cmd, "@EndTime", endTimeLocal);
|
||||||
AddParameter(cmd, "@EndTime", endTime);
|
|
||||||
|
|
||||||
DbDataAdapter da = factory.CreateDataAdapter();
|
DbDataAdapter da = factory.CreateDataAdapter();
|
||||||
da.SelectCommand = cmd;
|
da.SelectCommand = cmd;
|
||||||
@ -357,17 +358,22 @@ public class MetrologyRepo : IMetrologyRepo
|
|||||||
if (startTime.HasValue)
|
if (startTime.HasValue)
|
||||||
{
|
{
|
||||||
whereClause = "[Date] >= @StartTime ";
|
whereClause = "[Date] >= @StartTime ";
|
||||||
|
DateTime startTimeLocal = startTime.Value.ToLocalTime();
|
||||||
AddParameter(cmd, "@StartTime", startTime.Value);
|
AddParameter(cmd, "@StartTime", startTimeLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTime.HasValue)
|
if (endTime.HasValue)
|
||||||
{
|
{
|
||||||
if (whereClause.Length > 0)
|
DateTime endTimeLocal = endTime.Value.ToLocalTime();
|
||||||
whereClause += "AND ";
|
TimeSpan timeSpan = new(DateTime.Now.Ticks - endTimeLocal.Ticks);
|
||||||
whereClause += "[Date] <= @EndTime ";
|
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>
|
<style>
|
||||||
#HeaderGridDiv,
|
#HeaderGridDiv,
|
||||||
# Div {
|
#DetailsGridDiv {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -96,7 +96,6 @@
|
|||||||
else {
|
else {
|
||||||
toolType = r.Results.ToolType;
|
toolType = r.Results.ToolType;
|
||||||
toolTypeMetaData = r.Results.Metadata;
|
toolTypeMetaData = r.Results.Metadata;
|
||||||
|
|
||||||
RequestHeaderData();
|
RequestHeaderData();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace OI.Metrology.Viewer.ApiContollers;
|
namespace OI.Metrology.Viewer.ApiContollers;
|
||||||
|
|
||||||
using OI.Metrology.Shared.Repositories;
|
using OI.Metrology.Shared.Repositories;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
// this controller is for the Awaiting Dispo functionality
|
// this controller is for the Awaiting Dispo functionality
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ public class AwaitingDispoController : Controller
|
|||||||
{
|
{
|
||||||
Results = _Repo.GetAwaitingDispo()
|
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
|
// 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.Shared.Services;
|
||||||
using OI.Metrology.Viewer.Models;
|
using OI.Metrology.Viewer.Models;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
// using System.Data.Common;
|
// using System.Data.Common;
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ public class ToolTypesController : Controller
|
|||||||
{
|
{
|
||||||
Results = _Repo.GetToolTypes().Select(tt => new { tt.ToolTypeName, tt.ID })
|
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
|
// Gets the metadata for a tooltype, accepts a parameter which sorts the results
|
||||||
@ -63,7 +64,7 @@ public class ToolTypesController : Controller
|
|||||||
Metadata = md
|
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
|
// 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)
|
public DataTable ExportData(string spName, DateTime startTime, DateTime endTime)
|
||||||
{
|
{
|
||||||
DataTable dt = new();
|
DataTable dt = new();
|
||||||
|
DateTime endTimeLocal = endTime.ToLocalTime();
|
||||||
|
DateTime startTimeLocal = startTime.ToLocalTime();
|
||||||
using (DbConnection conn = GetDbConnection())
|
using (DbConnection conn = GetDbConnection())
|
||||||
{
|
{
|
||||||
DbProviderFactory factory = GetDbProviderFactory(conn);
|
DbProviderFactory factory = GetDbProviderFactory(conn);
|
||||||
@ -284,8 +286,8 @@ public class MetrologyRepo : IMetrologyRepo
|
|||||||
cmd.Connection = conn;
|
cmd.Connection = conn;
|
||||||
cmd.CommandText = spName;
|
cmd.CommandText = spName;
|
||||||
cmd.CommandType = CommandType.StoredProcedure;
|
cmd.CommandType = CommandType.StoredProcedure;
|
||||||
AddParameter(cmd, "@StartTime", startTime);
|
AddParameter(cmd, "@StartTime", startTimeLocal);
|
||||||
AddParameter(cmd, "@EndTime", endTime);
|
AddParameter(cmd, "@EndTime", endTimeLocal);
|
||||||
|
|
||||||
DbDataAdapter da = factory.CreateDataAdapter();
|
DbDataAdapter da = factory.CreateDataAdapter();
|
||||||
da.SelectCommand = cmd;
|
da.SelectCommand = cmd;
|
||||||
@ -357,17 +359,22 @@ public class MetrologyRepo : IMetrologyRepo
|
|||||||
if (startTime.HasValue)
|
if (startTime.HasValue)
|
||||||
{
|
{
|
||||||
whereClause = "[Date] >= @StartTime ";
|
whereClause = "[Date] >= @StartTime ";
|
||||||
|
DateTime startTimeLocal = startTime.Value.ToLocalTime();
|
||||||
AddParameter(cmd, "@StartTime", startTime.Value);
|
AddParameter(cmd, "@StartTime", startTimeLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTime.HasValue)
|
if (endTime.HasValue)
|
||||||
{
|
{
|
||||||
if (whereClause.Length > 0)
|
DateTime endTimeLocal = endTime.Value.ToLocalTime();
|
||||||
whereClause += "AND ";
|
TimeSpan timeSpan = new(DateTime.Now.Ticks - endTimeLocal.Ticks);
|
||||||
whereClause += "[Date] <= @EndTime ";
|
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