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); } }
public async Task <object> UpdateProductionDate(string value, int scheduleID) { var dt = Convert.ToDateTime(value); var item = _repoScheduleUpdate.FindById(scheduleID); var process = await _repoProcess.FindAll().FirstOrDefaultAsync(x => x.Name.ToUpper().Equals(item.Treatment.ToUpper())); var ProcessID = 0; if (process != null) { ProcessID = process.ID; } try { item.ProductionDate = dt.Date; if (ProcessID == 1) { item.EstablishDate = dt.Date.AddDays(-30); } else { item.EstablishDate = dt.Date.AddDays(-15); } return(await _repoScheduleUpdate.SaveAll()); } catch (Exception) { return(false); } throw new System.NotImplementedException(); }
public async Task <bool> Add(TreatmentWayDto model) { var treatmentWay = _mapper.Map <TreatmentWay>(model); var processID = _repoProcess.FindAll().FirstOrDefault(x => x.Name == model.process).ID; treatmentWay.processID = processID; _repoTreatmentWay.Add(treatmentWay); return(await _repoTreatmentWay.SaveAll()); }
//Lấy toàn bộ danh sách Supplier public async Task <List <SuppilerDto> > GetAllAsync() { // ProjectTo<SuppilerDto>(_configMapper).OrderByDescending(x => x.ID).ToListAsync() return(await _repoSupplier.FindAll().Where(x => x.isShow == true).Select(x => new SuppilerDto { ID = x.ID, Name = x.Name, Process = _repoProcess.FindAll().FirstOrDefault(y => y.ID == x.ProcessID).Name }).OrderByDescending(x => x.ID).ToListAsync()); }
public async Task <List <ProcessDto> > GetAllAsync() { return(await _repoProcess.FindAll().ProjectTo <ProcessDto>(_configMapper).OrderBy(x => x.ID).ToListAsync()); }