/// <summary> /// 设置泛型结果信息,并返回 /// </summary> /// <typeparam name="TRes"></typeparam> /// <param name="res"></param> /// <param name="sysRet"></param> /// <param name="eMsg"></param> /// <returns></returns> public static TRes WithResult <TRes>(this TRes res, SysResultTypes sysRet, string eMsg) where TRes : ResultMo { return(res.WithResult((int)sysRet, (int)ResultTypes.Success, eMsg)); }
/// <summary> /// 构造结果类 /// </summary> /// <param name="sysRet">【系统/框架】 结果标识</param> /// <param name="ret">【业务】结果标识</param> /// <param name="message">结果信息描述</param> public ResultMo(SysResultTypes sysRet, ResultTypes ret, string message) : this((int) sysRet, (int) ret, message) { }
/// <summary> /// 构造异常结果类 /// </summary> /// <param name="sysRet">【系统/框架】 结果标识</param> /// <param name="msg">结果信息描述</param> public ResultException(SysResultTypes sysRet, string msg) : base(msg) { sys_ret = (int)sysRet; this.ret = (int)ret; this.msg = msg; }
/// <summary> /// 构造结果类 /// </summary> /// <param name="sysRet">【系统/框架】 结果标识</param> /// <param name="message">结果信息描述</param> public ResultMo(SysResultTypes sysRet, string message = null) : this((int) sysRet, 0, message) { }
/// <summary> /// 【系统结果】是否是对应的类型 /// </summary> /// <param name="res"></param> /// <param name="type"></param> /// <returns></returns> public static bool IsSysResultType(this ResultMo res, SysResultTypes type) => res.sys_ret == (int)type;