public async Task <NFeResult> DeleteAll(CancellationToken cancellationToken) { try { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); NFeSet.Load(); NFeSet.RemoveRange(NFeSet.Local); await SaveChangesAsync(cancellationToken); return(NFeResult.Success); } catch (DbUpdateConcurrencyException e) { return(NFeResult.Failed(e)); } catch (DbUpdateException e) { return(NFeResult.Failed(e)); } catch (Exception e) { return(NFeResult.Failed(e)); } }
public async Task <NFeResult> ImportTag(TNFe nfe, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); if (nfe == null) { throw new ArgumentNullException(nameof(nfe)); } try { await NFeSet.AddAsync(nfe); await SaveChangesAsync(cancellationToken); return(NFeResult.Success); } catch (DbUpdateConcurrencyException e) { return(NFeResult.Failed(e)); } catch (DbUpdateException e) { return(NFeResult.Failed(e)); } catch (Exception e) { return(NFeResult.Failed(e)); } }
public static NFeResult Failed(DbUpdateConcurrencyException exception) { var result = new NFeResult { Succeeded = false, DbUpdateConcurrencyException = exception, NFeResultException = NFeResultException.DbUpdateConcurrencyException }; return(result); }
public static NFeResult Failed(Exception exception) { var result = new NFeResult { Succeeded = false, Exception = exception, NFeResultException = NFeResultException.Exception }; return(result); }
public static NFeResult Failed(DbUpdateException exception) { var result = new NFeResult { Succeeded = false, DbUpdateException = exception, NFeResultException = NFeResultException.DbUpdateException, ErrorNumber = ((System.Data.SqlClient.SqlException)exception.InnerException).Number }; return(result); }