Example #1
0
        private static string TranslateErrorCode(Enums.ErrorCode errorCode)
        {
            var resourceValue = ResourceManagerHelper.FindValueInResources(errorCode);

            if (!string.IsNullOrEmpty(resourceValue))
            {
                return(resourceValue);
            }
            return(errorCode.GetDescription());
        }
Example #2
0
        public static void ReportCode(Enums.ErrorCode code, string desc = null)
        {
            string result = string.Format("[ErrorCode]:{0}", code);

            if (desc != null)
            {
                result += string.Format(" {0}", desc);
            }

            ConsoleText(result);
        }
Example #3
0
        public static ApplicationResult <T> Fail <T>(Enums.ErrorCode errorCode, params object[] args)
        {
            var newArs = args.Select(x => (object)ResourceManagerHelper.FindValueInResources(x.ToString())).ToArray();

            return(new ApplicationResult <T>(default(T), errorCode, string.Format(TranslateErrorCode(errorCode), newArs)));
        }
Example #4
0
 public static ApplicationResult Fail(Enums.ErrorCode errorCode)
 {
     return(new ApplicationResult(errorCode));
 }
Example #5
0
 protected ApplicationResult(Enums.ErrorCode errorCode, string errorMessage)
 {
     IsSuccess = false;
     Message   = errorMessage;
     ErrorCode = errorCode;
 }
Example #6
0
 protected ApplicationResult(Enums.ErrorCode errorCode)
 {
     IsSuccess = false;
     Message   = TranslateErrorCode(errorCode);
     ErrorCode = errorCode;
 }
 public DownloaderException(string message, Enums.ErrorCode errorCode)
     : base(String.Format("Devhus.DownloadService Exception: {0}\nErro Code: {1}", message, errorCode.ToString()))
 {
     Code = errorCode;
 }