Files
2024-12-10 09:03:59 +08:00

41 lines
1.2 KiB
C#

using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace UFIDA.U8.Framework.Api.ControlObject.Common
{
public class APARHelper
{
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
//private readonly VoucherData _vd;
private readonly PropertyInfo[] _props;
//public APARHelper(VoucherDataClass vd)
//{
// _vd = vd;
// var tp = vd.GetType();
// _props = tp.GetProperties();
//}
public void SetValue(Dictionary<string, object> dictionary)
{
foreach (var key in dictionary.Keys)
{
if (key != "body")
logInfo.Debug($"正在设置字段:{key}--{dictionary[key]}");
if (!string.IsNullOrWhiteSpace($"{dictionary[key]}") && _props.Any(a => string.Equals(a.Name, key, StringComparison.OrdinalIgnoreCase)))
{
var prop = _props.First(a => string.Equals(a.Name, key, StringComparison.OrdinalIgnoreCase));
//prop.SetPropValue(_vd, dictionary[key]);
}
}
}
}
}