internal static int?ResponseCode(Exception ex, int ResponseCode) { int result = UtilResut.ErrorCode(ResponseCode); string fullname = ex.GetType().FullName; if (fullname.Equals("Movilway.API.Core.ApiException", StringComparison.InvariantCultureIgnoreCase)) { result = UtilResut.BussErrorCode(ResponseCode); } else if (fullname.IndexOf(".Data.", StringComparison.InvariantCultureIgnoreCase) > 0) { result = UtilResut.DbErrorCode(ResponseCode); } else if (fullname.IndexOf(".Net.", StringComparison.InvariantCultureIgnoreCase) > 0) { result = UtilResut.SvcErrorCode(ResponseCode); } else if (fullname.IndexOf(".IO.", StringComparison.InvariantCultureIgnoreCase) > 0) { result = UtilResut.IOErrorCode(ResponseCode); } return(result); }
/// <summary> /// Asigna los valores de la operacion en caso de que la operacion fue erronea /// </summary> /// <param name="t"></param> /// <param name="ResponseCode"></param> /// <param name="ResponseMessage"></param> /// <param name="TransactionID"></param> public void SetResultData(T t, int ResponseCode = UtilResut.OK_RESPONSE_CODE, string ResponseMessage = "OK", int TransactionID = 0) { ObjectResult = t; this.ResponseCode = ResponseCode != UtilResut.OK_RESPONSE_CODE ? UtilResut.BussErrorCode(ResponseCode) : ResponseCode; this.ResponseMessage = ResponseMessage; this.TransactionID = TransactionID; }