using Bro.Common.Helper;
|
using System.Collections.Generic;
|
|
namespace Bro.Common.Model
|
{
|
public class ProcessResponse : IComplexDisplay
|
{
|
/// <summary>
|
/// 执行操作简单结果
|
/// </summary>
|
public int ResultValue { get; set; } = 0;
|
|
//public string Message { get; set; }
|
|
//public string DataJson { get; set; }
|
|
/// <summary>
|
/// 执行结果数据集合
|
/// </summary>
|
public List<ushort> DataList { get; set; } = new List<ushort>();
|
|
public ProcessResponse() { }
|
|
public ProcessResponse(int result)
|
{
|
ResultValue = result;
|
}
|
|
public ProcessResponse(bool resultFlag, List<ushort> datas = null)
|
{
|
ResultValue = resultFlag ? 1 : -1;
|
|
if (datas != null)
|
{
|
DataList = datas;
|
}
|
}
|
|
public ProcessResponse(bool resultFlag, List<int> datas)
|
{
|
ResultValue = resultFlag ? 1 : -1;
|
|
if (datas != null)
|
{
|
datas.ForEach(d =>
|
{
|
DataList.AddRange(d.ParseIntToUnsignShortList());
|
});
|
}
|
}
|
|
public string GetDisplayText()
|
{
|
return $"{ResultValue} | {(DataList.Count > 0 ? string.Join(" ", DataList) : "NA")}";
|
}
|
}
|
}
|