- Added import algorithm - Added FromJsonX() methods to data models - Added possibility to work with temp. database file - Added export processor to handle export process & triggers - Added something changed event e.g. as export trigger - Added possibility to import a JSON export - Updated Git icon
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using DataModel.Database.Common;
|
|
|
|
namespace DataModel.Database;
|
|
|
|
public sealed class TextElement
|
|
{
|
|
[Key]
|
|
public int Id { get; set; }
|
|
|
|
public Guid UniqueId { get; set; }
|
|
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
public string Code { get; set; } = string.Empty;
|
|
|
|
public bool IsMultiLine { get; set; } = false;
|
|
|
|
public Section Section { get; set; }
|
|
|
|
public List<Translation> Translations { get; set; } = new();
|
|
|
|
internal DataContext.JsonUniqueId JsonUniqueId => new(this.Code, this.UniqueId, "TXT");
|
|
|
|
internal DataContext.JsonTextElement ToJsonTextElement() => new()
|
|
{
|
|
UniqueId = this.JsonUniqueId,
|
|
Code = this.Code,
|
|
Name = this.Name,
|
|
IsMultiLine = this.IsMultiLine,
|
|
SectionUniqueId = this.Section.JsonUniqueId,
|
|
Translations = this.Translations.Select(n => n.JsonUniqueId).ToList(),
|
|
};
|
|
|
|
internal static TextElement FromJsonTextElement(DataContext.JsonTextElement jsonTextElement) => new()
|
|
{
|
|
UniqueId = jsonTextElement.UniqueId.UniqueId,
|
|
Code = jsonTextElement.Code,
|
|
Name = jsonTextElement.Name,
|
|
IsMultiLine = jsonTextElement.IsMultiLine,
|
|
Section = new(),
|
|
Translations = new(),
|
|
};
|
|
} |