2024-07-01 16:56:59 +10:00
|
|
|
|
using PARR.Constants;
|
2026-01-20 16:17:09 +10:00
|
|
|
|
using PARR.DAL.Context;
|
2024-07-01 16:56:59 +10:00
|
|
|
|
using PARR.DAL.Models.Base;
|
2026-01-20 16:17:09 +10:00
|
|
|
|
using PARR.DAL.Models.Job;
|
2024-07-01 12:09:01 +10:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
|
|
|
|
|
|
namespace PARR.DAL.Models
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Период автоматического распеделения РР
|
|
|
|
|
|
/// </summary>
|
2026-01-20 16:17:09 +10:00
|
|
|
|
[Table("DistributionPeriods", Schema = DataContextSettings.Schedule)]
|
2024-07-01 12:09:01 +10:00
|
|
|
|
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; }
|
|
|
|
|
|
|
2024-07-01 16:56:59 +10:00
|
|
|
|
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; }
|
2024-07-01 12:09:01 +10:00
|
|
|
|
|
2026-01-20 16:17:09 +10:00
|
|
|
|
public ICollection<JobGroupDistributionConfig> GroupDistributionConfig { get; set; } = new HashSet<JobGroupDistributionConfig>();
|
|
|
|
|
|
|
|
|
|
|
|
//public ICollection<EsppSchTypeValue> EsppSchTypeValues { get; set; } = new HashSet<EsppSchTypeValue>();
|
2024-07-01 12:09:01 +10:00
|
|
|
|
|
2024-07-01 16:56:59 +10:00
|
|
|
|
|
|
|
|
|
|
|
2024-07-01 12:09:01 +10:00
|
|
|
|
}
|
|
|
|
|
|
}
|