Elég sok minden...
This commit is contained in:
@@ -17,11 +17,13 @@ namespace WorkFlowCheck.BL.Services
|
||||
{
|
||||
private AppDbContext _dbContext;
|
||||
private IMapper _mapper;
|
||||
private readonly INumberGeneratorService _numberGeneratorService;
|
||||
|
||||
public CheckListService(AppDbContext dbContext, IMapper mapper)
|
||||
public CheckListService(AppDbContext dbContext, IMapper mapper, INumberGeneratorService numberGeneratorService)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_mapper = mapper;
|
||||
_numberGeneratorService = numberGeneratorService;
|
||||
}
|
||||
|
||||
public async Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id)
|
||||
@@ -112,7 +114,7 @@ namespace WorkFlowCheck.BL.Services
|
||||
|
||||
return retVal;
|
||||
}
|
||||
public async Task<CheckListHeaderDTO> StartNewCheckListAsync(ApiRequestDTO<CheckListTemplateHeaderDTO> request)
|
||||
public async Task<CheckListHeaderDTO> StartNewCheckListAsync(CheckListHeaderNewDTO checkListHeaderNewDTO)
|
||||
{
|
||||
var retVal = new CheckListHeaderDTO()
|
||||
{
|
||||
@@ -121,19 +123,27 @@ namespace WorkFlowCheck.BL.Services
|
||||
|
||||
try
|
||||
{
|
||||
var checkListTemplateHeader = await _dbContext.CheckListTemplateHeaders
|
||||
.Where(w => w.Id == checkListHeaderNewDTO.CheckListTemplateHeaderId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (checkListTemplateHeader == null)
|
||||
{
|
||||
return retVal;
|
||||
}
|
||||
var currentDate = DateTime.UtcNow;
|
||||
var documentNumber = await _numberGeneratorService.GenerateNextNumberAsync(checkListTemplateHeader.NumberGenerator1.Id, currentDate);
|
||||
CheckListHeader checkListHeader = new CheckListHeader()
|
||||
{
|
||||
CheckListTemplateHeaderId = request.Data.Id,
|
||||
CreatedAt = currentDate,
|
||||
CreatedBy = request.UserDTO.UserName,
|
||||
Description = request.Data.Description,
|
||||
DocumentNumber = "",
|
||||
CheckListTemplateHeaderId = checkListHeaderNewDTO.CheckListTemplateHeaderId,
|
||||
DateExecution = currentDate,
|
||||
IsEditable = true,
|
||||
UserId = checkListHeaderNewDTO.UserId,
|
||||
ShortName = "",
|
||||
Description = "",
|
||||
DocumentNumber = documentNumber,
|
||||
GuidNumber = Guid.NewGuid(),
|
||||
IsDeleted = false,
|
||||
IsStorno = false,
|
||||
LastModAt = currentDate,
|
||||
ShortName = "",
|
||||
CheckListRows = new List<CheckListRow>()
|
||||
};
|
||||
_dbContext.CheckListHeaders.Add(checkListHeader);
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces
|
||||
Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync();
|
||||
Task<CheckListHeaderDTO> UpdateCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO);
|
||||
|
||||
Task<CheckListHeaderDTO> StartNewCheckListAsync(ApiRequestDTO<CheckListTemplateHeaderDTO> request);
|
||||
Task<CheckListHeaderDTO> StartNewCheckListAsync(CheckListHeaderNewDTO checkListHeaderNewDTO);
|
||||
|
||||
|
||||
Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeaderAsync(int Id);
|
||||
|
||||
Reference in New Issue
Block a user