|
|
@@ -346,23 +346,24 @@ public partial class DataEntryPanel : UserControl, IBasePanel, IDynamicEditorHos
|
|
|
|
|
|
private void SaveDocument(DataEntryDocument dataEntryDocument)
|
|
|
{
|
|
|
- var linktype = CoreUtils.TypeList(x =>
|
|
|
- x.GetInterfaces().Contains(typeof(IEntityLink))
|
|
|
- && x.BaseType != null
|
|
|
- && x.BaseType.IsGenericType
|
|
|
- && x.BaseType.GenericTypeArguments.FirstOrDefault() == _selectedType
|
|
|
- ).FirstOrDefault();
|
|
|
- if (linktype == null)
|
|
|
- return;
|
|
|
-
|
|
|
var doctype = CoreUtils.TypeList(x =>
|
|
|
- x.GetInterfaces().Contains(typeof(IEntityDocument))
|
|
|
- && x.BaseType != null
|
|
|
- && x.BaseType.IsGenericType
|
|
|
- && x.BaseType.GenericTypeArguments.FirstOrDefault() == linktype
|
|
|
- ).FirstOrDefault();
|
|
|
- if (doctype == null)
|
|
|
+ {
|
|
|
+ var entityDoc = x.GetInterfaceDefinition(typeof(IEntityDocument<>));
|
|
|
+ if (entityDoc is null)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ var linkType = entityDoc.GenericTypeArguments[0].GetInterfaceDefinition(typeof(IEntityLink<>));
|
|
|
+ if (linkType is null)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return linkType.GenericTypeArguments[0] == _selectedType;
|
|
|
+ }).FirstOrDefault();
|
|
|
+ if(doctype is null)
|
|
|
+ {
|
|
|
return;
|
|
|
+ }
|
|
|
|
|
|
var doc = (IEntityDocument)Activator.CreateInstance(doctype)!;
|
|
|
CoreUtils.SetPropertyValue(doc,"EntityLink.ID",_entityID);
|