json Bugs from Newtonsoft.Json to System.Text.Json

This commit is contained in:
2022-07-27 12:30:27 -07:00
parent b155863645
commit c832b63f2f
5 changed files with 36 additions and 22 deletions

View File

@ -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)
{
if (whereClause.Length > 0)
whereClause += "AND ";
whereClause += "[Date] <= @EndTime ";
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);
}
}
}

View File

@ -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();
}
},