예제 #1
0
 /// <summary>
 /// Asigna resultado fallido y asocia datos de mensaje segun las excepcion que haya ocurrido segun el formato definido
 /// </summary>
 /// <param name="t">Resultado fallido</param>
 /// <param name="ex">Excepcion inesperada</param>
 /// <param name="ResponseCode">Codigo de la operacions</param>
 /// <param name="ResponseMessage">Mensaje de error</param>
 /// <param name="TransactionID"></param>
 public void SetErrorResultData(T t, Exception ex, int ResponseCode = 0, string ResponseMessage = "ERROR", int TransactionID = 0)
 {
     ObjectResult         = t;
     this.ResponseCode    = UtilResut.ResponseCode(ex, ResponseCode);
     this.ResponseMessage = String.Concat("[", ex.GetType().Name.ToUpper(), "]", " ", ResponseMessage);
     this.TransactionID   = TransactionID;
 }
예제 #2
0
        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);
        }
예제 #3
0
 /// <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;
 }