This commit is contained in:
2025-04-05 11:31:16 +02:00
24 changed files with 1488 additions and 188 deletions
@@ -43,6 +43,29 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpGet("DeleteCheckPoint/{id}")]
public async Task<ApiResponseDTO<bool>> DeleteCheckpointAsync(int id)
{
var retVal = new ApiResponseDTO<bool>()
{
IsSuccess = true,
};
var response = await _syncService.DeleteCheckPointAsync(id);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllCheckPoints")]
public async Task<ApiResponseDTO<List<CheckPointDTO>>> GetAllCheckpointsAsync()
{
@@ -132,6 +155,29 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpGet("DeleteEquipment/{id}")]
public async Task<ApiResponseDTO<bool>> DeleteEquipmentAsync(int id)
{
var retVal = new ApiResponseDTO<bool>()
{
IsSuccess = true,
};
var response = await _syncService.DeleteEquipmentAsync(id);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllEquipments")]
public async Task<ApiResponseDTO<List<EquipmentDTO>>> GetAllEquipmentsAsync()
{
@@ -201,6 +247,29 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpGet("DeleteLocation/{id}")]
public async Task<ApiResponseDTO<bool>> DeleteLocationAsync(int id)
{
var retVal = new ApiResponseDTO<bool>()
{
IsSuccess = true,
};
var response = await _syncService.DeleteLocationAsync(id);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllLocations")]
public async Task<ApiResponseDTO<List<LocationDTO>>> GetAllLocationsAsync()
{
@@ -0,0 +1,147 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL;
namespace WorkFlowCheck.BL.Services
{
public class BaseService
{
public readonly AppDbContext _dbContext;
public readonly IMapper _mapper;
public BaseService(AppDbContext db_dbContext, IMapper mapper)
{
_dbContext = db_dbContext;
_mapper = mapper;
}
public async Task<bool> DeleteEntityByIdAsync<T>(int id) where T : class
{
try
{
var entity = await _dbContext.Set<T>().FindAsync(id);
if (entity == null)
return false;
_dbContext.Set<T>().Remove(entity);
await _dbContext.SaveChangesAsync();
return true;
}
catch (Exception ex)
{
Log.Error($"Hiba történt a törlés során: {ex.Message}");
return false;
}
}
public async Task<T?> GetEntityByIdAsync<T>(int id) where T : class
{
try
{
var entity = await _dbContext.Set<T>().FindAsync(id);
return entity;
}
catch (Exception ex)
{
Log.Error($"Hiba történt a lekérdezés során: {ex.Message}");
return null;
}
}
public async Task<List<TEntity>> GetEntityByFilterAsync<TEntity, TFilter>(TFilter filter) where TEntity : class where TFilter : class
{
try
{
IQueryable<TEntity> query = _dbContext.Set<TEntity>();
foreach (var property in typeof(TFilter).GetProperties())
{
var value = property.GetValue(filter);
if (value != null)
{
var parameter = Expression.Parameter(typeof(TEntity), "x");
var member = Expression.Property(parameter, property.Name);
var constant = Expression.Constant(value);
var equal = Expression.Equal(member, constant);
var lambda = Expression.Lambda<Func<TEntity, bool>>(equal, parameter);
query = query.Where(lambda);
}
}
// Adatok lekérdezése
return await query.ToListAsync();
}
catch (Exception ex)
{
Log.Error($"Hiba történt a lekérdezés során: {ex.Message}");
return new List<TEntity>();
}
}
public async Task<PagedResult<TEntity>> GetPagedEntityByFilterAsync<TEntity, TFilter>(TFilter filter, int pageNumber, int pageSize) where TEntity : class where TFilter : class
{
try
{
// Az IQueryable típusú lista létrehozása
IQueryable<TEntity> query = _dbContext.Set<TEntity>();
// Dinamikus szűrés a filter tulajdonságai alapján
foreach (var property in typeof(TFilter).GetProperties())
{
var value = property.GetValue(filter);
if (value != null)
{
var parameter = Expression.Parameter(typeof(TEntity), "x");
var member = Expression.Property(parameter, property.Name);
var constant = Expression.Constant(value);
var equal = Expression.Equal(member, constant);
var lambda = Expression.Lambda<Func<TEntity, bool>>(equal, parameter);
query = query.Where(lambda);
}
}
// Teljes rekordok száma a szűrő után
int totalCount = await query.CountAsync();
// Lapozás alkalmazása
var items = await query
.Skip((pageNumber - 1) * pageSize)
.Take(pageSize)
.ToListAsync();
// Lapozási eredmény összerakása
return new PagedResult<TEntity>
{
Items = items,
TotalCount = totalCount,
PageNumber = pageNumber,
PageSize = pageSize
};
}
catch (Exception ex)
{
Console.WriteLine($"Hiba történt a lekérdezés során: {ex.Message}");
return new PagedResult<TEntity>();
}
}
}
public class PagedResult<TEntity>
{
public List<TEntity> Items { get; set; } = new List<TEntity>();
public int TotalCount { get; set; }
public int PageNumber { get; set; }
public int PageSize { get; set; }
}
}
@@ -21,8 +21,8 @@ namespace WorkFlowCheck.BL.Services
{
public class CheckListService : ICheckListService
{
private AppDbContext _dbContext;
private IMapper _mapper;
private readonly AppDbContext _dbContext;
private readonly IMapper _mapper;
private readonly INumberGeneratorService _numberGeneratorService;
public CheckListService(AppDbContext dbContext, IMapper mapper, INumberGeneratorService numberGeneratorService)
@@ -7,17 +7,20 @@ namespace WorkFlowCheck.BL.Services.Interfaces
{
Task<List<CheckPointDTO>> GetAllCheckPointAsync();
Task<CheckPointDTO> GetCheckPointAsync(int id);
Task<bool> DeleteCheckPointAsync(int id);
Task<CheckPointDTO> UpdateCheckPointAsync(CheckPointDTO checkPointDTO);
Task<List<CheckPointDTO>> UpdateAllCheckPointAsync(List<CheckPointDTO> checkPointListDTO);
Task<List<LocationDTO>> GetAllLocationAsync();
Task<LocationDTO> GetLocationAsync(int id);
Task<bool> DeleteLocationAsync(int id);
Task<LocationDTO> UpdateLocationAsync(LocationDTO LocationDTO);
Task<List<EquipmentDTO>> GetAllEquipmentAsync();
Task<EquipmentDTO> GetEquipmentAsync(int id);
Task<bool> DeleteEquipmentAsync(int id);
Task<EquipmentDTO> UpdateEquipmentAsync(EquipmentDTO EquipmentDTO);
+17 -11
View File
@@ -12,16 +12,9 @@ using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Services
{
public class SyncService : ISyncService
public class SyncService : BaseService, ISyncService
{
private AppDbContext _dbContext;
private IMapper _mapper;
public SyncService(AppDbContext dbContext, IMapper mapper)
{
_dbContext = dbContext;
_mapper = mapper;
}
public SyncService(AppDbContext dbContext, IMapper mapper) : base(dbContext, mapper) { }
public async Task<List<CheckPointDTO>> GetAllCheckPointAsync()
{
@@ -68,6 +61,10 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<bool> DeleteCheckPointAsync(int id)
{
return await DeleteEntityByIdAsync<CheckPoint>(id);
}
public async Task<CheckPointDTO> UpdateCheckPointAsync(CheckPointDTO checkPointDTO)
{
var retVal = new CheckPointDTO();
@@ -173,6 +170,10 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<bool> DeleteLocationAsync(int id)
{
return await DeleteEntityByIdAsync<Location>(id);
}
public async Task<LocationDTO> UpdateLocationAsync(LocationDTO LocationDTO)
{
var retVal = new LocationDTO();
@@ -249,6 +250,10 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<bool> DeleteEquipmentAsync(int id)
{
return await DeleteEntityByIdAsync<Equipment>(id);
}
public async Task<EquipmentDTO> UpdateEquipmentAsync(EquipmentDTO EquipmentDTO)
{
var retVal = new EquipmentDTO();
@@ -284,6 +289,7 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateAsync(int userId)
{
var retVal = new List<CheckListTemplateHeaderDTO>();
@@ -377,12 +383,12 @@ namespace WorkFlowCheck.BL.Services
if (dtoRow != null)
{
row.Answer = dtoRow.Answer;
if (dtoRow.Photo != null && dtoRow.Photo.Length > 0 )
if (dtoRow.Photo != null && dtoRow.Photo.Length > 0)
{
string imageDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Images");
var timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
var fileName = $"PH_{timestamp}_{row.CheckListHeaderId}_{row.Id}.jpeg";
row.PhotoFileName = fileName;
row.PhotoFileName = fileName;
var filePath = Path.Combine(imageDirectory, fileName);
await File.WriteAllBytesAsync(filePath, dtoRow.Photo);
}
+22 -2
View File
@@ -1,19 +1,39 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace WorkFlowCheck.Common.DTO
{
public class UserDTO
{
public int Id { get; set; }
public string Email { get; set; } = null!;
[Required(ErrorMessage = "Az utónév kötelező.")]
[DisplayName("E-mail")]
public string Email { get; set; } = null!;
[Required(ErrorMessage = "Az utónév kötelező.")]
[DisplayName("Utónév")]
public string FirstName { get; set; } = null!;
[Required(ErrorMessage = "Az vezetéknév kötelező.")]
[DisplayName("Vezetéknév")]
public string LastName { get; set; } = null!;
[Required(ErrorMessage = "A felhasználónév kötelező.")]
[DisplayName("Felhasználó neve")]
public string UserName { get;set; } = null!;
[DisplayName("Jelszó")]
public string Password { get; set; }
public string JwtToken { get; set; } = null!;
[DisplayName("Aktív")]
public bool Active { get; set; }
[DisplayName("NFC belépés")]
public bool NFCActive { get; set; }
public ICollection<RoleDTO>? RoleDTO { get; set; } = new List<RoleDTO>();
}
}
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.Helper
{
public static class DisplayNameHelper
{
public static string GetDisplayName(string propertyName, Type modelType)
{
var property = modelType.GetProperty(propertyName);
var displayNameAttribute = property?.GetCustomAttributes(typeof(DisplayNameAttribute), false)
.FirstOrDefault() as DisplayNameAttribute;
return displayNameAttribute?.DisplayName ?? propertyName;
}
}
}
+6 -14
View File
@@ -1,10 +1,6 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.RequestContext;
using WorkFlowCheck.Common.Security;
using WorkFlowCheck.DL.Configurations;
@@ -23,14 +19,6 @@ namespace WorkFlowCheck.DL
_requestContext = requestContext;
}
#if !DEBUG
private dynamic _requestContext;
public AppDbContext(DbContextOptions<AppDbContext> options)
: base(options)
{
_requestContext = new { CurrentUserEmail = "", CurrentUsername = "admin", TraceId = 0 };
}
#endif
#region Entities DbSet
public DbSet<Entities.CheckListHeader> CheckListHeaders { get; set; } = null!;
public DbSet<Entities.CheckListRow> CheckListRows { get; set; } = null!;
@@ -144,7 +132,9 @@ namespace WorkFlowCheck.DL
LastModBy = "System",
JwtToken = "",
Active = true,
Token2FA = ""
Token2FA = "",
NFCActive = true,
NFCCode = "00000000"
},
new User
{
@@ -161,7 +151,9 @@ namespace WorkFlowCheck.DL
LastModBy = "System",
JwtToken = "",
Active = true,
Token2FA = ""
Token2FA = "",
NFCActive = true,
NFCCode = "00000000"
}
);
modelBuilder.Entity<NumberGeneratorTemplate>().HasData(
+2
View File
@@ -14,6 +14,8 @@ namespace WorkFlowCheck.DL.Entities
public string JwtToken { get; set; } = null!;
public string Token2FA { get; set; } = null!;
public bool Active { get; set; }
public bool NFCActive { get; set; }
public string NFCCode { get; set; } = null!;
public virtual ICollection<UserRole> UserRoles { get; set; } = new List<UserRole>();
@@ -0,0 +1,861 @@
// <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("20250404104148_Extend013")]
partial class Extend013
{
/// <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<int>("CheckStatus")
.HasColumnType("int");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateExecution")
.HasColumnType("datetime2");
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>("IsEditable")
.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.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CheckListTemplateHeaderId");
b.HasIndex("UserId");
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<string>("PhotoFileName")
.IsRequired()
.HasColumnType("nvarchar(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<int?>("NumberGenerator1Id")
.HasColumnType("int");
b.Property<int?>("NumberGenerator2Id")
.HasColumnType("int");
b.Property<string>("ShortName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("NumberGenerator1Id");
b.HasIndex("NumberGenerator2Id");
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<bool>("IsEnabled")
.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", (string)null);
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", (string)null);
b.HasData(
new
{
Id = 1,
CurrentNumber = 0,
LastGeneratedNumber = "",
Month = 0,
NumberGeneratorTemplateId = 1,
Year = 1
});
});
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.RoleCheckPoint", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CheckPointId")
.HasColumnType("int");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CheckPointId");
b.HasIndex("RoleId");
b.ToTable("RoleCheckPoint", (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<bool>("NFCActive")
.HasColumnType("bit");
b.Property<string>("NFCCode")
.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, 4, 4, 10, 41, 46, 227, DateTimeKind.Utc).AddTicks(5578),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 4, 4, 10, 41, 46, 227, DateTimeKind.Utc).AddTicks(5580),
LastModBy = "System",
LastName = "System",
NFCActive = true,
NFCCode = "00000000",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
Token2FA = "",
UserName = "admin"
},
new
{
Id = 2,
Active = true,
CreatedAt = new DateTime(2025, 4, 4, 10, 41, 46, 239, DateTimeKind.Utc).AddTicks(1896),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 4, 4, 10, 41, 46, 239, DateTimeKind.Utc).AddTicks(1897),
LastModBy = "System",
LastName = "System",
NFCActive = true,
NFCCode = "00000000",
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.HasOne("WorkFlowCheck.DL.Entities.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CheckListTemplateHeader");
b.Navigation("User");
});
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.CheckListTemplateHeader", b =>
{
b.HasOne("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", "NumberGenerator1")
.WithMany()
.HasForeignKey("NumberGenerator1Id");
b.HasOne("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", "NumberGenerator2")
.WithMany()
.HasForeignKey("NumberGenerator2Id");
b.Navigation("NumberGenerator1");
b.Navigation("NumberGenerator2");
});
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.RoleCheckPoint", b =>
{
b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "CheckPoint")
.WithMany()
.HasForeignKey("CheckPointId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CheckPoint");
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,69 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class Extend013 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "NFCActive",
table: "Users",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "NFCCode",
table: "Users",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt", "NFCActive", "NFCCode" },
values: new object[] { new DateTime(2025, 4, 4, 10, 41, 46, 227, DateTimeKind.Utc).AddTicks(5578), new DateTime(2025, 4, 4, 10, 41, 46, 227, DateTimeKind.Utc).AddTicks(5580), true, "00000000" });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt", "NFCActive", "NFCCode" },
values: new object[] { new DateTime(2025, 4, 4, 10, 41, 46, 239, DateTimeKind.Utc).AddTicks(1896), new DateTime(2025, 4, 4, 10, 41, 46, 239, DateTimeKind.Utc).AddTicks(1897), true, "00000000" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "NFCActive",
table: "Users");
migrationBuilder.DropColumn(
name: "NFCCode",
table: "Users");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 4, 2, 8, 28, 48, 480, DateTimeKind.Utc).AddTicks(5537), new DateTime(2025, 4, 2, 8, 28, 48, 480, DateTimeKind.Utc).AddTicks(5540) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 4, 2, 8, 28, 48, 491, DateTimeKind.Utc).AddTicks(9369), new DateTime(2025, 4, 2, 8, 28, 48, 491, DateTimeKind.Utc).AddTicks(9370) });
}
}
}
@@ -591,6 +591,13 @@ namespace WorkFlowCheck.DL.Migrations
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("NFCActive")
.HasColumnType("bit");
b.Property<string>("NFCCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
@@ -611,15 +618,17 @@ namespace WorkFlowCheck.DL.Migrations
{
Id = 1,
Active = true,
CreatedAt = new DateTime(2025, 4, 2, 8, 28, 48, 480, DateTimeKind.Utc).AddTicks(5537),
CreatedAt = new DateTime(2025, 4, 4, 10, 41, 46, 227, DateTimeKind.Utc).AddTicks(5578),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 4, 2, 8, 28, 48, 480, DateTimeKind.Utc).AddTicks(5540),
LastModAt = new DateTime(2025, 4, 4, 10, 41, 46, 227, DateTimeKind.Utc).AddTicks(5580),
LastModBy = "System",
LastName = "System",
NFCActive = true,
NFCCode = "00000000",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
Token2FA = "",
UserName = "admin"
@@ -628,15 +637,17 @@ namespace WorkFlowCheck.DL.Migrations
{
Id = 2,
Active = true,
CreatedAt = new DateTime(2025, 4, 2, 8, 28, 48, 491, DateTimeKind.Utc).AddTicks(9369),
CreatedAt = new DateTime(2025, 4, 4, 10, 41, 46, 239, DateTimeKind.Utc).AddTicks(1896),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 4, 2, 8, 28, 48, 491, DateTimeKind.Utc).AddTicks(9370),
LastModAt = new DateTime(2025, 4, 4, 10, 41, 46, 239, DateTimeKind.Utc).AddTicks(1897),
LastModBy = "System",
LastName = "System",
NFCActive = true,
NFCCode = "00000000",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG",
Token2FA = "",
UserName = "user"
@@ -135,43 +135,44 @@
formData.CheckPointDTO.CheckListTemplateRowDTO = [];
formData.CheckPointDTO.IsEnabled = $('#CheckPointDTO_IsEnabled').is(':checked');
$.ajax({
url: $('#checkPointEditPostUrl').val(),
type: 'POST',
headers: {
'X-CSRF-TOKEN': csrfToken,
'Content-Type': 'application/json'
},
data: JSON.stringify(formData.CheckPointDTO),
success: function (response) {
if (response.success)
{
showMessageModal({
title: 'Figyelmem!',
message: 'Sikeres mentés.',
okText: 'Értettem'
});
}
else
{
showMessageModal({
title: 'Figyelmem, HIBA!',
message: 'Sikertelen mentés.',
okText: 'Értettem'
});
}
},
error: function (xhr, status, error) {
// Hiba esetén
console.error("Hiba: ", error);
showMessageModal({
title: 'Hiba!',
message: 'A mentés NEM sikerült!',
okText: 'Értettem'
});
}
});
saveEntity(csrfToken, formData.CheckPointDTO, $('#checkPointEditPostUrl').val());
// $.ajax({
// url: $('#checkPointEditPostUrl').val(),
// type: 'POST',
// headers: {
// 'X-CSRF-TOKEN': csrfToken,
// 'Content-Type': 'application/json'
// },
// data: JSON.stringify(formData.CheckPointDTO),
// success: function (response) {
// if (response.success)
// {
// showMessageModal({
// title: 'Figyelmem!',
// message: 'Sikeres mentés.',
// okText: 'Értettem'
// });
// }
// else
// {
// showMessageModal({
// title: 'Figyelmem, HIBA!',
// message: 'Sikertelen mentés.',
// okText: 'Értettem'
// });
// }
// },
// error: function (xhr, status, error) {
// console.error("Hiba: ", error);
// showMessageModal({
// title: 'Hiba!',
// message: 'A mentés NEM sikerült!',
// okText: 'Értettem'
// });
// }
// });
});
@@ -44,31 +44,7 @@
if ($form.valid())
{
$.ajax({
url: $('#EquipmentEditPostUrl').val(),
type: 'POST',
headers: {
'X-CSRF-TOKEN': csrfToken,
'Content-Type': 'application/json'
},
data: JSON.stringify(formData.EquipmentDTO),
success: function (response) {
showMessageModal({
title: 'Figyelmem!',
message: 'Sikeres mentés.',
okText: 'Értettem'
});
},
error: function (xhr, status, error) {
// Hiba esetén
console.error("Hiba: ", error);
showMessageModal({
title: 'Hiba!',
message: 'A mentés NEM sikerült!',
okText: 'Értettem'
});
}
});
saveEntity(csrfToken, formData.EquipmentDTO, $('#EquipmentEditPostUrl').val());
} else
{
$form[0].reportValidity();
@@ -77,17 +77,7 @@
$('#tbEquipmentsPage').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');
}
});
deleteEntity(table, '/BaseStock/Equipments/EquipmentPage?handler=DeleteLocation', row.id);
});
</script>
}
@@ -23,5 +23,10 @@ namespace WorkFlowCheck.Web.Pages.BaseStock.Equipments
var results = await _baseStockService.GetAllEquipments();
return new JsonResult(new { data = results });
}
public async Task<JsonResult> OnGetDeleteEquipment(int id)
{
var isSuccess = await _baseStockService.DeleteEquipment(id);
return new JsonResult(new { result = isSuccess });
}
}
}
@@ -35,35 +35,9 @@
var formData = getFormAsNestedObject('#LocationForm');
const $form = $('#LocationForm');
console.log(formData.Location);
if ($form.valid())
{
$.ajax({
url: $('#LocationEditPostUrl').val(),
type: 'POST',
headers: {
'X-CSRF-TOKEN': csrfToken,
'Content-Type': 'application/json'
},
data: JSON.stringify(formData.LocationDTO),
success: function (response) {
showMessageModal({
title: 'Figyelmem!',
message: 'Sikeres mentés.',
okText: 'Értettem'
});
},
error: function (xhr, status, error) {
// Hiba esetén
console.error("Hiba: ", error);
showMessageModal({
title: 'Hiba!',
message: 'A mentés NEM sikerült!',
okText: 'Értettem'
});
}
});
saveEntity(csrfToken, formData.LocationDTO, $('#LocationEditPostUrl').val());
} else
{
$form[0].reportValidity();
@@ -73,18 +73,9 @@
$('#tbLocationsPage').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');
}
});
var row = table.row($(this).closest('tr')).data();
deleteEntity(table, '/BaseStock/Locations/LocationsPage?handler=DeleteLocation', row.id);
});
</script>
}
@@ -23,5 +23,10 @@ namespace WorkFlowCheck.Web.Pages.BaseStock.Locations
var results = await _baseStockService.GetAllLocations();
return new JsonResult(new { data = results });
}
public async Task<JsonResult> OnGetDeleteLocation(int id)
{
var isSuccess = await _baseStockService.DeleteLocation(id);
return new JsonResult(new { result = isSuccess });
}
}
}
@@ -48,6 +48,16 @@
<input asp-for="UserDTO.LastName" class="form-control" />
<span asp-validation-for="UserDTO.LastName" class="text-danger"></span>
</div>
<div class="col-md-3">
<label asp-for="UserDTO.Active"></label>
<input type="checkbox" asp-for="UserDTO.Active" class="form-check-input" />
<span asp-validation-for="UserDTO.Active" class="text-danger"></span>
</div>
<div class="col-md-3">
<label asp-for="UserDTO.NFCActive"></label>
<input type="checkbox" asp-for="UserDTO.NFCActive" class="form-check-input" />
<span asp-validation-for="UserDTO.NFCActive" class="text-danger"></span>
</div>
<div class="mb-3 d-flex justify-content-between">
<button type="button" id="saveUser" class="btn btn-primary">Mentés</button>
<button type="button" class="btn btn-secondary" onclick="history.back()">Mégsem</button>
@@ -102,35 +112,13 @@
var formData = getFormAsNestedObject('#UserForm');
const $form = $('#UserForm');
formData.User.RoleDTO=[];
formData.UserDTO.RoleDTO=[];
formData.UserDTO.Active = $('#UserForm input[name="UserDTO.Active"]').is(':checked');
formData.UserDTO.NFCActive = $('#UserForm input[name="UserDTO.NFCActive"]').is(':checked');
if ($form.valid())
{
$.ajax({
url: $('#UserEditPostUrl').val(),
type: 'POST',
headers: {
'X-CSRF-TOKEN': csrfToken,
'Content-Type': 'application/json'
},
data: JSON.stringify(formData.User),
success: function (response) {
showMessageModal({
title: 'Figyelmem!',
message: 'Sikeres mentés.',
okText: 'Értettem'
});
},
error: function (xhr, status, error) {
// Hiba esetén
console.error("Hiba: ", error);
showMessageModal({
title: 'Hiba!',
message: 'A mentés NEM sikerült!',
okText: 'Értettem'
});
}
});
saveEntity(csrfToken, formData.UserDTO, $('#UserEditPostUrl').val());
} else
{
$form[0].reportValidity();
@@ -1,5 +1,7 @@
@page
@model WorkFlowCheck.Web.Pages.UserAndRole.UserPageModel
@using WorkFlowCheck.Common.Helper
@using WorkFlowCheck.Common.DTO
@{
ViewData["Title"] = "Felhasználók";
}
@@ -15,20 +17,24 @@
<thead class="table-primary">
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>User Name</th>
<th>E-mail</th>
<th>@DisplayNameHelper.GetDisplayName("Active", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("NFCActive", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("FirstName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("LastName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("UserName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("Email", typeof(UserDTO))</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>User Name</th>
<th>E-mail</th>
<th>@DisplayNameHelper.GetDisplayName("Active", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("NFCActive", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("FirstName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("LastName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("UserName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("Email", typeof(UserDTO))</th>
<th>Action</th>
</tr>
</tfoot>
@@ -45,6 +51,26 @@
},
columns: [
{ data: "id" },
{
data: "active",
searchable: false,
sortable: false,
className: "text-center",
render: function ( data, type, row ) {
return renderCheckBox(data);
}
},
{
data: "nfcActive",
searchable: false,
sortable: false,
className: "text-center",
render: function ( data, type, row ) {
return renderCheckBox(data);
}
},
{ data: "firstName" },
{ data: "lastName" },
{ data: "userName" },
@@ -59,7 +85,7 @@
"visible": false
},
{
"targets": 5,
"targets": 7,
"className": "text-center",
"width": "10%"
}
@@ -144,6 +144,69 @@ namespace WorkFlowCheck.Web.Services
return retVal;
}
public async Task<bool> DeleteLocation(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/Sync/DeleteLocation/{id}";
var retVal = false;
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response.Data;
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<bool> DeleteEquipment(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/Sync/DeleteEquipment/{id}";
var retVal = false;
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response.Data;
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<bool> DeleteCheckPoint(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/Sync/DeleteCheckPoint/{id}";
var retVal = false;
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response.Data;
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<ApiResponseDTO<CheckPointDTO>> UpdateCheckPoint(CheckPointDTO checkPointDTO)
{
@@ -5,17 +5,20 @@ namespace WorkFlowCheck.Web.Services.Interfaces
{
public interface IBaseStockService
{
Task<CheckPointDTO> GetCheckPoint(int id);
Task<bool> DeleteCheckPoint(int id);
Task<List<CheckPointDTO>> GetAllCheckPoints();
Task<ApiResponseDTO<CheckPointDTO>> UpdateCheckPoint(CheckPointDTO checkPointDTO);
Task<EquipmentDTO> GetEquipment(int id);
Task<bool> DeleteEquipment(int id);
Task<List<EquipmentDTO>> GetAllEquipments();
Task<ApiResponseDTO<EquipmentDTO>> UpdateEquipment(EquipmentDTO equipmentDTO);
Task<LocationDTO> GetLocation(int id);
Task<bool> DeleteLocation(int id);
Task<List<LocationDTO>> GetAllLocations();
Task<ApiResponseDTO<LocationDTO>> UpdateLocation(LocationDTO LocationDTO);
+83 -7
View File
@@ -128,13 +128,13 @@ function renderActionButtonsforCheckListHeader(data, rowId) {
}
function renderCheckStatus(data) {
//Open = 0,
//InProgress = 1,
//Blocked = 2,
//Storno = 3,
//Sent = 4,
//Signed = 5,
//Closed = 6
//Open = 0,
//InProgress = 1,
//Blocked = 2,
//Storno = 3,
//Sent = 4,
//Signed = 5,
//Closed = 6
switch (data) {
case 0:
return 'Nyitott';
@@ -222,3 +222,79 @@ function renderAnswerPhoto(data, row) {
}
return `<div class="text-center">${data}</div></div>`;
}
//Törlési funkció adatbázisnál
function deleteEntity(table, url, entityid) {
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') {
$.ajax({
url: url,
type: 'GET',
data: { id: entityid },
success: function (data) {
if (data) {
showMessageModal({
title: 'Információ',
message: 'A törlés sikerült!',
okText: 'Értettem'
});
table.ajax.reload();
} else {
showMessageModal({
title: 'Hiba!',
message: 'A törlés NEM sikerült!',
okText: 'Értettem'
});
}
},
error: function (xhr, status, error) {
showMessageModal({
title: 'Hiba!',
message: 'A törlés NEM sikerült!',
okText: 'Értettem'
});
}
});
}
});
}
function saveEntity(csrfToken, data, url) {
$.ajax({
url: url,
type: 'POST',
headers: {
'X-CSRF-TOKEN': csrfToken,
'Content-Type': 'application/json'
},
data: JSON.stringify(data),
success: function (response) {
if (response.success) {
showMessageModal({
title: 'Figyelmem!',
message: 'Sikeres mentés.',
okText: 'Értettem'
});
}
else {
showMessageModal({
title: 'Figyelmem, HIBA!',
message: 'Sikertelen mentés.',
okText: 'Értettem'
});
}
},
error: function (xhr, status, error) {
console.error("Hiba: ", error);
showMessageModal({
title: 'Hiba!',
message: 'A mentés NEM sikerült!',
okText: 'Értettem'
});
}
});
}