67 lines
2.1 KiB
C#
67 lines
2.1 KiB
C#
using PARR.Constants;
|
||
using PARR.DAL.Models.Base;
|
||
using System.ComponentModel.DataAnnotations;
|
||
using System.ComponentModel.DataAnnotations.Schema;
|
||
|
||
namespace PARR.DAL.Models
|
||
{
|
||
/// <summary>
|
||
/// Период автоматического распеделения РР
|
||
/// </summary>
|
||
[Table("DistributionPeriods")]
|
||
public class DistributionPeriod : IBase
|
||
{
|
||
[Key]
|
||
public Guid Id { get; set; }
|
||
|
||
[NotMapped]
|
||
public DateTimeOffset DateCreated { get; set; }
|
||
|
||
[NotMapped]
|
||
public DateTimeOffset? DateModified { get; set; }
|
||
|
||
public required string Name { get; set; }
|
||
|
||
public required string Duration { get; set; }
|
||
|
||
public required string Type { get; set; }
|
||
|
||
//public DateTimeOffset AddDate
|
||
//{
|
||
// get
|
||
// {
|
||
// var typeEnum = Enum.Parse(typeof(DistributionPeriodTypeEnum), Type);
|
||
|
||
// switch (typeEnum)
|
||
// {
|
||
// case (DistributionPeriodTypeEnum.Day):
|
||
// int.TryParse(Duration, out var intDays);
|
||
// return new DateTimeOffset().AddDays(intDays);
|
||
|
||
// case (DistributionPeriodTypeEnum.Month):
|
||
// int.TryParse(Duration, out var intMonth);
|
||
// return new DateTimeOffset().AddMonths(intMonth);
|
||
|
||
// case (DistributionPeriodTypeEnum.Year):
|
||
// int.TryParse(Duration, out var intYear);
|
||
// return new DateTimeOffset().AddYears(intYear);
|
||
|
||
// case (DistributionPeriodTypeEnum.TimeSpan):
|
||
// TimeSpan.TryParse(Duration, out var timeSpan);
|
||
// return new DateTimeOffset().Add(timeSpan);
|
||
// }
|
||
|
||
// return new DateTimeOffset();
|
||
// }
|
||
//}
|
||
|
||
[ForeignKey(nameof(Type))]
|
||
public DistributionPeriodType? DistributionPeriodType { get; set; }
|
||
|
||
public ICollection<EsppSchTypeValue> EsppSchTypeValues { get; set; } = new HashSet<EsppSchTypeValue>();
|
||
|
||
|
||
|
||
}
|
||
}
|