DeviceMessages-hez backend fejlesztése
This commit is contained in:
@@ -471,6 +471,30 @@ namespace WorkFlowCheck.API.Controllers
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("DeviceMessageReadUnreadedRole/{roleId}")]
|
||||
public async Task<ApiResponseDTO<List<DeviceMessageDTO>>> DeviceMessageReadUnreadedRole(int roleId)
|
||||
{
|
||||
var retVal = new ApiResponseDTO<List<DeviceMessageDTO>>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
|
||||
var response = await _syncService.DeviceMessageReadUnreadedRole(roleId);
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = response;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No data!");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
[HttpGet("Download")]
|
||||
public async Task<IActionResult> DownloadAPKFileAsync()
|
||||
|
||||
@@ -32,7 +32,8 @@ namespace WorkFlowCheck.BL.Services.Interfaces
|
||||
|
||||
Task<bool> DeviceMessageSend(DeviceMessageDTO deviceMessageDTO);
|
||||
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreaded(string deviceId);
|
||||
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreadedRole(int roleId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,5 +553,31 @@ namespace WorkFlowCheck.BL.Services
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<List<DeviceMessageDTO>> DeviceMessageReadUnreadedRole(int roleId)
|
||||
{
|
||||
var retVal = new List<DeviceMessageDTO>();
|
||||
try
|
||||
{
|
||||
var res = await _dbContext.DeviceMessages
|
||||
.Where(w => w.RoleId == roleId && w.IsReaded != true)
|
||||
.ToListAsync();
|
||||
|
||||
if (res != null)
|
||||
{
|
||||
retVal = _mapper.Map<List<DeviceMessageDTO>>(res);
|
||||
foreach (var deviceMessage in res)
|
||||
{
|
||||
deviceMessage.IsReaded = true;
|
||||
deviceMessage.ReceiveDate = DateTime.UtcNow;
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ namespace WorkFlowCheck.BL.Services
|
||||
|
||||
try
|
||||
{
|
||||
Log.ForContext("TAG", "AuditFlow").Information($"Bejelentkezési kísérlet: {userName}");
|
||||
var user = await _dbContext.Users
|
||||
.Include(i => i.UserRoles)
|
||||
.ThenInclude(i => i.Role)
|
||||
@@ -116,9 +117,13 @@ namespace WorkFlowCheck.BL.Services
|
||||
}
|
||||
user.JwtToken = GenerateJwtToken(userDTO);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
Log.ForContext("TAG", "AuditFlow").Information($"Sikeres bejelentkezés: {userName}");
|
||||
retVal = _mapper.Map<UserDTO>(user);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.ForContext("TAG", "AuditFlow").Error($"Sikertelen bejelenkezési kísérlet: {userName}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page
|
||||
@model WorkFlowCheck.Web.Pages.BaseStock.Equipments.EquipmentsPageModel
|
||||
@using WorkFlowCheck.Common.Helper
|
||||
@using WorkFlowCheck.Common.DTO
|
||||
@{
|
||||
ViewData["Title"] = "Berendezések";
|
||||
}
|
||||
@@ -15,16 +17,16 @@
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Short Name</th>
|
||||
<th>Equipment Number</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(EquipmentDTO.ShortName), typeof(EquipmentDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(EquipmentDTO.EquipmentNumber), typeof(EquipmentDTO))</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot class="table-light">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Short Name</th>
|
||||
<th>Equipment Number</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(EquipmentDTO.ShortName), typeof(EquipmentDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(EquipmentDTO.EquipmentNumber), typeof(EquipmentDTO))</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page
|
||||
@model WorkFlowCheck.Web.Pages.BaseStock.Locations.LocationsPageModel
|
||||
@using WorkFlowCheck.Common.Helper
|
||||
@using WorkFlowCheck.Common.DTO
|
||||
@{
|
||||
ViewData["Title"] = "Lokációk";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user