Beispiel #1
0
        /// <summary>
        /// 返回编码方法
        /// </summary>
        /// <param name="errorCode"></param>
        /// <returns>返回一个int类型的Code值</returns>
        public static int InfoGetValue(this InfoErrorCode errorCode)
        {
            var name = Enum.GetName(typeof(InfoErrorCode), errorCode);
            var val  = (int)Enum.Parse(typeof(InfoErrorCode), name);

            return(val);
        }
Beispiel #2
0
 /// <summary>
 /// 初始化接口返回参数方法
 /// </summary>
 /// <param name="response">接受参数实体</param>
 /// <param name="errorCode">参数接口枚举</param>
 /// <returns></returns>
 public static InnerResponse InfoToResponse(this InnerResponse response, InfoErrorCode errorCode)
 {
     response.ErrorCode = errorCode.InfoGetValue();
     response.Message   = errorCode.InfoGetDescription();
     response.Success   = false;
     if (errorCode == InfoErrorCode.Code100)
     {
         response.Success = true;
     }
     return(response);
 }
Beispiel #3
0
 /// <summary>
 /// 初始化接口返回参数方法
 /// </summary>
 /// <param name="response">接受参数实体</param>
 /// <param name="errorCode">参数接口枚举</param>
 /// <returns></returns>
 public static Response InfoToResponse(this Response response, InfoErrorCode errorCode)
 {
     response.ErrorCode = errorCode.InfoGetValue();
     response.Message   = errorCode.InfoGetDescription();
     return(response);
 }