27 lines
952 B
C#
27 lines
952 B
C#
using Microsoft.Extensions.Logging;
|
|
namespace AyaNova.Biz
|
|
{
|
|
|
|
//Turn a type and ID into a displayable name
|
|
//Used by search and eventlog processor
|
|
internal static class BizObjectNameFetcherDirect
|
|
{
|
|
internal static string Name(AyaType ayaType, long id, System.Data.Common.DbCommand cmd)
|
|
{
|
|
try
|
|
{
|
|
cmd.CommandText = $"select PUBLIC.AYGETNAME({id}, {(int)ayaType}) as m";
|
|
// cmd.CommandText = $"SELECT m.{COLUMN} FROM {TABLE} AS m WHERE m.id = {id} LIMIT 1";
|
|
using (var dr = cmd.ExecuteReader())
|
|
return dr.Read() ? dr.GetString(0) : "-";
|
|
}
|
|
catch
|
|
{
|
|
((ILogger)AyaNova.Util.ApplicationLogging.CreateLogger("BizObjectNameFetcherDirect")).LogError($"### Error fetching for type {ayaType}");
|
|
throw;
|
|
}
|
|
}
|
|
}//eoc
|
|
}//eons
|
|
|