Elég sok minden ...
This commit is contained in:
@@ -39,7 +39,50 @@ namespace WorkFlowCheck.API.Controllers
|
|||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
[HttpGet("GetAllCheckListHeaders")]
|
||||||
|
public async Task<ApiResponseDTO<List<CheckListHeaderDTO>>> GetAllCheckListHeadersAsync()
|
||||||
|
{
|
||||||
|
var retVal = new ApiResponseDTO<List<CheckListHeaderDTO>>()
|
||||||
|
{
|
||||||
|
IsSuccess = true,
|
||||||
|
};
|
||||||
|
var checkPointListDTO = await _checkListService.GetAllCheckListHeaderAsync();
|
||||||
|
|
||||||
|
if (checkPointListDTO != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
retVal.IsSuccess = true;
|
||||||
|
retVal.Data = checkPointListDTO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
retVal.Errors.Add("No data!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
[HttpPost("UpdateCheckListHeader")]
|
||||||
|
public async Task<ApiResponseDTO<CheckListHeaderDTO>> UpdateCheckListHeader([FromBody] CheckListHeaderDTO checkListHeaderDTO)
|
||||||
|
{
|
||||||
|
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
|
||||||
|
{
|
||||||
|
IsSuccess = true
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _checkListService.UpdateCheckListHeaderAsync(checkListHeaderDTO);
|
||||||
|
retVal.Data = result;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
[HttpPost("StartNew")]
|
[HttpPost("StartNew")]
|
||||||
public async Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew([FromBody] ApiRequestDTO<CheckListTemplateHeaderDTO> request)
|
public async Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew([FromBody] ApiRequestDTO<CheckListTemplateHeaderDTO> request)
|
||||||
{
|
{
|
||||||
@@ -59,5 +102,74 @@ namespace WorkFlowCheck.API.Controllers
|
|||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpGet("GetCheckListTemplateHeader/{id}")]
|
||||||
|
public async Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> GetCheckListTemplateHeader(int id)
|
||||||
|
{
|
||||||
|
var retVal = new ApiResponseDTO<CheckListTemplateHeaderDTO>()
|
||||||
|
{
|
||||||
|
IsSuccess = true,
|
||||||
|
};
|
||||||
|
var CheckListTemplateHeaderDTO = await _checkListService.GetCheckListTemplateHeaderAsync(id);
|
||||||
|
|
||||||
|
if (CheckListTemplateHeaderDTO != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
retVal.IsSuccess = true;
|
||||||
|
retVal.Data = CheckListTemplateHeaderDTO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
retVal.Errors.Add("No data!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
[HttpGet("GetAllCheckListTemplateHeaders")]
|
||||||
|
public async Task<ApiResponseDTO<List<CheckListTemplateHeaderDTO>>> GetAllCheckListTemplateHeadersAsync()
|
||||||
|
{
|
||||||
|
var retVal = new ApiResponseDTO<List<CheckListTemplateHeaderDTO>>()
|
||||||
|
{
|
||||||
|
IsSuccess = true,
|
||||||
|
};
|
||||||
|
var checkPointListDTO = await _checkListService.GetAllCheckListTemplateHeaderAsync();
|
||||||
|
|
||||||
|
if (checkPointListDTO != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
retVal.IsSuccess = true;
|
||||||
|
retVal.Data = checkPointListDTO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
retVal.Errors.Add("No data!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
[HttpPost("UpdateCheckListTemplateHeader")]
|
||||||
|
public async Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> UpdateCheckListTemplateHeader([FromBody] CheckListTemplateHeaderDTO CheckListTemplateHeaderDTO)
|
||||||
|
{
|
||||||
|
var retVal = new ApiResponseDTO<CheckListTemplateHeaderDTO>()
|
||||||
|
{
|
||||||
|
IsSuccess = true
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _checkListService.UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO);
|
||||||
|
retVal.Data = result;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ namespace WorkFlowCheck.BL.Infra
|
|||||||
{
|
{
|
||||||
service.AddScoped<IUserService, UserService>();
|
service.AddScoped<IUserService, UserService>();
|
||||||
service.AddScoped<ISyncService, SyncService>();
|
service.AddScoped<ISyncService, SyncService>();
|
||||||
|
service.AddScoped<ICheckListService, CheckListService>();
|
||||||
|
service.AddScoped<INumberGeneratorService, NumberGeneratorService>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ namespace WorkFlowCheck.BL.Services
|
|||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id)
|
public async Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id)
|
||||||
{
|
{
|
||||||
var retVal = new CheckListHeaderDTO()
|
var retVal = new CheckListHeaderDTO()
|
||||||
@@ -51,6 +52,66 @@ namespace WorkFlowCheck.BL.Services
|
|||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
public async Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync()
|
||||||
|
{
|
||||||
|
var retVal = new List<CheckListHeaderDTO>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var roles = await _dbContext.CheckListHeaders
|
||||||
|
.Include(i => i.CheckListRows)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync();
|
||||||
|
if (roles != null)
|
||||||
|
{
|
||||||
|
retVal = _mapper.Map<List<CheckListHeaderDTO>>(roles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
public async Task<CheckListHeaderDTO> UpdateCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO)
|
||||||
|
{
|
||||||
|
var retVal = new CheckListHeaderDTO() { CheckListRowDTO = new List<CheckListRowDTO>() };
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (checkListHeaderDTO.Id == 0)
|
||||||
|
{
|
||||||
|
var checkListHeader = new CheckListHeader()
|
||||||
|
{
|
||||||
|
CheckListTemplateHeaderId = checkListHeaderDTO.CheckListTemplateHeaderDTO.Id,
|
||||||
|
Description = checkListHeaderDTO.Description,
|
||||||
|
GuidNumber = Guid.NewGuid(),
|
||||||
|
};
|
||||||
|
_dbContext.CheckListHeaders.Add(checkListHeader);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
retVal = _mapper.Map<CheckListHeaderDTO>(checkListHeader);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var checkListHeader = await _dbContext.CheckListHeaders
|
||||||
|
.Include(i => i.CheckListRows)
|
||||||
|
.Where(w => w.Id == checkListHeaderDTO.Id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (checkListHeader != null)
|
||||||
|
{
|
||||||
|
checkListHeader.Description = checkListHeaderDTO.Description;
|
||||||
|
|
||||||
|
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
retVal = _mapper.Map<CheckListHeaderDTO>(checkListHeader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
public async Task<CheckListHeaderDTO> StartNewCheckListAsync(ApiRequestDTO<CheckListTemplateHeaderDTO> request)
|
public async Task<CheckListHeaderDTO> StartNewCheckListAsync(ApiRequestDTO<CheckListTemplateHeaderDTO> request)
|
||||||
{
|
{
|
||||||
var retVal = new CheckListHeaderDTO()
|
var retVal = new CheckListHeaderDTO()
|
||||||
@@ -86,5 +147,95 @@ namespace WorkFlowCheck.BL.Services
|
|||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeaderAsync(int Id)
|
||||||
|
{
|
||||||
|
var retVal = new CheckListTemplateHeaderDTO()
|
||||||
|
{
|
||||||
|
CheckListTemplateRowDTO = new List<CheckListTemplateRowDTO>()
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var res = await _dbContext.CheckListTemplateHeaders
|
||||||
|
.Where(w => w.Id == Id)
|
||||||
|
.Include(i => i.CheckListTemplateRows)
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (res != null)
|
||||||
|
{
|
||||||
|
retVal = _mapper.Map<CheckListTemplateHeaderDTO>(res);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
public async Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync()
|
||||||
|
{
|
||||||
|
var retVal = new List<CheckListTemplateHeaderDTO>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var roles = await _dbContext.CheckListTemplateHeaders
|
||||||
|
.Include(i => i.CheckListTemplateRows)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync();
|
||||||
|
if (roles != null)
|
||||||
|
{
|
||||||
|
retVal = _mapper.Map<List<CheckListTemplateHeaderDTO>>(roles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
public async Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO)
|
||||||
|
{
|
||||||
|
var retVal = new CheckListTemplateHeaderDTO() { CheckListTemplateRowDTO = new List<CheckListTemplateRowDTO>() };
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (checkListTemplateHeaderDTO.Id == 0)
|
||||||
|
{
|
||||||
|
var checkListTemplateHeader = new CheckListTemplateHeader()
|
||||||
|
{
|
||||||
|
Description = checkListTemplateHeaderDTO.Description,
|
||||||
|
ShortName = checkListTemplateHeaderDTO.ShortName,
|
||||||
|
IsDeleted =false,
|
||||||
|
|
||||||
|
};
|
||||||
|
_dbContext.CheckListTemplateHeaders.Add(checkListTemplateHeader);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
retVal = _mapper.Map<CheckListTemplateHeaderDTO>(checkListTemplateHeader);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var checkListTemplateHeader = await _dbContext.CheckListTemplateHeaders
|
||||||
|
.Include(i => i.CheckListTemplateRows)
|
||||||
|
.Where(w => w.Id == checkListTemplateHeaderDTO.Id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (checkListTemplateHeader != null)
|
||||||
|
{
|
||||||
|
checkListTemplateHeader.Description = checkListTemplateHeaderDTO.Description;
|
||||||
|
checkListTemplateHeader.ShortName = checkListTemplateHeaderDTO.ShortName;
|
||||||
|
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
retVal = _mapper.Map<CheckListTemplateHeaderDTO>(checkListTemplateHeader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,14 @@ namespace WorkFlowCheck.BL.Services.Interfaces
|
|||||||
public interface ICheckListService
|
public interface ICheckListService
|
||||||
{
|
{
|
||||||
Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id);
|
Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id);
|
||||||
|
Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync();
|
||||||
|
Task<CheckListHeaderDTO> UpdateCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO);
|
||||||
|
|
||||||
Task<CheckListHeaderDTO> StartNewCheckListAsync(ApiRequestDTO<CheckListTemplateHeaderDTO> request);
|
Task<CheckListHeaderDTO> StartNewCheckListAsync(ApiRequestDTO<CheckListTemplateHeaderDTO> request);
|
||||||
|
|
||||||
|
|
||||||
|
Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeaderAsync(int Id);
|
||||||
|
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync();
|
||||||
|
Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.BL.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface INumberGeneratorService
|
||||||
|
{
|
||||||
|
Task<string> GenerateNextNumberAsync(int templateId, DateTime? baseDate = null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WorkFlowCheck.BL.Services.Interfaces;
|
||||||
|
using WorkFlowCheck.DL;
|
||||||
|
using WorkFlowCheck.DL.Entities;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.BL.Services
|
||||||
|
{
|
||||||
|
public class NumberGeneratorService : INumberGeneratorService
|
||||||
|
{
|
||||||
|
private readonly DbContext _dbContext;
|
||||||
|
private static readonly Dictionary<int, SemaphoreSlim> _templateLocks = new();
|
||||||
|
|
||||||
|
public NumberGeneratorService(AppDbContext dbContext)
|
||||||
|
{
|
||||||
|
_dbContext = dbContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<string> GenerateNextNumberAsync(int templateId, DateTime? baseDate = null)
|
||||||
|
{
|
||||||
|
var semaphore = GetOrCreateSemaphore(templateId);
|
||||||
|
await semaphore.WaitAsync();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var transaction = await _dbContext.Database.BeginTransactionAsync();
|
||||||
|
|
||||||
|
var template = await _dbContext.Set<NumberGeneratorTemplate>()
|
||||||
|
.FirstOrDefaultAsync(t => t.Id == templateId);
|
||||||
|
|
||||||
|
if (template == null)
|
||||||
|
throw new InvalidOperationException($"Template with ID {templateId} not found.");
|
||||||
|
|
||||||
|
var now = baseDate ?? DateTime.Now;
|
||||||
|
var (year, month) = GetKeyDateParts(template, now);
|
||||||
|
|
||||||
|
var templateDate = await _dbContext.Set<NumberGeneratorTemplateDate>()
|
||||||
|
.FirstOrDefaultAsync(td => td.NumberGeneratorTemplateId == templateId && td.Year == year && td.Month == month);
|
||||||
|
|
||||||
|
if (templateDate == null)
|
||||||
|
{
|
||||||
|
templateDate = new NumberGeneratorTemplateDate
|
||||||
|
{
|
||||||
|
NumberGeneratorTemplateId = template.Id,
|
||||||
|
Year = year,
|
||||||
|
Month = month,
|
||||||
|
CurrentNumber = 0
|
||||||
|
};
|
||||||
|
_dbContext.Add(templateDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
templateDate.CurrentNumber++;
|
||||||
|
var formatted = templateDate.CurrentNumber.ToString(template.DigitFormat);
|
||||||
|
var dynamicSuffix = BuildDynamicSuffix(template, now);
|
||||||
|
var result = BuildFormattedNumber(template, formatted, dynamicSuffix);
|
||||||
|
|
||||||
|
templateDate.LastGeneratedNumber = result;
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
await transaction.CommitAsync();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
await _dbContext.Database.RollbackTransactionAsync();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
semaphore.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<string> GetSampleAsync(int templateId, DateTime? baseDate = null)
|
||||||
|
{
|
||||||
|
var template = await _dbContext.Set<NumberGeneratorTemplate>()
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(t => t.Id == templateId);
|
||||||
|
|
||||||
|
if (template == null)
|
||||||
|
throw new InvalidOperationException($"Template with ID {templateId} not found.");
|
||||||
|
|
||||||
|
var now = baseDate ?? DateTime.Now;
|
||||||
|
var formatted = 1.ToString(template.DigitFormat);
|
||||||
|
var dynamicSuffix = BuildDynamicSuffix(template, now);
|
||||||
|
|
||||||
|
return BuildFormattedNumber(template, formatted, dynamicSuffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SemaphoreSlim GetOrCreateSemaphore(int templateId)
|
||||||
|
{
|
||||||
|
lock (_templateLocks)
|
||||||
|
{
|
||||||
|
if (!_templateLocks.ContainsKey(templateId))
|
||||||
|
_templateLocks[templateId] = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
|
return _templateLocks[templateId];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static (int year, int? month) GetKeyDateParts(NumberGeneratorTemplate template, DateTime date)
|
||||||
|
{
|
||||||
|
int year = date.Year;
|
||||||
|
int? month = template.GenerateType == GenerateType.YearAndMonth ? date.Month : null;
|
||||||
|
return (year, month);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string BuildDynamicSuffix(NumberGeneratorTemplate template, DateTime date)
|
||||||
|
{
|
||||||
|
return template.GenerateType switch
|
||||||
|
{
|
||||||
|
GenerateType.OnlyYear => date.Year.ToString(),
|
||||||
|
GenerateType.YearAndMonth => $"{date.Year}/{date.Month:D2}",
|
||||||
|
_ => template.Suffix
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string BuildFormattedNumber(NumberGeneratorTemplate template, string formattedNumber, string dynamicSuffix)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(template.Prefix))
|
||||||
|
sb.Append(template.Prefix);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(template.PrefixSeparator) && !string.IsNullOrEmpty(template.Prefix))
|
||||||
|
sb.Append(template.PrefixSeparator);
|
||||||
|
|
||||||
|
sb.Append(formattedNumber);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(dynamicSuffix))
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(template.SuffixSeparator))
|
||||||
|
sb.Append(template.SuffixSeparator);
|
||||||
|
|
||||||
|
sb.Append(dynamicSuffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ namespace WorkFlowCheck.Common.DTO
|
|||||||
public class CheckListHeaderDTO
|
public class CheckListHeaderDTO
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
public CheckListTemplateHeaderDTO CheckListTemplateHeaderDTO { get; set; }
|
||||||
public string ShortName { get; set; } = null!;
|
public string ShortName { get; set; } = null!;
|
||||||
public string Description { get; set; } = null!;
|
public string Description { get; set; } = null!;
|
||||||
public string DocumentNumber { get; set; } = null!;
|
public string DocumentNumber { get; set; } = null!;
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.Common.DTO
|
||||||
|
{
|
||||||
|
public class NumberGeneratorTemplateDTO
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -158,6 +158,21 @@ namespace WorkFlowCheck.DL
|
|||||||
Token2FA = ""
|
Token2FA = ""
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
modelBuilder.Entity<NumberGeneratorTemplate>().HasData(
|
||||||
|
new NumberGeneratorTemplate
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
CurrentNumber = 0,
|
||||||
|
DigitFormat = "D4",
|
||||||
|
GenerateType = GenerateType.OnlyYear,
|
||||||
|
LastGeneratedNumber = "",
|
||||||
|
Prefix = "CHK",
|
||||||
|
PrefixSeparator = "-",
|
||||||
|
ShortName = "Ellenőrzési dokumentum sorszámozása",
|
||||||
|
Suffix = "",
|
||||||
|
SuffixSeparator = "-",
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Entities
|
||||||
|
{
|
||||||
|
public enum GenerateType
|
||||||
|
{
|
||||||
|
OnlyYear = 0,
|
||||||
|
YearAndMonth = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NumberGeneratorTemplate
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string ShortName { get; set; }
|
||||||
|
public string Prefix { get; set; }
|
||||||
|
public string PrefixSeparator { get; set; }
|
||||||
|
public string DigitFormat { get; set; }
|
||||||
|
public string SuffixSeparator { get; set; }
|
||||||
|
public string Suffix { get; set; }
|
||||||
|
public int CurrentNumber { get; set; }
|
||||||
|
public string LastGeneratedNumber { get; set; }
|
||||||
|
public GenerateType GenerateType { get; set; }
|
||||||
|
public virtual ICollection<NumberGeneratorTemplateDate> NumberGeneratorTemplateDates { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Entities
|
||||||
|
{
|
||||||
|
public class NumberGeneratorTemplateDate
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int NumberGeneratorTemplateId { get; set; }
|
||||||
|
public virtual NumberGeneratorTemplate NumberGeneratorTemplate { get; set; }
|
||||||
|
|
||||||
|
public int Year { get; set; }
|
||||||
|
public int? Month { get; set; } // csak ha YearAndMonth
|
||||||
|
|
||||||
|
public int CurrentNumber { get; set; }
|
||||||
|
public string LastGeneratedNumber { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,744 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using WorkFlowCheck.DL;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20250319132531_Extend005")]
|
||||||
|
partial class Extend005
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.12")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CheckListTemplateHeaderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentNumber")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidNumber")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("IsStorno")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("LastModBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ShortName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CheckListTemplateHeaderId");
|
||||||
|
|
||||||
|
b.ToTable("CheckListHeader", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Answer")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("CheckListHeaderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CheckListTemplateRowId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidNumber")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("LastModBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<byte[]>("Photo")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("varbinary(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CheckListHeaderId");
|
||||||
|
|
||||||
|
b.HasIndex("CheckListTemplateRowId");
|
||||||
|
|
||||||
|
b.ToTable("CheckListRow", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("LastModBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ShortName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("CheckListTemplateHeader", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("AnswerType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("CheckListTemplateHeaderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CheckPointId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("EquipmentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("LastModBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("OperationDescription")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("RowIndex")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CheckListTemplateHeaderId");
|
||||||
|
|
||||||
|
b.HasIndex("CheckPointId");
|
||||||
|
|
||||||
|
b.HasIndex("EquipmentId");
|
||||||
|
|
||||||
|
b.ToTable("CheckListTemplateRow", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckPoint", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("LastModBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ShortName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("CheckPoint", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Equipment", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("EquipmentNumber")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("LastModBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ShortName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Equipment", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Location", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("FullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("LastModBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Location", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CurrentNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("DigitFormat")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("GenerateType")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("LastGeneratedNumber")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Prefix")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("PrefixSeparator")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ShortName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Suffix")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("SuffixSeparator")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("NumberGeneratorTemplate");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
CurrentNumber = 0,
|
||||||
|
DigitFormat = "D4",
|
||||||
|
GenerateType = 0,
|
||||||
|
LastGeneratedNumber = "",
|
||||||
|
Prefix = "CHK",
|
||||||
|
PrefixSeparator = "-",
|
||||||
|
ShortName = "Ellenőrzési dokumentum sorszámozása",
|
||||||
|
Suffix = "",
|
||||||
|
SuffixSeparator = "-"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplateDate", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CurrentNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("LastGeneratedNumber")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int?>("Month")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("NumberGeneratorTemplateId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NumberGeneratorTemplateId");
|
||||||
|
|
||||||
|
b.ToTable("NumberGeneratorTemplateDate");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("LastModBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("RoleName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Roles", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CheckListTemplateHeaderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("Enabled")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CheckListTemplateHeaderId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("RoleCheckListTemplateHeader", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<bool>("Active")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDeleted")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("JwtToken")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModAt")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("LastModBy")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("PasswordHash")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Token2FA")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users", (string)null);
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Active = true,
|
||||||
|
CreatedAt = new DateTime(2025, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9821),
|
||||||
|
CreatedBy = "System",
|
||||||
|
Email = "admin@nuvolar.hu",
|
||||||
|
FirstName = "Administrator",
|
||||||
|
IsDeleted = false,
|
||||||
|
JwtToken = "",
|
||||||
|
LastModAt = new DateTime(2025, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9825),
|
||||||
|
LastModBy = "System",
|
||||||
|
LastName = "System",
|
||||||
|
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
|
||||||
|
Token2FA = "",
|
||||||
|
UserName = "admin"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
Active = true,
|
||||||
|
CreatedAt = new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5779),
|
||||||
|
CreatedBy = "System",
|
||||||
|
Email = "user@nuvolar.hu",
|
||||||
|
FirstName = "User",
|
||||||
|
IsDeleted = false,
|
||||||
|
JwtToken = "",
|
||||||
|
LastModAt = new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5783),
|
||||||
|
LastModBy = "System",
|
||||||
|
LastName = "System",
|
||||||
|
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG",
|
||||||
|
Token2FA = "",
|
||||||
|
UserName = "user"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("RoleId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("UserId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("UserRoles", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CheckListTemplateHeaderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("CheckListTemplateHeader");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.CheckListHeader", "CheckListHeader")
|
||||||
|
.WithMany("CheckListRows")
|
||||||
|
.HasForeignKey("CheckListHeaderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateRow", "CheckListTemplateRow")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CheckListTemplateRowId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("CheckListHeader");
|
||||||
|
|
||||||
|
b.Navigation("CheckListTemplateRow");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader")
|
||||||
|
.WithMany("CheckListTemplateRows")
|
||||||
|
.HasForeignKey("CheckListTemplateHeaderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "CheckPoint")
|
||||||
|
.WithMany("CheckListTemplateRows")
|
||||||
|
.HasForeignKey("CheckPointId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.Equipment", "Equipment")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("EquipmentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("CheckListTemplateHeader");
|
||||||
|
|
||||||
|
b.Navigation("CheckPoint");
|
||||||
|
|
||||||
|
b.Navigation("Equipment");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplateDate", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", "NumberGeneratorTemplate")
|
||||||
|
.WithMany("NumberGeneratorTemplateDates")
|
||||||
|
.HasForeignKey("NumberGeneratorTemplateId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("NumberGeneratorTemplate");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CheckListTemplateHeaderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("CheckListTemplateHeader");
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role")
|
||||||
|
.WithMany("UserRoles")
|
||||||
|
.HasForeignKey("RoleId");
|
||||||
|
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.User", "User")
|
||||||
|
.WithMany("UserRoles")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Role");
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("CheckListRows");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("CheckListTemplateRows");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckPoint", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("CheckListTemplateRows");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("NumberGeneratorTemplateDates");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("UserRoles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("UserRoles");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.DL.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Extend005 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "NumberGeneratorTemplate",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Prefix = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
PrefixSeparator = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
DigitFormat = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
SuffixSeparator = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Suffix = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
CurrentNumber = table.Column<int>(type: "int", nullable: false),
|
||||||
|
LastGeneratedNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
GenerateType = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_NumberGeneratorTemplate", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "NumberGeneratorTemplateDate",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
NumberGeneratorTemplateId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Year = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Month = table.Column<int>(type: "int", nullable: true),
|
||||||
|
CurrentNumber = table.Column<int>(type: "int", nullable: false),
|
||||||
|
LastGeneratedNumber = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_NumberGeneratorTemplateDate", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_NumberGeneratorTemplateDate_NumberGeneratorTemplate_NumberGeneratorTemplateId",
|
||||||
|
column: x => x.NumberGeneratorTemplateId,
|
||||||
|
principalTable: "NumberGeneratorTemplate",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "NumberGeneratorTemplate",
|
||||||
|
columns: new[] { "Id", "CurrentNumber", "DigitFormat", "GenerateType", "LastGeneratedNumber", "Prefix", "PrefixSeparator", "ShortName", "Suffix", "SuffixSeparator" },
|
||||||
|
values: new object[] { 1, 0, "D4", 0, "", "CHK", "-", "Ellenőrzési dokumentum sorszámozása", "", "-" });
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "Users",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 1,
|
||||||
|
columns: new[] { "CreatedAt", "LastModAt" },
|
||||||
|
values: new object[] { new DateTime(2025, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9821), new DateTime(2025, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9825) });
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "Users",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 2,
|
||||||
|
columns: new[] { "CreatedAt", "LastModAt" },
|
||||||
|
values: new object[] { new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5779), new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5783) });
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_NumberGeneratorTemplateDate_NumberGeneratorTemplateId",
|
||||||
|
table: "NumberGeneratorTemplateDate",
|
||||||
|
column: "NumberGeneratorTemplateId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "NumberGeneratorTemplateDate");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "NumberGeneratorTemplate");
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "Users",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 1,
|
||||||
|
columns: new[] { "CreatedAt", "LastModAt" },
|
||||||
|
values: new object[] { new DateTime(2025, 3, 18, 10, 48, 13, 634, DateTimeKind.Utc).AddTicks(7867), new DateTime(2025, 3, 18, 10, 48, 13, 634, DateTimeKind.Utc).AddTicks(7870) });
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "Users",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 2,
|
||||||
|
columns: new[] { "CreatedAt", "LastModAt" },
|
||||||
|
values: new object[] { new DateTime(2025, 3, 18, 10, 48, 13, 645, DateTimeKind.Utc).AddTicks(9210), new DateTime(2025, 3, 18, 10, 48, 13, 645, DateTimeKind.Utc).AddTicks(9212) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -330,6 +330,99 @@ namespace WorkFlowCheck.DL.Migrations
|
|||||||
b.ToTable("Location", (string)null);
|
b.ToTable("Location", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CurrentNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("DigitFormat")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("GenerateType")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("LastGeneratedNumber")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Prefix")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("PrefixSeparator")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ShortName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Suffix")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("SuffixSeparator")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("NumberGeneratorTemplate");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
CurrentNumber = 0,
|
||||||
|
DigitFormat = "D4",
|
||||||
|
GenerateType = 0,
|
||||||
|
LastGeneratedNumber = "",
|
||||||
|
Prefix = "CHK",
|
||||||
|
PrefixSeparator = "-",
|
||||||
|
ShortName = "Ellenőrzési dokumentum sorszámozása",
|
||||||
|
Suffix = "",
|
||||||
|
SuffixSeparator = "-"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplateDate", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CurrentNumber")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("LastGeneratedNumber")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int?>("Month")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("NumberGeneratorTemplateId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NumberGeneratorTemplateId");
|
||||||
|
|
||||||
|
b.ToTable("NumberGeneratorTemplateDate");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b =>
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@@ -454,13 +547,13 @@ namespace WorkFlowCheck.DL.Migrations
|
|||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
Active = true,
|
Active = true,
|
||||||
CreatedAt = new DateTime(2025, 3, 18, 10, 48, 13, 634, DateTimeKind.Utc).AddTicks(7867),
|
CreatedAt = new DateTime(2025, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9821),
|
||||||
CreatedBy = "System",
|
CreatedBy = "System",
|
||||||
Email = "admin@nuvolar.hu",
|
Email = "admin@nuvolar.hu",
|
||||||
FirstName = "Administrator",
|
FirstName = "Administrator",
|
||||||
IsDeleted = false,
|
IsDeleted = false,
|
||||||
JwtToken = "",
|
JwtToken = "",
|
||||||
LastModAt = new DateTime(2025, 3, 18, 10, 48, 13, 634, DateTimeKind.Utc).AddTicks(7870),
|
LastModAt = new DateTime(2025, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9825),
|
||||||
LastModBy = "System",
|
LastModBy = "System",
|
||||||
LastName = "System",
|
LastName = "System",
|
||||||
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
|
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
|
||||||
@@ -471,13 +564,13 @@ namespace WorkFlowCheck.DL.Migrations
|
|||||||
{
|
{
|
||||||
Id = 2,
|
Id = 2,
|
||||||
Active = true,
|
Active = true,
|
||||||
CreatedAt = new DateTime(2025, 3, 18, 10, 48, 13, 645, DateTimeKind.Utc).AddTicks(9210),
|
CreatedAt = new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5779),
|
||||||
CreatedBy = "System",
|
CreatedBy = "System",
|
||||||
Email = "user@nuvolar.hu",
|
Email = "user@nuvolar.hu",
|
||||||
FirstName = "User",
|
FirstName = "User",
|
||||||
IsDeleted = false,
|
IsDeleted = false,
|
||||||
JwtToken = "",
|
JwtToken = "",
|
||||||
LastModAt = new DateTime(2025, 3, 18, 10, 48, 13, 645, DateTimeKind.Utc).AddTicks(9212),
|
LastModAt = new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5783),
|
||||||
LastModBy = "System",
|
LastModBy = "System",
|
||||||
LastName = "System",
|
LastName = "System",
|
||||||
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG",
|
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG",
|
||||||
@@ -566,6 +659,17 @@ namespace WorkFlowCheck.DL.Migrations
|
|||||||
b.Navigation("Equipment");
|
b.Navigation("Equipment");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplateDate", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", "NumberGeneratorTemplate")
|
||||||
|
.WithMany("NumberGeneratorTemplateDates")
|
||||||
|
.HasForeignKey("NumberGeneratorTemplateId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("NumberGeneratorTemplate");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b =>
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader")
|
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader")
|
||||||
@@ -617,6 +721,11 @@ namespace WorkFlowCheck.DL.Migrations
|
|||||||
b.Navigation("CheckListTemplateRows");
|
b.Navigation("CheckListTemplateRows");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("NumberGeneratorTemplateDates");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b =>
|
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("UserRoles");
|
b.Navigation("UserRoles");
|
||||||
|
|||||||
+90
@@ -1,4 +1,94 @@
|
|||||||
@page
|
@page
|
||||||
@model WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader.CheckListTemplateHeaderPageModel
|
@model WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader.CheckListTemplateHeaderPageModel
|
||||||
@{
|
@{
|
||||||
|
ViewData["Title"] = "Felhasználók";
|
||||||
|
}
|
||||||
|
<h1>@ViewData["Title"]</h1>
|
||||||
|
|
||||||
|
<div class="card shadow p-4">
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<button id="newCheckListTemplateHeaderBtn" class="btn btn-primary float-right new-btn" data-bs-toggle="tooltip" data-bs-placement="top" title="Új elem hozzáadása">
|
||||||
|
<i class="bi bi-plus-square"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<table id="tbCheckListTemplateHeadersPage" class="table table-bordered table-hover table-sm" style="width:100%">
|
||||||
|
<thead class="table-primary">
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Short Name</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th class="text-center">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tfoot class="table-light">
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Short Name</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th class="text-center">Action</th>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@section Scripts {
|
||||||
|
<script>
|
||||||
|
const table = new DataTable('#tbCheckListTemplateHeadersPage', {
|
||||||
|
ajax: {
|
||||||
|
url: "@Url.Page("./CheckListTemplateHeaderPage", "LoadCheckListTemplateHeaders")",
|
||||||
|
type: "GET",
|
||||||
|
dataSrc : "data"
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{ data: "id" },
|
||||||
|
{ data: "shortName" },
|
||||||
|
{ data: "description" },
|
||||||
|
{ data: null, render: function (data, type, row) {
|
||||||
|
return renderActionButtons(row.id);
|
||||||
|
}}
|
||||||
|
],
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
"targets": 0,
|
||||||
|
"visible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"targets": 3,
|
||||||
|
"className": "text-center",
|
||||||
|
"width": "10%"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
processing:true,
|
||||||
|
language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#newCheckListTemplateHeaderBtn').on('click', function ()
|
||||||
|
{
|
||||||
|
console.log('New button clicked!"');
|
||||||
|
window.location.href = `@Url.Page("./CheckListTemplateHeaderEditPage")?id=0`;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#tbCheckListTemplateHeadersPage').on('click', '.edit-btn', function ()
|
||||||
|
{
|
||||||
|
const row = table.row($(this).closest('tr')).data();
|
||||||
|
window.location.href = `@Url.Page("./CheckListTemplateHeaderEditPage")?id=${row.id}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#tbCheckListTemplateHeadersPage').on('click', '.delete-btn', function ()
|
||||||
|
{
|
||||||
|
const row = table.row($(this).closest('tr')).data();
|
||||||
|
console.log(row);
|
||||||
|
showConfirmModal({
|
||||||
|
title: 'Törlés megerősítése',
|
||||||
|
message: 'Biztosan törölni szeretnéd ezt az elemet?',
|
||||||
|
okText: 'Törlés',
|
||||||
|
cancelText: 'Mégsem'
|
||||||
|
}).then(function(result) {
|
||||||
|
if(result === 'ok') {
|
||||||
|
console.log('Törlés végrehajtva');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-1
@@ -1,12 +1,25 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
using WorkFlowCheck.Web.Services.Interfaces;
|
||||||
|
|
||||||
namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader
|
namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader
|
||||||
{
|
{
|
||||||
public class CheckListTemplateHeaderPageModel : PageModel
|
public class CheckListTemplateHeaderPageModel : PageModel
|
||||||
{
|
{
|
||||||
public void OnGet()
|
private readonly ILogger<IndexModel> _logger;
|
||||||
|
private readonly ICheckListService _checkListService;
|
||||||
|
public CheckListTemplateHeaderPageModel(ILogger<IndexModel> logger, ICheckListService checkListService)
|
||||||
{
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_checkListService = checkListService;
|
||||||
|
}
|
||||||
|
public async Task OnGet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public async Task<JsonResult> OnGetLoadCheckListTemplateHeaders()
|
||||||
|
{
|
||||||
|
var results = await _checkListService.GetAllCheckListHeaderAsync();
|
||||||
|
return new JsonResult(new { data = results });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ builder.Services.AddHttpContextAccessor();
|
|||||||
builder.Services.AddHttpClient();
|
builder.Services.AddHttpClient();
|
||||||
|
|
||||||
builder.Services.AddScoped<IUserService, UserService>();
|
builder.Services.AddScoped<IUserService, UserService>();
|
||||||
builder.Services.AddScoped<IBaseStockService, BaseStockService>();
|
builder.Services.AddScoped<IBaseStockService, BaseStockService>();
|
||||||
|
builder.Services.AddScoped<ICheckListService, CheckListService>();
|
||||||
|
|
||||||
builder.Host.UseSerilog();
|
builder.Host.UseSerilog();
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
using Serilog;
|
||||||
|
using System.Net.Http;
|
||||||
|
using WorkFlowCheck.Common.DTO;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.Web.Services.Interfaces
|
||||||
|
{
|
||||||
|
public class CheckListService : BaseService, ICheckListService
|
||||||
|
{
|
||||||
|
public CheckListService(HttpClient httpClient, IConfiguration configuration, IHttpContextAccessor httpContextAccessor) : base(httpClient, configuration, httpContextAccessor)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public async Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync()
|
||||||
|
{
|
||||||
|
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetAllCheckListHeaders";
|
||||||
|
var retVal = new List<CheckListHeaderDTO>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<List<CheckListHeaderDTO>>>(endpoint);
|
||||||
|
if (response != null)
|
||||||
|
{
|
||||||
|
if (response.IsSuccess)
|
||||||
|
{
|
||||||
|
return response.Data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
public async Task<CheckListHeaderDTO> GetCheckListHeader(int id)
|
||||||
|
{
|
||||||
|
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetCheckListHeader/{id}";
|
||||||
|
var retVal = new CheckListHeaderDTO() { CheckListRowDTO = new List<CheckListRowDTO>() };
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<CheckListHeaderDTO>>(endpoint);
|
||||||
|
if (response != null)
|
||||||
|
{
|
||||||
|
if (response.IsSuccess)
|
||||||
|
{
|
||||||
|
return response.Data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
public async Task<ApiResponseDTO<CheckListHeaderDTO>> UpdateCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) => throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using WorkFlowCheck.Common.DTO;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.Web.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICheckListService
|
||||||
|
{
|
||||||
|
Task<CheckListHeaderDTO> GetCheckListHeader(int id);
|
||||||
|
Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync();
|
||||||
|
Task<ApiResponseDTO<CheckListHeaderDTO>> UpdateCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user