CheckListTemplateHeader törlése WEB-ről
This commit is contained in:
@@ -278,6 +278,28 @@ namespace WorkFlowCheck.API.Controllers
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("DeleteCheckListTemplateHeader/{id}")]
|
||||
public async Task<ApiResponseDTO<bool>> DeleteCheckListTemplateHeader(int id)
|
||||
{
|
||||
var retVal = new ApiResponseDTO<bool>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
var result = await _checkListService.DeleteCheckListTemplateHeaderAsync(id);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No data!");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("GetCheckListTemplateRow/{id}")]
|
||||
|
||||
@@ -50,8 +50,10 @@ namespace WorkFlowCheck.API.Controllers
|
||||
};
|
||||
try
|
||||
{
|
||||
var allowedExtensions = new[] { ".png", ".jpg", ".jpeg", ".bmp", ".gif", ".webp", ".tiff" };
|
||||
var imageFolder = Path.Combine(Directory.GetCurrentDirectory(), "Images");
|
||||
var files = Directory.GetFiles(imageFolder)
|
||||
.Where(f => allowedExtensions.Contains(Path.GetExtension(f).ToLower()))
|
||||
.Select(f =>
|
||||
{
|
||||
var fileInfo = new FileInfo(f);
|
||||
@@ -102,8 +104,112 @@ namespace WorkFlowCheck.API.Controllers
|
||||
};
|
||||
try
|
||||
{
|
||||
var imageFolder = Path.Combine(Directory.GetCurrentDirectory(), "PDF");
|
||||
var files = Directory.GetFiles(imageFolder)
|
||||
var pdfFolder = Path.Combine(Directory.GetCurrentDirectory(), "PDF");
|
||||
var files = Directory.GetFiles(pdfFolder, "*.pdf")
|
||||
.Select(f =>
|
||||
{
|
||||
var fileInfo = new FileInfo(f);
|
||||
return new
|
||||
{
|
||||
FileName = fileInfo.Name,
|
||||
FileSize = FormatFileSize(fileInfo.Length),
|
||||
CreatedDate = fileInfo.CreationTime.ToString("yyyy.MM.dd HH:mm"),
|
||||
};
|
||||
});
|
||||
|
||||
var checkListFileInfos = new List<ImageFileDTO>();
|
||||
foreach (var file in files.OrderBy(o => o.FileName).ToList())
|
||||
{
|
||||
var checkListFileInfoDTO = new ImageFileDTO()
|
||||
{
|
||||
FileName = file.FileName,
|
||||
FileSize = file.FileSize,
|
||||
CreateDate = file.CreatedDate,
|
||||
|
||||
};
|
||||
checkListFileInfos.Add(checkListFileInfoDTO);
|
||||
}
|
||||
|
||||
if (checkListFileInfos != null)
|
||||
{
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = checkListFileInfos;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No data!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("GetAllLogAuditFiles")]
|
||||
public async Task<ApiResponseDTO<List<ImageFileDTO>>> GetAllLogAuditiFilesAsync()
|
||||
{
|
||||
var retVal = new ApiResponseDTO<List<ImageFileDTO>>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
try
|
||||
{
|
||||
var logAuditFiles = Path.Combine(Directory.GetCurrentDirectory(), "Logs\\AuditFlow");
|
||||
var files = Directory.GetFiles(logAuditFiles, "*.log")
|
||||
.Select(f =>
|
||||
{
|
||||
var fileInfo = new FileInfo(f);
|
||||
return new
|
||||
{
|
||||
FileName = fileInfo.Name,
|
||||
FileSize = FormatFileSize(fileInfo.Length),
|
||||
CreatedDate = fileInfo.CreationTime.ToString("yyyy.MM.dd HH:mm"),
|
||||
};
|
||||
});
|
||||
|
||||
var checkListFileInfos = new List<ImageFileDTO>();
|
||||
foreach (var file in files.OrderBy(o => o.FileName).ToList())
|
||||
{
|
||||
var checkListFileInfoDTO = new ImageFileDTO()
|
||||
{
|
||||
FileName = file.FileName,
|
||||
FileSize = file.FileSize,
|
||||
CreateDate = file.CreatedDate,
|
||||
|
||||
};
|
||||
checkListFileInfos.Add(checkListFileInfoDTO);
|
||||
}
|
||||
|
||||
if (checkListFileInfos != null)
|
||||
{
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = checkListFileInfos;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No data!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("GetAllLogBusinessFiles")]
|
||||
public async Task<ApiResponseDTO<List<ImageFileDTO>>> GetAllLogBusinessFilesAsync()
|
||||
{
|
||||
var retVal = new ApiResponseDTO<List<ImageFileDTO>>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
try
|
||||
{
|
||||
var logBusinessFiles = Path.Combine(Directory.GetCurrentDirectory(), "Logs\\BusinessFlow");
|
||||
var files = Directory.GetFiles(logBusinessFiles, "*.log")
|
||||
.Select(f =>
|
||||
{
|
||||
var fileInfo = new FileInfo(f);
|
||||
|
||||
@@ -489,7 +489,10 @@ namespace WorkFlowCheck.BL.Services
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteCheckListTemplateHeaderAsync(int id)
|
||||
{
|
||||
return await DeleteEntityByIdAsync<CheckListTemplateHeader>(id);
|
||||
}
|
||||
public async Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id)
|
||||
{
|
||||
var retVal = new CheckListTemplateRowDTO();
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces
|
||||
Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeaderAsync(int Id);
|
||||
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync();
|
||||
Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
|
||||
|
||||
Task<bool> DeleteCheckListTemplateHeaderAsync(int id);
|
||||
Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id);
|
||||
Task<bool> DeleteCheckListTemplateRowAsync(int id);
|
||||
Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO);
|
||||
|
||||
+8
-15
@@ -1,5 +1,8 @@
|
||||
@page
|
||||
@model WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader.CheckListTemplateHeaderPageModel
|
||||
@using WorkFlowCheck.Common.Helper
|
||||
@using WorkFlowCheck.Common.DTO
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Ellenőrzési sablonok";
|
||||
}
|
||||
@@ -15,16 +18,16 @@
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Short Name</th>
|
||||
<th>Description</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateHeaderDTO.ShortName), typeof(CheckListTemplateHeaderDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateHeaderDTO.Description), typeof(CheckListTemplateHeaderDTO))</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>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateHeaderDTO.ShortName), typeof(CheckListTemplateHeaderDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateHeaderDTO.Description), typeof(CheckListTemplateHeaderDTO))</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@@ -78,17 +81,7 @@
|
||||
$('#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');
|
||||
}
|
||||
});
|
||||
deleteEntity(table, './CheckListTemplateHeaderPage?handler=DeleteCheckListTemplateHeader', row.id);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
+6
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using WorkFlowCheck.Web.Services;
|
||||
using WorkFlowCheck.Web.Services.Interfaces;
|
||||
|
||||
namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader
|
||||
@@ -21,5 +22,10 @@ namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader
|
||||
var results = await _checkListService.GetAllCheckListTemplateHeaderAsync();
|
||||
return new JsonResult(new { data = results });
|
||||
}
|
||||
public async Task<JsonResult> OnGetDeleteCheckListTemplateHeader(int id)
|
||||
{
|
||||
var isSuccess = await _checkListService.DeleteCheckListTemplateHeader(id);
|
||||
return new JsonResult(new { result = isSuccess });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,6 +243,28 @@ namespace WorkFlowCheck.Web.Services
|
||||
};
|
||||
}
|
||||
}
|
||||
public async Task<bool> DeleteCheckListTemplateHeader(int id)
|
||||
{
|
||||
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/DeleteCheckListTemplateHeader/{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<CheckListTemplateRowDTO> GetCheckListTemplateRow(int id)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace WorkFlowCheck.Web.Services.Interfaces
|
||||
Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeader(int id);
|
||||
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync();
|
||||
Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> UpdateCheckListTemplateHeader(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
|
||||
|
||||
Task<bool> DeleteCheckListTemplateHeader(int id);
|
||||
|
||||
Task<CheckListTemplateRowDTO> GetCheckListTemplateRow(int id);
|
||||
Task<bool> DeleteCheckListTemplateRow(int id);
|
||||
|
||||
Reference in New Issue
Block a user