コード例 #1
0
 public async Task<OperationStatus> DeleteSecuritiesAndExchanges()
 {
     OperationStatus opStatus = new OperationStatus { Status = true };
     try
     {
         await Task.Run(() => Database.ExecuteSqlCommand("DeleteSecuritiesAndExchanges"));
     }
     catch (Exception exp)
     {
         return OperationStatus.CreateFromException(exp.Message, exp);
     }
     return opStatus;            
 }
コード例 #2
0
        public static OperationStatus CreateFromException(string message, Exception ex)
        {
            OperationStatus opStatus = new OperationStatus
            {
                Status = false,
                Message = message,
                OperationID = null
            };

            if (ex != null)
            {
                opStatus.ExceptionMessage = ex.Message;
                opStatus.ExceptionStackTrace = ex.StackTrace;
                opStatus.ExceptionInnerMessage = (ex.InnerException == null) ? null : ex.InnerException.Message;
                opStatus.ExceptionInnerStackTrace = (ex.InnerException == null) ? null : ex.InnerException.StackTrace;
            }
            return opStatus;
        }