添加项目文件。
This commit is contained in:
140
Print.Forum.Application.Contracts/ResultDto.cs
Normal file
140
Print.Forum.Application.Contracts/ResultDto.cs
Normal file
@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Print.Forum.Application.Contracts
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace JingGong.Abp.MES
|
||||
{
|
||||
public class CommonDto
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class SelectOptionDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 选项类型id
|
||||
/// </summary>
|
||||
[Description("选项类型id")]
|
||||
public string Option_Id
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 选项类型名称
|
||||
/// </summary>
|
||||
[Description("选项类型名称")]
|
||||
public string Option_Name { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选项扩展
|
||||
/// </summary>
|
||||
[Description("选项扩展")]
|
||||
public string Option_Extend { get; set; }
|
||||
|
||||
}
|
||||
public class ExecResult
|
||||
{
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
public bool IsScucess { get; set; }
|
||||
public int ReturnCode { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 通用的操作方法返回类(不携带数据)
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ResultDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 操作是否成功
|
||||
/// </summary>
|
||||
[Description("操作是否成功")]
|
||||
public bool IsSuccess { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作提示语
|
||||
/// </summary>
|
||||
[Description("操作提示语")]
|
||||
public string Info { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 错误列表
|
||||
/// </summary>
|
||||
[Description("错误列表")]
|
||||
public List<string> ErrorList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 以是否成功和提示语进行初始化
|
||||
/// </summary>
|
||||
/// <param name="isSuccess">是否成功</param>
|
||||
/// <param name="info">提示语</param>
|
||||
/// <param name="data">辅助对象</param>
|
||||
public ResultDto(bool isSuccess, string info = "")
|
||||
{
|
||||
this.IsSuccess = isSuccess;
|
||||
this.Info = info;
|
||||
}
|
||||
/// <summary>
|
||||
/// 用于if语句,直接判断是否成功
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public static implicit operator Boolean(ResultDto t)
|
||||
{
|
||||
if (t == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return t.IsSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用的操作方法返回类(携带泛型数据)
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class ResultDto<T> : ResultDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 携带的辅助对象
|
||||
/// </summary>
|
||||
public T Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 以操作是否成功、提示语、携带数据进行初始化
|
||||
/// </summary>
|
||||
/// <param name="isSuccess">是否成功</param>
|
||||
/// <param name="info">提示语</param>
|
||||
/// <param name="data">辅助对象</param>
|
||||
public ResultDto(bool isSuccess, string info = "", T data = default(T)) : base(isSuccess, info)
|
||||
{
|
||||
this.Data = data;
|
||||
}
|
||||
|
||||
public ResultDto(ResultDto result) : base(result.IsSuccess, result.Info)
|
||||
{
|
||||
this.Data = default(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 默认构造方法
|
||||
/// </summary>
|
||||
public ResultDto() : base(false, string.Empty)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user