HelperCamstarOracle
This commit is contained in:
@ -1,54 +1,11 @@
|
||||
using File_Watcher.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Watcher.Helpers;
|
||||
|
||||
internal static partial class HelperInfinityQS
|
||||
{
|
||||
|
||||
internal record Record([property: JsonPropertyName("count_se_sgtm")] int CountSeSubgroupTime,
|
||||
[property: JsonPropertyName("date_time")] DateTime DateTime,
|
||||
[property: JsonPropertyName("max_se_lot")] int MaxSeLot,
|
||||
[property: JsonPropertyName("max_se_prcs")] int MaxSeProcess,
|
||||
[property: JsonPropertyName("max_se_sgrp")] int MaxSeSubgroup,
|
||||
[property: JsonPropertyName("max_se_test")] int MaxSeTest,
|
||||
[property: JsonPropertyName("max_se_val")] float MaxSeValue,
|
||||
[property: JsonPropertyName("min_se_sgrp")] int MinSeSubgroup,
|
||||
[property: JsonPropertyName("test")] string Test);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Record[]))]
|
||||
internal partial class RecordCollectionSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
private static string GetCommandText(ReadOnlyCollection<int> subGroups)
|
||||
{ // cSpell:disable
|
||||
List<string> results = [];
|
||||
results.Add(" update [spcepiworld].[dbo].[sgrp_ext] ");
|
||||
results.Add(" set f_flag = 1 ");
|
||||
results.Add(" where f_flag = 0 ");
|
||||
results.Add($" and f_sgrp in ({string.Join(',', subGroups)}) ");
|
||||
return string.Join(Environment.NewLine, results);
|
||||
} // cSpell:enable
|
||||
|
||||
private static StringBuilder GetForJsonPath(InfinityQSConfiguration infinityQSConfiguration, string commandText)
|
||||
{
|
||||
StringBuilder stringBuilder = new();
|
||||
using SqlConnection sqlConnection = new(infinityQSConfiguration.ConnectionString);
|
||||
sqlConnection.Open();
|
||||
using SqlCommand sqlCommand = new(commandText, sqlConnection);
|
||||
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.SequentialAccess);
|
||||
while (sqlDataReader.Read())
|
||||
_ = stringBuilder.Append(sqlDataReader.GetString(0));
|
||||
return stringBuilder;
|
||||
}
|
||||
|
||||
private static void RunMI()
|
||||
{
|
||||
#pragma warning disable CA1416
|
||||
|
Reference in New Issue
Block a user