123 lines
4.1 KiB
C#
123 lines
4.1 KiB
C#
using Microsoft.EntityFrameworkCore;
|
||
using PARR.DAL.Models.Base;
|
||
using PARR.DAL.Settings;
|
||
using System.ComponentModel.DataAnnotations;
|
||
using System.ComponentModel.DataAnnotations.Schema;
|
||
|
||
namespace PARR.DAL.Models
|
||
{
|
||
[Table("ApplicationsInWorks")]
|
||
[Index(nameof(WorkId), nameof(ApplicationId), IsUnique = true)]
|
||
public class ApplicationsInWork : IBase
|
||
{
|
||
[Key]
|
||
public Guid Id { get; set; }
|
||
|
||
public DateTimeOffset DateCreated { get; set; }
|
||
|
||
public DateTimeOffset? DateModified { get; set; }
|
||
|
||
public Guid WorkId { get; set; }
|
||
|
||
public Guid ApplicationId { get; set; }
|
||
|
||
/// <summary>
|
||
/// TemplateDuration в формате ЕСПП
|
||
/// </summary>
|
||
public required string TemplateDuration { get; set; }
|
||
|
||
/// <summary>
|
||
/// TemplateDuration в формате TimeSpan
|
||
/// </summary>
|
||
public TimeSpan? TemplateDurationTimeSpan
|
||
{
|
||
get
|
||
{
|
||
try
|
||
{
|
||
//ЕСПП кривоногие, они почему-то таймспан пишут так "7 00:00:00", а правильно так: "7:00:00:00"
|
||
var durationWithTimeSpanFormat = TemplateDuration.Replace(" ", ":");
|
||
|
||
return TimeSpan.Parse(durationWithTimeSpanFormat);
|
||
}
|
||
catch
|
||
{
|
||
return null;
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Краткое описание
|
||
/// </summary>
|
||
public required string ShortDescription { get; set; }
|
||
|
||
|
||
private string _fullDescription = string.Empty;
|
||
public required string FullDescription
|
||
{
|
||
get
|
||
{
|
||
//В полное описание подставляем префикс, для дальнейшего поиска наряда
|
||
return $"{_fullDescription}\r\n{PrefixSettings.PrefixWithoutVariable}";
|
||
}
|
||
set
|
||
{
|
||
//удаляем префикс, если он есть
|
||
//_fullDescription = value.Replace($"\r\n{PrefixSettings.PrefixWithoutVariable}", string.Empty);
|
||
_fullDescription = value.Replace($"{PrefixSettings.PrefixWithoutVariable}", string.Empty).TrimEnd();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Решение
|
||
/// </summary>
|
||
public required string Solution { get; set; }
|
||
|
||
|
||
/// <summary>
|
||
/// Включить автораспределение
|
||
/// </summary>
|
||
public bool IsAutoDistributionEnabled { get; set; }
|
||
|
||
/// <summary>
|
||
/// Дата начала работ
|
||
/// </summary>
|
||
public DateTimeOffset ReferenceDate { get; set; }
|
||
|
||
/// <summary>
|
||
/// Выполняет агент
|
||
/// </summary>
|
||
public bool IsAgent { get; set; }
|
||
|
||
/// <summary>
|
||
/// Какое-то имя которое мы передаем агенту, пока непонятно что это такое.
|
||
/// </summary>
|
||
public string? AgentName { get; set; }
|
||
|
||
/// <summary>
|
||
/// Сколько времени ожидать выполнение скрипта агентом (секунд)
|
||
/// </summary>
|
||
public int? AgentTimeOutSec { get; set; }
|
||
|
||
/// <summary>
|
||
/// Скрипт для автоматического выполнения
|
||
/// </summary>
|
||
public string? AgentScript { get; set; }
|
||
|
||
[ForeignKey(nameof(WorkId))]
|
||
public Work? Work { get; set; }
|
||
|
||
[ForeignKey(nameof(ApplicationId))]
|
||
public Application? Application { get; set; }
|
||
|
||
// public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
|
||
|
||
//public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
|
||
|
||
public ICollection<AppInWorkInWorkGroup> WorkGroups { get; set; } = new HashSet<AppInWorkInWorkGroup>();
|
||
|
||
//public JobAutoControl? JobAutoControl { get; set; }
|
||
}
|
||
}
|