Use DateTime.Now instead of DateTime.UtcNow

This commit is contained in:
2025-11-24 15:05:43 +09:00
parent 3ccccd2467
commit be3d369575
13 changed files with 24 additions and 24 deletions

View File

@ -55,7 +55,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
using var transaction = await context.Database.BeginTransactionAsync(); using var transaction = await context.Database.BeginTransactionAsync();
try try
{ {
startedAt = DateTime.UtcNow; startedAt = DateTime.Now;
await HeadquartersService.SetCampaignStartedAsync(context, campaign.Id, startedAt); await HeadquartersService.SetCampaignStartedAsync(context, campaign.Id, startedAt);
await ProgressStepAsync(context, (int)Step.ExecutionWait); await ProgressStepAsync(context, (int)Step.ExecutionWait);
@ -118,7 +118,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
{ {
await ProgressStepAsync(context, (int)Step.End); await ProgressStepAsync(context, (int)Step.End);
endedAt = DateTime.UtcNow; endedAt = DateTime.Now;
await HeadquartersService.SetCampaignEndedAsync(context, campaign.Id, endedAt); await HeadquartersService.SetCampaignEndedAsync(context, campaign.Id, endedAt);
await transaction.CommitAsync(); await transaction.CommitAsync();

View File

@ -55,7 +55,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
using var transaction = await context.Database.BeginTransactionAsync(); using var transaction = await context.Database.BeginTransactionAsync();
try try
{ {
startedAt = DateTime.UtcNow; startedAt = DateTime.Now;
await HeadquartersService.SetCampaignStartedAsync(context, campaign.Id, startedAt); await HeadquartersService.SetCampaignStartedAsync(context, campaign.Id, startedAt);
await ProgressStepAsync(context, (int)Step.ExecutionWait); await ProgressStepAsync(context, (int)Step.ExecutionWait);
@ -118,7 +118,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
{ {
await ProgressStepAsync(context, (int)Step.End); await ProgressStepAsync(context, (int)Step.End);
endedAt = DateTime.UtcNow; endedAt = DateTime.Now;
await HeadquartersService.SetCampaignEndedAsync(context, campaign.Id, endedAt); await HeadquartersService.SetCampaignEndedAsync(context, campaign.Id, endedAt);
await transaction.CommitAsync(); await transaction.CommitAsync();

View File

@ -35,7 +35,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
public async Task EndWithFailAsync(Exception e) public async Task EndWithFailAsync(Exception e)
{ {
var endedAt = DateTime.UtcNow; var endedAt = DateTime.Now;
var failureReason = e.CombineMessages(); var failureReason = e.CombineMessages();
await HeadquartersService.SetCampaignEndedWithFailAsync(campaign.Id, endedAt, failureReason); await HeadquartersService.SetCampaignEndedWithFailAsync(campaign.Id, endedAt, failureReason);

View File

@ -51,7 +51,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
using var transaction = await context.Database.BeginTransactionAsync(); using var transaction = await context.Database.BeginTransactionAsync();
try try
{ {
startedAt = DateTime.UtcNow; startedAt = DateTime.Now;
await HeadquartersService.SetCampaignStartedAsync(context, campaign.Id, startedAt); await HeadquartersService.SetCampaignStartedAsync(context, campaign.Id, startedAt);
await ProgressStepAsync(context, (int)Step.ParseWait); await ProgressStepAsync(context, (int)Step.ParseWait);
@ -95,7 +95,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
{ {
await ProgressStepAsync(context, (int)Step.End); await ProgressStepAsync(context, (int)Step.End);
endedAt = DateTime.UtcNow; endedAt = DateTime.Now;
await HeadquartersService.SetCampaignEndedAsync(context, campaign.Id, endedAt); await HeadquartersService.SetCampaignEndedAsync(context, campaign.Id, endedAt);
await transaction.CommitAsync(); await transaction.CommitAsync();

View File

@ -46,7 +46,7 @@ namespace Hcs.WebApp.BackgroundServices.DataParsers
HcsId = Guid.Parse(hcsId), HcsId = Guid.Parse(hcsId),
IsMkd = isMkd, IsMkd = isMkd,
IsZhd = !isMkd, IsZhd = !isMkd,
SyncedAt = DateTime.UtcNow, SyncedAt = DateTime.Now,
LastSyncOperationId = operation.Id LastSyncOperationId = operation.Id
}); });
} }
@ -78,7 +78,7 @@ namespace Hcs.WebApp.BackgroundServices.DataParsers
using var transaction = await context.Database.BeginTransactionAsync(); using var transaction = await context.Database.BeginTransactionAsync();
try try
{ {
var now = DateTime.UtcNow; var now = DateTime.Now;
var fileToParse = await fileToParseService.GetFileToParseByOperationIdAsync(context, operation.Id); var fileToParse = await fileToParseService.GetFileToParseByOperationIdAsync(context, operation.Id);
fileToParse.ParsedAt = now; fileToParse.ParsedAt = now;

View File

@ -33,7 +33,7 @@ namespace Hcs.WebApp.BackgroundServices
var headquartersService = scope.ServiceProvider.GetRequiredService<HeadquartersService>(); var headquartersService = scope.ServiceProvider.GetRequiredService<HeadquartersService>();
try try
{ {
var startedAt = DateTime.UtcNow; var startedAt = DateTime.Now;
await headquartersService.SetOperationStartedAsync(operation.Id, startedAt); await headquartersService.SetOperationStartedAsync(operation.Id, startedAt);
state.InvokeOnOperationStarted(operation.Id, operation.CampaignId, startedAt); state.InvokeOnOperationStarted(operation.Id, operation.CampaignId, startedAt);
@ -41,11 +41,11 @@ namespace Hcs.WebApp.BackgroundServices
var dataParser = dataParserFactory.CreateDataParser(scope, operation, webHostEnvironment); var dataParser = dataParserFactory.CreateDataParser(scope, operation, webHostEnvironment);
await dataParser.ParseAsync(); await dataParser.ParseAsync();
state.InvokeOnOperationEnded(operation.Id, operation.CampaignId, DateTime.UtcNow, string.Empty); state.InvokeOnOperationEnded(operation.Id, operation.CampaignId, DateTime.Now, string.Empty);
} }
catch (Exception e) catch (Exception e)
{ {
var failedAt = DateTime.UtcNow; var failedAt = DateTime.Now;
var failureReason = e.CombineMessages(); var failureReason = e.CombineMessages();
await headquartersService.SetOperationEndedWithFailAsync(operation.Id, failedAt, failureReason); await headquartersService.SetOperationEndedWithFailAsync(operation.Id, failedAt, failureReason);

View File

@ -45,7 +45,7 @@ namespace Hcs.WebApp.BackgroundServices
var messageGuid = string.Empty; var messageGuid = string.Empty;
try try
{ {
var startedAt = DateTime.UtcNow; var startedAt = DateTime.Now;
await headquartersService.SetOperationStartedAsync(operation.Id, startedAt); await headquartersService.SetOperationStartedAsync(operation.Id, startedAt);
state.InvokeOnOperationStarted(operation.Id, operation.CampaignId, startedAt); state.InvokeOnOperationStarted(operation.Id, operation.CampaignId, startedAt);
@ -55,7 +55,7 @@ namespace Hcs.WebApp.BackgroundServices
} }
catch (Exception e) catch (Exception e)
{ {
var endedAt = DateTime.UtcNow; var endedAt = DateTime.Now;
var failureReason = e.CombineMessages(); var failureReason = e.CombineMessages();
await headquartersService.SetOperationEndedWithFailAsync(operation.Id, endedAt, failureReason); await headquartersService.SetOperationEndedWithFailAsync(operation.Id, endedAt, failureReason);

View File

@ -89,7 +89,7 @@ namespace Hcs.WebApp.BackgroundServices
catch (Exception e) catch (Exception e)
{ {
var headquartersService = scope.ServiceProvider.GetRequiredService<HeadquartersService>(); var headquartersService = scope.ServiceProvider.GetRequiredService<HeadquartersService>();
endedAt = DateTime.UtcNow; endedAt = DateTime.Now;
failureReason = e.CombineMessages(); failureReason = e.CombineMessages();
await headquartersService.SetOperationEndedWithFailAsync(entry.operation.Id, endedAt, failureReason); await headquartersService.SetOperationEndedWithFailAsync(entry.operation.Id, endedAt, failureReason);

View File

@ -38,14 +38,14 @@ namespace Hcs.WebApp.BackgroundServices.ResultGetters.HouseManagement
contracts.Add(new SupplyContract() contracts.Add(new SupplyContract()
{ {
HcsId = Guid.Parse(entry.ContractGUID), HcsId = Guid.Parse(entry.ContractGUID),
SyncedAt = DateTime.UtcNow, SyncedAt = DateTime.Now,
LastSyncOperationId = operation.Id LastSyncOperationId = operation.Id
}); });
} }
await supplyContractService.UpsertSupplyContracts(context, contracts); await supplyContractService.UpsertSupplyContracts(context, contracts);
endedAt = DateTime.UtcNow; endedAt = DateTime.Now;
await headquartersService.SetOperationEndedAsync(context, operation.Id, endedAt); await headquartersService.SetOperationEndedAsync(context, operation.Id, endedAt);
if (!string.IsNullOrEmpty(result.NextResultsGuid)) if (!string.IsNullOrEmpty(result.NextResultsGuid))

View File

@ -34,7 +34,7 @@ namespace Hcs.WebApp.BackgroundServices.ResultGetters.Nsi
try try
{ {
var registry = await registryService.GetRegistryByOperationIdAsync(context, operation.Id, true); var registry = await registryService.GetRegistryByOperationIdAsync(context, operation.Id, true);
registry.SyncedAt = DateTime.UtcNow; registry.SyncedAt = DateTime.Now;
registry.Elements?.Clear(); registry.Elements?.Clear();
await context.SaveChangesAsync(); await context.SaveChangesAsync();
@ -52,7 +52,7 @@ namespace Hcs.WebApp.BackgroundServices.ResultGetters.Nsi
} }
await context.SaveChangesAsync(); await context.SaveChangesAsync();
endedAt = DateTime.UtcNow; endedAt = DateTime.Now;
await headquartersService.SetOperationEndedAsync(context, operation.Id, endedAt); await headquartersService.SetOperationEndedAsync(context, operation.Id, endedAt);
await transaction.CommitAsync(); await transaction.CommitAsync();

View File

@ -34,7 +34,7 @@ namespace Hcs.WebApp.BackgroundServices.ResultGetters.NsiCommon
try try
{ {
var registry = await registryService.GetRegistryByOperationIdAsync(context, operation.Id, true); var registry = await registryService.GetRegistryByOperationIdAsync(context, operation.Id, true);
registry.SyncedAt = DateTime.UtcNow; registry.SyncedAt = DateTime.Now;
registry.Elements?.Clear(); registry.Elements?.Clear();
await context.SaveChangesAsync(); await context.SaveChangesAsync();
@ -52,7 +52,7 @@ namespace Hcs.WebApp.BackgroundServices.ResultGetters.NsiCommon
} }
await context.SaveChangesAsync(); await context.SaveChangesAsync();
endedAt = DateTime.UtcNow; endedAt = DateTime.Now;
await headquartersService.SetOperationEndedAsync(context, operation.Id, endedAt); await headquartersService.SetOperationEndedAsync(context, operation.Id, endedAt);
await transaction.CommitAsync(); await transaction.CommitAsync();

View File

@ -77,7 +77,7 @@
root.GetProperty("path").GetString(), root.GetProperty("path").GetString(),
root.GetProperty("fileName").GetString(), root.GetProperty("fileName").GetString(),
UploaderId, UploaderId,
DateTime.UtcNow); DateTime.Now);
fileToParseId = fileToParse.Id; fileToParseId = fileToParse.Id;
} }
catch (Exception e) catch (Exception e)

View File

@ -77,7 +77,7 @@ namespace Hcs.WebApp.Services
{ {
Type = type, Type = type,
InitiatorId = initiatorId, InitiatorId = initiatorId,
CreatedAt = DateTime.UtcNow CreatedAt = DateTime.Now
}; };
if (args != null) if (args != null)
@ -99,7 +99,7 @@ namespace Hcs.WebApp.Services
{ {
CampaignId = campaignId, CampaignId = campaignId,
Type = type, Type = type,
CreatedAt = DateTime.UtcNow CreatedAt = DateTime.Now
}); });
} }
await context.Operations.AddRangeAsync(operations); await context.Operations.AddRangeAsync(operations);