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();
try
{
startedAt = DateTime.UtcNow;
startedAt = DateTime.Now;
await HeadquartersService.SetCampaignStartedAsync(context, campaign.Id, startedAt);
await ProgressStepAsync(context, (int)Step.ExecutionWait);
@ -118,7 +118,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
{
await ProgressStepAsync(context, (int)Step.End);
endedAt = DateTime.UtcNow;
endedAt = DateTime.Now;
await HeadquartersService.SetCampaignEndedAsync(context, campaign.Id, endedAt);
await transaction.CommitAsync();

View File

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

View File

@ -35,7 +35,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
public async Task EndWithFailAsync(Exception e)
{
var endedAt = DateTime.UtcNow;
var endedAt = DateTime.Now;
var failureReason = e.CombineMessages();
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();
try
{
startedAt = DateTime.UtcNow;
startedAt = DateTime.Now;
await HeadquartersService.SetCampaignStartedAsync(context, campaign.Id, startedAt);
await ProgressStepAsync(context, (int)Step.ParseWait);
@ -95,7 +95,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
{
await ProgressStepAsync(context, (int)Step.End);
endedAt = DateTime.UtcNow;
endedAt = DateTime.Now;
await HeadquartersService.SetCampaignEndedAsync(context, campaign.Id, endedAt);
await transaction.CommitAsync();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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