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

            return(val);
        }
Пример #2
0
 public void Fail(object result, QueryErrorCode errorCode, string message)
 {
     Success   = false;
     Result    = result;
     ErrorCode = errorCode;
     Message   = message;
     HasError  = true;
 }
Пример #3
0
 /// <summary>
 /// 查询接口返回参数方法
 /// </summary>
 /// <param name="query">接受参数实体</param>
 /// <param name="errorCode">参数接口枚举</param>
 /// <returns></returns>
 public static QueryRespon QueryResp(this QueryRespon query, QueryErrorCode error)
 {
     query.ErrorCode = error.QueryGetValue();
     query.Message   = error.QueryGetDescription();
     if (error == QueryErrorCode.Code100)
     {
         query.Success = true;
     }
     return(query);
 }
Пример #4
0
 public void Fail(object result, QueryErrorCode errorCode)
 {
     Fail(result, errorCode, null);
 }
Пример #5
0
 public void Fail(QueryErrorCode errorCode)
 {
     Fail(null, errorCode, errorCode.ToString());
 }
Пример #6
0
 /// <summary>
 /// 查询接口返回参数方法
 /// </summary>
 /// <param name="response">接受参数实体</param>
 /// <param name="errorCode">参数接口枚举</param>
 /// <returns></returns>
 public static Response QueryToResponse(this Response response, QueryErrorCode errorCode)
 {
     response.ErrorCode = errorCode.QueryGetValue();
     response.Message   = errorCode.QueryGetDescription();
     return(response);
 }