Exemple #1
0
        private async Task <ChemicalDto> AddInk(ChemicalForImportExcelDto chemicalDto)
        {
            var result = new ChemicalDto();

            using (var scope = new TransactionScope(TransactionScopeOption.Required,
                                                    new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }, TransactionScopeAsyncFlowOption.Enabled))
            {
                var supname = await _repoSup.FindAll().FirstOrDefaultAsync(x => x.Name.ToUpper().Equals(chemicalDto.Supplier.ToUpper()));

                if (supname != null)
                {
                    result.SupplierID = supname.ID;
                }
                else
                {
                }

                var process = await _repoProcess.FindAll().FirstOrDefaultAsync(x => x.Name.ToUpper().Equals(chemicalDto.Process.ToUpper()));

                if (process != null)
                {
                    result.ProcessID = process.ID;
                }
                else
                {
                }

                // result.CreatedBy = inkDto.CreatedBy;
                scope.Complete();
                return(result);
            }
        }
Exemple #2
0
 private async Task <bool> CheckExistInk(ChemicalForImportExcelDto ink)
 {
     return(await _repoChemical.FindAll().AnyAsync(x => x.Name == ink.Name && x.ProcessID == ink.ProcessID));
 }