DD.WellWorkover.Cloud/AsbCloudApp/Data/ScheduleDto.cs

63 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data
{
/// <summary>
/// Описание данных графика работ
/// </summary>
public class ScheduleDto : IId, IWellRelated, IValidatableObject
{
/// <inheritdoc/>
[Required]
public int Id { get; set; }
/// <inheritdoc/>
[Required]
public int IdWell { get; set; }
/// <summary>
/// Идентификатор бурильщика
/// </summary>
[Required]
public int IdDriller { get; set; }
/// <summary>
/// Начало смены
/// </summary>
[Required]
public TimeDto ShiftStart { get; set; } = null!;
/// <summary>
/// Конец смены
/// </summary>
[Required]
public TimeDto ShiftEnd { get; set; } = null!;
/// <summary>
/// Начало бурения
/// </summary>
[Required]
public DateTimeOffset DrillStart { get; set; }
/// <summary>
/// Конец бурения
/// </summary>
[Required]
public DateTimeOffset DrillEnd { get; set; }
/// <summary>
/// Бурильщик
/// </summary>
public DrillerDto? Driller { get; set; }
/// <inheritdoc/>
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if(DrillStart >= DrillEnd)
yield return new ValidationResult($"DrillStart > DrillEnd");
}
}
}