mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 17:25:32 +00:00
CMIF implementiert
This commit is contained in:
@@ -3,10 +3,34 @@ using System.Collections.Generic;
|
||||
using HaXMLReader.EvArgs;
|
||||
|
||||
namespace HaDocument.Models {
|
||||
public class AdditionalDates {
|
||||
public DateTime? NotBefore { get; } = null;
|
||||
public DateTime? NotAfter { get; } = null;
|
||||
public DateTime? From { get; } = null;
|
||||
public DateTime? To { get; } = null;
|
||||
public string? Cert { get; } = null;
|
||||
|
||||
|
||||
public AdditionalDates(
|
||||
DateTime? notBefore,
|
||||
DateTime? notAfter,
|
||||
DateTime? from,
|
||||
DateTime? to,
|
||||
string? cert
|
||||
) {
|
||||
NotBefore = notBefore;
|
||||
NotAfter = notAfter;
|
||||
From = from;
|
||||
To = to;
|
||||
Cert = cert;
|
||||
}
|
||||
}
|
||||
|
||||
public class Meta {
|
||||
public string ID { get; } = "";
|
||||
public string Date { get; } = "";
|
||||
public DateTime Sort { get; } = new DateTime(1700, 1, 1);
|
||||
public AdditionalDates? AdditionalDates { get; } = null;
|
||||
public int Order { get; } = -1;
|
||||
public string Location { get; } = "";
|
||||
public List<string> Senders { get; } = null;
|
||||
@@ -14,12 +38,12 @@ namespace HaDocument.Models {
|
||||
public bool? hasOriginal { get; }
|
||||
public bool? isProofread { get; }
|
||||
public bool? isDraft { get; }
|
||||
public ZHInfo ZH { get; } = null;
|
||||
public ZHInfo? ZH { get; } = null;
|
||||
|
||||
public Meta(
|
||||
string id,
|
||||
string date,
|
||||
DateTime sort,
|
||||
string id,
|
||||
string date,
|
||||
DateTime sort,
|
||||
int order,
|
||||
bool? hasOriginal,
|
||||
bool? isProofread,
|
||||
@@ -27,7 +51,8 @@ namespace HaDocument.Models {
|
||||
string location,
|
||||
List<string> senders,
|
||||
List<string> receivers,
|
||||
ZHInfo ZH
|
||||
ZHInfo? ZH,
|
||||
AdditionalDates? additionalDates = null
|
||||
) {
|
||||
ID = id;
|
||||
Date = date;
|
||||
@@ -40,7 +65,8 @@ namespace HaDocument.Models {
|
||||
this.isProofread = isProofread;
|
||||
this.isDraft = isDraft;
|
||||
this.ZH = ZH;
|
||||
this.AdditionalDates = additionalDates;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace HaDocument.Models {
|
||||
public string? Surname { get; }
|
||||
public string? Komm { get; }
|
||||
public string? Reference { get; }
|
||||
public bool IsOrg { get; } = false;
|
||||
public XElement? XElement { get; }
|
||||
|
||||
public Person(
|
||||
@@ -17,7 +18,8 @@ namespace HaDocument.Models {
|
||||
string? surname,
|
||||
string? komm,
|
||||
string? reference,
|
||||
XElement? xElement = null
|
||||
XElement? xElement = null,
|
||||
bool IsOrg = false
|
||||
) {
|
||||
Index = index;
|
||||
Name = name;
|
||||
@@ -25,11 +27,14 @@ namespace HaDocument.Models {
|
||||
Surname = surname;
|
||||
Komm = komm;
|
||||
Reference = reference;
|
||||
this.XElement = xElement;
|
||||
this.IsOrg = IsOrg;
|
||||
}
|
||||
|
||||
public static Person? FromXElement(XElement element) {
|
||||
if (!element.HasAttributes || (element.Name != "personDef" && element.Name != "handDef")) return null;
|
||||
if (element.Attribute("index")?.Value == null || element.Attribute("name")?.Value == null) return null;
|
||||
var org = element.HasAttributes && element.Attribute("org")?.Value == "true";
|
||||
return new Person(
|
||||
element.Attribute("index")!.Value,
|
||||
element.Attribute("name")!.Value,
|
||||
@@ -37,8 +42,9 @@ namespace HaDocument.Models {
|
||||
element.Attribute("nachname")?.Value,
|
||||
element.Attribute("komm")?.Value,
|
||||
element.Attribute("ref")?.Value,
|
||||
element
|
||||
element,
|
||||
org
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user