Смена типов дат для TelemetryMessageDto и TelemetryWirelineRunOutBaseDto

This commit is contained in:
Olga Nemt 2024-03-25 09:52:34 +05:00
parent 15b74da498
commit 3def1ad101
4 changed files with 6 additions and 5 deletions

View File

@ -15,7 +15,7 @@ namespace AsbCloudApp.Data.SAUB
/// <summary>
/// отметка времени
/// </summary>
public DateTime Date { get; set; }
public DateTimeOffset Date { get; set; }
/// <summary>
/// глубина забоя

View File

@ -10,7 +10,7 @@ namespace AsbCloudApp.Data.SAUB
/// <summary>
/// отметка времени
/// </summary>
public DateTime DateTime { get; set; }
public DateTimeOffset DateTime { get; set; }
/// <summary>
/// Наработка талевого каната с момента перетяжки каната, т*км

View File

@ -5,6 +5,7 @@ using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Mapster;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@ -93,14 +94,14 @@ namespace AsbCloudInfrastructure.Repository
{
var entity = dto.Adapt<TelemetryWirelineRunOut>();
entity.IdTelemetry = idTelemetry;
entity.DateTime = dto.DateTime.ToUtcDateTimeOffset(timezoneOffset);
entity.DateTime = dto.DateTime.ToOffset(TimeSpan.FromHours(timezoneOffset));
return entity;
}
private static TelemetryWirelineRunOutDto Convert(TelemetryWirelineRunOut entity, WellDto well, double timezoneOffset)
{
var dto = entity.Adapt<TelemetryWirelineRunOutDto>();
dto.DateTime = entity.DateTime.ToRemoteDateTime(timezoneOffset);
dto.DateTime = entity.DateTime.ToOffset(TimeSpan.FromHours(timezoneOffset));
dto.WellInfo = well;
return dto;
}

View File

@ -150,7 +150,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
var entity = dto.Adapt<TelemetryMessage>();
entity.Id = 0;
entity.IdTelemetry = telemetry.Id;
entity.DateTime = dto.Date.ToUtcDateTimeOffset(timezone.Hours);
entity.DateTime = dto.Date.ToOffset(TimeSpan.FromHours(timezone.Hours));
db.TelemetryMessages.Add(entity);
}