Author SHA1 Message Date
ivanszabo 3d0f9ce987 Saját notify 2025-05-14 20:12:25 +02:00
123 changed files with 649 additions and 3707 deletions
-2
View File
@@ -342,5 +342,3 @@ healthchecksdb
/src/WorkFlowCheck.API/Images /src/WorkFlowCheck.API/Images
*.pdf *.pdf
/src/WorkFlowCheck.API/Pdf/c86f3a6a-c646-4627-823c-7e24134b7725.docx /src/WorkFlowCheck.API/Pdf/c86f3a6a-c646-4627-823c-7e24134b7725.docx
/src/WorkFlowCheck.API/Downloads/APK/com.nuvolar.wfcapp-Signed.apk
/src/WorkFlowCheck.API/Pdf/3b9fd83a-dce8-4427-813b-9475726700be.docx
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18 # Visual Studio Version 17
VisualStudioVersion = 18.2.11408.102 d18.0 VisualStudioVersion = 17.12.35527.113
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.API", "WorkFlowCheck.API\WorkFlowCheck.API.csproj", "{2466E04A-CB0C-4421-9074-A928F819926C}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.API", "WorkFlowCheck.API\WorkFlowCheck.API.csproj", "{2466E04A-CB0C-4421-9074-A928F819926C}"
EndProject EndProject
@@ -63,14 +63,14 @@ namespace WorkFlowCheck.API.Controllers
return retVal; return retVal;
} }
[HttpGet("GetAllCheckListHeaders/{mode}")] [HttpGet("GetAllCheckListHeaders")]
public async Task<ApiResponseDTO<List<CheckListHeaderDTO>>> GetAllCheckListHeadersAsync(int mode = 0) public async Task<ApiResponseDTO<List<CheckListHeaderDTO>>> GetAllCheckListHeadersAsync()
{ {
var retVal = new ApiResponseDTO<List<CheckListHeaderDTO>>() var retVal = new ApiResponseDTO<List<CheckListHeaderDTO>>()
{ {
IsSuccess = true, IsSuccess = true,
}; };
var checkPointListDTO = await _checkListService.GetAllCheckListHeaderAsync(mode); var checkPointListDTO = await _checkListService.GetAllCheckListHeaderAsync();
if (checkPointListDTO != null) if (checkPointListDTO != null)
{ {
@@ -139,7 +139,6 @@ namespace WorkFlowCheck.API.Controllers
{ {
var result = await _checkListService.CloseCheckListHeader(checkListHeaderCloseDTO); var result = await _checkListService.CloseCheckListHeader(checkListHeaderCloseDTO);
retVal.Data = result; retVal.Data = result;
retVal.IsSuccess = result;
} }
catch (Exception ex) catch (Exception ex)
@@ -302,28 +301,6 @@ namespace WorkFlowCheck.API.Controllers
return retVal; return retVal;
} }
[HttpGet("CloneCheckListTemplateHeader/{id}")]
public async Task<ApiResponseDTO<bool>> CloneCheckListTemplateHeader(int id)
{
var retVal = new ApiResponseDTO<bool>()
{
IsSuccess = true,
};
var result = await _checkListService.CloneCheckListTemplateHeaderAsync(id);
if (result != null)
{
retVal.IsSuccess = true;
retVal.Data = result;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetCheckListTemplateRow/{id}")] [HttpGet("GetCheckListTemplateRow/{id}")]
public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> GetCheckListTemplateRow(int id) public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> GetCheckListTemplateRow(int id)
@@ -1,83 +0,0 @@
using Google.Apis.Auth.OAuth2;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Serilog;
using System.Net.Http.Headers;
using System.Text;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class FCMController : ControllerBase
{
private readonly IMessageService _messageService;
public FCMController(IMessageService messageService)
{
_messageService = messageService;
}
[HttpPost("SendFCMMessage")]
public async Task<ApiResponseDTO<bool>> SendFCMMessage([FromBody] FCMMessageDTO fCMMessageDTO)
{
var retVal = new ApiResponseDTO<bool>()
{
IsSuccess = true
};
try
{
retVal.IsSuccess = await _messageService.SendFCMMessage(fCMMessageDTO);
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpPost("SendFCMMessageToLastToken")]
public async Task<ApiResponseDTO<bool>> SendFCMMessageToLastToken([FromBody] FCMMessageDTO fCMMessageDTO)
{
var retVal = new ApiResponseDTO<bool>()
{
IsSuccess = true
};
try
{
retVal.IsSuccess = await _messageService.SendFCMMessageToLastToken(fCMMessageDTO);
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpPost("SendFCMToken")]
public async Task<ApiResponseDTO<bool>> SendFCMToken([FromBody] FCMMessageDTO fCMMessageDTO)
{
var retVal = new ApiResponseDTO<bool>()
{
IsSuccess = true
};
try
{
await _messageService.SendFCMTokenAsync(fCMMessageDTO.Token);
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
}
}
Binary file not shown.
@@ -17,16 +17,6 @@
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
},
"WSL": {
"commandName": "WSL2",
"launchBrowser": true,
"launchUrl": "https://localhost:5069/swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "https://localhost:5069"
},
"distributionName": ""
} }
}, },
"$schema": "http://json.schemastore.org/launchsettings.json", "$schema": "http://json.schemastore.org/launchsettings.json",
@@ -10,7 +10,6 @@
<InvariantGlobalization>false</InvariantGlobalization> <InvariantGlobalization>false</InvariantGlobalization>
<PublishAot>false</PublishAot> <PublishAot>false</PublishAot>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled> <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
<UserSecretsId>4081cb25-5ca2-40a1-a788-0d8396b4f50e</UserSecretsId>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\WorkFlowCheck.BL\WorkFlowCheck.BL.csproj" /> <ProjectReference Include="..\WorkFlowCheck.BL\WorkFlowCheck.BL.csproj" />
@@ -18,7 +17,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Google.Apis.Auth" Version="1.69.0" />
<PackageReference Include="MailKit" Version="4.11.0" /> <PackageReference Include="MailKit" Version="4.11.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.11" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.12"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.12">
@@ -1,20 +1,11 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
//"DefaultConnection": "Data Source=NSINB-37\\WFC;Initial Catalog=WFC;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False" "DefaultConnection": "Data Source=WS2016DC\\SQLEXPRESS;Initial Catalog=WFC;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False"
//"DefaultConnection": "Data Source=WS2016DC\\SQLEXPRESS;Initial Catalog=WFC;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False",
"DefaultConnection": "Data Source=WS2016DC\\SQLEXPRESS;Initial Catalog=WFCUAT;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False"
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
},
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://localhost:59027"
}
}
} }
} }
@@ -1,13 +0,0 @@
{
"type": "service_account",
"project_id": "com-nuvolar-wfcapp",
"private_key_id": "37642626e4a61fea715f3ef02a35d53fa9227666",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCVQKzCOgEhaQFo\nxtOYCpOc6XQNOVfNm8Z1xu1uoQtSZZIH3ivJy1IBqlyP/+sQ+7FO3Af5v90ae3rf\nvzd42QC4hrbBPyLGbVJWDHNPOzwg7bbez3waaU4i/7m4YJ61hlOObo888mjAxG8t\nz0cDEQzWPPUlLBCvtzY8Zv3jWdYaBxGUUzHxfemjTVLG7YCUjyt057HJVSH7AJpV\ndhnBi+3xlogsnK227ou/rLWoNyZVDOUaSiMor+LNiQx82eXc+UUaJgjpbI5AMk9z\n7CgAM8CSMOw7BHhCImVXaxH9rLZCsw0xpZnCJuOJKRyIMhrfcWKcHjrgkEW+xErj\nWN9lSkHRAgMBAAECggEAAwH5FUcrVom13b9bfF3ysnPdKwbNvVrLN5yDFIKV7oK1\n3Bca42u3rulIqR15doe275GVLtASL+ZfABcrslGPr1hGIqvvusdRVGL2+CjXveti\nbvgoDmVyvddwzf2S9zIiOQ2i8PHK4P8YZTg/DGmVnFPhRg7utWbMFtClw0UQQKkd\nzRwRDsw0jx9wDpP4EaO+czNvVZnnj+miL8QICN4gjbTdyQiVw2D1KzabwmozfEkM\nqTP+yH9mSC4gAEkG+X3i48QxiXZXvLflfnhF58+mT4yjIBIQbRTi0w9yLWRkcs8n\nmCq/89PZMncpNdCSJqdNOsYXgVaW8OMePxPNER2g4QKBgQDHl47N9AGyukpqEJJK\nR/8u3IwcCjLBb0wk5UxtZyz2JpoyqXoaKw7teqCqhg6lVd8MdIcVITKe0nZ+P29z\nyL+RVC+hGm/OQj6mAVyFEZptMgtQZGA2ThLY4ozZgzTW7uNyChhnUcqTiMCJ0g5g\n05imd6nQFKxI1ZfCsE7qlq6yYQKBgQC/bxKYno/6OT+9TTS+OCYVx9WJ8JCzOqFh\n/S+7qV14Bmml/JmYoSo/umxNOlKu3c7QtjU6caD/r4q/r6RHvvBxMlBu4K+vTEXh\nhFeqYORwTcEkcTDpjAGDekeJsRSxv5bg6QtsW30mtreBBC1/fOAvHD03Tz8GmFsp\nHry7b1WlcQKBgQCrnb51iix3oETh5DPVWQirI4n5hi9UMb24L81CeKepU1Hc4+qQ\nW5uvSHSjizdGpIpwLDYGThA3jeHC9gp/9Qn7DPcTQCcIo984YA1MgfFVmOUvj89G\ngmUkRdA0KuQhNzEsWk/XbvWPW9Op7YrdaLNl15iUyWHGEpo2FeEVRtEZoQKBgF5Z\nM+UcYQGGLa/y2UfXDI43izsM4YQ0JU3SJzBqbLK3FmLEeD8NT3FRRAdb81xT3ZZn\n9xvy3NKnhc6rll/17zMbBSFgg7X19YsMWtiSIIRpDgQT9XNlmWlfXtqx9+0S7B21\nPfgNr0ThUNe5Y2Mt/J+7X0BfQkTR2jwN9h665I9BAoGADx/oQLMXgKGdes4adF1Z\np9miGNsmUgXHdT+CdWkRx5uRd1a5s1Di6sOEUBPyFJ9hYc5ObRuC5q1A24ApASak\n0YCbUV1lqzFI4loXyM5ABqRTRCVGH94PXDAvsRUTTLvRIOliOeOBa8bNGGPlXtFw\nXzrkDjsz71JdNxgvT2Zz7nA=\n-----END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-fbsvc@com-nuvolar-wfcapp.iam.gserviceaccount.com",
"client_id": "109975038898567298706",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-fbsvc%40com-nuvolar-wfcapp.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
+1 -13
View File
@@ -1,14 +1,2 @@
@echo off dotnet publish -c Release -o e:\wfcapi\
REM ha van paraméter, azt használjuk, különben default
set PUBLISH_DIR=%1
if "%PUBLISH_DIR%"=="" (
set PUBLISH_DIR=c:\Publish\wfcapi
)
echo Publish to: %PUBLISH_DIR%
dotnet publish -c Release -o "%PUBLISH_DIR%"
pause pause
@@ -41,12 +41,7 @@ namespace WorkFlowCheck.BL.DocumentGenerator
// LibreOffice parancssori konverzió // LibreOffice parancssori konverzió
ProcessStartInfo startInfo = new ProcessStartInfo ProcessStartInfo startInfo = new ProcessStartInfo
{ {
#if !DEBUG
FileName = "e:\\LibreOffice\\program\\soffice", // LibreOffice parancs FileName = "e:\\LibreOffice\\program\\soffice", // LibreOffice parancs
#else
//FileName = "c:\\Program Files\\LibreOffice\\program\\soffice", // LibreOffice parancs
FileName = "e:\\LibreOffice\\program\\soffice", // LibreOffice parancs
#endif
Arguments = $"--headless --convert-to pdf \"{tempWordPath}\" --outdir \"{pdfDirectory}", Arguments = $"--headless --convert-to pdf \"{tempWordPath}\" --outdir \"{pdfDirectory}",
RedirectStandardOutput = true, RedirectStandardOutput = true,
UseShellExecute = false, UseShellExecute = false,
@@ -174,6 +169,8 @@ namespace WorkFlowCheck.BL.DocumentGenerator
body.Append(new Paragraph(new Run(new Break() { Type = BreakValues.Page }))); body.Append(new Paragraph(new Run(new Break() { Type = BreakValues.Page })));
body.Append(table); body.Append(table);
} }
private static Drawing CreateImageDrawing(string relationshipId, long width, long height) private static Drawing CreateImageDrawing(string relationshipId, long width, long height)
{ {
return new Drawing( return new Drawing(
@@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<title>Értesítés jóváhagyásról</title>
</head>
<body style="font-family: Arial, sans-serif; background-color: #f9f9f9; padding: 20px;">
<p style="font-size: 18px;">
A következő munkafolyamat jóvá lett hagyva:
</p>
<p style="font-size: 28px; font-weight: bold; color: #333; margin-top: 10px;">
#DocumentNumber#
</p>
</body>
</html>
+10 -133
View File
@@ -26,16 +26,13 @@ namespace WorkFlowCheck.BL.Services
{ {
private readonly INumberGeneratorService _numberGeneratorService; private readonly INumberGeneratorService _numberGeneratorService;
private readonly IMessageService _messageService;
public CheckListService(AppDbContext dbContext, public CheckListService(AppDbContext dbContext,
IMapper mapper, IMapper mapper,
INumberGeneratorService numberGeneratorService, INumberGeneratorService numberGeneratorService,
IMessageService messageService,
IUserService userService) : base(dbContext, mapper) IUserService userService) : base(dbContext, mapper)
{ {
_numberGeneratorService = numberGeneratorService; _numberGeneratorService = numberGeneratorService;
_messageService = messageService;
} }
public async Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id) public async Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id)
@@ -81,40 +78,21 @@ namespace WorkFlowCheck.BL.Services
return retVal; return retVal;
} }
public async Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync(int mode = 0) public async Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync()
{ {
var retVal = new List<CheckListHeaderDTO>(); var retVal = new List<CheckListHeaderDTO>();
try try
{ {
IQueryable<CheckListHeader> query = _dbContext.CheckListHeaders var checkListHeaders = await _dbContext.CheckListHeaders
.Include(i => i.CheckListRows) .Include(i => i.CheckListRows)
.Include(i => i.User) .Include(i => i.User)
.Include(i => i.AcceptUser) .Include(i => i.AcceptUser)
.AsNoTracking(); .AsNoTracking()
switch (mode) .ToListAsync();
if (checkListHeaders != null)
{ {
case 0: retVal = _mapper.Map<List<CheckListHeaderDTO>>(checkListHeaders);
query = query.Where(w => w.CheckStatus == CheckStatus.InProgress || w.CheckStatus == CheckStatus.Open).OrderByDescending(o => o.CreatedAt);
break;
case 1:
query = query.Where(w => w.CheckStatus == CheckStatus.Sent).OrderByDescending(o => o.CreatedAt);
break;
case 2:
query = query.Where(w => w.CheckStatus == CheckStatus.Closed).OrderByDescending(o => o.CreatedAt);
break;
case 3:
query = query.Where(w => w.CheckStatus == CheckStatus.Signed).OrderByDescending(o => o.CreatedAt);
break;
default:
query = query.OrderByDescending(o => o.CreatedAt);
break;
} }
var list = await query.ToListAsync();
retVal = _mapper.Map<List<CheckListHeaderDTO>>(list);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -133,7 +111,6 @@ namespace WorkFlowCheck.BL.Services
{ {
CheckListTemplateHeaderId = checkListHeaderDTO.CheckListTemplateHeaderDTO.Id, CheckListTemplateHeaderId = checkListHeaderDTO.CheckListTemplateHeaderDTO.Id,
Description = checkListHeaderDTO.Description, Description = checkListHeaderDTO.Description,
ShortName = checkListHeaderDTO.ShortName,
GuidNumber = Guid.NewGuid(), GuidNumber = Guid.NewGuid(),
}; };
_dbContext.CheckListHeaders.Add(checkListHeader); _dbContext.CheckListHeaders.Add(checkListHeader);
@@ -149,7 +126,7 @@ namespace WorkFlowCheck.BL.Services
if (checkListHeader != null) if (checkListHeader != null)
{ {
checkListHeader.Description = checkListHeaderDTO.Description; checkListHeader.Description = checkListHeaderDTO.Description;
checkListHeader.ShortName = checkListHeaderDTO.ShortName;
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckListHeaderDTO>(checkListHeader); retVal = _mapper.Map<CheckListHeaderDTO>(checkListHeader);
@@ -189,7 +166,7 @@ namespace WorkFlowCheck.BL.Services
IsEditable = true, IsEditable = true,
UserId = checkListHeaderNewDTO.UserId, UserId = checkListHeaderNewDTO.UserId,
ShortName = "", ShortName = "",
Description = checkListTemplateHeader.Description ?? "", Description = "",
DocumentNumber = documentNumber, DocumentNumber = documentNumber,
GuidNumber = Guid.NewGuid(), GuidNumber = Guid.NewGuid(),
IsDeleted = false, IsDeleted = false,
@@ -237,11 +214,6 @@ namespace WorkFlowCheck.BL.Services
try try
{ {
var user = await _dbContext.Users
.Where(w => w.Id == userid)
.FirstOrDefaultAsync();
if (user == null) return false;
var checkListHeader = await _dbContext.CheckListHeaders var checkListHeader = await _dbContext.CheckListHeaders
.Where(w => w.Id == id && w.CheckStatus == CheckStatus.Sent) .Where(w => w.Id == id && w.CheckStatus == CheckStatus.Sent)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
@@ -251,10 +223,7 @@ namespace WorkFlowCheck.BL.Services
checkListHeader.CheckStatus = CheckStatus.Signed; checkListHeader.CheckStatus = CheckStatus.Signed;
checkListHeader.IsEditable = false; checkListHeader.IsEditable = false;
checkListHeader.AcceptUserId = userid; checkListHeader.AcceptUserId = userid;
Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap státuszváltozása, jóváhasyás: Ellenőrzés:{id}, Felhasználó:{userid}");
checkListHeader.DateExecution = DateTime.Now;
Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap státuszváltozása, jóváhagyás: Ellenőrzés:{checkListHeader.DocumentNumber}, Felhasználó: {user.LastName} {user.FirstName}");
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
var pdf = await CreateCheckListHeaderPDFAsync(id); var pdf = await CreateCheckListHeaderPDFAsync(id);
@@ -267,60 +236,17 @@ namespace WorkFlowCheck.BL.Services
var filePath = Path.Combine(pdfDirectory, fileName); var filePath = Path.Combine(pdfDirectory, fileName);
await File.WriteAllBytesAsync(filePath, pdf); await File.WriteAllBytesAsync(filePath, pdf);
await SendMailToAcceptedUser(filePath, checkListHeader, userid);
retVal = true; retVal = true;
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
retVal = false;
Log.Error(ex.Message); Log.Error(ex.Message);
} }
return retVal; return retVal;
} }
private async Task SendMailToAcceptedUser(string filePath, CheckListHeader checkListHeader, int userId)
{
try
{
var user = _dbContext.Users.Where(W => W.Id == userId).FirstOrDefault();
if (user != null)
{
if (!string.IsNullOrEmpty(user.Email))
{
var recepients = new List<string>()
{
user.Email,
};
await _messageService.SendMailAsync(recepients,
$"Értesítés folyamat jóváhagyásáról {checkListHeader.DocumentNumber}",
GetAcceptCheckListHeaderMessageBody(checkListHeader),
filePath);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
}
private string GetAcceptCheckListHeaderMessageBody(CheckListHeader checkListHeader)
{
var assembly = Assembly.GetExecutingAssembly();
var resourceName = "WorkFlowCheck.BL.HtmlTemplates.AcceptCheckListHeaderBody.html";
using var stream = assembly.GetManifestResourceStream(resourceName);
if (stream == null)
throw new FileNotFoundException($"Nem található a beágyazott erőforrás: {resourceName}");
using var reader = new StreamReader(stream);
var html = reader.ReadToEnd();
return html.Replace("#DocumentNumber#", checkListHeader.DocumentNumber);
}
public async Task<byte[]> CreateCheckListHeaderPDFAsync(int checkListHeaderId) public async Task<byte[]> CreateCheckListHeaderPDFAsync(int checkListHeaderId)
{ {
try try
@@ -332,10 +258,8 @@ namespace WorkFlowCheck.BL.Services
byte[] byteArray = File.ReadAllBytes(Path.Combine(pdfDirectory, "CheckList_Template_V1.docx")); byte[] byteArray = File.ReadAllBytes(Path.Combine(pdfDirectory, "CheckList_Template_V1.docx"));
SablonGenerator gen = new SablonGenerator(byteArray); SablonGenerator gen = new SablonGenerator(byteArray);
gen.SimpleReplace("#description#", checkListHeader.Description);
gen.SimpleReplace("#DocumentNumber#", checkListHeader.DocumentNumber); gen.SimpleReplace("#DocumentNumber#", checkListHeader.DocumentNumber);
gen.SimpleReplace("#DateExecution#", checkListHeader.DateExecution.ToString("yyyy.MM.dd HH:mm")); gen.SimpleReplace("#DateExecution#", checkListHeader.DateExecution.ToString("yyyy.MM.dd HH:mm"));
gen.SimpleReplace("#WorkUser#", $"{checkListHeader.UserDTO?.LastName} {checkListHeader.UserDTO?.FirstName}"); gen.SimpleReplace("#WorkUser#", $"{checkListHeader.UserDTO?.LastName} {checkListHeader.UserDTO?.FirstName}");
gen.SimpleReplace("#AcceptUser#", $"{checkListHeader.AcceptUserDTO?.LastName} {checkListHeader.AcceptUserDTO?.FirstName}"); gen.SimpleReplace("#AcceptUser#", $"{checkListHeader.AcceptUserDTO?.LastName} {checkListHeader.AcceptUserDTO?.FirstName}");
gen.SimpleReplace("#Guid#", checkListHeader.GuidNumber.ToString()); gen.SimpleReplace("#Guid#", checkListHeader.GuidNumber.ToString());
@@ -569,53 +493,6 @@ namespace WorkFlowCheck.BL.Services
{ {
return await DeleteEntityByIdAsync<CheckListTemplateHeader>(id); return await DeleteEntityByIdAsync<CheckListTemplateHeader>(id);
} }
public async Task<bool> CloneCheckListTemplateHeaderAsync(int id)
{
var retVal = false;
try
{
var checkListTemplateHeader = await _dbContext.CheckListTemplateHeaders
.AsNoTracking()
.Include(i => i.CheckListTemplateRows)
.Where(w => w.Id == id).FirstOrDefaultAsync();
if (checkListTemplateHeader != null)
{
var newCheckListTemplateHeader = new CheckListTemplateHeader()
{
CheckListTemplateRows = new List<CheckListTemplateRow>(),
Description = checkListTemplateHeader.Description,
IsDeleted = false,
NumberGenerator1Id = checkListTemplateHeader.NumberGenerator1Id,
NumberGenerator2Id = checkListTemplateHeader.NumberGenerator2Id,
ShortName = $"{checkListTemplateHeader.ShortName} (másolat)",
};
foreach (var checkListTemplateRow in checkListTemplateHeader.CheckListTemplateRows)
{
var newCheckListTemplateRow = new CheckListTemplateRow()
{
AnswerType = checkListTemplateRow.AnswerType,
CheckListTemplateHeader = newCheckListTemplateHeader,
CheckPointId = checkListTemplateRow.CheckPointId,
EquipmentId = checkListTemplateRow.EquipmentId,
IsDeleted = false,
OperationDescription = checkListTemplateRow.OperationDescription,
RowIndex = checkListTemplateRow.RowIndex,
};
newCheckListTemplateHeader.CheckListTemplateRows.Add(newCheckListTemplateRow);
}
_dbContext.CheckListTemplateHeaders.Add(newCheckListTemplateHeader);
await _dbContext.SaveChangesAsync();
}
}
catch (Exception ex)
{
retVal = false;
Log.ForContext("TAG", "BusinessFlow").Error(ex.Message);
}
return retVal;
}
public async Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id) public async Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id)
{ {
var retVal = new CheckListTemplateRowDTO(); var retVal = new CheckListTemplateRowDTO();
@@ -6,7 +6,7 @@ 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(int mode = 0); Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync();
Task<CheckListHeaderDTO> UpdateCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO); Task<CheckListHeaderDTO> UpdateCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> AcceptCheckListHeaderAsync(int id, int userid); Task<bool> AcceptCheckListHeaderAsync(int id, int userid);
Task<bool> BlockCheckListHeaderAsync(int id, int userid); Task<bool> BlockCheckListHeaderAsync(int id, int userid);
@@ -20,7 +20,6 @@ namespace WorkFlowCheck.BL.Services.Interfaces
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync(); Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync();
Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO); Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
Task<bool> DeleteCheckListTemplateHeaderAsync(int id); Task<bool> DeleteCheckListTemplateHeaderAsync(int id);
Task<bool> CloneCheckListTemplateHeaderAsync(int id);
Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id); Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id);
Task<bool> DeleteCheckListTemplateRowAsync(int id); Task<bool> DeleteCheckListTemplateRowAsync(int id);
Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO); Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO);
@@ -3,17 +3,11 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces namespace WorkFlowCheck.BL.Services.Interfaces
{ {
public interface IMessageService public interface IMessageService
{ {
Task<bool> SendMailAsync(List<string> recipients, string subject, string htmlBody, string? attachmentFilePath = null); Task<bool> SendMailAsync(List<string> recipients, string subject, string htmlBody);
Task<bool> SendFCMTokenAsync(string token);
Task<string> GetLastFCMTokensAsync();
Task<bool> SendFCMMessage(FCMMessageDTO fCMMessageDTO);
Task<bool> SendFCMMessageToLastToken(FCMMessageDTO fCMMessageDTO);
} }
} }
+5 -175
View File
@@ -4,31 +4,19 @@ using MimeKit;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using WorkFlowCheck.BL.Models; using WorkFlowCheck.BL.Models;
using WorkFlowCheck.BL.Services.Interfaces; using WorkFlowCheck.BL.Services.Interfaces;
using Serilog;
using WorkFlowCheck.DL.Entities;
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using WorkFlowCheck.DL;
using WorkFlowCheck.Common.DTO;
using System.Net.Http.Headers;
using System.Text;
using Google.Apis.Auth.OAuth2;
using Newtonsoft.Json;
namespace WorkFlowCheck.BL.Services namespace WorkFlowCheck.BL.Services
{ {
public class MessageService : BaseService, IMessageService public class MessageService : IMessageService
{ {
private readonly EmailSettings _settings; private readonly EmailSettings _settings;
public MessageService(AppDbContext dbContext, public MessageService(IConfiguration configuration)
IMapper mapper,
IConfiguration configuration) : base(dbContext, mapper)
{ {
_settings = configuration.GetSection("EmailSettings").Get<EmailSettings>()!; _settings = configuration.GetSection("EmailSettings").Get<EmailSettings>()!;
} }
public async Task<bool> SendMailAsync(List<string> recipients, string subject, string htmlBody, string? attachmentFilePath = null) public async Task<bool> SendMailAsync(List<string> recipients, string subject, string htmlBody)
{ {
var message = new MimeMessage(); var message = new MimeMessage();
message.From.Add(new MailboxAddress(_settings.SenderName, _settings.Username)); message.From.Add(new MailboxAddress(_settings.SenderName, _settings.Username));
@@ -40,177 +28,19 @@ namespace WorkFlowCheck.BL.Services
message.Subject = subject; message.Subject = subject;
var builder = new BodyBuilder message.Body = new TextPart("html")
{ {
HtmlBody = htmlBody Text = htmlBody
}; };
if (!string.IsNullOrEmpty(attachmentFilePath) && File.Exists(attachmentFilePath))
{
builder.Attachments.Add(attachmentFilePath);
}
message.Body = builder.ToMessageBody();
const int maxRetries = 10;
const int delayMs = 2000;
bool authenticated = false;
Exception lastException = null;
for (int attempt = 1; attempt <= maxRetries; attempt++)
{
try
{
using var smtp = new SmtpClient(); using var smtp = new SmtpClient();
await smtp.ConnectAsync(_settings.SmtpServer, _settings.SmtpPort, SecureSocketOptions.StartTls); await smtp.ConnectAsync(_settings.SmtpServer, _settings.SmtpPort, SecureSocketOptions.StartTls);
await smtp.AuthenticateAsync(_settings.Username, _settings.Password); await smtp.AuthenticateAsync(_settings.Username, _settings.Password);
await smtp.SendAsync(message); await smtp.SendAsync(message);
await smtp.DisconnectAsync(true); await smtp.DisconnectAsync(true);
authenticated = true;
break; // 🎯 siker
}
catch (Exception ex)
{
lastException = ex;
Log.ForContext("TAG", "BusinessFlow").Error(lastException?.Message ?? "E-mail küldése sikertelen!");
if (attempt == maxRetries)
break;
// ⏳ várunk 1 másodpercet és újrapróbáljuk
await Task.Delay(delayMs);
}
}
if (!authenticated)
{
// 🔴 IDE ÍRHATSZ MAJD SAJÁT LOGIKÁT
Log.ForContext("TAG", "BusinessFlow").Error(lastException?.Message ?? "E-mail küldése sikertelen!");
}
return true; return true;
} }
public async Task<bool> SendFCMTokenAsync(string token)
{
var retVal = true;
try
{
if (!string.IsNullOrEmpty(token))
{
var FCMToken = await _dbContext.FCMTokens.Where(w => w.Token == token).FirstOrDefaultAsync();
if (FCMToken == null)
{
FCMToken = new FCMToken();
FCMToken.Token = token;
await _dbContext.FCMTokens.AddAsync(FCMToken);
}
else
{
FCMToken.LastModAt = DateTime.UtcNow;
}
await _dbContext.SaveChangesAsync();
}
}
catch (Exception ex)
{
retVal = false;
Log.ForContext("TAG", "BusinessFlow").Error(ex.Message);
}
return retVal;
}
public async Task<string> GetLastFCMTokensAsync()
{
var retVal = "";
try
{
var FCMToken = await _dbContext.FCMTokens
.AsNoTracking()
.OrderByDescending(x => x.LastModAt)
.Take(1)
.FirstOrDefaultAsync();
if (FCMToken != null && !string.IsNullOrEmpty(FCMToken.Token))
{
retVal += FCMToken.Token;
}
}
catch (Exception ex)
{
retVal = "";
Log.ForContext("TAG", "BusinessFlow").Error(ex.Message);
}
return retVal;
}
public async Task<bool> SendFCMMessage(FCMMessageDTO fCMMessageDTO)
{
var retVal = true;
try
{
var pathToJsonKey = "com-nuvolar-wfcapp-firebase-adminsdk-fbsvc-37642626e4.json";
var projectId = "com-nuvolar-wfcapp";
var credential = GoogleCredential
.FromFile(pathToJsonKey)
.CreateScoped("https://www.googleapis.com/auth/firebase.messaging");
var accessToken = await credential.UnderlyingCredential.GetAccessTokenForRequestAsync();
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
var message = new
{
message = new
{
token = fCMMessageDTO.Token,
notification = new
{
title = fCMMessageDTO.Title,
body = fCMMessageDTO.Body,
},
android = new
{
notification = new
{
channel_id = "com.nuvolar.wfcapp.general"
}
}
}
};
var json = JsonConvert.SerializeObject(message);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync($"https://fcm.googleapis.com/v1/projects/{projectId}/messages:send", content);
var result = await response.Content.ReadAsStringAsync();
}
catch (Exception ex)
{
retVal = false;
Log.Error(ex.Message);
}
return retVal;
}
public async Task<bool> SendFCMMessageToLastToken(FCMMessageDTO fCMMessageDTO)
{
var retVal = true;
try
{
fCMMessageDTO.Token = await GetLastFCMTokensAsync();
retVal = await SendFCMMessage(fCMMessageDTO);
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
} }
} }
+36 -52
View File
@@ -19,17 +19,15 @@ namespace WorkFlowCheck.BL.Services
{ {
private readonly IRequestContext _requestContext; private readonly IRequestContext _requestContext;
private readonly IUserService _userService; private readonly IUserService _userService;
private readonly IMessageService _messageService;
public SyncService(AppDbContext dbContext, public SyncService(AppDbContext dbContext,
IMapper mapper, IMapper mapper,
IRequestContext requestContext, IRequestContext requestContext,
IMessageService messageService,
IUserService userService) : base(dbContext, mapper) IUserService userService) : base(dbContext, mapper)
{ {
_requestContext = requestContext; _requestContext = requestContext;
_userService = userService; _userService = userService;
_messageService = messageService;
} }
public async Task<List<CheckPointDTO>> GetAllCheckPointAsync() public async Task<List<CheckPointDTO>> GetAllCheckPointAsync()
@@ -212,7 +210,8 @@ namespace WorkFlowCheck.BL.Services
var res = await _dbContext.Locations.Where(w => w.Id == LocationDTO.Id).FirstOrDefaultAsync(); var res = await _dbContext.Locations.Where(w => w.Id == LocationDTO.Id).FirstOrDefaultAsync();
if (res != null) if (res != null)
{ {
res.FullName = LocationDTO.FullName; res = _mapper.Map<DL.Entities.Location>(LocationDTO);
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<LocationDTO>(res); retVal = _mapper.Map<LocationDTO>(res);
@@ -348,10 +347,9 @@ namespace WorkFlowCheck.BL.Services
try try
{ {
var res = await _dbContext.CheckListHeaders var res = await _dbContext.CheckListHeaders
.Where(w => w.CheckStatus == CheckStatus.Open || .Where(w => (w.IsEditable &&
w.CheckStatus == CheckStatus.InProgress || w.IsDeleted != true) || (w.CheckStatus == CheckStatus.Blocked)
w.CheckStatus == CheckStatus.Blocked || )
w.CheckStatus == CheckStatus.Sent)
.Include(i => i.CheckListRows) .Include(i => i.CheckListRows)
//.ThenInclude(i => i.CheckListTemplateRow) //.ThenInclude(i => i.CheckListTemplateRow)
.AsNoTracking() .AsNoTracking()
@@ -385,6 +383,35 @@ namespace WorkFlowCheck.BL.Services
if (res != null && (res.CheckStatus == CheckStatus.Open || if (res != null && (res.CheckStatus == CheckStatus.Open ||
res.CheckStatus == CheckStatus.InProgress)) res.CheckStatus == CheckStatus.InProgress))
{ {
if (NeedBlocking(checkListHeaderDTO))
{
/// TODO: blokkolás miatt
res.CheckStatus = CheckStatus.Blocked;
await _dbContext.SaveChangesAsync();
Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap blokkolva: Ellenőrzés:{checkListHeaderDTO.Id}, Felhasználó:{_requestContext.CurrentUsername}");
var user = await _userService.GetUserAsync(_requestContext.CurrentUserId ?? 1);
foreach (var item in user.RoleDTO)
{
var deviceMessageDTO = new DeviceMessageDTO()
{
IsReaded = false,
Message = "Ellenőrző lap blokkolva!",
SendDate = DateTime.UtcNow,
ExtraDataJSON = "",
RoleId = item.ParentId,
DeviceIdFrom = "",
DeviceIdTo = "",
};
await this.DeviceMessageSend(deviceMessageDTO);
}
return retVal;
}
res.CheckStatus = CheckStatus.InProgress;
var ids = checkListHeaderDTO.CheckListRowDTO?.Select(r => r.Id).ToList(); var ids = checkListHeaderDTO.CheckListRowDTO?.Select(r => r.Id).ToList();
if (ids != null && ids.Count > 0) if (ids != null && ids.Count > 0)
{ {
@@ -411,47 +438,6 @@ namespace WorkFlowCheck.BL.Services
} }
} }
} }
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckListHeaderDTO>(res);
string Answer = "";
if (NeedBlocking(checkListHeaderDTO, out Answer))
{
/// TODO: blokkolás miatt
res.CheckStatus = CheckStatus.Blocked;
await _dbContext.SaveChangesAsync();
Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap blokkolva: Ellenőrzés:{checkListHeaderDTO.Id}, Felhasználó:{_requestContext.CurrentUsername}");
var user = await _userService.GetUserAsync(_requestContext.CurrentUserId ?? 1);
foreach (var item in user.RoleDTO)
{
var deviceMessageDTO = new DeviceMessageDTO()
{
IsReaded = false,
Message = $"Ellenőrző lap blokkolva! [{checkListHeaderDTO.DocumentNumber}]\n({Answer})",
SendDate = DateTime.UtcNow,
ExtraDataJSON = "",
RoleId = item.ParentId,
DeviceIdFrom = "",
DeviceIdTo = "",
};
await this.DeviceMessageSend(deviceMessageDTO);
var fCMMessageDTO = new FCMMessageDTO
{
Body = deviceMessageDTO.Message,
Title = "Blokkolási értesítés",
UserId = user.Id,
};
await _messageService.SendFCMMessageToLastToken(fCMMessageDTO);
}
return retVal;
}
res.CheckStatus = CheckStatus.InProgress;
if (CheckIfLastReached(checkListHeaderDTO)) if (CheckIfLastReached(checkListHeaderDTO))
{ {
/// TODO: most kell a CheckStatust állítani és menjen üzenet ! /// TODO: most kell a CheckStatust állítani és menjen üzenet !
@@ -474,10 +460,9 @@ namespace WorkFlowCheck.BL.Services
return retVal; return retVal;
} }
private bool NeedBlocking(CheckListHeaderDTO checkListHeaderDTO, out string Answer) private bool NeedBlocking(CheckListHeaderDTO checkListHeaderDTO)
{ {
var retVal = false; var retVal = false;
Answer = "";
if (checkListHeaderDTO.CheckListRowDTO != null && checkListHeaderDTO.CheckListRowDTO.Count > 0) if (checkListHeaderDTO.CheckListRowDTO != null && checkListHeaderDTO.CheckListRowDTO.Count > 0)
{ {
var checkListRows = checkListHeaderDTO.CheckListRowDTO; var checkListRows = checkListHeaderDTO.CheckListRowDTO;
@@ -487,7 +472,6 @@ namespace WorkFlowCheck.BL.Services
{ {
if (row.CheckListTemplateRowDTO != null) if (row.CheckListTemplateRowDTO != null)
{ {
Answer = row.CheckListTemplateRowDTO.OperationDescription;
if (row.CheckListTemplateRowDTO.AnswerType == "PI-N" && row.Answer == "Igen") if (row.CheckListTemplateRowDTO.AnswerType == "PI-N" && row.Answer == "Igen")
{ {
retVal = true; retVal = true;
+1 -1
View File
@@ -141,7 +141,7 @@ namespace WorkFlowCheck.BL.Services
var user = await _dbContext.Users var user = await _dbContext.Users
.Include(i => i.UserRoles) .Include(i => i.UserRoles)
.ThenInclude(i => i.Role) .ThenInclude(i => i.Role)
.Where(w => w.UserName == userName && w.Active == true) .Where(w => w.UserName == userName)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (user != null && PasswordHasher.VerifyPassword(user.PasswordHash, password)) if (user != null && PasswordHasher.VerifyPassword(user.PasswordHash, password))
{ {
@@ -11,14 +11,12 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="HtmlTemplates\AcceptCheckListHeaderBody.html" />
<EmbeddedResource Include="HtmlTemplates\Token2FBody.html" /> <EmbeddedResource Include="HtmlTemplates\Token2FBody.html" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" /> <PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="DocumentFormat.OpenXml" Version="3.3.0" /> <PackageReference Include="DocumentFormat.OpenXml" Version="3.3.0" />
<PackageReference Include="Google.Apis.Auth" Version="1.69.0" />
<PackageReference Include="MailKit" Version="4.11.0" /> <PackageReference Include="MailKit" Version="4.11.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" /> <PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" /> <PackageReference Include="Serilog.Expressions" Version="5.0.0" />
@@ -22,7 +22,5 @@ namespace WorkFlowCheck.Common.DTO
[DisplayName("Ellenőrzési pontok száma")] [DisplayName("Ellenőrzési pontok száma")]
public int CheckPointCount { get; set; } public int CheckPointCount { get; set; }
} }
} }
@@ -14,7 +14,7 @@ namespace WorkFlowCheck.Common.DTO
public int CheckListHeaderId { get; set; } public int CheckListHeaderId { get; set; }
public int CheckListTemplateRowId { get; set; } public int CheckListTemplateRowId { get; set; }
public CheckListTemplateRowDTO? CheckListTemplateRowDTO { get; set; } public CheckListTemplateRowDTO? CheckListTemplateRowDTO { get; set; }
public string GroupName => $"AnswerGroup_{CheckListTemplateRowDTO?.Id ?? 0}"; public string GroupName => $"AnswerGroup_{CheckListTemplateRowDTO?.RowIndex ?? 0}";
[DisplayName("Eredmény")] [DisplayName("Eredmény")]
public string Answer { get; set; } = null!; public string Answer { get; set; } = null!;
@@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -11,13 +9,7 @@ namespace WorkFlowCheck.Common.DTO
public class EquipmentDTO public class EquipmentDTO
{ {
public int Id { get; set; } public int Id { get; set; }
[Required(ErrorMessage = "A megnevezést megadása kötelező.")]
[DisplayName("Megnevezés")]
public string ShortName { get; set; } = null!; public string ShortName { get; set; } = null!;
[Required(ErrorMessage = "Az azonosító megadása kötelező.")]
[DisplayName("Azonosító")]
public string EquipmentNumber { get; set; } = null!; public string EquipmentNumber { get; set; } = null!;
} }
} }
@@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class FCMMessageDTO
{
public string? Token { get; set; }
public string? Body { get; set; }
public string? Title { get; set; }
public int? UserId { get; set; }
}
}
@@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -11,9 +9,6 @@ namespace WorkFlowCheck.Common.DTO
public class LocationDTO public class LocationDTO
{ {
public int Id { get; set; } public int Id { get; set; }
[Required(ErrorMessage = "A megnevezést megadása kötelező.")]
[DisplayName("Megnevezés")]
public string FullName { get; set; } = null!; public string FullName { get; set; } = null!;
} }
} }
@@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -12,19 +10,10 @@ namespace WorkFlowCheck.Common.DTO
public class RoleCheckListTemplateHeaderDTO public class RoleCheckListTemplateHeaderDTO
{ {
public int Id { get; set; } public int Id { get; set; }
[Required(ErrorMessage = "A szabály megnevezésének megadása kötelező.")]
[DisplayName("Szabály")]
public int RoleId { get; set; } public int RoleId { get; set; }
public RoleDTO? RoleDTO { get; set; } = null!; public RoleDTO? RoleDTO { get; set; } = null!;
[Required(ErrorMessage = "Az ellenőrzési sablon megadása kötelező.")]
[DisplayName("Ellenőrzési sablon")]
public int CheckListTemplateHeaderId { get; set; } public int CheckListTemplateHeaderId { get; set; }
public CheckListTemplateHeaderDTO? CheckListTemplateHeaderDTO { get; set; } = null!; public CheckListTemplateHeaderDTO? CheckListTemplateHeaderDTO { get; set; } = null!;
[DisplayName("Engedélyezve?")]
public bool Enabled { get; set; } = false; public bool Enabled { get; set; } = false;
} }
} }
@@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -12,18 +10,10 @@ namespace WorkFlowCheck.Common.DTO
public class RoleCheckPointDTO public class RoleCheckPointDTO
{ {
public int Id { get; set; } public int Id { get; set; }
[Required(ErrorMessage = "A szabály megadása kötelező.")]
[DisplayName("Szabály")]
public int RoleId { get; set; } public int RoleId { get; set; }
public RoleDTO? RoleDTO { get; set; } = null!; public RoleDTO? RoleDTO { get; set; } = null!;
[Required(ErrorMessage = "Az ellenőrzési pont megadása kötelező.")]
[DisplayName("Ellenőrzési pont")]
public int CheckPointId { get; set; } public int CheckPointId { get; set; }
public CheckPointDTO? CheckPointDTO { get; set; } = null!; public CheckPointDTO? CheckPointDTO { get; set; } = null!;
[DisplayName("Engedélyezve?")]
public bool Enabled { get; set; } = false; public bool Enabled { get; set; } = false;
} }
} }
@@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -17,13 +16,9 @@ namespace WorkFlowCheck.Common.DTO
[DisplayName("Régi jelszó")] [DisplayName("Régi jelszó")]
public string OldPassword { get; set; } = null!; public string OldPassword { get; set; } = null!;
[Required(ErrorMessage = "A jelszó kötelező.")]
[RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "Az új jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")]
[DisplayName("Új jelszó")] [DisplayName("Új jelszó")]
public string NewPassword1 { get; set; } = null!; public string NewPassword1 { get; set; } = null!;
[Required(ErrorMessage = "A jelszó kötelező.")]
[RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "Az új jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")]
[DisplayName("Jelszó megerősítése")] [DisplayName("Jelszó megerősítése")]
public string NewPassword2 { get; set; } = null!; public string NewPassword2 { get; set; } = null!;
+1 -4
View File
@@ -25,11 +25,8 @@ namespace WorkFlowCheck.Common.DTO
[DisplayName("Felhasználó neve")] [DisplayName("Felhasználó neve")]
public string UserName { get;set; } = null!; public string UserName { get;set; } = null!;
[Required(ErrorMessage = "A jelszó kötelező.")]
[RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "A jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")]
[DisplayName("Jelszó")] [DisplayName("Jelszó")]
public string Password { get; set; } = null!; public string Password { get; set; }
public string JwtToken { get; set; } = null!; public string JwtToken { get; set; } = null!;
@@ -34,8 +34,6 @@ namespace WorkFlowCheck.Common.Security
// Jelszó ellenőrzése // Jelszó ellenőrzése
public static bool VerifyPassword(string storedPasswordHash, string inputPassword) public static bool VerifyPassword(string storedPasswordHash, string inputPassword)
{ {
var inputPasswordHash = HashPassword(inputPassword);
byte[] hashBytes = Convert.FromBase64String(storedPasswordHash); byte[] hashBytes = Convert.FromBase64String(storedPasswordHash);
// Extract salt (first 16 bytes) and stored hash (next 32 bytes) // Extract salt (first 16 bytes) and stored hash (next 32 bytes)
-2
View File
@@ -27,7 +27,6 @@ namespace WorkFlowCheck.DL
public DbSet<Entities.CheckPoint> CheckPoints { get; set; } = null!; public DbSet<Entities.CheckPoint> CheckPoints { get; set; } = null!;
public DbSet<DeviceMessage> DeviceMessages { get; set; } = null!; public DbSet<DeviceMessage> DeviceMessages { get; set; } = null!;
public DbSet<Entities.Equipment> Equipments { get; set; } = null!; public DbSet<Entities.Equipment> Equipments { get; set; } = null!;
public DbSet<Entities.FCMToken> FCMTokens { get; set; } = null!;
public DbSet<Entities.Location> Locations { get; set; } = null!; public DbSet<Entities.Location> Locations { get; set; } = null!;
public DbSet<Entities.NumberGeneratorTemplate> NumberGeneratorTemplates { get; set; } = null!; public DbSet<Entities.NumberGeneratorTemplate> NumberGeneratorTemplates { get; set; } = null!;
public DbSet<Entities.NumberGeneratorTemplateDate> NumberGeneratorTemplateDates { get; set; } = null!; public DbSet<Entities.NumberGeneratorTemplateDate> NumberGeneratorTemplateDates { get; set; } = null!;
@@ -49,7 +48,6 @@ namespace WorkFlowCheck.DL
modelBuilder.ApplyConfiguration(new CheckPointTypeConfiguration()); modelBuilder.ApplyConfiguration(new CheckPointTypeConfiguration());
modelBuilder.ApplyConfiguration(new DeviceMessageTypeConfiguration()); modelBuilder.ApplyConfiguration(new DeviceMessageTypeConfiguration());
modelBuilder.ApplyConfiguration(new EquipmentTypeConfiguration()); modelBuilder.ApplyConfiguration(new EquipmentTypeConfiguration());
modelBuilder.ApplyConfiguration(new FCMTokenTypeConfiguration());
modelBuilder.ApplyConfiguration(new LocationTypeConfiguration()); modelBuilder.ApplyConfiguration(new LocationTypeConfiguration());
modelBuilder.ApplyConfiguration(new NumberGeneratorTypeConfiguration()); modelBuilder.ApplyConfiguration(new NumberGeneratorTypeConfiguration());
modelBuilder.ApplyConfiguration(new NumberGeneratorDateTypeConfiguration()); modelBuilder.ApplyConfiguration(new NumberGeneratorDateTypeConfiguration());
@@ -1,21 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.DL.Configurations
{
public class FCMTokenTypeConfiguration : IEntityTypeConfiguration<Entities.FCMToken>
{
public void Configure(EntityTypeBuilder<Entities.FCMToken> builder)
{
builder.ToTable("FCMToken");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
-20
View File
@@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Entities
{
public class FCMToken:ISoftDeletableEntity, IAuditableEntity
{
public int Id { get; set; }
public string Token { get; set; } = null!;
public bool IsDeleted { get; set; }
public DateTime LastModAt { get; set; }
public string LastModBy { get; set; } = null!;
public DateTime CreatedAt { get; set; }
public string CreatedBy { get; set; } = null!;
}
}
@@ -1,997 +0,0 @@
// <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("20250515123614_Extend021")]
partial class Extend021
{
/// <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?>("AcceptUserId")
.HasColumnType("int");
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("AcceptUserId");
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<int>("RoleId")
.HasColumnType("int");
b.Property<string>("ShortName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("CheckPoint", (string)null);
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.DeviceMessage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("DeviceIdFrom")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("DeviceIdTo")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<string>("ExtraDataJSON")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsReaded")
.HasColumnType("bit");
b.Property<string>("Message")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("ReceiveDate")
.HasColumnType("datetime2");
b.Property<int?>("RoleId")
.HasColumnType("int");
b.Property<DateTime>("SendDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("DeviceIdTo")
.HasDatabaseName("IX_DeviceMessage_DeviceIdTo");
b.HasIndex("RoleId");
b.ToTable("DeviceMessage", (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.FCMToken", 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>("Token")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("FCMToken", (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<bool>("CanDownloadAPK")
.HasColumnType("bit");
b.Property<bool>("CanEnableBlocked")
.HasColumnType("bit");
b.Property<bool>("CanUseMobilApp")
.HasColumnType("bit");
b.Property<bool>("CanUseWebAdmin")
.HasColumnType("bit");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime>("LastModAt")
.HasColumnType("datetime2");
b.Property<string>("LastModBy")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ParentId")
.HasColumnType("int");
b.Property<string>("RoleName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ParentId");
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, 5, 15, 12, 36, 12, 645, DateTimeKind.Utc).AddTicks(5079),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 5, 15, 12, 36, 12, 645, DateTimeKind.Utc).AddTicks(5082),
LastModBy = "System",
LastName = "System",
NFCActive = true,
NFCCode = "00000000",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
Token2FA = "",
UserName = "admin"
},
new
{
Id = 2,
Active = true,
CreatedAt = new DateTime(2025, 5, 15, 12, 36, 12, 656, DateTimeKind.Utc).AddTicks(8830),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 5, 15, 12, 36, 12, 656, DateTimeKind.Utc).AddTicks(8834),
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.User", "AcceptUser")
.WithMany()
.HasForeignKey("AcceptUserId")
.OnDelete(DeleteBehavior.Restrict);
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("AcceptUser");
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.DeviceMessage", b =>
{
b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role")
.WithMany()
.HasForeignKey("RoleId");
b.Navigation("Role");
});
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.Role", b =>
{
b.HasOne("WorkFlowCheck.DL.Entities.Role", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("Parent");
});
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("Children");
b.Navigation("UserRoles");
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
{
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,68 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class Extend021 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "FCMToken",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Token = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
LastModAt = table.Column<DateTime>(type: "datetime2", nullable: false),
LastModBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FCMToken", x => x.Id);
});
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 5, 15, 12, 36, 12, 645, DateTimeKind.Utc).AddTicks(5079), new DateTime(2025, 5, 15, 12, 36, 12, 645, DateTimeKind.Utc).AddTicks(5082) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 5, 15, 12, 36, 12, 656, DateTimeKind.Utc).AddTicks(8830), new DateTime(2025, 5, 15, 12, 36, 12, 656, DateTimeKind.Utc).AddTicks(8834) });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "FCMToken");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 4, 10, 9, 50, 12, 488, DateTimeKind.Utc).AddTicks(1377), new DateTime(2025, 4, 10, 9, 50, 12, 488, DateTimeKind.Utc).AddTicks(1382) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 4, 10, 9, 50, 12, 499, DateTimeKind.Utc).AddTicks(4095), new DateTime(2025, 4, 10, 9, 50, 12, 499, DateTimeKind.Utc).AddTicks(4096) });
}
}
}
@@ -377,40 +377,6 @@ namespace WorkFlowCheck.DL.Migrations
b.ToTable("Equipment", (string)null); b.ToTable("Equipment", (string)null);
}); });
modelBuilder.Entity("WorkFlowCheck.DL.Entities.FCMToken", 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>("Token")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("FCMToken", (string)null);
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Location", b => modelBuilder.Entity("WorkFlowCheck.DL.Entities.Location", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@@ -726,13 +692,13 @@ namespace WorkFlowCheck.DL.Migrations
{ {
Id = 1, Id = 1,
Active = true, Active = true,
CreatedAt = new DateTime(2025, 5, 15, 12, 36, 12, 645, DateTimeKind.Utc).AddTicks(5079), CreatedAt = new DateTime(2025, 4, 10, 9, 50, 12, 488, DateTimeKind.Utc).AddTicks(1377),
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, 5, 15, 12, 36, 12, 645, DateTimeKind.Utc).AddTicks(5082), LastModAt = new DateTime(2025, 4, 10, 9, 50, 12, 488, DateTimeKind.Utc).AddTicks(1382),
LastModBy = "System", LastModBy = "System",
LastName = "System", LastName = "System",
NFCActive = true, NFCActive = true,
@@ -745,13 +711,13 @@ namespace WorkFlowCheck.DL.Migrations
{ {
Id = 2, Id = 2,
Active = true, Active = true,
CreatedAt = new DateTime(2025, 5, 15, 12, 36, 12, 656, DateTimeKind.Utc).AddTicks(8830), CreatedAt = new DateTime(2025, 4, 10, 9, 50, 12, 499, DateTimeKind.Utc).AddTicks(4095),
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, 5, 15, 12, 36, 12, 656, DateTimeKind.Utc).AddTicks(8834), LastModAt = new DateTime(2025, 4, 10, 9, 50, 12, 499, DateTimeKind.Utc).AddTicks(4096),
LastModBy = "System", LastModBy = "System",
LastName = "System", LastName = "System",
NFCActive = true, NFCActive = true,
+9
View File
@@ -8,7 +8,15 @@ using WorkFlowCheck.MAUI.DataLayer;
using WorkFlowCheck.MAUI.Helper; using WorkFlowCheck.MAUI.Helper;
using WorkFlowCheck.MAUI.Services; using WorkFlowCheck.MAUI.Services;
using WorkFlowCheck.MAUI.Services.Interfaces; using WorkFlowCheck.MAUI.Services.Interfaces;
using Android.Content.PM;
using WorkFlowCheck.MAUI.Platforms.Android.Services;
#if ANDROID
using Android.Content;
using WorkFlowCheck.MAUI.Platforms.Android;
#endif
namespace WorkFlowCheck.MAUI namespace WorkFlowCheck.MAUI
{ {
public partial class App : Application public partial class App : Application
@@ -29,6 +37,7 @@ namespace WorkFlowCheck.MAUI
_dbContext.Database.EnsureDeleted(); // Adatbázis törlése _dbContext.Database.EnsureDeleted(); // Adatbázis törlése
_dbContext.Database.EnsureCreated(); // Új adatbázis létrehozása _dbContext.Database.EnsureCreated(); // Új adatbázis létrehozása
//StartBackgroundTask(); //StartBackgroundTask();
MainPage = new AppShell(); MainPage = new AppShell();
//MainPage = new NavigationPage(new MainPage(serviceProvider.GetRequiredService<IUserService>())); //MainPage = new NavigationPage(new MainPage(serviceProvider.GetRequiredService<IUserService>()));
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -10,7 +9,6 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class CheckListHeader public class CheckListHeader
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public int CheckListTemplateHeaderId { get; set; } public int CheckListTemplateHeaderId { get; set; }
public virtual CheckListTemplateHeader? CheckListTemplateHeader { get; set; } public virtual CheckListTemplateHeader? CheckListTemplateHeader { get; set; }
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -9,7 +8,6 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class CheckListRow public class CheckListRow
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public int CheckListHeaderId { get; set; } public int CheckListHeaderId { get; set; }
public virtual CheckListHeader CheckListHeader { get; set; } = null!; public virtual CheckListHeader CheckListHeader { get; set; } = null!;
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -9,7 +8,6 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class CheckListTemplateHeader public class CheckListTemplateHeader
{ {
[Key]
public int Id { get; set; } public int Id { 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!;
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -9,7 +8,6 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class CheckListTemplateRow public class CheckListTemplateRow
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public int RowIndex { get; set; } public int RowIndex { get; set; }
public int CheckListTemplateHeaderId { get; set; } public int CheckListTemplateHeaderId { get; set; }
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -9,7 +8,6 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class CheckPoint public class CheckPoint
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string ShortName { get; set; } = null!; public string ShortName { get; set; } = null!;
public string Code { get; set; } = null!; public string Code { get; set; } = null!;
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -9,7 +8,6 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class Equipment public class Equipment
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string ShortName { get; set; } = null!; public string ShortName { get; set; } = null!;
public string EquipmentNumber { get; set; } = null!; public string EquipmentNumber { get; set; } = null!;
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -9,7 +8,6 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class Location public class Location
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string FullName { get; set; } = null!; public string FullName { get; set; } = null!;
} }
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -9,7 +8,6 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class MobileUser public class MobileUser
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string? UserName { get; set; } public string? UserName { get; set; }
@@ -1,62 +0,0 @@
using SkiaSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.MAUI.Helper
{
public static class ImageHelper
{
public static string ResizeAndSaveImage(byte[] imageBytes, int id, int targetWidth = 50)
{
// Átméretezett fájl elérési útja
var filename = Path.Combine(FileSystem.CacheDirectory, $"wfc_{id}_photo.jpg");
if (File.Exists(filename))
{
try
{
File.Delete(filename);
// opcionálisan logolhatsz
// Console.WriteLine($"Törölve: {filename}");
}
catch (Exception ex)
{
//Console.WriteLine($"Hiba a fájl törlésekor: {ex.Message}");
}
}
// Eredeti kép betöltése
using var inputStream = new MemoryStream(imageBytes);
using var original = SKBitmap.Decode(inputStream);
if (original == null)
throw new InvalidOperationException("A kép nem olvasható vagy hibás.");
// Új szélesség és magasság arányosan
int targetHeight = (int)(original.Height * ((double)targetWidth / original.Width));
// Új üres bitmap létrehozása
using var resizedSurface = SKSurface.Create(new SKImageInfo(targetWidth, targetHeight));
using var canvas = resizedSurface.Canvas;
canvas.Clear(SKColors.White); // választható háttérszín
var srcRect = new SKRect(0, 0, original.Width, original.Height);
var destRect = new SKRect(0, 0, targetWidth, targetHeight);
canvas.DrawBitmap(original, srcRect, destRect);
using var resizedImage = resizedSurface.Snapshot();
using var imageData = resizedImage.Encode(SKEncodedImageFormat.Jpeg, 90);
// Mentés fájlba
using var fileStream = File.OpenWrite(filename);
imageData.SaveTo(fileStream);
return filename;
}
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.MAUI.Helper
{
public static class ServiceHelper
{
public static IServiceProvider Services { get; set; }
}
}
@@ -19,12 +19,10 @@ namespace WorkFlowCheck.MAUI.Helper
public static string DatabaseName = ""; public static string DatabaseName = "";
public static bool Syncronised = false; public static bool Syncronised = false;
public static UserDTO SystemUserDTO; public static UserDTO SystemUserDTO;
public static string ProgramVersion = "v1.1.039"; public static string ProgramVersion = "v1.1.020";
#if DEBUG #if DEBUG
//public static string ApiBaseUrl = $"http://10.0.2.2:59027/"; public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
//public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
public static string ApiBaseUrl = $"https://uat.wfcapi.nuvolar.hu/";
public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU="; public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=";
#endif #endif
+4 -1
View File
@@ -1,7 +1,9 @@
using DevExpress.Entity.Model.Metadata; using Android.Content;
using DevExpress.Entity.Model.Metadata;
using WorkFlowCheck.Common.DTO; using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Helper; using WorkFlowCheck.MAUI.Helper;
using WorkFlowCheck.MAUI.Pages.Media; using WorkFlowCheck.MAUI.Pages.Media;
using WorkFlowCheck.MAUI.Platforms.Android.Services;
using WorkFlowCheck.MAUI.Services.Interfaces; using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI namespace WorkFlowCheck.MAUI
{ {
@@ -15,6 +17,7 @@ namespace WorkFlowCheck.MAUI
{ {
InitializeComponent(); InitializeComponent();
_userService = userService; _userService = userService;
} }
private void SetInfo() private void SetInfo()
+3 -21
View File
@@ -12,12 +12,7 @@ using Microsoft.Maui.Hosting;
using CommunityToolkit.Maui.Core; using CommunityToolkit.Maui.Core;
using WorkFlowCheck.MAUI.Handlers; using WorkFlowCheck.MAUI.Handlers;
using WorkFlowCheck.MAUI.Helper; using WorkFlowCheck.MAUI.Helper;
using Plugin.Firebase.CloudMessaging;
using Microsoft.Maui.LifecycleEvents;
#if ANDROID
using Plugin.Firebase.Core.Platforms.Android;
#endif
namespace WorkFlowCheck.MAUI namespace WorkFlowCheck.MAUI
{ {
public static class MauiProgram public static class MauiProgram
@@ -32,7 +27,6 @@ namespace WorkFlowCheck.MAUI
builder.Services.AddAutoMapper(typeof(MapperProfile)); builder.Services.AddAutoMapper(typeof(MapperProfile));
builder.Services.AddHttpClient(); builder.Services.AddHttpClient();
builder.Services.AddDbContext<AppDbContext>(); builder.Services.AddDbContext<AppDbContext>();
//builder.Services.AddSingleton<AppDbContext>();
builder.Services.AddSingleton<IUserService, UserService>(); builder.Services.AddSingleton<IUserService, UserService>();
@@ -52,7 +46,7 @@ namespace WorkFlowCheck.MAUI
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFont("FontAwesome.ttf", "FontAwesome"); fonts.AddFont("FontAwesome.ttf", "FontAwesome");
}) })
.RegisterFirebaseServices()
.UseMauiCommunityToolkitCore() .UseMauiCommunityToolkitCore()
.UseMauiCommunityToolkit(); .UseMauiCommunityToolkit();
#if DEBUG #if DEBUG
@@ -69,24 +63,12 @@ namespace WorkFlowCheck.MAUI
}).GetAwaiter().GetResult(); }).GetAwaiter().GetResult();
} }
ServiceProvider = app.Services; ServiceProvider = app.Services;
ServiceHelper.Services = app.Services;
return app; return app;
} }
public static IServiceProvider ServiceProvider { get; private set; } public static IServiceProvider ServiceProvider { get; private set; }
private static MauiAppBuilder RegisterFirebaseServices(this MauiAppBuilder builder)
{
builder.ConfigureLifecycleEvents(events =>
{
#if ANDROID
events.AddAndroid(android => android.OnCreate((activity, _) =>
CrossFirebase.Initialize(activity)));
#endif
});
return builder;
}
} }
} }
@@ -1,55 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListInfoPage"
Title="CheckListInfoPage">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label x:Name="HeaderLabel" Text=""
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start" />
<HorizontalStackLayout
VerticalOptions="Center"
HorizontalOptions="End"
Spacing="5">
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="DeviceId"
FontSize="10"
TextColor="Black"/>
</Frame>
<Frame CornerRadius="1"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label x:Name="UserInfo"
FontSize="10"
FontAttributes="Bold"
TextColor="Black"/>
</Frame>
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<Grid RowDefinitions="*" Padding="30,30">
<Frame Grid.Row="0"
BorderColor="Gray"
Padding="5"
Margin="1"
CornerRadius="10"
HasShadow="True">
<StackLayout Grid.Column="1" Spacing="2">
<Label x:Name="row1" FontSize="20" FontAttributes="Bold" />
<Label x:Name="row2" Text="B" FontSize="20" />
<Label x:Name="row3" Text="C" FontSize="20" />
<Label x:Name="row4" Text="D" FontSize="20" />
<Label x:Name="row5" Text="D" FontSize="25" FontAttributes="Bold"/>
</StackLayout>
</Frame>
</Grid>
</ContentPage>
@@ -1,71 +0,0 @@
using Android.DeviceLock;
using Firebase.Auth;
using System.Globalization;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.CheckList;
public partial class CheckListInfoPage : ContentPage
{
private readonly ICheckListService _checkListService;
private readonly IUserService _userService;
private UserDTO _currentUser;
private CheckListHeaderDTO _checkListHeaderDTO;
private CheckListHeaderInfoDTO _checkListHeaderInfoDTO;
public CheckListInfoPage(CheckListHeaderDTO checkListHeaderDTO)
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
_checkListService = MauiProgram.ServiceProvider.GetRequiredService<ICheckListService>();
_checkListHeaderDTO = checkListHeaderDTO;
}
private async Task SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
HeaderLabel.Text = _checkListHeaderDTO.DocumentNumber;
}
protected override async void OnAppearing()
{
base.OnAppearing();
BindingContext = this;
await SetInfo();
BuildCheckListHeaderInfo();
}
private async Task BuildCheckListHeaderInfo()
{
_checkListHeaderInfoDTO = new CheckListHeaderInfoDTO();
var result = _checkListHeaderDTO.CheckListRowDTO
.GroupBy(r => 1)
.Select(g => new
{
TotalRowCount = g.Count(),
EmptyAnswerCount = g.Count(r => string.IsNullOrEmpty(r.Answer)),
CheckPointCount = g.Select(r => r.CheckListTemplateRowDTO.CheckPointId).Distinct().Count()
})
.FirstOrDefault();
if (result != null)
{
_checkListHeaderInfoDTO.TotalRowCount = result.TotalRowCount;
_checkListHeaderInfoDTO.CheckPointCount = result.CheckPointCount;
_checkListHeaderInfoDTO.EmptyAnswerCount = result.EmptyAnswerCount;
if (_checkListHeaderInfoDTO.TotalRowCount > 0)
{
_checkListHeaderInfoDTO.ReadyPercent = ((double)(_checkListHeaderInfoDTO.TotalRowCount - _checkListHeaderInfoDTO.EmptyAnswerCount) / _checkListHeaderInfoDTO.TotalRowCount * 100)
.ToString("0.00", new CultureInfo("hu-HU")) + " %";
}
}
var checkPointDTO = await _checkListService.GetNextCheckpointNotSend(_checkListHeaderDTO);
row1.Text = $"Összes ellenõrizendõ lépés: {_checkListHeaderInfoDTO.TotalRowCount} db";
row2.Text = $"Összes még nem ellenõrzött lépés: {_checkListHeaderInfoDTO.EmptyAnswerCount} db";
row3.Text = $"Ellenõrzési pontok száma: {_checkListHeaderInfoDTO.CheckPointCount} db";
row4.Text = $"Készültség: {_checkListHeaderInfoDTO.ReadyPercent}";
row5.Text = $"Következõ ellenõrzési pont : {checkPointDTO.ShortName}";
}
}
@@ -82,53 +82,16 @@
<DataTemplate> <DataTemplate>
<Frame BorderColor="Gray" Padding="15" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke"> <Frame BorderColor="Gray" Padding="15" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto"> <Grid ColumnDefinitions="*,Auto">
<Grid ColumnSpacing="10"> <!-- Bal oldali oszlop: Két Label egymás alatt -->
<Grid.ColumnDefinitions> <StackLayout Grid.Column="0" Spacing="2">
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Bal oldali gomb -->
<Button Grid.Column="0"
VerticalOptions="Center"
Text="i"
FontSize="17"
FontAttributes="Bold"
BackgroundColor="Purple"
HeightRequest="40"
WidthRequest="40"
CornerRadius="20"
BorderColor="Gray"
BorderWidth="1"
Command="{Binding BindingContext.InfoCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}" />
<!-- Jobb oldali szövegek -->
<StackLayout Grid.Column="1" Spacing="2">
<Label Text="{Binding DocumentNumber}" FontSize="14" FontAttributes="Bold" /> <Label Text="{Binding DocumentNumber}" FontSize="14" FontAttributes="Bold" />
<Label Text="{Binding DateExecution}" FontSize="12" /> <Label Text="{Binding DateExecution}" FontSize="12" />
<Label Text="{Binding CheckListTemplateHeaderDTO.ShortName}" FontSize="10" /> <Label Text="{Binding CheckListTemplateHeaderDTO.ShortName}" FontSize="10" />
<Label Text="{Binding StatusName}" FontSize="10" /> <Label Text="{Binding StatusName}" FontSize="10" />
</StackLayout> </StackLayout>
</Grid>
<!-- Jobb oldali oszlop: Két gomb egymás mellett --> <!-- Jobb oldali oszlop: Két gomb egymás mellett -->
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="3"> <HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="3">
<Button Text="L"
Margin="0,0,0,0"
BackgroundColor="DarkOrange"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource CloseConverter}}"
Command="{Binding BindingContext.CloseCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text="" <Button Text=""
Margin="0,0,0,0" Margin="0,0,0,0"
ImageSource="arrow_down.svg" ImageSource="arrow_down.svg"
@@ -198,9 +161,6 @@
Margin="1" Margin="1"
CornerRadius="10" CornerRadius="10"
HasShadow="True"> HasShadow="True">
<RefreshView x:Name="CheckListTemplateRefreshView"
IsRefreshing="{Binding IsRefreshingT}"
Command="{Binding RefreshCommandT}">
<ScrollView> <ScrollView>
<VerticalStackLayout> <VerticalStackLayout>
<Label Text="Új ellenőrzés" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" /> <Label Text="Új ellenőrzés" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
@@ -231,7 +191,6 @@
</CollectionView> </CollectionView>
</VerticalStackLayout> </VerticalStackLayout>
</ScrollView> </ScrollView>
</RefreshView>
</Frame> </Frame>
<Grid BackgroundColor="#80000000" <Grid BackgroundColor="#80000000"
IsVisible="{Binding IsLoading}" IsVisible="{Binding IsLoading}"
@@ -254,7 +213,6 @@
<local:UnBlockedConverter x:Key="UnBlockedConverter" /> <local:UnBlockedConverter x:Key="UnBlockedConverter" />
<local:ContinueConverter x:Key="ContinueConverter" /> <local:ContinueConverter x:Key="ContinueConverter" />
<local:AcceptConverter x:Key="AcceptConverter" /> <local:AcceptConverter x:Key="AcceptConverter" />
<local:CloseConverter x:Key="CloseConverter" />
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
</ContentPage> </ContentPage>
@@ -9,7 +9,6 @@ using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Common.Enums; using WorkFlowCheck.Common.Enums;
using WorkFlowCheck.MAUI.Helper; using WorkFlowCheck.MAUI.Helper;
using WorkFlowCheck.MAUI.Pages.NFC; using WorkFlowCheck.MAUI.Pages.NFC;
using WorkFlowCheck.MAUI.Pages.System;
using WorkFlowCheck.MAUI.Services.Interfaces; using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.CheckList; namespace WorkFlowCheck.MAUI.Pages.CheckList;
@@ -28,10 +27,7 @@ public partial class CheckListPage : ContentPage
public ICommand UnblockCommand { get; set; } public ICommand UnblockCommand { get; set; }
public ICommand BlockCommand { get; set; } public ICommand BlockCommand { get; set; }
public ICommand AcceptCommand { get; set; } public ICommand AcceptCommand { get; set; }
public ICommand InfoCommand { get; set; }
public ICommand CloseCommand { get; set; }
public ICommand RefreshCommand { get; } public ICommand RefreshCommand { get; }
public ICommand RefreshCommandT { get; }
public bool IsLoading public bool IsLoading
{ {
@@ -53,7 +49,6 @@ public partial class CheckListPage : ContentPage
} }
private bool _isRefreshing; private bool _isRefreshing;
private bool _isRefreshingT;
public bool IsRefreshing public bool IsRefreshing
{ {
get => _isRefreshing; get => _isRefreshing;
@@ -66,18 +61,6 @@ public partial class CheckListPage : ContentPage
} }
} }
} }
public bool IsRefreshingT
{
get => _isRefreshingT;
set
{
if (_isRefreshingT != value)
{
_isRefreshingT = value;
OnPropertyChanged(nameof(IsRefreshingT));
}
}
}
public CheckListPage() public CheckListPage()
{ {
@@ -90,10 +73,7 @@ public partial class CheckListPage : ContentPage
UnblockCommand = new Command<CheckListHeaderDTO>(OnUnblockItem); UnblockCommand = new Command<CheckListHeaderDTO>(OnUnblockItem);
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem); BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
AcceptCommand = new Command<CheckListHeaderDTO>(OnAcceptItem); AcceptCommand = new Command<CheckListHeaderDTO>(OnAcceptItem);
InfoCommand = new Command<CheckListHeaderDTO>(OnInfoItem);
CloseCommand = new Command<CheckListHeaderDTO>(OnCloseItem);
RefreshCommand = new Command(async () => await OnRefresh()); RefreshCommand = new Command(async () => await OnRefresh());
RefreshCommandT = new Command(async () => await OnRefreshT());
} }
private async void OnSyncClicked(object sender, EventArgs e) private async void OnSyncClicked(object sender, EventArgs e)
@@ -143,16 +123,6 @@ public partial class CheckListPage : ContentPage
IsRefreshing = false; IsRefreshing = false;
} }
private async Task OnRefreshT()
{
IsRefreshingT = true;
//await _syncService.SyncCheckListHeader_Down((d, s) => { });
await LoadCheckListTemplate();
IsRefreshingT = false;
}
private void SetInfo() private void SetInfo()
{ {
_currentUser = _userService.GetCurrentUser(); _currentUser = _userService.GetCurrentUser();
@@ -313,43 +283,6 @@ public partial class CheckListPage : ContentPage
} }
} }
} }
private async void OnCloseItem(CheckListHeaderDTO checkListHeaderDTO)
{
var popup = new InputPopup("Kérem adja meg a lezárás okát!");
var (isConfirmed, userInput) = await popup.ShowAsync();
if (isConfirmed && !string.IsNullOrEmpty(userInput))
{
var checkListHeaderCloseDTO = new CheckListHeaderCloseDTO()
{
Id = checkListHeaderDTO.Id,
CloseReason = userInput,
UserId = _userService.GetCurrentUser().Id
};
var success = await _checkListService.CloseCheckListHeader(checkListHeaderCloseDTO);
if (success)
{
IsRefreshing = true;
await LoadCheckList();
IsRefreshing = false;
await SystemHelper.ShowSnackBar("Lezárás sikeres!",
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.White),
5);
}
else
{
await SystemHelper.ShowSnackBar("Lezárás SIKERTELEN!",
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Yellow),
15);
}
}
}
private async void OnAcceptItem(CheckListHeaderDTO checkListHeaderDTO) private async void OnAcceptItem(CheckListHeaderDTO checkListHeaderDTO)
{ {
bool answer = await DisplayAlert("Megerõsítés", "Biztosan jóváhagyod a folyamatot?", "Igen", "Mégsem"); bool answer = await DisplayAlert("Megerõsítés", "Biztosan jóváhagyod a folyamatot?", "Igen", "Mégsem");
@@ -378,10 +311,6 @@ public partial class CheckListPage : ContentPage
} }
} }
} }
private async void OnInfoItem(CheckListHeaderDTO checkListHeaderDTO)
{
await Navigation.PushAsync(new CheckListInfoPage(checkListHeaderDTO));
}
private async Task LoadCheckListTemplate() private async Task LoadCheckListTemplate()
{ {
IsLoading = true; IsLoading = true;
@@ -409,11 +338,7 @@ public partial class CheckListPage : ContentPage
if (!isAdmin) if (!isAdmin)
{ {
var result = checkListHeaderDTOs var result = checkListHeaderDTOs
.Where(w => w.UserId == userDTO.Id && .Where(w => w.UserId == userDTO.Id && w.CheckStatus != CheckStatus.Blocked).ToList();
//w.CheckStatus != CheckStatus.Blocked &&
w.CheckStatus != CheckStatus.Sent &&
w.CheckStatus != CheckStatus.Closed
).ToList();
CheckList.ItemsSource = result; CheckList.ItemsSource = result;
} }
@@ -447,31 +372,6 @@ public class BlockedConverter : IValueConverter
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
public class CloseConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var canEnableBlocked = false;
foreach (var roleDTO in SystemHelper.SystemUserDTO.RoleDTO)
{
if (roleDTO.CanEnableBlocked)
{
canEnableBlocked = true;
break;
}
}
if (value is CheckStatus status && canEnableBlocked)
{
return true;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class UnBlockedConverter : IValueConverter public class UnBlockedConverter : IValueConverter
{ {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
@@ -1,91 +0,0 @@
using SkiaSharp;
using System.ComponentModel;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Helper;
namespace WorkFlowCheck.MAUI.Pages.CheckList
{
public class CheckListRowCS : INotifyPropertyChanged
{
private byte[] _photoBytes;
//private ImageSource? _photo;
private string? _photoPath;
public event PropertyChangedEventHandler PropertyChanged;
public int Id { get; set; }
public string AnswerType { get; set; } = null!;
public int RowIndex { get; set; }
public string OperationDescription { get; set; } = null!;
public string GroupName { get; set; } = null!;
public string Answer { get; set; } = null!;
public bool? AnswerYes { get; set; } = null!;
public bool? AnswerNo { get; set; } = null!;
public byte[] PhotoBytes
{
get => _photoBytes;
set
{
if (_photoBytes != value)
{
_photoBytes = value;
//_photo = null;
_photoPath = null;
//OnPropertyChanged(nameof(PhotoBytes));
//OnPropertyChanged(nameof(Photo));
OnPropertyChanged(nameof(PhotoPath));
}
}
}
//public ImageSource Photo
//{
// get
// {
// if (_photo == null)
// {
// if (PhotoBytes != null && PhotoBytes.Length > 0)
// {
// try
// {
// var bytesCopy = PhotoBytes.ToArray();
// _photo = ImageSource.FromStream(() => new MemoryStream(bytesCopy));
// }
// catch
// {
// _photo = ImageSource.FromFile("noimage.png");
// }
// }
// else
// {
// _photo = ImageSource.FromFile("noimage.png");
// }
// }
// return _photo;
// }
//}
public string PhotoPath
{
get
{
if (_photoPath == null)
{
if (PhotoBytes != null && PhotoBytes.Length > 0)
{
_photoPath = ImageHelper.ResizeAndSaveImage(PhotoBytes, Id, 100);
}
else
{
_photoPath = "noimage.png";
}
}
return _photoPath;
}
}
protected void OnPropertyChanged(string name) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}
@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListWorkPage" x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListWorkPage"
xmlns:templateselectors="clr-namespace:WorkFlowCheck.MAUI.TemplateSelectors" xmlns:templateselectors="clr-namespace:WorkFlowCheck.MAUI.TemplateSelectors"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList" xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
BackgroundColor="#f0f0f0" BackgroundColor="#f0f0f0"
Title=""> Title="">
@@ -48,7 +47,7 @@
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2"> <Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
<CollectionView x:Name="CheckPointCheckListRows" <CollectionView x:Name="CheckPointCheckListRows"
HeightRequest="555" HeightRequest="555"
ItemsSource="{Binding CheckListRowCSs}" ItemsSource="{Binding CheckListRows}"
ItemTemplate="{StaticResource AnswerTemplateSelector}"> ItemTemplate="{StaticResource AnswerTemplateSelector}">
<CollectionView.EmptyView> <CollectionView.EmptyView>
<Label Text="Nincsenek feladatok." HorizontalOptions="Center" VerticalOptions="Center"/> <Label Text="Nincsenek feladatok." HorizontalOptions="Center" VerticalOptions="Center"/>
@@ -93,8 +92,8 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" /> <Label Text="{Binding CheckListTemplateRowDTO.RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" /> <Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*"> <Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center"/> <Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center"/> <Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center"/>
@@ -105,14 +104,14 @@
Content="Igen" Content="Igen"
Value="Igen" Value="Igen"
BindableGroupName="{Binding GroupName}" BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}" IsChecked="{Binding AnswerYes}"
HorizontalOptions="Center" VerticalOptions="Center"/> HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton <local:BindableRadioButton
Grid.Row="1" Grid.Row="1"
Content="Nem" Content="Nem"
Value="Nem" Value="Nem"
BindableGroupName="{Binding GroupName}" BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}" IsChecked="{Binding AnswerNo}"
HorizontalOptions="Center" VerticalOptions="Center"/> HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid> </Grid>
</Grid> </Grid>
@@ -126,20 +125,19 @@
<ColumnDefinition Width="3*" /> <ColumnDefinition Width="3*" />
<ColumnDefinition Width="2*" /> <ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" /> <Label Text="{Binding CheckListTemplateRowDTO.RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" /> <Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="Auto,Auto" VerticalOptions="Center"> <Grid Grid.Column="2" ColumnDefinitions="Auto,Auto" VerticalOptions="Center">
<Image Grid.Column="0" <Image Grid.Column="0"
WidthRequest="65" WidthRequest="95"
HeightRequest="90" HeightRequest="120"
Aspect="AspectFill" Aspect="AspectFill"
Margin="0,0,10,0" Margin="0,0,10,0"
VerticalOptions="Center" VerticalOptions="Center"
Source="{Binding PhotoPath}" > Source="{Binding Photo, Converter={StaticResource ByteArrayToImageSourceConverter}}" />
</Image>
<Button Text="📷" Grid.Column="1" <Button Text="📷" Grid.Column="1"
VerticalOptions="Center" VerticalOptions="Center"
Command="{Binding BindingContext.TakePhoto, Source={x:Reference CheckPointCheckListRows}}" Command="{Binding BindingContext.CreatePhoto, Source={x:Reference CheckPointCheckListRows}}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</Grid> </Grid>
</Grid> </Grid>
@@ -154,15 +152,14 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" /> <Label Text="{Binding CheckListTemplateRowDTO.RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" /> <Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*"> <Grid Grid.Column="2" ColumnDefinitions="*">
<Label Text="Érték megadása szükséges" Grid.Column="0" HorizontalTextAlignment="Center"/> <Label Text="Érték megadása szükséges" Grid.Column="0" HorizontalTextAlignment="Center"/>
</Grid> </Grid>
<Entry Grid.Column="3" <Entry Grid.Column="3"
Text="{Binding Answer}" Text="{Binding Answer}"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextChanged="V_Entry_Text_Changed"
VerticalOptions="Center" /> VerticalOptions="Center" />
</Grid> </Grid>
</Frame> </Frame>
@@ -176,8 +173,8 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="{Binding CheckListTemplateRowDTO.RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" /> <Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*"> <Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="I" Grid.Column="0" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
@@ -188,14 +185,14 @@
Content="Igen" Content="Igen"
Value="Igen" Value="Igen"
BindableGroupName="{Binding GroupName}" BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}" IsChecked="{Binding AnswerYes}"
HorizontalOptions="Center" VerticalOptions="Center"/> HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton <local:BindableRadioButton
Grid.Row="1" Grid.Row="1"
Content="Nem" Content="Nem"
Value="Nem" Value="Nem"
BindableGroupName="{Binding GroupName}" BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}" IsChecked="{Binding AnswerNo}"
HorizontalOptions="Center" VerticalOptions="Center"/> HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid> </Grid>
</Grid> </Grid>
@@ -210,8 +207,8 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="{Binding CheckListTemplateRowDTO.RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" /> <Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*"> <Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="N" Grid.Column="1" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
@@ -222,14 +219,14 @@
Content="Igen" Content="Igen"
Value="Igen" Value="Igen"
BindableGroupName="{Binding GroupName}" BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}" IsChecked="{Binding AnswerYes}"
HorizontalOptions="Center" VerticalOptions="Center"/> HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton <local:BindableRadioButton
Grid.Row="1" Grid.Row="1"
Content="Nem" Content="Nem"
Value="Nem" Value="Nem"
BindableGroupName="{Binding GroupName}" BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}" IsChecked="{Binding AnswerNo}"
HorizontalOptions="Center" VerticalOptions="Center"/> HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid> </Grid>
</Grid> </Grid>
@@ -244,8 +241,8 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="{Binding CheckListTemplateRowDTO.RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" /> <Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*"> <Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="I" Grid.Column="0" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
@@ -256,14 +253,14 @@
Content="Igen" Content="Igen"
Value="Igen" Value="Igen"
BindableGroupName="{Binding GroupName}" BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}" IsChecked="{Binding AnswerYes}"
HorizontalOptions="Center" VerticalOptions="Center"/> HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton <local:BindableRadioButton
Grid.Row="1" Grid.Row="1"
Content="Nem" Content="Nem"
Value="Nem" Value="Nem"
BindableGroupName="{Binding GroupName}" BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}" IsChecked="{Binding AnswerNo}"
HorizontalOptions="Center" VerticalOptions="Center"/> HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid> </Grid>
</Grid> </Grid>
@@ -278,8 +275,8 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Text="{Binding RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="{Binding CheckListTemplateRowDTO.RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="{Binding OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" /> <Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
<Grid Grid.Column="2" ColumnDefinitions="*,*"> <Grid Grid.Column="2" ColumnDefinitions="*,*">
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Label Text="N" Grid.Column="1" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/> <Label Text="N" Grid.Column="1" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
@@ -290,14 +287,14 @@
Content="Igen" Content="Igen"
Value="Igen" Value="Igen"
BindableGroupName="{Binding GroupName}" BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerYes, Mode=TwoWay}" IsChecked="{Binding AnswerYes}"
HorizontalOptions="Center" VerticalOptions="Center"/> HorizontalOptions="Center" VerticalOptions="Center"/>
<local:BindableRadioButton <local:BindableRadioButton
Grid.Row="1" Grid.Row="1"
Content="Nem" Content="Nem"
Value="Nem" Value="Nem"
BindableGroupName="{Binding GroupName}" BindableGroupName="{Binding GroupName}"
IsChecked="{Binding AnswerNo, Mode=TwoWay}" IsChecked="{Binding AnswerNo}"
HorizontalOptions="Center" VerticalOptions="Center"/> HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid> </Grid>
</Grid> </Grid>
@@ -311,5 +308,6 @@
PI_N_Template="{StaticResource PI_N_Template}" PI_N_Template="{StaticResource PI_N_Template}"
I_PN_Template="{StaticResource I_PN_Template}" I_PN_Template="{StaticResource I_PN_Template}"
V_Template="{StaticResource V_Template}"/> V_Template="{StaticResource V_Template}"/>
<local:ByteArrayToImageSourceConverter x:Key="ByteArrayToImageSourceConverter"/>
</ContentPage.Resources> </ContentPage.Resources>
</ContentPage> </ContentPage>
@@ -29,10 +29,8 @@ public partial class CheckListWorkPage : ContentPage
OnPropertyChanged(nameof(IsLoading)); OnPropertyChanged(nameof(IsLoading));
} }
} }
public ObservableCollection<CheckListRowCS> CheckListRowCSs { get; set; } = new ObservableCollection<CheckListRowCS>(); public ObservableCollection<CheckListRowDTO> CheckListRows { get; set; } = new ObservableCollection<CheckListRowDTO>();
public List<CheckListRowDTO> CheckListRowDTOs { get; set; } public ICommand CreatePhoto { get; set; }
public ICommand TakePhoto { get; set; }
public ICommand SendCommand { get; set; } public ICommand SendCommand { get; set; }
public ICommand SaveCommand { get; set; } public ICommand SaveCommand { get; set; }
@@ -111,36 +109,26 @@ public partial class CheckListWorkPage : ContentPage
} }
} }
private async Task OnSave(bool withReload = true) private async Task OnSave()
{ {
IsLoading = true; IsLoading = true;
try try
{ {
await Task.Run(async () => await Task.Run(async () =>
{ {
foreach (var checkListRowCS in CheckListRowCSs) foreach (var checkListRow in CheckListRows)
{ {
var checkListRowDTO = CheckListRowDTOs.Where(w => w.Id == checkListRowCS.Id).FirstOrDefault(); if (checkListRow.AnswerYes == true)
if (checkListRowDTO != null)
{ {
checkListRowDTO.Answer = checkListRowCS.Answer; checkListRow.Answer = "Igen";
if (checkListRowCS.AnswerYes == true) }
if (checkListRow.AnswerNo == true)
{ {
checkListRowDTO.Answer = "Igen"; checkListRow.Answer = "Nem";
} }
else if (checkListRowCS.AnswerNo == true) await _checkListService.UpdateCheckListRow(checkListRow);
{
checkListRowDTO.Answer = "Nem";
} }
else await LoadCheckPointCheckListRows();
{
checkListRowDTO.Answer = checkListRowCS.Answer;
}
await _checkListService.UpdateCheckListRow(checkListRowDTO, withReload);
}
}
if (withReload) await LoadCheckPointCheckListRows();
}); });
} }
catch (Exception) catch (Exception)
@@ -158,15 +146,29 @@ public partial class CheckListWorkPage : ContentPage
base.OnAppearing(); base.OnAppearing();
BindingContext = this; BindingContext = this;
await SetInfo(); await SetInfo();
TakePhoto = new Command<CheckListRowCS>(OnTakePhoto); CreatePhoto = new Command<CheckListRowDTO>(OnTakePhoto);
await LoadCheckPointCheckListRows(); await LoadCheckPointCheckListRows();
} }
private async Task<byte[]> ResizePicture(FileResult? photo, int newWidth) private async void OnTakePhoto(CheckListRowDTO checkListRowDTO)
{ {
try
{
if (MediaPicker.IsCaptureSupported)
{
await OnSave();
var photo = await MediaPicker.CapturePhotoAsync();
if (photo != null)
{
//using var stream = await photo.OpenReadAsync();
//using var ms = new MemoryStream();
//await stream.CopyToAsync(ms);
//byte[] photoBytes = ms.ToArray();
using var stream = await photo.OpenReadAsync(); using var stream = await photo.OpenReadAsync();
using var originalBitmap = SKBitmap.Decode(stream); using var originalBitmap = SKBitmap.Decode(stream);
int newWidth = 500;
int newHeight = (int)(originalBitmap.Height * ((double)newWidth / originalBitmap.Width)); int newHeight = (int)(originalBitmap.Height * ((double)newWidth / originalBitmap.Width));
using var surface = SKSurface.Create(new SKImageInfo(newWidth, newHeight)); using var surface = SKSurface.Create(new SKImageInfo(newWidth, newHeight));
@@ -179,30 +181,11 @@ public partial class CheckListWorkPage : ContentPage
using var resizedImage = surface.Snapshot(); using var resizedImage = surface.Snapshot();
using var data = resizedImage.Encode(SKEncodedImageFormat.Jpeg, 100); using var data = resizedImage.Encode(SKEncodedImageFormat.Jpeg, 100);
return data.ToArray(); checkListRowDTO.Photo = data.ToArray();
}
private async void OnTakePhoto(CheckListRowCS checkListRowCS)
{
try
{
if (MediaPicker.IsCaptureSupported)
{
//await OnSave(false);
var photo = await MediaPicker.CapturePhotoAsync();
if (photo != null)
{
checkListRowCS.PhotoBytes = await ResizePicture(photo, 500);
checkListRowCS.Answer = "Igen";
var checkListRowDTO = CheckListRowDTOs.FirstOrDefault(w => w.Id == checkListRowCS.Id);
if (checkListRowDTO != null)
{
checkListRowDTO.Photo = checkListRowCS.PhotoBytes;
checkListRowDTO.Answer = "Igen"; checkListRowDTO.Answer = "Igen";
await _checkListService.UpdateCheckListRow(checkListRowDTO, true); await _checkListService.UpdateCheckListRow(checkListRowDTO);
//await LoadCheckPointCheckListRows(); await LoadCheckPointCheckListRows();
}
} }
} }
else else
@@ -219,11 +202,9 @@ public partial class CheckListWorkPage : ContentPage
{ {
IsLoading = true; IsLoading = true;
CheckListRowCSs.Clear(); CheckListRows.Clear();
var checkListRowDTOs = await _checkListService.GetCheckListRowsByCheckPointCode(_currentUser.Id, _checkListHeaderId, _checkPointCode);
CheckListRowDTOs = await _checkListService.GetCheckListRowsByCheckPointCode(_currentUser.Id, _checkListHeaderId, _checkPointCode); foreach (var item in checkListRowDTOs)
foreach (var item in CheckListRowDTOs)
{ {
if (item.Answer == "Igen") if (item.Answer == "Igen")
{ {
@@ -235,34 +216,12 @@ public partial class CheckListWorkPage : ContentPage
item.AnswerYes = false; item.AnswerYes = false;
item.AnswerNo = true; item.AnswerNo = true;
} }
var checkListRowCS = new CheckListRowCS() CheckListRows.Add(item);
{
Answer = item.Answer,
AnswerNo = item.AnswerNo,
AnswerYes = item.AnswerYes,
GroupName = $"AnswerGroup_{item.CheckListTemplateRowDTO?.Id ?? 0}",
Id = item.Id,
RowIndex = item.CheckListTemplateRowDTO?.RowIndex ?? 0,
OperationDescription = item.CheckListTemplateRowDTO?.OperationDescription ?? "N/A",
AnswerType = item.CheckListTemplateRowDTO?.AnswerType ?? "I-N",
PhotoBytes = item.Photo ?? Array.Empty<byte>(),
};
CheckListRowCSs.Add(checkListRowCS);
} }
IsLoading = false; IsLoading = false;
} }
private void V_Entry_Text_Changed(object sender, TextChangedEventArgs e)
{
var entry = sender as Entry;
var model = entry?.BindingContext as CheckListRowCS;
if (model != null)
{
model.Answer = e.NewTextValue;
}
}
} }
public class BindableRadioButton : RadioButton public class BindableRadioButton : RadioButton
{ {
@@ -282,32 +241,20 @@ public class BindableRadioButton : RadioButton
radioButton.GroupName = newGroupName; radioButton.GroupName = newGroupName;
} }
} }
public BindableRadioButton()
{
CheckedChanged += OnCheckedChangedInternal;
} }
private void OnCheckedChangedInternal(object sender, CheckedChangedEventArgs e) public class ByteArrayToImageSourceConverter : IValueConverter
{ {
if (e.Value && BindingContext is CheckListRowCS checkListRowCS) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{ {
if (Value?.ToString() == "Igen") if (value is byte[] bytes && bytes.Length > 0)
checkListRowCS.Answer = "Igen"; {
else if (Value?.ToString() == "Nem") return ImageSource.FromStream(() => new MemoryStream(bytes));
checkListRowCS.Answer = "Nem";
} }
return null;
} }
protected override void OnBindingContextChanged() public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{ {
base.OnBindingContextChanged(); throw new NotImplementedException();
if (BindingContext is CheckListRowCS checkListRowCS)
{
if (Value?.ToString() == "Igen")
IsChecked = checkListRowCS.Answer == "Igen";
else if (Value?.ToString() == "Nem")
IsChecked = checkListRowCS.Answer == "Nem";
} }
} }
}
@@ -1,9 +1,10 @@
using Android.Content;
using CommunityToolkit.Maui.Alerts; using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core; using CommunityToolkit.Maui.Core;
using Plugin.Firebase.CloudMessaging;
using System.Drawing; using System.Drawing;
using WorkFlowCheck.MAUI.Helper; using WorkFlowCheck.MAUI.Helper;
using WorkFlowCheck.MAUI.Pages.NFC; using WorkFlowCheck.MAUI.Pages.NFC;
using WorkFlowCheck.MAUI.Platforms.Android.Services;
using WorkFlowCheck.MAUI.Services.Interfaces; using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.Security; namespace WorkFlowCheck.MAUI.Pages.Security;
@@ -15,7 +16,6 @@ public partial class LoginPage : BasePage
public LoginPage() public LoginPage()
{ {
InitializeComponent(); InitializeComponent();
SetContent(LoginContent); SetContent(LoginContent);
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>(); _userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>(); _syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
@@ -37,19 +37,11 @@ public partial class LoginPage : BasePage
_userService.SetCurrentUser(response.Data); _userService.SetCurrentUser(response.Data);
SystemHelper.SystemUserDTO = response.Data; SystemHelper.SystemUserDTO = response.Data;
var needFCM = false; #if ANDROID
foreach (var role in response.Data.RoleDTO) var intent = new Intent(Android.App.Application.Context, typeof(NotifyService));
{ Android.App.Application.Context.StartForegroundService(intent);
if (role.CanEnableBlocked) #endif
{
needFCM = true;
break;
}
}
if (needFCM)
{
await InitFirebase();
}
var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data); var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data);
await SecureStorage.Default.SetAsync("WFCUser", "wFCUser"); await SecureStorage.Default.SetAsync("WFCUser", "wFCUser");
@@ -180,23 +172,4 @@ public partial class LoginPage : BasePage
} }
} }
private async Task InitFirebase()
{
try
{
await CrossFirebaseCloudMessaging.Current.CheckIfValidAsync();
var token = await CrossFirebaseCloudMessaging.Current.GetTokenAsync();
await _syncService.UploadFCMToken(token);
}
catch (Exception ex)
{
await SystemHelper.ShowSnackBar("FCM üzenetküldõ inicializálása SIKERTELEN!",
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Yellow),
15);
}
}
} }
@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:popups="clr-namespace:WorkFlowCheck.MAUI.Pages.System"
x:Class="WorkFlowCheck.MAUI.Pages.System.InputPopup">
<toolkit:Popup.Resources>
<Style TargetType="{x:Type popups:InputPopup}">
<Setter Property="Size" Value="400,150" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="VerticalOptions" Value="Start" />
<Setter Property="CanBeDismissedByTappingOutsideOfPopup" Value="True" />
</Style>
</toolkit:Popup.Resources>
<VerticalStackLayout Padding="20" Spacing="10">
<Label x:Name="UserConfirmationLabel" />
<Entry x:Name="UserInputEntry" />
<HorizontalStackLayout HorizontalOptions="End" Spacing="10">
<Button Text="Mégsem" Clicked="OnCancelClicked" />
<Button Text="Megerősít" Clicked="OnOkClicked" />
</HorizontalStackLayout>
</VerticalStackLayout>
</toolkit:Popup>
@@ -1,42 +0,0 @@
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Views;
namespace WorkFlowCheck.MAUI.Pages.System;
public partial class InputPopup : Popup
{
private TaskCompletionSource<(bool IsConfirmed, string Result)> _taskCompletionSource;
public InputPopup(string userConfirmationLabel)
{
InitializeComponent();
_taskCompletionSource = new();
UserConfirmationLabel.Text = userConfirmationLabel;
this.Closed += OnPopupClosed;
}
public Task<(bool IsConfirmed, string Result)> ShowAsync()
{
Application.Current.MainPage.ShowPopup(this);
return _taskCompletionSource.Task;
}
private void OnOkClicked(object sender, EventArgs e)
{
Close((true, UserInputEntry.Text));
}
private void OnCancelClicked(object sender, EventArgs e)
{
Close((false, ""));
}
private void OnPopupClosed(object sender, PopupClosedEventArgs e)
{
if (e?.Result is ValueTuple<bool, string> value)
{
_taskCompletionSource.TrySetResult(value);
}
else
{
_taskCompletionSource.TrySetResult((false, null));
}
}
}
@@ -5,7 +5,6 @@
android:icon="@mipmap/appicon" android:icon="@mipmap/appicon"
android:supportsRtl="true" android:supportsRtl="true"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:networkSecurityConfig="@xml/network_security_config"
android:label="Workflow Check App"> android:label="Workflow Check App">
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
@@ -16,21 +15,11 @@
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" /> android:resource="@xml/file_paths" />
</provider> </provider>
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" <service android:name="WorkFlowCheck.MAUI.Platforms.Android.Services.NotifyService"
android:value="default" /> android:enabled="true"
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" />
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:exported="true" android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND"> android:foregroundServiceType="dataSync"
<intent-filter> android:process=":notiprocess"/>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
</application> </application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
@@ -39,8 +28,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-feature android:name="android.hardware.nfc" android:required="true" /> <uses-feature android:name="android.hardware.nfc" android:required="true" />
</manifest> </manifest>
@@ -1,11 +1,8 @@
using Android.App; using Android.App;
using Android.Content; using Android.Content;
using Android.Content.PM; using Android.Content.PM;
using Android.Media;
using Android.Nfc; using Android.Nfc;
using Android.OS; using Android.OS;
using Firebase;
using Plugin.Firebase.CloudMessaging;
using Plugin.NFC; using Plugin.NFC;
@@ -37,21 +34,18 @@ namespace WorkFlowCheck.MAUI
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
CrossNFC.Init(this); CrossNFC.Init(this);
Firebase.FirebaseApp.InitializeApp(this);
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
nfcAdapter = NfcAdapter.GetDefaultAdapter(this); nfcAdapter = NfcAdapter.GetDefaultAdapter(this);
pendingIntent = PendingIntent.GetActivity(this, 0, pendingIntent = PendingIntent.GetActivity(this, 0,
new Intent(this, typeof(MainActivity)).AddFlags(ActivityFlags.SingleTop), new Intent(this, typeof(MainActivity)).AddFlags(ActivityFlags.SingleTop),
Build.VERSION.SdkInt >= BuildVersionCodes.S ? PendingIntentFlags.Mutable : PendingIntentFlags.UpdateCurrent); Build.VERSION.SdkInt >= BuildVersionCodes.S ? PendingIntentFlags.Mutable : PendingIntentFlags.UpdateCurrent);
HandleIntent(Intent);
CreateNotificationChannelIfNeeded();
} }
protected override void OnNewIntent(Intent intent) protected override void OnNewIntent(Intent intent)
{ {
base.OnNewIntent(intent); base.OnNewIntent(intent);
HandleIntent(intent);
CrossNFC.OnNewIntent(intent); CrossNFC.OnNewIntent(intent);
if (intent.Action == NfcAdapter.ActionTagDiscovered) if (intent.Action == NfcAdapter.ActionTagDiscovered)
@@ -91,37 +85,5 @@ namespace WorkFlowCheck.MAUI
// nfcAdapter?.DisableForegroundDispatch(this); // nfcAdapter?.DisableForegroundDispatch(this);
//} //}
} }
private static void HandleIntent(Intent intent)
{
FirebaseCloudMessagingImplementation.OnNewIntent(intent);
}
private void CreateNotificationChannelIfNeeded()
{
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
{
CreateNotificationChannel();
}
}
private void CreateNotificationChannel()
{
var soundUri = Android.Net.Uri.Parse($"android.resource://{Android.App.Application.Context.PackageName}/raw/siren_alert");
var audioAttributes = new AudioAttributes.Builder()
.SetUsage(AudioUsageKind.Notification)
.SetContentType(AudioContentType.Sonification)
.Build();
var channelId = $"{PackageName}.general";
var channel = new NotificationChannel(channelId, "General", NotificationImportance.High);
channel.SetSound(soundUri, audioAttributes);
var notificationManager = (NotificationManager)GetSystemService(NotificationService);
notificationManager.CreateNotificationChannel(channel);
FirebaseCloudMessagingImplementation.ChannelId = channelId;
}
} }
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<string name="com.google.firebase.crashlytics.mapping_file_id">none</string>
</resources>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!--Set application-wide security config using base-config tag.-->
<base-config cleartextTrafficPermitted="true"/>
</network-security-config>
@@ -0,0 +1,124 @@
using Android.App;
using Android.Content;
using Android.OS;
using System.Threading;
using System.Threading.Tasks;
using WorkFlowCheck.MAUI.Helper;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Platforms.Android.Services
{
[Service]
public class NotifyService : Service
{
private CancellationTokenSource _cts;
private IUserService _userService;
private ISyncService _syncService;
public NotifyService()
{
}
public override IBinder OnBind(Intent intent) => null;
public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
{
CreateNotificationChannel();
var notification = new Notification.Builder(this, "polling_channel")
.SetContentTitle("Értesítés figyelés")
.SetContentText("A háttérfigyelés aktív")
.SetSmallIcon(Resource.Drawable.notification_icon)
.SetVisibility(NotificationVisibility.Public) // Lock screen-en is látszódjon
.SetPriority((int)NotificationPriority.High)
.Build();
StartForeground(1, notification);
_cts = new CancellationTokenSource();
var _syncService = ServiceHelper.Services.GetService(typeof(ISyncService)) as ISyncService;
var _userService = ServiceHelper.Services.GetService(typeof(IUserService)) as IUserService;
Task.Run(async () =>
{
await _syncService.SyncUsers_Down((progress, message) =>
{
});
}, _cts.Token);
var userDTO = _userService.GetCurrentUser();
if (userDTO != null && userDTO.Id > 0)
{
if (userDTO.RoleDTO?.Count > 0)
{
foreach (var roleDTO in userDTO.RoleDTO)
{
if (roleDTO.CanEnableBlocked)
{
Task.Run(async () =>
{
while (!_cts.Token.IsCancellationRequested)
{
var deviceMessageDTOList = await _syncService.DeviceMessageReadUnreaded(_userService.DeviceId.ToUpper());
if (deviceMessageDTOList != null && deviceMessageDTOList.Count > 0)
{
ShowNotification("Új esemény", deviceMessageDTOList[0].Message);
break;
}
deviceMessageDTOList = await _syncService.DeviceMessageReadUnreadedRole(roleDTO.Id);
if (deviceMessageDTOList != null && deviceMessageDTOList.Count > 0)
{
ShowNotification("Új esemény", deviceMessageDTOList[0].Message);
break;
}
await Task.Delay(5000);
}
}, _cts.Token);
}
}
}
}
return StartCommandResult.Sticky;
}
public override void OnDestroy()
{
_cts?.Cancel();
base.OnDestroy();
}
private void CreateNotificationChannel()
{
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
{
var channel = new NotificationChannel("polling_channel", "Polling Channel", NotificationImportance.High)
{
Description = "Foreground service polling channel",
LockscreenVisibility = NotificationVisibility.Public
};
var notificationManager = (NotificationManager)GetSystemService(NotificationService);
notificationManager.CreateNotificationChannel(channel);
}
}
private void ShowNotification(string title, string message)
{
var builder = new Notification.Builder(this, "polling_channel")
.SetContentTitle(title)
.SetContentText(message)
.SetSmallIcon(Resource.Drawable.notification_icon)
.SetAutoCancel(true)
.SetVisibility(NotificationVisibility.Public)
.SetPriority((int)NotificationPriority.High);
var notificationManager = (NotificationManager)GetSystemService(NotificationService);
notificationManager.Notify(new System.Random().Next(), builder.Build());
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

@@ -2,7 +2,6 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Diagnostics;
using System.Net.Http.Json; using System.Net.Http.Json;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using WorkFlowCheck.Common.DTO; using WorkFlowCheck.Common.DTO;
@@ -100,8 +99,7 @@ namespace WorkFlowCheck.MAUI.Services
.Include(i => i.CheckListTemplateHeader) .Include(i => i.CheckListTemplateHeader)
.Where(w => w.CheckStatus == CheckStatus.Open || .Where(w => w.CheckStatus == CheckStatus.Open ||
w.CheckStatus == CheckStatus.InProgress || w.CheckStatus == CheckStatus.InProgress ||
w.CheckStatus == CheckStatus.Blocked || w.CheckStatus == CheckStatus.Blocked)
w.CheckStatus == CheckStatus.Sent)
.ToListAsync(); .ToListAsync();
retVal = _mapper.Map<List<CheckListHeaderDTO>>(res); retVal = _mapper.Map<List<CheckListHeaderDTO>>(res);
} }
@@ -157,34 +155,24 @@ namespace WorkFlowCheck.MAUI.Services
return retVal; return retVal;
} }
public async Task<CheckListRowDTO> UpdateCheckListRow(CheckListRowDTO checkListRowDTO, bool withPhoto = true) public async Task<CheckListRowDTO> UpdateCheckListRow(CheckListRowDTO checkListRowDTO)
{ {
var retVal = checkListRowDTO; var retVal = checkListRowDTO;
try try
{ {
var checkListRow = await _dbContext.CheckListRows var checkListRow = await _dbContext.CheckListRows.Where(w => w.Id == checkListRowDTO.Id).FirstOrDefaultAsync();
//.AsNoTracking()
.Where(w => w.Id == checkListRowDTO.Id).FirstOrDefaultAsync();
if (checkListRow != null) if (checkListRow != null)
{
if (checkListRow.Answer != checkListRowDTO.Answer)
{ {
checkListRow.Answer = checkListRowDTO.Answer; checkListRow.Answer = checkListRowDTO.Answer;
} if (checkListRowDTO.Photo != null && checkListRowDTO.Photo.Length > 0)
if (checkListRowDTO.Photo != null && checkListRowDTO.Photo.Length > 0 && withPhoto)
{ {
if (!checkListRow.Photo.SequenceEqual(checkListRowDTO.Photo ?? Array.Empty<byte>())) checkListRow.Photo = checkListRowDTO.Photo;
{
checkListRow.Photo = checkListRowDTO.Photo ?? Array.Empty<byte>();
}
} }
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
} }
} }
catch (Exception ex) catch (Exception)
{ {
Debug.WriteLine(ex.Message);
} }
return retVal; return retVal;
} }
@@ -251,42 +239,6 @@ namespace WorkFlowCheck.MAUI.Services
} }
return retVal; return retVal;
} }
public async Task<bool> CloseCheckListHeader(CheckListHeaderCloseDTO checkListHeaderCloseDTO)
{
var retVal = false;
try
{
var checkListHeader = await _dbContext.CheckListHeaders
.Where(w => w.Id == checkListHeaderCloseDTO.Id)
.FirstOrDefaultAsync();
if (checkListHeader != null)
{
var userDTO = _userService.GetCurrentUser();
var endpoint = $"{_httpClient.BaseAddress}api/CheckList/CloseCheckListHeader";
using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, checkListHeaderCloseDTO))
{
httpResponseMessage.EnsureSuccessStatusCode();
var jsonString = await httpResponseMessage.Content.ReadAsStringAsync();
var response = JsonConvert.DeserializeObject<ApiResponseDTO<bool>>(jsonString);
if (response != null)
{
if (response.IsSuccess)
{
checkListHeader.CheckStatus = CheckStatus.Closed;
await _dbContext.SaveChangesAsync();
retVal = true;
}
}
}
}
}
catch (Exception ex)
{
retVal = false;
}
return retVal;
}
public async Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) public async Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO)
{ {
var retVal = false; var retVal = false;
@@ -328,8 +280,7 @@ namespace WorkFlowCheck.MAUI.Services
.Include(i => i.CheckListTemplateRow) .Include(i => i.CheckListTemplateRow)
.ThenInclude(i => i.CheckPoint) .ThenInclude(i => i.CheckPoint)
.Where(w => w.CheckListHeaderId == checkListHeaderDTO.Id .Where(w => w.CheckListHeaderId == checkListHeaderDTO.Id
&& string.IsNullOrEmpty(w.Answer.Trim()) && string.IsNullOrEmpty(w.Answer.Trim()))
&& w.CheckListTemplateRow.AnswerType != "PN")
.Select(w => w.CheckListTemplateRow.CheckPoint) .Select(w => w.CheckListTemplateRow.CheckPoint)
.OrderBy(cp => cp.ShortName) .OrderBy(cp => cp.ShortName)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
@@ -17,11 +17,10 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
Task<List<CheckListHeaderDTO>> GetCheckLists(int userId); Task<List<CheckListHeaderDTO>> GetCheckLists(int userId);
Task<List<CheckListTemplateHeaderDTO>> GetCheckListTemplates(int userId); Task<List<CheckListTemplateHeaderDTO>> GetCheckListTemplates(int userId);
Task<List<CheckListRowDTO>> GetCheckListRowsByCheckPointCode(int userId, int checkListHeaderId, string checkPointCode); Task<List<CheckListRowDTO>> GetCheckListRowsByCheckPointCode(int userId, int checkListHeaderId, string checkPointCode);
Task<CheckListRowDTO> UpdateCheckListRow(CheckListRowDTO checkListRowDTO, bool withPhoto = true); Task<CheckListRowDTO> UpdateCheckListRow(CheckListRowDTO checkListRowDTO);
Task<bool> UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); Task<bool> UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); Task<bool> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> CloseCheckListHeader(CheckListHeaderCloseDTO checkListHeaderCloseDTO);
Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
Task<CheckPointDTO> GetNextCheckpointNotSend(CheckListHeaderDTO checkListHeaderDTO); Task<CheckPointDTO> GetNextCheckpointNotSend(CheckListHeaderDTO checkListHeaderDTO);
} }
@@ -26,7 +26,5 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
Task<ApiResponseDTO<string>> SyncUsers_Up(Action<double, string> reportProgress); Task<ApiResponseDTO<string>> SyncUsers_Up(Action<double, string> reportProgress);
Task SyncUsers_Down(Action<double, string> reportProgress); Task SyncUsers_Down(Action<double, string> reportProgress);
Task<ApiResponseDTO<bool>> UploadFCMToken(string token);
} }
} }
+1 -36
View File
@@ -218,7 +218,7 @@ namespace WorkFlowCheck.MAUI.Services
{ {
if (responseList.IsSuccess) if (responseList.IsSuccess)
{ {
var entityList = await _dbContext.Equipments.ToListAsync(); var entityList = await _dbContext.Locations.ToListAsync();
var missingItems = responseList.Data.Where(f => !entityList.Any(s => s.Id == f.Id)).ToList(); var missingItems = responseList.Data.Where(f => !entityList.Any(s => s.Id == f.Id)).ToList();
var mappedMissingItems = _mapper.Map<List<Equipment>>(missingItems); var mappedMissingItems = _mapper.Map<List<Equipment>>(missingItems);
@@ -512,40 +512,5 @@ namespace WorkFlowCheck.MAUI.Services
} }
} }
public async Task<ApiResponseDTO<bool>> UploadFCMToken(string token)
{
var retVal = new ApiResponseDTO<bool>();
try
{
string endpoint = $"{_httpClient.BaseAddress}api/fcm/SendFCMToken";
var FCMMessageDTO = new FCMMessageDTO()
{
Token = token,
UserId = _userService.GetCurrentUser()?.Id
};
using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, FCMMessageDTO))
{
httpResponseMessage.EnsureSuccessStatusCode();
var jsonString = await httpResponseMessage.Content.ReadAsStringAsync();
var response = JsonConvert.DeserializeObject<ApiResponseDTO<bool>>(jsonString);
return response ?? new ApiResponseDTO<bool>
{
IsSuccess = false,
};
}
}
catch (Exception ex)
{
// Hiba visszaadása
return new ApiResponseDTO<bool>
{
IsSuccess = false
};
}
}
} }
} }
@@ -50,21 +50,6 @@ namespace WorkFlowCheck.MAUI.TemplateSelectors
_ => I_N_Template _ => I_N_Template
}; };
} }
if (item is CheckListRowCS model3)
{
return model3.AnswerType switch
{
"I-N" => I_N_Template,
"P" => P_Template,
"PN" => P_Template,
"V" => V_Template,
"SI-N" => SI_N_Template,
"I-SN" => I_SN_Template,
"PI-N" => PI_N_Template,
"I-PN" => I_PN_Template,
_ => I_N_Template
};
}
return null; return null;
} }
@@ -31,14 +31,12 @@
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>--> <!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>-->
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>--> <!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>-->
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">29.0</SupportedOSPlatformVersion>
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion> <!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion> <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>--> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>-->
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
<GoogleServicesJson Include="Platforms\Android\google-services.json" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<!-- App Icon --> <!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" /> <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
@@ -56,12 +54,6 @@
<!-- Raw Assets (also remove the "Resources\Raw" prefix) --> <!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /> <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Remove="Platforms\Android\Resources\values\strings.xml" />
</ItemGroup>
<ItemGroup>
<None Remove="Platforms\Android\Resources\xml\network_security_config.xml" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<AndroidResource Include="Platforms\Android\Resources\xml\file_paths.xml" /> <AndroidResource Include="Platforms\Android\Resources\xml\file_paths.xml" />
@@ -91,8 +83,6 @@
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" /> <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Plugin.Firebase.Auth" Version="3.1.1" />
<PackageReference Include="Plugin.Firebase.CloudMessaging" Version="3.1.2" />
<PackageReference Include="Serilog" Version="4.2.0" /> <PackageReference Include="Serilog" Version="4.2.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" /> <PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" /> <PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
@@ -133,9 +123,6 @@
<MauiXaml Update="Pages\BaseStock\Locations\LocationsPage.xaml"> <MauiXaml Update="Pages\BaseStock\Locations\LocationsPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Pages\CheckList\CheckListInfoPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\CheckList\CheckListPage.xaml"> <MauiXaml Update="Pages\CheckList\CheckListPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
@@ -160,9 +147,6 @@
<MauiXaml Update="Pages\System\DownloadAPKPage.xaml"> <MauiXaml Update="Pages\System\DownloadAPKPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Pages\System\InputPopup.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\System\SyncPage.xaml"> <MauiXaml Update="Pages\System\SyncPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
@@ -175,4 +159,10 @@
<Folder Include="Platforms\Android\Resources\mipmap-xxxhdpi\" /> <Folder Include="Platforms\Android\Resources\mipmap-xxxhdpi\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Update="Platforms\Android\Resources\drawable\notification_icon.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</AndroidResource>
</ItemGroup>
</Project> </Project>
+1 -1
View File
@@ -1,2 +1,2 @@
dotnet publish -f net8.0-android -c Release -p:AndroidPackageFormat=apk dotnet publish -f net8.0-android -c Release -p:AndroidPackageFormat=apk
pause pause
@@ -1,44 +0,0 @@
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace WorkFlowCheck.Web.Helpers
{
[HtmlTargetElement("input", Attributes = "asp-for-datatype")]
public class AspForDataTypeTagHelper : TagHelper
{
[HtmlAttributeName("asp-for-datatype")]
public ModelExpression For { get; set; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (For == null) return;
var type = For.ModelExplorer.ModelType;
string dataType = GetDataTypeString(type);
output.Attributes.SetAttribute("data-type", dataType);
// 🔥 EZ HIÁNYZIK → Rakd be!
output.Attributes.RemoveAll("asp-for-datatype");
}
private string GetDataTypeString(Type type)
{
// Nullable<T> esetén nyerjük ki az alaptípust
if (Nullable.GetUnderlyingType(type) is Type underlyingType)
{
type = underlyingType;
}
if (type == typeof(string)) return "string";
if (type == typeof(int) || type == typeof(long) || type == typeof(float) ||
type == typeof(double) || type == typeof(decimal)) return "number";
if (type == typeof(bool)) return "bool";
if (type == typeof(DateTime)) return "date";
return "string"; // default fallback
}
}
}
@@ -7,7 +7,7 @@ namespace WorkFlowCheck.Web.Helpers
public static class SystemHelper public static class SystemHelper
{ {
public static string DatabaseName = ""; public static string DatabaseName = "";
public static string ProgramVersion = "v1.1.032"; public static string ProgramVersion = "v1.1.019";
public async static Task GetAPIInfoAsync(IConfiguration configuration) public async static Task GetAPIInfoAsync(IConfiguration configuration)
{ {
@@ -21,15 +21,6 @@
<div class="card shadow p-4" style="min-width: 350px; max-width: 400px; width: 100%;"> <div class="card shadow p-4" style="min-width: 350px; max-width: 400px; width: 100%;">
<h2 class="mb-4 text-center">Jelszó módosítása</h2> <h2 class="mb-4 text-center">Jelszó módosítása</h2>
<!-- Loading overlay -->
<div id="formLoading" class="position-absolute top-0 start-0 w-100 h-100 d-none align-items-center justify-content-center"
style="background: rgba(255,255,255,.75); z-index: 10; border-radius: .375rem;">
<div class="text-center">
<div class="spinner-border" role="status" aria-hidden="true"></div>
<div class="mt-2 small text-muted">Kérlek várj…</div>
</div>
</div>
<div id="errorMessageContainer" class="alert alert-danger" style="display:none;"></div> <div id="errorMessageContainer" class="alert alert-danger" style="display:none;"></div>
<form method="post"> <form method="post">
@@ -64,7 +55,7 @@
</div> </div>
<hr class="mt-4 mb-3 border-secondary"> <hr class="mt-4 mb-3 border-secondary">
<div id="login2F1" class="d-grid"> <div id="login2F1" class="d-grid">
<button id="Login2F1Btn" type="button" class="btn btn-primary">Ellenőrzés</button> <button id="Login2F1Btn" type="button" class="btn btn-primary">Bejelentkezés</button>
</div> </div>
<div id="login2F2" class="d-grid"> <div id="login2F2" class="d-grid">
<button id="Login2F2Btn" type="button" class="btn btn-primary">Megerősítés</button> <button id="Login2F2Btn" type="button" class="btn btn-primary">Megerősítés</button>
@@ -97,30 +88,6 @@
<script src="https://cdn.jsdelivr.net/npm/jquery-validation-unobtrusive@4.0.0/dist/jquery.validate.unobtrusive.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-validation-unobtrusive@4.0.0/dist/jquery.validate.unobtrusive.min.js"></script>
<script> <script>
function setLoading(isLoading) {
if (isLoading) {
$('#formLoading').removeClass('d-none').addClass('d-flex');
$('#Login2F1Btn, #Login2F2Btn').prop('disabled', true);
// opcionális: inputok tiltása is
// $('#User2FADTO_UserName, #User2FADTO_Password, #User2FADTO_Code').prop('disabled', true);
} else {
$('#formLoading').addClass('d-none').removeClass('d-flex');
$('#Login2F1Btn, #Login2F2Btn').prop('disabled', false);
// $('#User2FADTO_UserName, #User2FADTO_Password, #User2FADTO_Code').prop('disabled', false);
}
}
let requestInFlight = false;
function beginRequest() {
if (requestInFlight) return false;
requestInFlight = true;
setLoading(true);
return true;
}
function endRequest() {
requestInFlight = false;
setLoading(false);
}
$(document).ready(function () { $(document).ready(function () {
$('#VerificationCode').hide(); $('#VerificationCode').hide();
$('#login2F2').hide(); $('#login2F2').hide();
@@ -130,8 +97,6 @@
$('#Login2F1Btn').on('click', function () { $('#Login2F1Btn').on('click', function () {
// $('#Login2F1Btn, #Login2F2Btn').prop('disabled', true); // $('#Login2F1Btn, #Login2F2Btn').prop('disabled', true);
if (!beginRequest()) return;
$('#errorMessageContainer').hide().text(''); $('#errorMessageContainer').hide().text('');
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
const userName = $('#UserChangePassword2FADTO_UserName').val(); const userName = $('#UserChangePassword2FADTO_UserName').val();
@@ -171,9 +136,6 @@
// .prop('disabled', false) // .prop('disabled', false)
// .removeAttr('disabled') // .removeAttr('disabled')
// .removeClass('disabled'); // .removeClass('disabled');
},
complete: function () {
endRequest();
} }
}); });
@@ -181,7 +143,6 @@
$('#Login2F2Btn').on('click', function () { $('#Login2F2Btn').on('click', function () {
// $('#Login2F1Btn, #Login2F2Btn').prop('disabled', true); // $('#Login2F1Btn, #Login2F2Btn').prop('disabled', true);
if (!beginRequest()) return;
$('#errorMessageContainer').hide().text(''); $('#errorMessageContainer').hide().text('');
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
@@ -233,9 +194,6 @@
// .prop('disabled', false) // .prop('disabled', false)
// .removeAttr('disabled') // .removeAttr('disabled')
// .removeClass('disabled'); // .removeClass('disabled');
},
complete: function () {
endRequest();
} }
}); });
}); });
@@ -8,6 +8,9 @@
Layout = null; Layout = null;
ViewData["Title"] = "Bejelentkezés"; ViewData["Title"] = "Bejelentkezés";
} }
<!DOCTYPE html> <!DOCTYPE html>
<html lang="hu"> <html lang="hu">
<head> <head>
@@ -22,15 +25,6 @@
<div class="card shadow p-4" style="min-width: 350px; max-width: 400px; width: 100%;"> <div class="card shadow p-4" style="min-width: 350px; max-width: 400px; width: 100%;">
<h2 class="mb-4 text-center">Bejelentkezés</h2> <h2 class="mb-4 text-center">Bejelentkezés</h2>
<!-- Loading overlay -->
<div id="formLoading" class="position-absolute top-0 start-0 w-100 h-100 d-none align-items-center justify-content-center"
style="background: rgba(255,255,255,.75); z-index: 10; border-radius: .375rem;">
<div class="text-center">
<div class="spinner-border" role="status" aria-hidden="true"></div>
<div class="mt-2 small text-muted">Kérlek várj…</div>
</div>
</div>
<div id="errorMessageContainer" class="alert alert-danger" style="display:none;"></div> <div id="errorMessageContainer" class="alert alert-danger" style="display:none;"></div>
<form method="post"> <form method="post">
@@ -74,41 +68,13 @@
<script src="https://cdn.jsdelivr.net/npm/jquery-validation-unobtrusive@4.0.0/dist/jquery.validate.unobtrusive.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-validation-unobtrusive@4.0.0/dist/jquery.validate.unobtrusive.min.js"></script>
<script> <script>
function setLoading(isLoading) {
if (isLoading) {
$('#formLoading').removeClass('d-none').addClass('d-flex');
$('#Login2F1Btn, #Login2F2Btn').prop('disabled', true);
// opcionális: inputok tiltása is
// $('#User2FADTO_UserName, #User2FADTO_Password, #User2FADTO_Code').prop('disabled', true);
} else {
$('#formLoading').addClass('d-none').removeClass('d-flex');
$('#Login2F1Btn, #Login2F2Btn').prop('disabled', false);
// $('#User2FADTO_UserName, #User2FADTO_Password, #User2FADTO_Code').prop('disabled', false);
}
}
let requestInFlight = false;
function beginRequest() {
if (requestInFlight) return false;
requestInFlight = true;
setLoading(true);
return true;
}
function endRequest() {
requestInFlight = false;
setLoading(false);
}
$(document).ready(function () { $(document).ready(function () {
$('#VerificationCode').hide(); $('#VerificationCode').hide();
$('#login2F2').hide(); $('#login2F2').hide();
$('#Login2F2Btn').hide(); $('#Login2F2Btn').hide();
$('#Login2F1Btn').on('click', function () { $('#Login2F1Btn').on('click', function () {
// $('#Login2F1Btn, #Login2F2Btn').prop('disabled', true); // $('#Login2F1Btn, #Login2F2Btn').prop('disabled', true);
if (!beginRequest()) return;
$('#errorMessageContainer').hide().text(''); $('#errorMessageContainer').hide().text('');
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
const userName = $('#User2FADTO_UserName').val(); const userName = $('#User2FADTO_UserName').val();
@@ -148,9 +114,6 @@
// .prop('disabled', false) // .prop('disabled', false)
// .removeAttr('disabled') // .removeAttr('disabled')
// .removeClass('disabled'); // .removeClass('disabled');
},
complete: function () {
endRequest();
} }
}); });
@@ -158,7 +121,6 @@
$('#Login2F2Btn').on('click', function () { $('#Login2F2Btn').on('click', function () {
// $('#Login2F1Btn, #Login2F2Btn').prop('disabled', true); // $('#Login2F1Btn, #Login2F2Btn').prop('disabled', true);
if (!beginRequest()) return;
$('#errorMessageContainer').hide().text(''); $('#errorMessageContainer').hide().text('');
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
@@ -185,7 +147,6 @@
if (result.success) { if (result.success) {
window.location.href = `/Index`; window.location.href = `/Index`;
} else { } else {
console.log(result);
$('#errorMessageContainer').text('Hibás felhasználónév vagy jelszó!').show(); $('#errorMessageContainer').text('Hibás felhasználónév vagy jelszó!').show();
// $('#Login2F1Btn, #Login2F2Btn') // $('#Login2F1Btn, #Login2F2Btn')
// .prop('disabled', false) // .prop('disabled', false)
@@ -201,9 +162,6 @@
// .prop('disabled', false) // .prop('disabled', false)
// .removeAttr('disabled') // .removeAttr('disabled')
// .removeClass('disabled'); // .removeClass('disabled');
},
complete: function () {
endRequest();
} }
}); });
}); });
@@ -55,8 +55,8 @@ namespace WorkFlowCheck.Web.Pages.Account
Response.Cookies.Append("AuthToken", token, new CookieOptions Response.Cookies.Append("AuthToken", token, new CookieOptions
{ {
HttpOnly = true, HttpOnly = true,
Secure = HttpContext.Request.IsHttps, Secure = true,
SameSite = SameSiteMode.Lax, SameSite = SameSiteMode.Strict,
Expires = DateTimeOffset.UtcNow.AddDays(1) Expires = DateTimeOffset.UtcNow.AddDays(1)
}); });
@@ -104,7 +104,7 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
$('#tbCheckPointsEditPage').on('click', '.edit-btn', function () $('#tbCheckPointsEditPage').on('click', '.edit-btn', function ()
@@ -80,7 +80,7 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
$('#newCheckPointBtn').on('click', function () $('#newCheckPointBtn').on('click', function ()
@@ -62,7 +62,7 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
$('#newEquipmentBtn').on('click', function () $('#newEquipmentBtn').on('click', function ()
@@ -79,7 +79,7 @@
$('#tbEquipmentsPage').on('click', '.delete-btn', function () $('#tbEquipmentsPage').on('click', '.delete-btn', function ()
{ {
const row = table.row($(this).closest('tr')).data(); const row = table.row($(this).closest('tr')).data();
deleteEntity(table, '/BaseStock/Equipments/EquipmentsPage?handler=DeleteEquipment', row.id); deleteEntity(table, '/BaseStock/Equipments/EquipmentPage?handler=DeleteEquipment', row.id);
}); });
</script> </script>
} }
@@ -68,7 +68,7 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
$('#tbImageFilesPage').on('click', '.download-btn', function () $('#tbImageFilesPage').on('click', '.download-btn', function ()
@@ -17,14 +17,14 @@
<thead class="table-primary"> <thead class="table-primary">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(LocationDTO.FullName), typeof(LocationDTO))</th> <th>Full name</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tfoot class="table-light"> <tfoot class="table-light">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(LocationDTO.FullName), typeof(LocationDTO))</th> <th>Full name</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</tfoot> </tfoot>
@@ -59,7 +59,7 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
$('#newLocationBtn').on('click', function () $('#newLocationBtn').on('click', function ()
@@ -68,7 +68,7 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
$('#tbAuditFilesPage').on('click', '.download-btn', function () $('#tbAuditFilesPage').on('click', '.download-btn', function ()
@@ -68,7 +68,7 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
$('#tbBusinessFilesPage').on('click', '.download-btn', function () $('#tbBusinessFilesPage').on('click', '.download-btn', function ()
@@ -68,7 +68,7 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
$('#tbPDFFilesPage').on('click', '.download-btn', function () $('#tbPDFFilesPage').on('click', '.download-btn', function ()
@@ -33,14 +33,7 @@
<div class="tab-pane fade show active" id="general" role="tabpanel"> <div class="tab-pane fade show active" id="general" role="tabpanel">
<form method="post" id="CheckListHeaderForm"> <form method="post" id="CheckListHeaderForm">
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" /> <meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
<input type="hidden" asp-for="CheckListHeaderDTO.Id" data-type="int" /> <input type="hidden" asp-for="CheckListHeaderDTO.Id" />
<input type="hidden" asp-for="CheckListHeaderDTO.IsEditable" data-type="bool" />
<input type="hidden" asp-for="CheckListHeaderDTO.IsStorno" data-type="bool" />
<input type="hidden" asp-for="CheckListHeaderDTO.GuidNumber" />
<input type="hidden" asp-for="CheckListHeaderDTO.CheckListTemplateHeaderId" data-type="int" />
<input type="hidden" asp-for="CheckListHeaderDTO.UserId" data-type="int" />
<input type="hidden" name="CheckListHeaderDTO.DateExecution" value="@Model.CheckListHeaderDTO.DateExecution.ToString("yyyy-MM-dd")" />
<input type="hidden" asp-for="CheckListHeaderDTO.AcceptUserId" data-type="int" />
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
<label asp-for="CheckListHeaderDTO.DocumentNumber"></label> <label asp-for="CheckListHeaderDTO.DocumentNumber"></label>
@@ -49,7 +42,7 @@
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label asp-for="CheckListHeaderDTO.CheckStatus"></label> <label asp-for="CheckListHeaderDTO.CheckStatus"></label>
<select asp-for="CheckListHeaderDTO.CheckStatus" class="form-control" asp-items="Model.CheckStatus" readonly data-type="int"></select> <select asp-for="CheckListHeaderDTO.CheckStatus" class="form-control" asp-items="Model.CheckStatus" readonly></select>
<span asp-validation-for="CheckListHeaderDTO.CheckStatus" class="text-danger"></span> <span asp-validation-for="CheckListHeaderDTO.CheckStatus" class="text-danger"></span>
</div> </div>
</div> </div>
@@ -173,7 +166,7 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
@@ -209,7 +202,7 @@
var formData = getFormAsNestedObject('#CheckListHeaderForm'); var formData = getFormAsNestedObject('#CheckListHeaderForm');
const $form = $('#CheckListHeaderForm'); const $form = $('#CheckListHeaderForm');
formData.CheckListHeaderDTO.CheckListRowDTO=[]; formData.CheckListHeader.RoleDTO=[];
if ($form.valid()) if ($form.valid())
{ {
@@ -220,24 +213,13 @@
'X-CSRF-TOKEN': csrfToken, 'X-CSRF-TOKEN': csrfToken,
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
data: JSON.stringify(formData.CheckListHeaderDTO), data: JSON.stringify(formData.CheckListHeader),
success: function (response) { success: function (response) {
if (response.success)
{
showMessageModal({ showMessageModal({
title: 'Figyelmem!', title: 'Figyelmem!',
message: 'Sikeres mentés.', message: 'Sikeres mentés.',
okText: 'Értettem' okText: 'Értettem'
}); });
}
else
{
showMessageModal({
title: 'Figyelmem, HIBA!',
message: 'Sikertelen mentés.',
okText: 'Értettem'
});
}
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
// Hiba esetén // Hiba esetén
@@ -1,7 +1,6 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Rendering;
using Serilog;
using System.Globalization; using System.Globalization;
using WorkFlowCheck.Common.DTO; using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Web.Services.Interfaces; using WorkFlowCheck.Web.Services.Interfaces;
@@ -33,27 +32,6 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
CheckStatus = _checkListService.GetCheckStatus(); CheckStatus = _checkListService.GetCheckStatus();
BuildCheckListHeaderInfo(); BuildCheckListHeaderInfo();
} }
public async Task<IActionResult> OnPostSave([FromBody] CheckListHeaderDTO checkListHeaderDTO)
{
try
{
var result = await _checkListService.UpdateCheckListHeader(checkListHeaderDTO);
if (result.IsSuccess)
{
return new JsonResult(new { success = true });
}
else
{
return new JsonResult(new { success = false });
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return new JsonResult(new { success = false });
}
private void BuildCheckListHeaderInfo() private void BuildCheckListHeaderInfo()
{ {
CheckListHeaderInfoDTO = new CheckListHeaderInfoDTO(); CheckListHeaderInfoDTO = new CheckListHeaderInfoDTO();
@@ -74,7 +52,7 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
CheckListHeaderInfoDTO.EmptyAnswerCount = result.EmptyAnswerCount; CheckListHeaderInfoDTO.EmptyAnswerCount = result.EmptyAnswerCount;
if (CheckListHeaderInfoDTO.TotalRowCount > 0) if (CheckListHeaderInfoDTO.TotalRowCount > 0)
{ {
CheckListHeaderInfoDTO.ReadyPercent = ((double)(CheckListHeaderInfoDTO.TotalRowCount - CheckListHeaderInfoDTO.EmptyAnswerCount) / CheckListHeaderInfoDTO.TotalRowCount * 100) CheckListHeaderInfoDTO.ReadyPercent = ((CheckListHeaderInfoDTO.TotalRowCount - CheckListHeaderInfoDTO.EmptyAnswerCount) / CheckListHeaderInfoDTO.TotalRowCount * 100)
.ToString("0.00", new CultureInfo("hu-HU")) + " %"; ; .ToString("0.00", new CultureInfo("hu-HU")) + " %"; ;
} }
} }
@@ -86,7 +64,7 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
{ {
foreach (var item in CheckListHeaderDTO.CheckListRowDTO) foreach (var item in CheckListHeaderDTO.CheckListRowDTO)
{ {
if (item.CheckListTemplateRowDTO?.AnswerType == "P" || item.CheckListTemplateRowDTO?.AnswerType == "PN") if (item.CheckListTemplateRowDTO?.AnswerType == "P")
{ {
if (item.Photo != null && item.Photo.Length > 0) if (item.Photo != null && item.Photo.Length > 0)
{ {
@@ -5,14 +5,7 @@
@using Microsoft.AspNetCore.Antiforgery @using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery @inject IAntiforgery Antiforgery
@{ @{
ViewData["Title"] = Model.Mode switch ViewData["Title"] = "Ellenőrzések";
{
0 => "Ellenőrzések (folyamatban)",
1 => "Ellenőrzések (beküldött)",
2 => "Ellenőrzések (lezárt)",
3 => "Ellenőrzések (jóváhagyott)",
_ => "Ellenőrzések (összes)"
};
} }
<h1>@ViewData["Title"]</h1> <h1>@ViewData["Title"]</h1>
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" /> <meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
@@ -56,16 +49,10 @@
@section Scripts { @section Scripts {
<script> <script>
let currentMode = @Model.Mode;
const table = new DataTable('#tbCheckListHeadersPage', { const table = new DataTable('#tbCheckListHeadersPage', {
ordering: true,
order: [],
ajax: { ajax: {
url: "@Url.Page("./CheckListHeaderPage", "LoadCheckListHeaders")", url: "@Url.Page("./CheckListHeaderPage", "LoadCheckListHeaders")",
type: "GET", type: "GET",
data: function (d) {
d.mode = currentMode;
},
dataSrc : "data" dataSrc : "data"
}, },
columns: [ columns: [
@@ -117,7 +104,7 @@
], ],
processing: true, processing: true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
$('#newCheckListHeaderBtn').on('click', function () $('#newCheckListHeaderBtn').on('click', function ()
@@ -13,7 +13,7 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
{ {
private readonly ILogger<IndexModel> _logger; private readonly ILogger<IndexModel> _logger;
private readonly ICheckListService _checkListService; private readonly ICheckListService _checkListService;
public int Mode { get; private set; }
public List<SelectListItem> CheckStatus { get; set; } public List<SelectListItem> CheckStatus { get; set; }
public CheckListHeaderPageModel(ILogger<IndexModel> logger, ICheckListService checkListService) public CheckListHeaderPageModel(ILogger<IndexModel> logger, ICheckListService checkListService)
@@ -21,16 +21,15 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
_logger = logger; _logger = logger;
_checkListService = checkListService; _checkListService = checkListService;
} }
public async Task OnGet(int mode = 0) public async Task OnGet()
{ {
Mode = mode;
CheckStatus = _checkListService.GetCheckStatus(); CheckStatus = _checkListService.GetCheckStatus();
} }
public async Task<JsonResult> OnGetLoadCheckListHeaders(int mode = 0) public async Task<JsonResult> OnGetLoadCheckListHeaders()
{ {
var results = await _checkListService.GetAllCheckListHeaderAsync(mode); var results = await _checkListService.GetAllCheckListHeaderAsync();
return new JsonResult(new { data = results }); return new JsonResult(new { data = results });
} }
@@ -116,7 +116,7 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
@@ -47,7 +47,7 @@
{ data: "shortName" }, { data: "shortName" },
{ data: "description" }, { data: "description" },
{ data: null, render: function (data, type, row) { { data: null, render: function (data, type, row) {
return renderActionButtonsforCheckListTemplateHeader(row.id); return renderActionButtons(row.id);
}} }}
], ],
columnDefs: [ columnDefs: [
@@ -63,64 +63,21 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
$('#newCheckListTemplateHeaderBtn').on('click', function () $('#newCheckListTemplateHeaderBtn').on('click', function ()
{ {
console.log('New button clicked!"');
window.location.href = `@Url.Page("./CheckListTemplateHeaderEditPage")?id=0`; window.location.href = `@Url.Page("./CheckListTemplateHeaderEditPage")?id=0`;
}); });
$('#tbCheckListTemplateHeadersPage').on('click', '.edit-btn', function () $('#tbCheckListTemplateHeadersPage').on('click', '.edit-btn', function ()
{ {
const row = table.row($(this).closest('tr')).data(); const row = table.row($(this).closest('tr')).data();
window.location.href = `@Url.Page("./CheckListTemplateHeaderEditPage")?id=${row.id}`; window.location.href = `@Url.Page("./CheckListTemplateHeaderEditPage")?id=${row.id}`;
}); });
$('#tbCheckListTemplateHeadersPage').on('click', '.clone-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
const url = './CheckListTemplateHeaderPage?handler=CloneCheckListTemplateHeader';
showConfirmModal({
title: 'Klónozás megerősítése',
message: 'Biztosan klónozni szeretnéd ezt az elemet?',
okText: 'Klónozás',
cancelText: 'Mégsem'
}).then(function (result) {
if (result === 'ok') {
$.ajax({
url: url,
type: 'GET',
data: { id: row.id },
success: function (data) {
if (data) {
showMessageModal({
title: 'Információ',
message: 'A klónozás sikerült!',
okText: 'Értettem'
});
table.ajax.reload();
} else {
showMessageModal({
title: 'Hiba!',
message: 'A klónozás NEM sikerült!',
okText: 'Értettem'
});
}
},
error: function (xhr, status, error) {
showMessageModal({
title: 'Hiba!',
message: 'A klónozás NEM sikerült!',
okText: 'Értettem'
});
}
});
}
});
});
$('#tbCheckListTemplateHeadersPage').on('click', '.delete-btn', function () $('#tbCheckListTemplateHeadersPage').on('click', '.delete-btn', function ()
{ {
const row = table.row($(this).closest('tr')).data(); const row = table.row($(this).closest('tr')).data();
@@ -27,10 +27,5 @@ namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader
var isSuccess = await _checkListService.DeleteCheckListTemplateHeader(id); var isSuccess = await _checkListService.DeleteCheckListTemplateHeader(id);
return new JsonResult(new { result = isSuccess }); return new JsonResult(new { result = isSuccess });
} }
public async Task<JsonResult> OnGetCloneCheckListTemplateHeader(int id)
{
var isSuccess = await _checkListService.CloneCheckListTemplateHeader(id);
return new JsonResult(new { result = isSuccess });
}
} }
} }
+2 -26
View File
@@ -1,32 +1,8 @@
@page @page
@model PrivacyModel @model PrivacyModel
@{ @{
ViewData["Title"] = "Adatvédelmi tájékoztató"; ViewData["Title"] = "Privacy Policy";
} }
<h1>@ViewData["Title"]</h1> <h1>@ViewData["Title"]</h1>
<p>Ez az adatvédelmi tájékoztató bemutatja, hogy az oldal hogyan kezeli a felhasználók személyes adatait.</p> <p>Use this page to detail your site's privacy policy.</p>
<h2>Gyűjtött adatok</h2>
<ul>
<li>Felhasználó neve</li>
<li>Felhasználó e-mail címe</li>
<li>Bejelentkezési azonosító (JWT token a böngésző cookie-jában tárolva)</li>
</ul>
<h2>Adatok felhasználása</h2>
<p>Az adatokat kizárólag a felhasználói fiók azonosítására és a szolgáltatás használatának biztosítására használjuk fel. Az e-mail címet például a fiók kezelésére, valamint a bejelentkezéshez és az azonosításhoz használjuk.</p>
<h2>Adatok megőrzése</h2>
<p>A személyes adatokat a fiók fennállásáig, illetve a törlési kérelem beérkezéséig tároljuk. A JWT token a cookie-ban tárolódik, és annak érvényességi ideje alatt használatos.</p>
<h2>Adatok továbbítása</h2>
<p>Az adatokat harmadik fél számára nem adjuk át, kivéve jogszabályi kötelezettség esetén.</p>
<h2>Cookie-k</h2>
<p>Oldalunk cookie-kat használ a bejelentkezési állapot megőrzése érdekében (JWT token). Ezek szükségesek a szolgáltatás megfelelő működéséhez. A cookie a böngésző bezárása után vagy a lejárati idő eltelte után automatikusan érvénytelenné válik.</p>
<h2>Felhasználói jogok</h2>
<p>A felhasználóknak joguk van tájékoztatást kérni a kezelt adataikról, kérhetik azok helyesbítését vagy törlését, valamint tiltakozhatnak az adatkezelés ellen a jogszabályi keretek között.</p>
<p>Amennyiben kérdése van az adatkezeléssel kapcsolatban, kérjük, vegye fel velünk a kapcsolatot.</p>
@@ -49,26 +49,7 @@
Ellenőrzési adatok Ellenőrzési adatok
</a> </a>
<ul class="dropdown-menu" aria-labelledby="checkListDropdown"> <ul class="dropdown-menu" aria-labelledby="checkListDropdown">
<li> <li><a class="dropdown-item" asp-area="" asp-page="/CheckList/CheckListHeader/CheckListHeaderPage">Ellenőrzések</a></li>
<a class="dropdown-item" asp-area="" asp-page="/CheckList/CheckListHeader/CheckListHeaderPage"
asp-route-mode="0">Ellenőrzések (folyamatban)</a>
</li>
<li>
<a class="dropdown-item" asp-area="" asp-page="/CheckList/CheckListHeader/CheckListHeaderPage"
asp-route-mode="1">Ellenőrzések (beküldött)</a>
</li>
<li>
<a class="dropdown-item" asp-area="" asp-page="/CheckList/CheckListHeader/CheckListHeaderPage"
asp-route-mode="3">Ellenőrzések (jóváhagyott)</a>
</li>
<li>
<a class="dropdown-item" asp-area="" asp-page="/CheckList/CheckListHeader/CheckListHeaderPage"
asp-route-mode="2">Ellenőrzések (lezárt)</a>
</li>
<li>
<a class="dropdown-item" asp-area="" asp-page="/CheckList/CheckListHeader/CheckListHeaderPage"
asp-route-mode="4">Ellenőrzések (összes)</a>
</li>
<li><hr class="dropdown-divider"></li> <!-- EZ AZ ELVÁLASZTÓ VONAL --> <li><hr class="dropdown-divider"></li> <!-- EZ AZ ELVÁLASZTÓ VONAL -->
<li><a class="dropdown-item" asp-area="" asp-page="/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderPage">Ellenőrzési sablonok</a></li> <li><a class="dropdown-item" asp-area="" asp-page="/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderPage">Ellenőrzési sablonok</a></li>
</ul> </ul>
@@ -86,7 +67,9 @@
<li><a class="dropdown-item" asp-area="" asp-page="/UserAndRole/RoleCheckPointsPage">Szabályok - Ellenőrzési pontok</a></li> <li><a class="dropdown-item" asp-area="" asp-page="/UserAndRole/RoleCheckPointsPage">Szabályok - Ellenőrzési pontok</a></li>
</ul> </ul>
</li> </li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
</li>
</ul> </ul>
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item dropdown"> <li class="nav-item dropdown">
@@ -104,10 +87,6 @@
Jelszó módosítása Jelszó módosítása
</a> </a>
</li> </li>
<li><hr class="dropdown-divider"></li> <!-- EZ AZ ELVÁLASZTÓ VONAL -->
<li class="dropdown-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Adatvédelmi tájékoztatás</a>
</li>
</ul> </ul>
</li> </li>
@@ -203,7 +182,7 @@
<footer class="border-top footer text-muted"> <footer class="border-top footer text-muted">
<div class="container"> <div class="container">
&copy; @(DateTime.Now.Year) - Workflow Check App - Version @(SystemHelper.ProgramVersion) (@(SystemHelper.DatabaseName))<a asp-area="" asp-page="/Privacy"> Adatvédelmi tájékoztatás</a> &copy; @(DateTime.Now.Year) - Workflow Check App - Version @(SystemHelper.ProgramVersion) (@(SystemHelper.DatabaseName))<a asp-area="" asp-page="/Privacy">Privacy</a>
</div> </div>
</footer> </footer>
@@ -3,7 +3,7 @@
@using Microsoft.AspNetCore.Antiforgery @using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery @inject IAntiforgery Antiforgery
@{ @{
ViewData["Title"] = "Szabály - ellenőrzési sablon"; ViewData["Title"] = "Ellenőrzési pont";
var RoleCheckListTemplateHeaderId = Model.RoleCheckListTemplateHeaderDTO.Id; var RoleCheckListTemplateHeaderId = Model.RoleCheckListTemplateHeaderDTO.Id;
var urlPost = Url.Page("./RoleCheckListTemplateHeaderEditPage", "Save"); var urlPost = Url.Page("./RoleCheckListTemplateHeaderEditPage", "Save");
} }
@@ -15,18 +15,18 @@
<thead class="table-primary"> <thead class="table-primary">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Szabály neve</th> <th>Role name</th>
<th>Ellenőrzési sablon neve</th> <th>Template name</th>
<th>Engedélyezve?</th> <th>Enabled</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tfoot class="table-light"> <tfoot class="table-light">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Szabály neve</th> <th>Role name</th>
<th>Ellenőrzési sablon neve</th> <th>Template name</th>
<th>Engedélyezve?</th> <th>Enabled</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</tfoot> </tfoot>
@@ -72,7 +72,7 @@
], ],
processing:true, processing:true,
language: { url: '/lib/datatables/datatables.hu.json',} language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
}); });
$('#newRoleCheckListTemplateHeadersBtn').on('click', function () $('#newRoleCheckListTemplateHeadersBtn').on('click', function ()
@@ -90,7 +90,17 @@
$('#tbRoleCheckListTemplateHeadersPage').on('click', '.delete-btn', function () $('#tbRoleCheckListTemplateHeadersPage').on('click', '.delete-btn', function ()
{ {
const row = table.row($(this).closest('tr')).data(); const row = table.row($(this).closest('tr')).data();
deleteEntity(table, '/UserAndRole/RoleCheckListTemplateHeadersPage?handler=DeleteRoleCheckListTemplateHeader', row.id); 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> </script>
} }
@@ -21,10 +21,5 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
var results = await _userService.GetAllRoleCheckListTemplates(); var results = await _userService.GetAllRoleCheckListTemplates();
return new JsonResult(new { data = results }); return new JsonResult(new { data = results });
} }
public async Task<JsonResult> OnGetDeleteRoleCheckListTemplateHeader(int id)
{
var isSuccess = await _userService.DeleteRoleCheckListTemplateHeader(id);
return new JsonResult(new { result = isSuccess });
}
} }
} }

Some files were not shown because too many files have changed in this diff Show More