feat(bll, dal): distributionPeriod - добавили типы, адаптировали методы
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using PARR.DAL.Models.Base;
|
||||
using PARR.Constants;
|
||||
using PARR.DAL.Models.Base;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -21,9 +22,45 @@ namespace PARR.DAL.Models
|
||||
|
||||
public required string Name { get; set; }
|
||||
|
||||
public TimeSpan Duration { 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>();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
16
PARR.DAL/Models/DistributionPeriodType.cs
Normal file
16
PARR.DAL/Models/DistributionPeriodType.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models
|
||||
{
|
||||
[Table("DistributionPeriodTypes")]
|
||||
public class DistributionPeriodType
|
||||
{
|
||||
[Key]
|
||||
public required string Type { get; set; }
|
||||
|
||||
public required string Description { get; set; }
|
||||
|
||||
public ICollection<DistributionPeriod> Periods { get; set; } = new HashSet<DistributionPeriod>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user