forked from ddrilling/AsbCloudServer
Правка типа дат для ReportParametersRequest
This commit is contained in:
parent
0bbbb43802
commit
820e383e5b
@ -24,12 +24,12 @@ public class ReportParametersRequest: IValidatableObject
|
||||
/// <summary>
|
||||
/// Дата начала интервала
|
||||
/// </summary>
|
||||
public DateTime Begin { get; set; } = default;
|
||||
public DateTimeOffset Begin { get; set; } = default;
|
||||
|
||||
/// <summary>
|
||||
/// Дата окончания интервала
|
||||
/// </summary>
|
||||
public DateTime End { get; set; } = default;
|
||||
public DateTimeOffset End { get; set; } = default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
@ -37,7 +37,7 @@ public class ReportParametersRequest: IValidatableObject
|
||||
if (End < Begin)
|
||||
yield return new("End mast be less then begin");
|
||||
|
||||
if (Begin < new DateTime(2000, 1, 1))
|
||||
if (Begin < new DateTimeOffset(2000, 1, 1, 0, 0, 0, TimeSpan.Zero))
|
||||
yield return new("Begin mast be > 2000-1-1");
|
||||
}
|
||||
}
|
@ -46,7 +46,7 @@ namespace AsbCloudApp.Services
|
||||
/// <param name="stepSeconds"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <returns></returns>
|
||||
int GetReportPagesCount(int idWell, DateTime begin, DateTime end,
|
||||
int GetReportPagesCount(int idWell, DateTimeOffset begin, DateTimeOffset end,
|
||||
int stepSeconds, int format);
|
||||
|
||||
/// <summary>
|
||||
|
@ -64,11 +64,11 @@ public class ReportService : IReportService
|
||||
return work.Id;
|
||||
}
|
||||
|
||||
public int GetReportPagesCount(int idWell, DateTime begin, DateTime end, int stepSeconds, int format)
|
||||
public int GetReportPagesCount(int idWell, DateTimeOffset begin, DateTimeOffset end, int stepSeconds, int format)
|
||||
{
|
||||
var timezoneOffset = wellService.GetTimezone(idWell).Hours;
|
||||
var beginRemote = begin.ToTimeZoneOffsetHours(timezoneOffset);
|
||||
var endRemote = end.ToTimeZoneOffsetHours(timezoneOffset);
|
||||
var beginRemote = begin.DateTime.ToTimeZoneOffsetHours(timezoneOffset);
|
||||
var endRemote = end.DateTime.ToTimeZoneOffsetHours(timezoneOffset);
|
||||
|
||||
var generator = GetReportGenerator(idWell, beginRemote, endRemote, stepSeconds, format, db);
|
||||
var pagesCount = generator.GetPagesCount();
|
||||
@ -127,10 +127,10 @@ public class ReportService : IReportService
|
||||
CancellationToken token)
|
||||
{
|
||||
var timezoneOffset = wellService.GetTimezone(idWell).Hours;
|
||||
var beginRemote = request.Begin.ToTimeZoneOffsetHours(timezoneOffset);
|
||||
var endRemote = request.End.ToTimeZoneOffsetHours(timezoneOffset);
|
||||
var beginUtc = request.Begin.ToUtcDateTimeOffset(timezoneOffset);
|
||||
var endUtc = request.End.ToUtcDateTimeOffset(timezoneOffset);
|
||||
var beginRemote = request.Begin.DateTime;
|
||||
var endRemote = request.End.DateTime;
|
||||
var beginUtc = request.Begin.ToUniversalTime();
|
||||
var endUtc = request.End.ToUniversalTime();
|
||||
|
||||
var tempDir = Path.Combine(Path.GetTempPath(), "report");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user