using Bro.Common.Helper;
using System.Collections.Generic;
namespace Bro.Common.Model
{
public class ProcessResponse : IComplexDisplay
{
///
/// 执行操作简单结果
///
public int ResultValue { get; set; } = 0;
//public string Message { get; set; }
//public string DataJson { get; set; }
///
/// 执行结果数据集合
///
public List DataList { get; set; } = new List();
public ProcessResponse() { }
public ProcessResponse(int result)
{
ResultValue = result;
}
public ProcessResponse(bool resultFlag, List datas = null)
{
ResultValue = resultFlag ? 1 : -1;
if (datas != null)
{
DataList = datas;
}
}
public ProcessResponse(bool resultFlag, List 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")}";
}
}
}