BT-Felder
This commit is contained in:
parent
b77e7b0563
commit
9ff1d7d0f0
@ -11,6 +11,7 @@ using static DigitalData.Modules.Interfaces.PropertyValues;
|
||||
using System.Data.SqlClient;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Xml.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace ZUGFeRDRESTService.Controllers
|
||||
{
|
||||
@ -387,15 +388,32 @@ namespace ZUGFeRDRESTService.Controllers
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pProperty.ItemType == 0 && string.IsNullOrEmpty(pProperty.Value.ToString()))
|
||||
{
|
||||
// Leere Texte speichern wir nicht in der DB
|
||||
return true;
|
||||
}
|
||||
|
||||
var oSql = $"INSERT INTO {pProperty.TableName} " +
|
||||
"(REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, CREATEDWHO, SPEC_NAME, GROUP_COUNTER, IS_REQUIRED) VALUES " +
|
||||
"(@REFERENCE_GUID, @ITEM_DESCRIPTION, @ITEM_VALUE, @CREATEDWHO, @SPEC_NAME, @GROUP_COUNTER, @IS_REQUIRED)";
|
||||
|
||||
string itemValue = string.Empty;
|
||||
if (pProperty.Value.Length > 900)
|
||||
{
|
||||
itemValue = pProperty.Value.Substring(1, 899);
|
||||
_logger.Warn("Value for field [{0}] is longer than 900 characters, will be truncated!", pProperty.TableColumn);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemValue = pProperty.Value;
|
||||
}
|
||||
|
||||
var oParams = new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@REFERENCE_GUID", pMessageId),
|
||||
new SqlParameter("@ITEM_DESCRIPTION", pProperty.Description),
|
||||
new SqlParameter("@ITEM_VALUE", pProperty.Value),
|
||||
new SqlParameter("@ITEM_VALUE", itemValue.Replace("'", "''")),
|
||||
new SqlParameter("@CREATEDWHO", ADDED_WHO),
|
||||
new SqlParameter("@GROUP_COUNTER", pProperty.GroupCounter),
|
||||
new SqlParameter("@SPEC_NAME", pProperty.TableColumn),
|
||||
|
||||
@ -70,7 +70,8 @@ namespace ZUGFeRDRESTService
|
||||
IsRequired = (bool)oRow["IS_REQUIRED"],
|
||||
IsGrouped = (bool)oRow["IS_GROUPED"],
|
||||
Specification = oRow["SPECIFICATION"].ToString(),
|
||||
ItemType = oRow["ITEM_TYPE"] != null ? Convert.ToInt32(oRow["ITEM_TYPE"]) : 0
|
||||
ItemType = oRow["ITEM_TYPE"] != null ? Convert.ToInt32(oRow["ITEM_TYPE"]) : 0,
|
||||
EN16931_ID = oRow["EN16931_ID"] != null ? oRow["EN16931_ID"].ToString() : "-"
|
||||
});
|
||||
}
|
||||
} else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user