예제 #1
0
        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));
            }
        }
예제 #2
0
        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));
            }
        }