63 Commits
Author SHA1 Message Date
ivanszabo 289992ce5e Arculat javítása 2026-09-12 22:19:24 +02:00
ivanszabo 02ba8d4fe5 INIT GITEA 2026-09-12 18:19:29 +02:00
ivanszabo b2faeb2986 Arculat hozzáadása 2026-09-12 12:38:39 +02:00
ivanszabo 717becd1fc ServerSide Paging 2026-08-02 16:36:21 +02:00
ivanszabo 92acb42601 Na most jó a lapozás 2026-03-09 11:32:12 +01:00
ivanszabo 53dc9b326a Ez most szerver oldalon szűr és lapoz 2026-03-02 14:12:43 +01:00
ivanszabo ea9673c29b Login secure problem 2026-01-28 13:46:16 +01:00
ivanszabo 4c7e24c478 1.1.32 kiadás 2026-01-28 12:48:21 +01:00
ivanszabo c11ff65a3e Ellenőrzések szétválasztása + sorrend 2026-01-28 12:47:43 +01:00
ivanszabo 8c0796eb69 satatables hu language pack lokálisan 2026-01-28 11:54:11 +01:00
ivanszabo 10ad411b5e appsettings beállítása fejlesztéshez 2026-01-28 11:53:52 +01:00
ivanszabo 8d766ab988 publish cmd 2026-01-28 11:18:26 +01:00
ivanszabo 8177a60351 - 2026-01-21 13:01:06 +01:00
ivanszabo 0fd073755e Password első felhasználó rögzítésénél hiba 2026-01-21 12:59:56 +01:00
ivanszabo 6ea799dcdf WS2016DC\\SQLEXPRESS javítása 2026-01-21 10:22:33 +01:00
ivanszabo caf9746443 API pulish.cmd kiegészítése 2026-01-21 09:35:09 +01:00
ivanszabo 41542e492d E-mail küldése 10 próbálkozásra, 2 mp-es várakozással 2026-01-21 09:19:22 +01:00
ivanszabo 4f4ca5cec4 Login és ChangePassword formok változtatása spinner kiegészítés 2026-01-20 10:10:52 +01:00
ivanszabo f480269bc5 Maximumart gépre átállás VS 2026 2026-01-20 10:09:59 +01:00
ivanszabo 24c49567aa BUGFIX valu mentésére 2025-07-07 14:57:40 +02:00
ivanszabo affad21ab0 BUGFIX mentés, scrollozás 2025-07-03 08:55:09 +02:00
ivanszabo a646258837 Elvileg jó, meg a mentés is. 2025-07-02 19:38:33 +02:00
ivanszabo 7f3562fb73 MemoryStreamos a fotó ... 2025-07-02 18:30:10 +02:00
ivanszabo bc977af15c Alap BUGFIX javításhoz 2025-07-02 13:32:33 +02:00
ivanszabo 6be6bc533c Hogy az "élesre" menjen .. 2025-07-01 17:13:34 +02:00
ivanszabo 864c76f827 BUGFIX Scroll javítása 1.1.035 2025-07-01 10:47:47 +02:00
ivanszabo 8208b31d08 1.1.033 Fényképek beküldése javítása 2025-07-01 08:30:34 +02:00
ivanszabo 4f149f4eef 1.1.030 2025-06-30 07:24:55 +02:00
ivanszabo 8ce7268338 Merge branch 'master' of https://tfs.nuvolar.hu:8443/tfs/AtomERP/_git/WorkFlowCheck 2025-06-29 13:30:38 +02:00
ivanszabo d42900e8f6 MOBILE BugFix 2025-06-29 13:30:34 +02:00
ivanszabo 25cd092a08 Backend BUGFIX 2025-06-29 13:30:08 +02:00
ivanszabo e5dd9aad27 A PDF generálásának javítása 2025-06-17 11:35:36 +02:00
ivanszabo d1ad7e76c3 Na most van jól beállítva a dolog. 2025-06-10 17:26:14 +02:00
ivanszabo 5e94586a75 Jóváhagyási BUGFIX 2025-06-10 12:14:52 +02:00
ivanszabo d775ae82a0 GIT 2025-06-10 12:14:41 +02:00
ivanszabo e6b53d193c ok 2025-06-06 08:47:53 +02:00
ivanszabo 400a459479 Itt maradt 2025-06-06 08:46:12 +02:00
Iván Szabó ac74ef9cfc v1.1.030 2025-06-05 08:56:22 +02:00
Iván Szabó 4c7d71a404 Blokkolás és frissítés is 2025-06-05 08:47:17 +02:00
ivanszabo 75d8119880 Ellenőrző lap mdosíthatósága 2025-06-05 08:12:27 +02:00
ivanszabo ff9d6ae361 Fontos kezelési javítások 2025-06-04 12:25:04 +02:00
ivanszabo 6839fc0b78 Hibajavítás hegyek 2025-06-04 11:05:29 +02:00
ivanszabo 11aea1eb5d git change 2025-06-04 09:13:52 +02:00
ivanszabo fb58bfcde0 PDF javítása 2025-05-23 21:20:05 +02:00
ivanszabo 7be3a5c58a console.log kivétele 2025-05-23 20:42:42 +02:00
ivanszabo d3e63404a2 Jóváhagyás utáni automatikus mail + CheckListHeader ShortName és Description javítása 2025-05-23 20:41:44 +02:00
ivanszabo cd0b1da85b v1.1.025 release kiadása 2025-05-23 10:51:44 +02:00
ivanszabo dc12fe8709 v1.1.025 MOBILE 2025-05-23 10:51:31 +02:00
ivanszabo 92dcb645db Merge branch 'master' of https://tfs.nuvolar.hu:8443/tfs/AtomERP/_git/WorkFlowCheck 2025-05-23 10:50:22 +02:00
ivanszabo 0d83e30cd2 Lezárás javítása 2025-05-23 10:50:13 +02:00
ivanszabo 2318269f99 Manuális lezárás indokkal 2025-05-23 10:49:02 +02:00
ivanszabo 84f161585a Merge branch 'master' of https://tfs.nuvolar.hu:8443/tfs/AtomERP/_git/WorkFlowCheck 2025-05-22 21:02:14 +02:00
ivanszabo 05259a09ee CheckListInfoPage implementálása 2025-05-22 21:02:09 +02:00
ivanszabo 98442dfe90 PDF javítása + %-os készültség javítása 2025-05-22 21:01:27 +02:00
ivanszabo e745f313a8 Megfelelő hang lejátszása is javítva 2025-05-16 08:40:51 +02:00
ivanszabo 254ab86d03 Egy pici javítás 2025-05-16 08:40:33 +02:00
ivanszabo 4c25dd2105 FCM kifejlesztése 2025-05-16 07:45:58 +02:00
ivanszabo da92dc45b6 Firebase FCM kliens működik 2025-05-16 07:27:02 +02:00
ivanszabo e8f7ee7e36 Merge branch 'master' of https://tfs.nuvolar.hu:8443/tfs/AtomERP/_git/WorkFlowCheck 2025-05-15 14:45:51 +02:00
ivanszabo b6ffcca996 Firebird Cloud Message API előkészítése 2025-05-15 14:41:34 +02:00
ivanszabo 0a36544dce Klónozás javítása 2025-05-08 11:01:55 +02:00
ivanszabo 699110af10 Privacy kialakítása 2025-05-07 13:25:27 +02:00
ivanszabo 272bd1a3fd CheckListTemplateHeader klónozása 2025-05-07 13:05:28 +02:00
440 changed files with 126835 additions and 122253 deletions
+107 -107
View File
@@ -1,107 +1,107 @@
# Suppress: EC112
# top-most EditorConfig file
root = true
# Don't use tabs for indentation.
[*]
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
# JSON files
[*.json]
indent_size = 2
# Dotnet code style settings:
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = false
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
# Naming Conventions:
# Pascal Casing
dotnet_naming_symbols.method_and_property_symbols.applicable_kinds = method,property,enum
dotnet_naming_symbols.method_and_property_symbols.applicable_accessibilities = *
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.severity = warning
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.symbols = method_and_property_symbols
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.style = pascal_case_style
# Non-public members must be lower-case
#dotnet_naming_symbols.non_public_symbols.applicable_kinds = property,event,delegate
#dotnet_naming_symbols.non_public_symbols.applicable_accessibilities = private
#dotnet_naming_style.all_lower_case_style.capitalization = camel_case
#dotnet_naming_rule.non_public_members_must_be_lower_case.severity = warning
#dotnet_naming_rule.non_public_members_must_be_lower_case.symbols = non_public_symbols
#dotnet_naming_rule.non_public_members_must_be_lower_case.style = all_lower_case_style
# Private fields must start with an underscore
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_style.prefix_underscore.capitalization = camel_case
dotnet_naming_style.prefix_underscore.required_prefix = _
dotnet_naming_rule.private_members_with_underscore.severity = warning
dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
# CSharp code style settings:
[*.cs]
# Do not prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = true:suggestion
csharp_style_expression_bodied_constructors = true:none
csharp_style_expression_bodied_operators = true:none
# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none
# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
# Suppress: EC112
# top-most EditorConfig file
root = true
# Don't use tabs for indentation.
[*]
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
# JSON files
[*.json]
indent_size = 2
# Dotnet code style settings:
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = false
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
# Naming Conventions:
# Pascal Casing
dotnet_naming_symbols.method_and_property_symbols.applicable_kinds = method,property,enum
dotnet_naming_symbols.method_and_property_symbols.applicable_accessibilities = *
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.severity = warning
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.symbols = method_and_property_symbols
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.style = pascal_case_style
# Non-public members must be lower-case
#dotnet_naming_symbols.non_public_symbols.applicable_kinds = property,event,delegate
#dotnet_naming_symbols.non_public_symbols.applicable_accessibilities = private
#dotnet_naming_style.all_lower_case_style.capitalization = camel_case
#dotnet_naming_rule.non_public_members_must_be_lower_case.severity = warning
#dotnet_naming_rule.non_public_members_must_be_lower_case.symbols = non_public_symbols
#dotnet_naming_rule.non_public_members_must_be_lower_case.style = all_lower_case_style
# Private fields must start with an underscore
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_style.prefix_underscore.capitalization = camel_case
dotnet_naming_style.prefix_underscore.required_prefix = _
dotnet_naming_rule.private_members_with_underscore.severity = warning
dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
# CSharp code style settings:
[*.cs]
# Do not prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = true:suggestion
csharp_style_expression_bodied_constructors = true:none
csharp_style_expression_bodied_operators = true:none
# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none
# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
+346 -344
View File
@@ -1,344 +1,346 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true
**/wwwroot/lib/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
/src/WorkFlowCheck.API/Images
*.pdf
/src/WorkFlowCheck.API/Pdf/c86f3a6a-c646-4627-823c-7e24134b7725.docx
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true
**/wwwroot/lib/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
/src/WorkFlowCheck.API/Images
*.pdf
/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
+19 -19
View File
@@ -1,20 +1,20 @@
#Introduction
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
#Getting Started
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
1. Installation process
2. Software dependencies
3. Latest releases
4. API references
#Build and Test
TODO: Describe and show how to build your code and run the tests.
#Contribute
TODO: Explain how other users and developers can contribute to make your code better.
If you want to learn more about creating good readme files then refer the following [guidelines](https://www.visualstudio.com/en-us/docs/git/create-a-readme). You can also seek inspiration from the below readme files:
- [ASP.NET Core](https://github.com/aspnet/Home)
- [Visual Studio Code](https://github.com/Microsoft/vscode)
#Introduction
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
#Getting Started
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
1. Installation process
2. Software dependencies
3. Latest releases
4. API references
#Build and Test
TODO: Describe and show how to build your code and run the tests.
#Contribute
TODO: Explain how other users and developers can contribute to make your code better.
If you want to learn more about creating good readme files then refer the following [guidelines](https://www.visualstudio.com/en-us/docs/git/create-a-readme). You can also seek inspiration from the below readme files:
- [ASP.NET Core](https://github.com/aspnet/Home)
- [Visual Studio Code](https://github.com/Microsoft/vscode)
- [Chakra Core](https://github.com/Microsoft/ChakraCore)
+5 -5
View File
@@ -1,5 +1,5 @@
echo off
echo "dotnet ef migrations add InitialCreate --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
echo "dotnet ef database update --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
echo "dotnet ef migrations remove --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
pause
echo off
echo "dotnet ef migrations add InitialCreate --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
echo "dotnet ef database update --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
echo "dotnet ef migrations remove --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
pause
+90 -90
View File
@@ -1,90 +1,90 @@
using Android.App;
using Android.Content;
using Android.OS;
using System;
namespace Plugin.NFC
{
/// <summary>
/// Cross NFC (Android specific)
/// </summary>
public static partial class CrossNFC
{
internal static ActivityLifecycleContextListener lifecycleListener;
/// <summary>
/// Initialization
/// </summary>
/// <param name="application">Android <see cref="Application"/></param>
public static void Init(Application application)
{
if (lifecycleListener != null) return;
lifecycleListener = new ActivityLifecycleContextListener();
application.RegisterActivityLifecycleCallbacks(lifecycleListener);
}
/// <summary>
/// Initialization
/// </summary>
/// <param name="activity">Android <see cref="Activity"/></param>
public static void Init(Activity activity)
{
Init(activity.Application);
lifecycleListener.Activity = activity;
}
/// <summary>
/// Overrides Activity.OnNewIntent()
/// </summary>
/// <param name="intent">Android <see cref="Intent"/></param>
public static void OnNewIntent(Intent intent) => ((NFCImplementation)Current).HandleNewIntent(intent);
/// <summary>
/// Overrides Activity.OnResume()
/// </summary>
public static void OnResume() => ((NFCImplementation)Current).HandleOnResume();
/// <summary>
/// Returns the current Android <see cref="Context"/>
/// </summary>
internal static Context AppContext => Application.Context;
/// <summary>
/// Returns the current Android <see cref="Activity"/>
/// </summary>
/// <param name="throwError"></param>
/// <returns></returns>
internal static Activity GetCurrentActivity(bool throwError)
{
var activity = lifecycleListener?.Activity;
if (throwError && activity == null)
throw new NullReferenceException("The current Activity can not be detected. Ensure that you have called Init in your Activity or Application class.");
return activity;
}
}
/// <summary>
/// James Montemagno's ActivityLifecycleContextListener from CurrentActivityPlugin
/// <see href="https://github.com/jamesmontemagno/CurrentActivityPlugin"/>
/// </summary>
class ActivityLifecycleContextListener : Java.Lang.Object, Application.IActivityLifecycleCallbacks
{
WeakReference<Activity> _currentActivity = new WeakReference<Activity>(null);
internal Context Context => Activity ?? Application.Context;
internal Activity Activity
{
get => _currentActivity.TryGetTarget(out var a) ? a : null;
set => _currentActivity.SetTarget(value);
}
void Application.IActivityLifecycleCallbacks.OnActivityCreated(Activity activity, Bundle savedInstanceState) => Activity = activity;
void Application.IActivityLifecycleCallbacks.OnActivityDestroyed(Activity activity) { }
void Application.IActivityLifecycleCallbacks.OnActivityPaused(Activity activity) => Activity = activity;
void Application.IActivityLifecycleCallbacks.OnActivityResumed(Activity activity) => Activity = activity;
void Application.IActivityLifecycleCallbacks.OnActivitySaveInstanceState(Activity activity, Bundle outState) { }
void Application.IActivityLifecycleCallbacks.OnActivityStarted(Activity activity) { }
void Application.IActivityLifecycleCallbacks.OnActivityStopped(Activity activity) { }
}
}
using Android.App;
using Android.Content;
using Android.OS;
using System;
namespace Plugin.NFC
{
/// <summary>
/// Cross NFC (Android specific)
/// </summary>
public static partial class CrossNFC
{
internal static ActivityLifecycleContextListener lifecycleListener;
/// <summary>
/// Initialization
/// </summary>
/// <param name="application">Android <see cref="Application"/></param>
public static void Init(Application application)
{
if (lifecycleListener != null) return;
lifecycleListener = new ActivityLifecycleContextListener();
application.RegisterActivityLifecycleCallbacks(lifecycleListener);
}
/// <summary>
/// Initialization
/// </summary>
/// <param name="activity">Android <see cref="Activity"/></param>
public static void Init(Activity activity)
{
Init(activity.Application);
lifecycleListener.Activity = activity;
}
/// <summary>
/// Overrides Activity.OnNewIntent()
/// </summary>
/// <param name="intent">Android <see cref="Intent"/></param>
public static void OnNewIntent(Intent intent) => ((NFCImplementation)Current).HandleNewIntent(intent);
/// <summary>
/// Overrides Activity.OnResume()
/// </summary>
public static void OnResume() => ((NFCImplementation)Current).HandleOnResume();
/// <summary>
/// Returns the current Android <see cref="Context"/>
/// </summary>
internal static Context AppContext => Application.Context;
/// <summary>
/// Returns the current Android <see cref="Activity"/>
/// </summary>
/// <param name="throwError"></param>
/// <returns></returns>
internal static Activity GetCurrentActivity(bool throwError)
{
var activity = lifecycleListener?.Activity;
if (throwError && activity == null)
throw new NullReferenceException("The current Activity can not be detected. Ensure that you have called Init in your Activity or Application class.");
return activity;
}
}
/// <summary>
/// James Montemagno's ActivityLifecycleContextListener from CurrentActivityPlugin
/// <see href="https://github.com/jamesmontemagno/CurrentActivityPlugin"/>
/// </summary>
class ActivityLifecycleContextListener : Java.Lang.Object, Application.IActivityLifecycleCallbacks
{
WeakReference<Activity> _currentActivity = new WeakReference<Activity>(null);
internal Context Context => Activity ?? Application.Context;
internal Activity Activity
{
get => _currentActivity.TryGetTarget(out var a) ? a : null;
set => _currentActivity.SetTarget(value);
}
void Application.IActivityLifecycleCallbacks.OnActivityCreated(Activity activity, Bundle savedInstanceState) => Activity = activity;
void Application.IActivityLifecycleCallbacks.OnActivityDestroyed(Activity activity) { }
void Application.IActivityLifecycleCallbacks.OnActivityPaused(Activity activity) => Activity = activity;
void Application.IActivityLifecycleCallbacks.OnActivityResumed(Activity activity) => Activity = activity;
void Application.IActivityLifecycleCallbacks.OnActivitySaveInstanceState(Activity activity, Bundle outState) { }
void Application.IActivityLifecycleCallbacks.OnActivityStarted(Activity activity) { }
void Application.IActivityLifecycleCallbacks.OnActivityStopped(Activity activity) { }
}
}
File diff suppressed because it is too large Load Diff
+108 -108
View File
@@ -1,108 +1,108 @@
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">
<PropertyGroup>
<!--Work around so the conditions work below-->
<!--<TargetFrameworks>netstandard1.0;netstandard2.0;Xamarin.iOS10;MonoAndroid10.0;net8.0;net8.0-android;net8.0-ios</TargetFrameworks>-->
<TargetFrameworks>net8.0;net8.0-android;net8.0-ios</TargetFrameworks>
<AssemblyName>Plugin.NFC</AssemblyName>
<RootNamespace>Plugin.NFC</RootNamespace>
<PackageId>Plugin.NFC</PackageId>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyFileVersion>1.0.0.0</AssemblyFileVersion>
<Version>1.0.0.0</Version>
<PackageVersion>1.0.0.0</PackageVersion>
<PackOnBuild>true</PackOnBuild>
<NeutralLanguage>en</NeutralLanguage>
<DefineConstants>$(DefineConstants);</DefineConstants>
<NoWarn>CS0067</NoWarn>
<UseFullSemVerForNuGet>false</UseFullSemVerForNuGet>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<LangVersion>latest</LangVersion>
<DebugType>portable</DebugType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/franckbour/Plugin.NFC</PackageProjectUrl>
<RepositoryUrl>https://github.com/franckbour/Plugin.NFC</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>https://github.com/franckbour/Plugin.NFC/blob/master/CHANGELOG.md</PackageReleaseNotes>
<PackageIconUrl>https://github.com/franckbour/Plugin.NFC/raw/master/art/nfc128.png</PackageIconUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageTags>maui, xamarin, ios, android, xamarin.forms, plugin, NFC</PackageTags>
<Title>NFC Plugin for Xamarin</Title>
<Summary>A Cross-Platform plugin to easily read and write NFC tags.</Summary>
<Description>Cross-Platform NFC (Near Field Communication) plugin to easily read and write NFC tags in your application.</Description>
<Owners>Franck Bour</Owners>
<Authors>Franck Bour</Authors>
<Copyright>Copyright 2022</Copyright>
<!-- When built in 2019 will remove extra references on pack for iOS in System.Drawing.Common -->
<DisableExtraReferences>false</DisableExtraReferences>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- sourcelink: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- sourcelink: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- sourcelink: Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<PropertyGroup>
<_NET8 Condition=" $(TargetFramework.Contains('net8')) ">true</_NET8>
<_DROID Condition=" $(TargetFramework.ToLowerInvariant().Contains('droid')) ">true</_DROID>
<_IOS Condition=" $(TargetFramework.ToLowerInvariant().Contains('ios')) ">true</_IOS>
<_MOBILE Condition=" '$(_DROID)' == 'true' OR '$(_IOS)' == 'true' ">true</_MOBILE>
<DefineConstants Condition=" '$(_DROID)' == 'true' ">$(DefineConstants);__ANDROID__;__MOBILE__;</DefineConstants>
<DefineConstants Condition=" '$(_IOS)' == 'true' ">$(DefineConstants);__IOS__;__MOBILE__;</DefineConstants>
<DefineConstants Condition=" '$(_NET8)' == 'true' ">$(DefineConstants);__NET8__;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(_NET8)' == 'true' AND '$(_MOBILE)' == 'true' ">
<SupportedOSPlatformVersion Condition="'$(_IOS)' == 'true'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(_DROID)' == 'true'">21.0</SupportedOSPlatformVersion>
</PropertyGroup>
<!-- Deterministic Builds (Azure Pipelines) -->
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\art\nfc128.png" PackagePath="icon.png" Pack="true" />
<Compile Include="**\*.shared.cs" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) OR '$(TargetFramework)' == 'net8.0' ">
</ItemGroup>
<ItemGroup Condition=" '$(_DROID)' == 'true' ">
<Compile Include="**\*.android.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(_IOS)' == 'true' ">
<Compile Include="**\*.iOS.cs" />
</ItemGroup>
</Project>
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">
<PropertyGroup>
<!--Work around so the conditions work below-->
<!--<TargetFrameworks>netstandard1.0;netstandard2.0;Xamarin.iOS10;MonoAndroid10.0;net8.0;net8.0-android;net8.0-ios</TargetFrameworks>-->
<TargetFrameworks>net8.0;net8.0-android;net8.0-ios</TargetFrameworks>
<AssemblyName>Plugin.NFC</AssemblyName>
<RootNamespace>Plugin.NFC</RootNamespace>
<PackageId>Plugin.NFC</PackageId>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyFileVersion>1.0.0.0</AssemblyFileVersion>
<Version>1.0.0.0</Version>
<PackageVersion>1.0.0.0</PackageVersion>
<PackOnBuild>true</PackOnBuild>
<NeutralLanguage>en</NeutralLanguage>
<DefineConstants>$(DefineConstants);</DefineConstants>
<NoWarn>CS0067</NoWarn>
<UseFullSemVerForNuGet>false</UseFullSemVerForNuGet>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<LangVersion>latest</LangVersion>
<DebugType>portable</DebugType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/franckbour/Plugin.NFC</PackageProjectUrl>
<RepositoryUrl>https://github.com/franckbour/Plugin.NFC</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>https://github.com/franckbour/Plugin.NFC/blob/master/CHANGELOG.md</PackageReleaseNotes>
<PackageIconUrl>https://github.com/franckbour/Plugin.NFC/raw/master/art/nfc128.png</PackageIconUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageTags>maui, xamarin, ios, android, xamarin.forms, plugin, NFC</PackageTags>
<Title>NFC Plugin for Xamarin</Title>
<Summary>A Cross-Platform plugin to easily read and write NFC tags.</Summary>
<Description>Cross-Platform NFC (Near Field Communication) plugin to easily read and write NFC tags in your application.</Description>
<Owners>Franck Bour</Owners>
<Authors>Franck Bour</Authors>
<Copyright>Copyright 2022</Copyright>
<!-- When built in 2019 will remove extra references on pack for iOS in System.Drawing.Common -->
<DisableExtraReferences>false</DisableExtraReferences>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- sourcelink: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- sourcelink: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- sourcelink: Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<PropertyGroup>
<_NET8 Condition=" $(TargetFramework.Contains('net8')) ">true</_NET8>
<_DROID Condition=" $(TargetFramework.ToLowerInvariant().Contains('droid')) ">true</_DROID>
<_IOS Condition=" $(TargetFramework.ToLowerInvariant().Contains('ios')) ">true</_IOS>
<_MOBILE Condition=" '$(_DROID)' == 'true' OR '$(_IOS)' == 'true' ">true</_MOBILE>
<DefineConstants Condition=" '$(_DROID)' == 'true' ">$(DefineConstants);__ANDROID__;__MOBILE__;</DefineConstants>
<DefineConstants Condition=" '$(_IOS)' == 'true' ">$(DefineConstants);__IOS__;__MOBILE__;</DefineConstants>
<DefineConstants Condition=" '$(_NET8)' == 'true' ">$(DefineConstants);__NET8__;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(_NET8)' == 'true' AND '$(_MOBILE)' == 'true' ">
<SupportedOSPlatformVersion Condition="'$(_IOS)' == 'true'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(_DROID)' == 'true'">21.0</SupportedOSPlatformVersion>
</PropertyGroup>
<!-- Deterministic Builds (Azure Pipelines) -->
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\art\nfc128.png" PackagePath="icon.png" Pack="true" />
<Compile Include="**\*.shared.cs" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) OR '$(TargetFramework)' == 'net8.0' ">
</ItemGroup>
<ItemGroup Condition=" '$(_DROID)' == 'true' ">
<Compile Include="**\*.android.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(_IOS)' == 'true' ">
<Compile Include="**\*.iOS.cs" />
</ItemGroup>
</Project>
+73 -73
View File
@@ -1,73 +1,73 @@
using System;
namespace Plugin.NFC
{
/// <summary>
/// Cross NFC
/// </summary>
public static partial class CrossNFC
{
static Lazy<INFC> _implementation = new Lazy<INFC>(() => CreateNFC(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
/// <summary>
/// Gets if the plugin is supported on the current platform.
/// </summary>
public static bool IsSupported => _implementation.Value != null;
/// <summary>
/// Legacy Mode (Supporting Mifare Classic on iOS)
/// </summary>
static bool _legacy = false;
public static bool Legacy
{
get
{
return _legacy;
}
set
{
_legacy = value;
_implementation = new Lazy<INFC>(() => CreateNFC(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
}
}
/// <summary>
/// Current plugin implementation to use
/// </summary>
public static INFC Current
{
get
{
INFC ret = _implementation.Value;
if (ret == null)
{
throw NotImplementedInReferenceAssembly();
}
return ret;
}
}
static INFC CreateNFC()
{
#if NETSTANDARD || !__MOBILE__
return null;
#elif __IOS__
ObjCRuntime.Class.ThrowOnInitFailure = false;
if (NFCUtils.IsWritingSupported() && !Legacy)
return new NFCImplementation();
return new NFCImplementation_Before_iOS13();
#else
#pragma warning disable IDE0022 // Use expression body for methods
return new NFCImplementation();
#pragma warning restore IDE0022 // Use expression body for methods
#endif
}
internal static Exception NotImplementedInReferenceAssembly() =>
new NotImplementedException("This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.");
}
}
using System;
namespace Plugin.NFC
{
/// <summary>
/// Cross NFC
/// </summary>
public static partial class CrossNFC
{
static Lazy<INFC> _implementation = new Lazy<INFC>(() => CreateNFC(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
/// <summary>
/// Gets if the plugin is supported on the current platform.
/// </summary>
public static bool IsSupported => _implementation.Value != null;
/// <summary>
/// Legacy Mode (Supporting Mifare Classic on iOS)
/// </summary>
static bool _legacy = false;
public static bool Legacy
{
get
{
return _legacy;
}
set
{
_legacy = value;
_implementation = new Lazy<INFC>(() => CreateNFC(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
}
}
/// <summary>
/// Current plugin implementation to use
/// </summary>
public static INFC Current
{
get
{
INFC ret = _implementation.Value;
if (ret == null)
{
throw NotImplementedInReferenceAssembly();
}
return ret;
}
}
static INFC CreateNFC()
{
#if NETSTANDARD || !__MOBILE__
return null;
#elif __IOS__
ObjCRuntime.Class.ThrowOnInitFailure = false;
if (NFCUtils.IsWritingSupported() && !Legacy)
return new NFCImplementation();
return new NFCImplementation_Before_iOS13();
#else
#pragma warning disable IDE0022 // Use expression body for methods
return new NFCImplementation();
#pragma warning restore IDE0022 // Use expression body for methods
#endif
}
internal static Exception NotImplementedInReferenceAssembly() =>
new NotImplementedException("This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.");
}
}
+118 -118
View File
@@ -1,118 +1,118 @@
using System;
namespace Plugin.NFC
{
#region Event delegates
public delegate void NdefMessageReceivedEventHandler(ITagInfo tagInfo);
public delegate void NdefMessagePublishedEventHandler(ITagInfo tagInfo);
public delegate void TagDiscoveredEventHandler(ITagInfo tagInfo, bool format);
public delegate void OnNfcStatusChangedEventHandler(bool isEnabled);
public delegate void TagListeningStatusChangedEventHandler(bool isListening);
#endregion
/// <summary>
/// Main interface for NFC
/// </summary>
public interface INFC
{
/// <summary>
/// Checks if NFC Feature is available
/// </summary>
bool IsAvailable { get; }
/// <summary>
/// Checks if NFC Feature is enabled
/// </summary>
bool IsEnabled { get; }
/// <summary>
/// Checks if writing mode is supported
/// </summary>
bool IsWritingTagSupported { get; }
/// <summary>
/// NFC Configuration
/// </summary>
NfcConfiguration Configuration { get; }
/// <summary>
/// Set Nfc configuration
/// </summary>
/// <param name="configuration"><see cref="NfcConfiguration"/></param>
void SetConfiguration(NfcConfiguration configuration);
/// <summary>
/// Starts tags detection
/// </summary>
void StartListening();
/// <summary>
/// Stops tags detection
/// </summary>
void StopListening();
/// <summary>
/// Starts tag publishing (writing or formatting)
/// </summary>
/// <param name="clearMessage">Format tag</param>
void StartPublishing(bool clearMessage = false);
/// <summary>
/// Stops tag publishing
/// </summary>
void StopPublishing();
/// <summary>
/// Publish or write a message on a tag
/// </summary>
/// <param name="tagInfo">see <see cref="ITagInfo"/></param>
/// <param name="makeReadOnly">make tag read-only</param>
void PublishMessage(ITagInfo tagInfo, bool makeReadOnly = false);
/// <summary>
/// Format tag
/// </summary>
/// <param name="tagInfo">see <see cref="ITagInfo"/></param>
void ClearMessage(ITagInfo tagInfo);
/// <summary>
/// Event raised when tag is connected
/// </summary>
event EventHandler OnTagConnected;
/// <summary>
/// Event raised when tag is disconnected
/// </summary>
event EventHandler OnTagDisconnected;
/// <summary>
/// Event raised when ndef message is received
/// </summary>
event NdefMessageReceivedEventHandler OnMessageReceived;
/// <summary>
/// Event raised when a tag is discovered (Editing)
/// </summary>
event TagDiscoveredEventHandler OnTagDiscovered;
/// <summary>
/// Event raised when ndef message has been published
/// </summary>
event NdefMessagePublishedEventHandler OnMessagePublished;
/// <summary>
/// Event raised when iOS NFC reading session is cancelled
/// </summary>
event EventHandler OniOSReadingSessionCancelled;
/// <summary>
/// Event raised when NFC status changes
/// </summary>
event OnNfcStatusChangedEventHandler OnNfcStatusChanged;
/// <summary>
/// Event raised when NFC listener status changes
/// </summary>
event TagListeningStatusChangedEventHandler OnTagListeningStatusChanged;
}
}
using System;
namespace Plugin.NFC
{
#region Event delegates
public delegate void NdefMessageReceivedEventHandler(ITagInfo tagInfo);
public delegate void NdefMessagePublishedEventHandler(ITagInfo tagInfo);
public delegate void TagDiscoveredEventHandler(ITagInfo tagInfo, bool format);
public delegate void OnNfcStatusChangedEventHandler(bool isEnabled);
public delegate void TagListeningStatusChangedEventHandler(bool isListening);
#endregion
/// <summary>
/// Main interface for NFC
/// </summary>
public interface INFC
{
/// <summary>
/// Checks if NFC Feature is available
/// </summary>
bool IsAvailable { get; }
/// <summary>
/// Checks if NFC Feature is enabled
/// </summary>
bool IsEnabled { get; }
/// <summary>
/// Checks if writing mode is supported
/// </summary>
bool IsWritingTagSupported { get; }
/// <summary>
/// NFC Configuration
/// </summary>
NfcConfiguration Configuration { get; }
/// <summary>
/// Set Nfc configuration
/// </summary>
/// <param name="configuration"><see cref="NfcConfiguration"/></param>
void SetConfiguration(NfcConfiguration configuration);
/// <summary>
/// Starts tags detection
/// </summary>
void StartListening();
/// <summary>
/// Stops tags detection
/// </summary>
void StopListening();
/// <summary>
/// Starts tag publishing (writing or formatting)
/// </summary>
/// <param name="clearMessage">Format tag</param>
void StartPublishing(bool clearMessage = false);
/// <summary>
/// Stops tag publishing
/// </summary>
void StopPublishing();
/// <summary>
/// Publish or write a message on a tag
/// </summary>
/// <param name="tagInfo">see <see cref="ITagInfo"/></param>
/// <param name="makeReadOnly">make tag read-only</param>
void PublishMessage(ITagInfo tagInfo, bool makeReadOnly = false);
/// <summary>
/// Format tag
/// </summary>
/// <param name="tagInfo">see <see cref="ITagInfo"/></param>
void ClearMessage(ITagInfo tagInfo);
/// <summary>
/// Event raised when tag is connected
/// </summary>
event EventHandler OnTagConnected;
/// <summary>
/// Event raised when tag is disconnected
/// </summary>
event EventHandler OnTagDisconnected;
/// <summary>
/// Event raised when ndef message is received
/// </summary>
event NdefMessageReceivedEventHandler OnMessageReceived;
/// <summary>
/// Event raised when a tag is discovered (Editing)
/// </summary>
event TagDiscoveredEventHandler OnTagDiscovered;
/// <summary>
/// Event raised when ndef message has been published
/// </summary>
event NdefMessagePublishedEventHandler OnMessagePublished;
/// <summary>
/// Event raised when iOS NFC reading session is cancelled
/// </summary>
event EventHandler OniOSReadingSessionCancelled;
/// <summary>
/// Event raised when NFC status changes
/// </summary>
event OnNfcStatusChangedEventHandler OnNfcStatusChanged;
/// <summary>
/// Event raised when NFC listener status changes
/// </summary>
event TagListeningStatusChangedEventHandler OnTagListeningStatusChanged;
}
}
+104 -104
View File
@@ -1,104 +1,104 @@
namespace Plugin.NFC
{
/// <summary>
/// Interface for ITagInfo
/// </summary>
public interface ITagInfo
{
/// <summary>
/// Tag Raw Identifier
/// </summary>
byte[] Identifier { get; }
/// <summary>
/// Tag Serial Number
/// </summary>
string SerialNumber { get; }
/// <summary>
/// Writable tag
/// </summary>
bool IsWritable { get; set; }
/// <summary>
/// Empty tag
/// </summary>
bool IsEmpty { get; }
/// <summary>
/// Supported tag
/// </summary>
bool IsSupported { get; }
/// <summary>
/// Capacity of tag in bytes
/// </summary>
int Capacity { get; set; }
/// <summary>
/// Array of <see cref="NFCNdefRecord"/> of tag
/// </summary>
NFCNdefRecord[] Records { get; set; }
}
/// <summary>
/// Class describing the information containing within a NFC tag
/// </summary>
public class NFCNdefRecord
{
/// <summary>
/// NDEF Type
/// </summary>
public NFCNdefTypeFormat TypeFormat { get; set; }
/// <summary>
/// MimeType used for <see cref="NFCNdefTypeFormat.Mime"/> type
/// </summary>
public string MimeType { get; set; } = "text/plain";
/// <summary>
/// External domain used for <see cref="NFCNdefTypeFormat.External"/> type
/// </summary>
public string ExternalDomain { get; set; }
/// <summary>
/// External type used for <see cref="NFCNdefTypeFormat.External"/> type
/// </summary>
public string ExternalType { get; set; }
/// <summary>
/// Payload
/// </summary>
public byte[] Payload { get; set; }
/// <summary>
/// Uri
/// </summary>
public string Uri { get; set; }
/// <summary>
/// String formatted payload
/// </summary>
public string Message => NFCUtils.GetMessage(TypeFormat, Payload, Uri);
/// <summary>
/// Two letters ISO 639-1 Language Code (ex: en, fr, de...)
/// </summary>
public string LanguageCode { get; set; }
}
/// <summary>
/// Enumeration of NDEF type
/// </summary>
public enum NFCNdefTypeFormat
{
Empty = 0x00,
WellKnown = 0x01,
Mime = 0x02,
Uri = 0x03,
External = 0x04,
Unknown = 0x05,
Unchanged = 0x06,
Reserved = 0x07
}
}
namespace Plugin.NFC
{
/// <summary>
/// Interface for ITagInfo
/// </summary>
public interface ITagInfo
{
/// <summary>
/// Tag Raw Identifier
/// </summary>
byte[] Identifier { get; }
/// <summary>
/// Tag Serial Number
/// </summary>
string SerialNumber { get; }
/// <summary>
/// Writable tag
/// </summary>
bool IsWritable { get; set; }
/// <summary>
/// Empty tag
/// </summary>
bool IsEmpty { get; }
/// <summary>
/// Supported tag
/// </summary>
bool IsSupported { get; }
/// <summary>
/// Capacity of tag in bytes
/// </summary>
int Capacity { get; set; }
/// <summary>
/// Array of <see cref="NFCNdefRecord"/> of tag
/// </summary>
NFCNdefRecord[] Records { get; set; }
}
/// <summary>
/// Class describing the information containing within a NFC tag
/// </summary>
public class NFCNdefRecord
{
/// <summary>
/// NDEF Type
/// </summary>
public NFCNdefTypeFormat TypeFormat { get; set; }
/// <summary>
/// MimeType used for <see cref="NFCNdefTypeFormat.Mime"/> type
/// </summary>
public string MimeType { get; set; } = "text/plain";
/// <summary>
/// External domain used for <see cref="NFCNdefTypeFormat.External"/> type
/// </summary>
public string ExternalDomain { get; set; }
/// <summary>
/// External type used for <see cref="NFCNdefTypeFormat.External"/> type
/// </summary>
public string ExternalType { get; set; }
/// <summary>
/// Payload
/// </summary>
public byte[] Payload { get; set; }
/// <summary>
/// Uri
/// </summary>
public string Uri { get; set; }
/// <summary>
/// String formatted payload
/// </summary>
public string Message => NFCUtils.GetMessage(TypeFormat, Payload, Uri);
/// <summary>
/// Two letters ISO 639-1 Language Code (ex: en, fr, de...)
/// </summary>
public string LanguageCode { get; set; }
}
/// <summary>
/// Enumeration of NDEF type
/// </summary>
public enum NFCNdefTypeFormat
{
Empty = 0x00,
WellKnown = 0x01,
Mime = 0x02,
Uri = 0x03,
External = 0x04,
Unknown = 0x05,
Unchanged = 0x06,
Reserved = 0x07
}
}
+113 -113
View File
@@ -1,113 +1,113 @@
using System.Linq;
using System.Text;
#if __IOS__
using UIKit;
#endif
namespace Plugin.NFC
{
/// <summary>
/// NFC tools
/// </summary>
public static class NFCUtils
{
/// <summary>
/// Returns the content size of an array of <see cref="NFCNdefRecord"/>
/// </summary>
/// <param name="records">array of <see cref="NFCNdefRecord"/></param>
/// <returns>Content size</returns>
internal static int GetSize(NFCNdefRecord[] records)
{
var size = 0;
if (records != null && records.Length > 0)
{
for (var i = 0; i < records.Length; i++)
{
if (records[i] != null)
size += records[i].Payload.Length;
}
}
return size;
}
/// <summary>
/// Returns the string formatted payload
/// </summary>
/// <param name="type">type of <see cref="NFCNdefTypeFormat"/></param>
/// <param name="payload">record payload</param>
/// <param name="uri">record uri</param>
/// <returns>String formatted payload</returns>
internal static string GetMessage(NFCNdefTypeFormat type, byte[] payload, string uri)
{
string message;
if (!string.IsNullOrWhiteSpace(uri))
message = uri;
else
{
if (type == NFCNdefTypeFormat.WellKnown)
{
// NDEF_WELLKNOWN Text record
var status = payload[0];
var enc = status & 0x80;
var languageCodeLength = status & 0x3F;
if (enc == 0)
message = Encoding.UTF8.GetString(payload, languageCodeLength + 1, payload.Length - languageCodeLength - 1);
else
message = Encoding.Unicode.GetString(payload, languageCodeLength + 1, payload.Length - languageCodeLength - 1);
}
else
{
// Other NDEF types
message = Encoding.UTF8.GetString(payload, 0, payload.Length);
}
}
return message;
}
/// <summary>
/// Transforms a string message into an array of bytes
/// </summary>
/// <param name="text">text message</param>
/// <returns>Array of bytes</returns>
public static byte[] EncodeToByteArray(string text) => Encoding.UTF8.GetBytes(text);
/// <summary>
/// Returns the string formatted payload
/// </summary>
/// <param name="record">Object <see cref="NFCNdefRecord"/></param>
/// <returns>String formatted payload</returns>
public static string GetMessage(NFCNdefRecord record)
{
if (record == null)
return string.Empty;
return GetMessage(record.TypeFormat, record.Payload, record.Uri);
}
/// <summary>
/// Convert bytes array into hexadecimal string
/// </summary>
/// <param name="bytes">Bytes Array</param>
/// <param name="separator">Separator</param>
/// <returns>Hexadecimal string</returns>
public static string ByteArrayToHexString(byte[] bytes, string separator = null)
{
return bytes == null ? string.Empty : string.Join(separator ?? string.Empty, bytes.Select(b => b.ToString("X2")));
}
/// <summary>
/// Checks if writing tags is supported
/// </summary>
/// <returns>boolean</returns>
public static bool IsWritingSupported()
{
#if __IOS__
var splitted = UIDevice.CurrentDevice.SystemVersion?.Split('.');
if (splitted != null && splitted.Length > 0 && int.TryParse(splitted[0], out var majorVersion))
return majorVersion >= 13;
return false;
#else
return true;
#endif
}
}
}
using System.Linq;
using System.Text;
#if __IOS__
using UIKit;
#endif
namespace Plugin.NFC
{
/// <summary>
/// NFC tools
/// </summary>
public static class NFCUtils
{
/// <summary>
/// Returns the content size of an array of <see cref="NFCNdefRecord"/>
/// </summary>
/// <param name="records">array of <see cref="NFCNdefRecord"/></param>
/// <returns>Content size</returns>
internal static int GetSize(NFCNdefRecord[] records)
{
var size = 0;
if (records != null && records.Length > 0)
{
for (var i = 0; i < records.Length; i++)
{
if (records[i] != null)
size += records[i].Payload.Length;
}
}
return size;
}
/// <summary>
/// Returns the string formatted payload
/// </summary>
/// <param name="type">type of <see cref="NFCNdefTypeFormat"/></param>
/// <param name="payload">record payload</param>
/// <param name="uri">record uri</param>
/// <returns>String formatted payload</returns>
internal static string GetMessage(NFCNdefTypeFormat type, byte[] payload, string uri)
{
string message;
if (!string.IsNullOrWhiteSpace(uri))
message = uri;
else
{
if (type == NFCNdefTypeFormat.WellKnown)
{
// NDEF_WELLKNOWN Text record
var status = payload[0];
var enc = status & 0x80;
var languageCodeLength = status & 0x3F;
if (enc == 0)
message = Encoding.UTF8.GetString(payload, languageCodeLength + 1, payload.Length - languageCodeLength - 1);
else
message = Encoding.Unicode.GetString(payload, languageCodeLength + 1, payload.Length - languageCodeLength - 1);
}
else
{
// Other NDEF types
message = Encoding.UTF8.GetString(payload, 0, payload.Length);
}
}
return message;
}
/// <summary>
/// Transforms a string message into an array of bytes
/// </summary>
/// <param name="text">text message</param>
/// <returns>Array of bytes</returns>
public static byte[] EncodeToByteArray(string text) => Encoding.UTF8.GetBytes(text);
/// <summary>
/// Returns the string formatted payload
/// </summary>
/// <param name="record">Object <see cref="NFCNdefRecord"/></param>
/// <returns>String formatted payload</returns>
public static string GetMessage(NFCNdefRecord record)
{
if (record == null)
return string.Empty;
return GetMessage(record.TypeFormat, record.Payload, record.Uri);
}
/// <summary>
/// Convert bytes array into hexadecimal string
/// </summary>
/// <param name="bytes">Bytes Array</param>
/// <param name="separator">Separator</param>
/// <returns>Hexadecimal string</returns>
public static string ByteArrayToHexString(byte[] bytes, string separator = null)
{
return bytes == null ? string.Empty : string.Join(separator ?? string.Empty, bytes.Select(b => b.ToString("X2")));
}
/// <summary>
/// Checks if writing tags is supported
/// </summary>
/// <returns>boolean</returns>
public static bool IsWritingSupported()
{
#if __IOS__
var splitted = UIDevice.CurrentDevice.SystemVersion?.Split('.');
if (splitted != null && splitted.Length > 0 && int.TryParse(splitted[0], out var majorVersion))
return majorVersion >= 13;
return false;
#else
return true;
#endif
}
}
}
+282 -282
View File
@@ -1,282 +1,282 @@
namespace Plugin.NFC
{
/// <summary>
/// NFC Configuration class
/// </summary>
public class NfcConfiguration
{
/// <summary>
/// List of user defined messages
/// </summary>
public UserDefinedMessages Messages { get; set; }
/// <summary>
/// Sets ISO 639-1 Language Code for all ndef records (default is "en")
/// </summary>
public string DefaultLanguageCode { get; set; }
/// <summary>
/// Update Nfc Configuration with a new configuration object
/// </summary>
/// <param name="newCfg"><see cref="NfcConfiguration"/></param>
public void Update(NfcConfiguration newCfg)
{
if (newCfg == null || newCfg.Messages == null)
return;
Messages = newCfg.Messages;
DefaultLanguageCode = newCfg.DefaultLanguageCode;
}
/// <summary>
/// Get the default Nfc configuration
/// </summary>
/// <returns>Default <see cref="NfcConfiguration"/></returns>
public static NfcConfiguration GetDefaultConfiguration()
=> new NfcConfiguration { Messages = new UserDefinedMessages(), DefaultLanguageCode = "en" };
}
/// <summary>
/// User defined UI messages
/// </summary>
public class UserDefinedMessages
{
string _nfcSessionInvalidated = "Session Invalidated";
string _nfcSessionInvalidatedButton = "OK";
string _nfcWritingNotSupported = "Writing NFC Tag is not supported on this device";
string _nfcDialogAlertMessage = "Please hold your phone near a NFC tag";
string _nfcErrorRead = "Read error. Please try again";
string _nfcErrorEmptyTag = "Tag is empty";
string _nfcErrorReadOnlyTag = "Tag is not writable";
string _nfcErrorCapacityTag = "Tag's capacity is too low";
string _nfcErrorMissingTag = "Tag is missing";
string _nfcErrorMissingTagInfo = "No Tag Informations: nothing to write";
string _nfcErrorNotSupportedTag = "Tag is not supported";
string _nfcErrorNotCompliantTag = "Tag is not NDEF compliant";
string _nfcErrorWrite = "Nothing to write";
string _nfcSuccessRead = "Read Operation Successful";
string _nfcSuccessWrite = "Write Operation Successful";
string _nfcSuccessClear = "Clear Operation Successful";
string _nfcSessionTimeout = "session timeout";
/// <summary>
/// Session timeout
/// </summary>
public string NFCSessionTimeout
{
get => _nfcSessionTimeout;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSessionTimeout = value;
}
}
/// <summary>
/// Session invalidated
/// </summary>
public string NFCSessionInvalidatedButton
{
get => _nfcSessionInvalidatedButton;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSessionInvalidatedButton = value;
}
}
/// <summary>
/// Session invalidated
/// </summary>
public string NFCSessionInvalidated
{
get => _nfcSessionInvalidated;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSessionInvalidated = value;
}
}
/// <summary>
/// Writing feature not supported
/// </summary>
public string NFCWritingNotSupported
{
get => _nfcWritingNotSupported;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcWritingNotSupported = value;
}
}
/// <summary>
/// [iOS] NFC Scan dialog alert message
/// </summary>
public string NFCDialogAlertMessage
{
get => _nfcDialogAlertMessage;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcDialogAlertMessage = value;
}
}
/// <summary>
/// Read operation error
/// </summary>
public string NFCErrorRead
{
get => _nfcErrorRead;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorRead = value;
}
}
/// <summary>
/// Write operation error
/// </summary>
public string NFCErrorWrite
{
get => _nfcErrorWrite;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorWrite = value;
}
}
/// <summary>
/// Empty tag error
/// </summary>
public string NFCErrorEmptyTag
{
get => _nfcErrorEmptyTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorEmptyTag = value;
}
}
/// <summary>
/// Read-only tag error
/// </summary>
public string NFCErrorReadOnlyTag
{
get => _nfcErrorReadOnlyTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorReadOnlyTag = value;
}
}
/// <summary>
/// Tag capacity error
/// </summary>
public string NFCErrorCapacityTag
{
get => _nfcErrorCapacityTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorCapacityTag = value;
}
}
/// <summary>
/// Missing tag error
/// </summary>
public string NFCErrorMissingTag
{
get => _nfcErrorMissingTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorMissingTag = value;
}
}
/// <summary>
/// Missing tag info error
/// </summary>
public string NFCErrorMissingTagInfo
{
get => _nfcErrorMissingTagInfo;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorMissingTagInfo = value;
}
}
/// <summary>
/// Not supported tag error
/// </summary>
public string NFCErrorNotSupportedTag
{
get => _nfcErrorNotSupportedTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorNotSupportedTag = value;
}
}
/// <summary>
/// Not NDEF compliant tag error
/// </summary>
public string NFCErrorNotCompliantTag
{
get => _nfcErrorNotCompliantTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorNotCompliantTag = value;
}
}
/// <summary>
/// [iOS] Successful read operation message
/// </summary>
public string NFCSuccessRead
{
get => _nfcSuccessRead;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSuccessRead = value;
}
}
/// <summary>
/// [iOS] Successful write operation message
/// </summary>
public string NFCSuccessWrite
{
get => _nfcSuccessWrite;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSuccessWrite = value;
}
}
/// <summary>
/// [iOS] Successful clear operation message
/// </summary>
public string NFCSuccessClear
{
get => _nfcSuccessClear;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSuccessClear = value;
}
}
}
}
namespace Plugin.NFC
{
/// <summary>
/// NFC Configuration class
/// </summary>
public class NfcConfiguration
{
/// <summary>
/// List of user defined messages
/// </summary>
public UserDefinedMessages Messages { get; set; }
/// <summary>
/// Sets ISO 639-1 Language Code for all ndef records (default is "en")
/// </summary>
public string DefaultLanguageCode { get; set; }
/// <summary>
/// Update Nfc Configuration with a new configuration object
/// </summary>
/// <param name="newCfg"><see cref="NfcConfiguration"/></param>
public void Update(NfcConfiguration newCfg)
{
if (newCfg == null || newCfg.Messages == null)
return;
Messages = newCfg.Messages;
DefaultLanguageCode = newCfg.DefaultLanguageCode;
}
/// <summary>
/// Get the default Nfc configuration
/// </summary>
/// <returns>Default <see cref="NfcConfiguration"/></returns>
public static NfcConfiguration GetDefaultConfiguration()
=> new NfcConfiguration { Messages = new UserDefinedMessages(), DefaultLanguageCode = "en" };
}
/// <summary>
/// User defined UI messages
/// </summary>
public class UserDefinedMessages
{
string _nfcSessionInvalidated = "Session Invalidated";
string _nfcSessionInvalidatedButton = "OK";
string _nfcWritingNotSupported = "Writing NFC Tag is not supported on this device";
string _nfcDialogAlertMessage = "Please hold your phone near a NFC tag";
string _nfcErrorRead = "Read error. Please try again";
string _nfcErrorEmptyTag = "Tag is empty";
string _nfcErrorReadOnlyTag = "Tag is not writable";
string _nfcErrorCapacityTag = "Tag's capacity is too low";
string _nfcErrorMissingTag = "Tag is missing";
string _nfcErrorMissingTagInfo = "No Tag Informations: nothing to write";
string _nfcErrorNotSupportedTag = "Tag is not supported";
string _nfcErrorNotCompliantTag = "Tag is not NDEF compliant";
string _nfcErrorWrite = "Nothing to write";
string _nfcSuccessRead = "Read Operation Successful";
string _nfcSuccessWrite = "Write Operation Successful";
string _nfcSuccessClear = "Clear Operation Successful";
string _nfcSessionTimeout = "session timeout";
/// <summary>
/// Session timeout
/// </summary>
public string NFCSessionTimeout
{
get => _nfcSessionTimeout;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSessionTimeout = value;
}
}
/// <summary>
/// Session invalidated
/// </summary>
public string NFCSessionInvalidatedButton
{
get => _nfcSessionInvalidatedButton;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSessionInvalidatedButton = value;
}
}
/// <summary>
/// Session invalidated
/// </summary>
public string NFCSessionInvalidated
{
get => _nfcSessionInvalidated;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSessionInvalidated = value;
}
}
/// <summary>
/// Writing feature not supported
/// </summary>
public string NFCWritingNotSupported
{
get => _nfcWritingNotSupported;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcWritingNotSupported = value;
}
}
/// <summary>
/// [iOS] NFC Scan dialog alert message
/// </summary>
public string NFCDialogAlertMessage
{
get => _nfcDialogAlertMessage;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcDialogAlertMessage = value;
}
}
/// <summary>
/// Read operation error
/// </summary>
public string NFCErrorRead
{
get => _nfcErrorRead;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorRead = value;
}
}
/// <summary>
/// Write operation error
/// </summary>
public string NFCErrorWrite
{
get => _nfcErrorWrite;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorWrite = value;
}
}
/// <summary>
/// Empty tag error
/// </summary>
public string NFCErrorEmptyTag
{
get => _nfcErrorEmptyTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorEmptyTag = value;
}
}
/// <summary>
/// Read-only tag error
/// </summary>
public string NFCErrorReadOnlyTag
{
get => _nfcErrorReadOnlyTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorReadOnlyTag = value;
}
}
/// <summary>
/// Tag capacity error
/// </summary>
public string NFCErrorCapacityTag
{
get => _nfcErrorCapacityTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorCapacityTag = value;
}
}
/// <summary>
/// Missing tag error
/// </summary>
public string NFCErrorMissingTag
{
get => _nfcErrorMissingTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorMissingTag = value;
}
}
/// <summary>
/// Missing tag info error
/// </summary>
public string NFCErrorMissingTagInfo
{
get => _nfcErrorMissingTagInfo;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorMissingTagInfo = value;
}
}
/// <summary>
/// Not supported tag error
/// </summary>
public string NFCErrorNotSupportedTag
{
get => _nfcErrorNotSupportedTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorNotSupportedTag = value;
}
}
/// <summary>
/// Not NDEF compliant tag error
/// </summary>
public string NFCErrorNotCompliantTag
{
get => _nfcErrorNotCompliantTag;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcErrorNotCompliantTag = value;
}
}
/// <summary>
/// [iOS] Successful read operation message
/// </summary>
public string NFCSuccessRead
{
get => _nfcSuccessRead;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSuccessRead = value;
}
}
/// <summary>
/// [iOS] Successful write operation message
/// </summary>
public string NFCSuccessWrite
{
get => _nfcSuccessWrite;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSuccessWrite = value;
}
}
/// <summary>
/// [iOS] Successful clear operation message
/// </summary>
public string NFCSuccessClear
{
get => _nfcSuccessClear;
set
{
if (!string.IsNullOrWhiteSpace(value))
_nfcSuccessClear = value;
}
}
}
}
+62 -62
View File
@@ -1,62 +1,62 @@
namespace Plugin.NFC
{
/// <summary>
/// Default implementation of <see cref="ITagInfo"/>
/// </summary>
public class TagInfo : ITagInfo
{
public byte[] Identifier { get; }
/// <summary>
/// Tag Serial Number
/// </summary>
public string SerialNumber { get; }
/// <summary>
/// Writable tag
/// </summary>
public bool IsWritable { get; set; }
/// <summary>
/// Capacity of tag in bytes
/// </summary>
public int Capacity { get; set; }
/// <summary>
/// Array of <see cref="NFCNdefRecord"/> of tag
/// </summary>
public NFCNdefRecord[] Records { get; set; }
/// <summary>
/// Empty tag
/// </summary>
public bool IsEmpty => Records == null || Records.Length == 0 || Records[0] == null ||Records[0].TypeFormat == NFCNdefTypeFormat.Empty;
/// <summary>
///
/// </summary>
public bool IsSupported { get; private set; }
/// <summary>
/// Default constructor
/// </summary>
public TagInfo()
{
IsSupported = true;
}
/// <summary>
/// Custom contructor
/// </summary>
/// <param name="identifier">Tag Identifier</param>
/// <param name="isNdef">Is Ndef tag</param>
public TagInfo(byte[] identifier, bool isNdef = true)
{
Identifier = identifier;
SerialNumber = NFCUtils.ByteArrayToHexString(identifier);
IsSupported = isNdef;
}
public override string ToString() => $"TagInfo: identifier: {Identifier}, SerialNumber:{SerialNumber}, Capacity:{Capacity} bytes, IsSupported:{IsSupported}, IsEmpty:{IsEmpty}, IsWritable:{IsWritable}";
}
}
namespace Plugin.NFC
{
/// <summary>
/// Default implementation of <see cref="ITagInfo"/>
/// </summary>
public class TagInfo : ITagInfo
{
public byte[] Identifier { get; }
/// <summary>
/// Tag Serial Number
/// </summary>
public string SerialNumber { get; }
/// <summary>
/// Writable tag
/// </summary>
public bool IsWritable { get; set; }
/// <summary>
/// Capacity of tag in bytes
/// </summary>
public int Capacity { get; set; }
/// <summary>
/// Array of <see cref="NFCNdefRecord"/> of tag
/// </summary>
public NFCNdefRecord[] Records { get; set; }
/// <summary>
/// Empty tag
/// </summary>
public bool IsEmpty => Records == null || Records.Length == 0 || Records[0] == null ||Records[0].TypeFormat == NFCNdefTypeFormat.Empty;
/// <summary>
///
/// </summary>
public bool IsSupported { get; private set; }
/// <summary>
/// Default constructor
/// </summary>
public TagInfo()
{
IsSupported = true;
}
/// <summary>
/// Custom contructor
/// </summary>
/// <param name="identifier">Tag Identifier</param>
/// <param name="isNdef">Is Ndef tag</param>
public TagInfo(byte[] identifier, bool isNdef = true)
{
Identifier = identifier;
SerialNumber = NFCUtils.ByteArrayToHexString(identifier);
IsSupported = isNdef;
}
public override string ToString() => $"TagInfo: identifier: {Identifier}, SerialNumber:{SerialNumber}, Capacity:{Capacity} bytes, IsSupported:{IsSupported}, IsEmpty:{IsEmpty}, IsWritable:{IsWritable}";
}
}
+1303 -1303
View File
File diff suppressed because it is too large Load Diff
+46 -46
View File
@@ -1,46 +1,46 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35527.113
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.API", "WorkFlowCheck.API\WorkFlowCheck.API.csproj", "{2466E04A-CB0C-4421-9074-A928F819926C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.DL", "WorkFlowCheck.DL\WorkFlowCheck.DL.csproj", "{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.BL", "WorkFlowCheck.BL\WorkFlowCheck.BL.csproj", "{73049F81-7A5D-4819-ADB8-A9926672365E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.Common", "WorkFlowCheck.Common\WorkFlowCheck.Common.csproj", "{7F94D6CB-3358-4687-88E1-FA46053D6B71}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.Web", "WorkFlowCheck.Web\WorkFlowCheck.Web.csproj", "{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2466E04A-CB0C-4421-9074-A928F819926C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2466E04A-CB0C-4421-9074-A928F819926C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2466E04A-CB0C-4421-9074-A928F819926C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2466E04A-CB0C-4421-9074-A928F819926C}.Release|Any CPU.Build.0 = Release|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Release|Any CPU.Build.0 = Release|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Release|Any CPU.Build.0 = Release|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Release|Any CPU.Build.0 = Release|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.2.11408.102 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.API", "WorkFlowCheck.API\WorkFlowCheck.API.csproj", "{2466E04A-CB0C-4421-9074-A928F819926C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.DL", "WorkFlowCheck.DL\WorkFlowCheck.DL.csproj", "{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.BL", "WorkFlowCheck.BL\WorkFlowCheck.BL.csproj", "{73049F81-7A5D-4819-ADB8-A9926672365E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.Common", "WorkFlowCheck.Common\WorkFlowCheck.Common.csproj", "{7F94D6CB-3358-4687-88E1-FA46053D6B71}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.Web", "WorkFlowCheck.Web\WorkFlowCheck.Web.csproj", "{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2466E04A-CB0C-4421-9074-A928F819926C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2466E04A-CB0C-4421-9074-A928F819926C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2466E04A-CB0C-4421-9074-A928F819926C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2466E04A-CB0C-4421-9074-A928F819926C}.Release|Any CPU.Build.0 = Release|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Release|Any CPU.Build.0 = Release|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Release|Any CPU.Build.0 = Release|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Release|Any CPU.Build.0 = Release|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+12 -12
View File
@@ -1,13 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "9.0.0",
"commands": [
"dotnet-ef"
],
"rollForward": false
}
}
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "9.0.0",
"commands": [
"dotnet-ef"
],
"rollForward": false
}
}
}
@@ -1,417 +1,463 @@
using Microsoft.AspNetCore.Mvc;
using Serilog;
using WorkFlowCheck.BL.Services;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class CheckListController : ControllerBase
{
private ICheckListService _checkListService;
public CheckListController(ICheckListService checkListService)
{
_checkListService = checkListService;
}
[HttpGet("GetCheckListHeader/{id}")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> GetCheckListHeader(int id)
{
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true,
};
var checkListHeaderDTO = await _checkListService.GetCheckListHeaderAsync(id);
if (checkListHeaderDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListHeaderDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("CreatePDF/{id}")]
public async Task<ApiResponseDTO<byte[]>> CreatePDF(int id)
{
var retVal = new ApiResponseDTO<byte[]>()
{
IsSuccess = true,
};
var checkListHeader = await _checkListService.GetCheckListHeaderAsync(id);
var response = await _checkListService.CreateCheckListHeaderPDFAsync(id);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllCheckListHeaders")]
public async Task<ApiResponseDTO<List<CheckListHeaderDTO>>> GetAllCheckListHeadersAsync()
{
var retVal = new ApiResponseDTO<List<CheckListHeaderDTO>>()
{
IsSuccess = true,
};
var checkPointListDTO = await _checkListService.GetAllCheckListHeaderAsync();
if (checkPointListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckListHeader")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> UpdateCheckListHeader([FromBody] CheckListHeaderDTO checkListHeaderDTO)
{
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.UpdateCheckListHeaderAsync(checkListHeaderDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpPost("StartNewCheckList")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew([FromBody] CheckListHeaderNewDTO checkListHeaderNewDTO)
{
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true
};
try
{
var response = await _checkListService.StartNewCheckListAsync(checkListHeaderNewDTO);
if (response != null)
{
retVal.Data = response;
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpPost("CloseCheckListHeader")]
public async Task<ApiResponseDTO<bool>> CloseCheckListHeader([FromBody] CheckListHeaderCloseDTO checkListHeaderCloseDTO)
{
var retVal = new ApiResponseDTO<bool>() { IsSuccess = false };
try
{
var result = await _checkListService.CloseCheckListHeader(checkListHeaderCloseDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("AcceptCheckListHeader/{id}/{userId}")]
public async Task<ApiResponseDTO<bool>> AcceptCheckListHeader(int id, int userId)
{
var retVal = new ApiResponseDTO<bool> { IsSuccess = false };
var response = await _checkListService.AcceptCheckListHeaderAsync(id, userId);
if (response)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("BlockCheckListHeader/{id}/{userId}")]
public async Task<ApiResponseDTO<bool>> BlockCheckListHeader(int id, int userId)
{
var retVal = new ApiResponseDTO<bool> { IsSuccess = false };
var response = await _checkListService.BlockCheckListHeaderAsync(id, userId);
if (response)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("UnBlockCheckListHeader/{id}/{userId}")]
public async Task<ApiResponseDTO<bool>> UnBlockCheckListHeader(int id, int userId)
{
var retVal = new ApiResponseDTO<bool> { IsSuccess = false };
var response = await _checkListService.UnBlockCheckListHeaderAsync(id, userId);
if (response)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetCheckListTemplateHeader/{id}")]
public async Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> GetCheckListTemplateHeader(int id)
{
var retVal = new ApiResponseDTO<CheckListTemplateHeaderDTO>()
{
IsSuccess = true,
};
var CheckListTemplateHeaderDTO = await _checkListService.GetCheckListTemplateHeaderAsync(id);
if (CheckListTemplateHeaderDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = CheckListTemplateHeaderDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllCheckListTemplateHeaders")]
public async Task<ApiResponseDTO<List<CheckListTemplateHeaderDTO>>> GetAllCheckListTemplateHeadersAsync()
{
var retVal = new ApiResponseDTO<List<CheckListTemplateHeaderDTO>>()
{
IsSuccess = true,
};
var checkPointListDTO = await _checkListService.GetAllCheckListTemplateHeaderAsync();
if (checkPointListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckListTemplateHeader")]
public async Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> UpdateCheckListTemplateHeader([FromBody] CheckListTemplateHeaderDTO CheckListTemplateHeaderDTO)
{
var retVal = new ApiResponseDTO<CheckListTemplateHeaderDTO>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("DeleteCheckListTemplateHeader/{id}")]
public async Task<ApiResponseDTO<bool>> DeleteCheckListTemplateHeader(int id)
{
var retVal = new ApiResponseDTO<bool>()
{
IsSuccess = true,
};
var result = await _checkListService.DeleteCheckListTemplateHeaderAsync(id);
if (result != null)
{
retVal.IsSuccess = true;
retVal.Data = result;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetCheckListTemplateRow/{id}")]
public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> GetCheckListTemplateRow(int id)
{
var retVal = new ApiResponseDTO<CheckListTemplateRowDTO>()
{
IsSuccess = true,
};
var checkListTemplateRowDTO = await _checkListService.GetCheckListTemplateRowAsync(id);
if (checkListTemplateRowDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListTemplateRowDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("DeleteCheckListTemplateRow/{id}")]
public async Task<ApiResponseDTO<bool>> DeleteCheckListTemplateRow(int id)
{
var retVal = new ApiResponseDTO<bool>()
{
IsSuccess = true,
};
var result = await _checkListService.DeleteCheckListTemplateRowAsync(id);
if (result != null)
{
retVal.IsSuccess = true;
retVal.Data = result;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckListTemplateRow")]
public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow([FromBody] CheckListTemplateRowDTO CheckListTemplateRowDTO)
{
var retVal = new ApiResponseDTO<CheckListTemplateRowDTO>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetCheckListRow/{id}")]
public async Task<ApiResponseDTO<CheckListRowDTO>> GetCheckListRow(int id)
{
var retVal = new ApiResponseDTO<CheckListRowDTO>()
{
IsSuccess = true,
};
var checkListRowDTO = await _checkListService.GetCheckListRowAsync(id);
if (checkListRowDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListRowDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckListRow")]
public async Task<ApiResponseDTO<CheckListRowDTO>> UpdateCheckListRow([FromBody] CheckListRowDTO CheckListRowDTO)
{
var retVal = new ApiResponseDTO<CheckListRowDTO>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.UpdateCheckListRowAsync(CheckListRowDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
}
}
using Microsoft.AspNetCore.Mvc;
using Serilog;
using WorkFlowCheck.BL.Services;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DataTables;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class CheckListController : ControllerBase
{
private ICheckListService _checkListService;
public CheckListController(ICheckListService checkListService)
{
_checkListService = checkListService;
}
[HttpGet("GetCheckListHeader/{id}")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> GetCheckListHeader(int id)
{
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true,
};
var checkListHeaderDTO = await _checkListService.GetCheckListHeaderAsync(id);
if (checkListHeaderDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListHeaderDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("GetFilteredCheckListHeader")]
public async Task<ApiResponseListDTO<List<CheckListHeaderDTO>>> GetFilteredCheckListHeader([FromBody] DataTablesRequest dataTablesRequest)
{
var retVal = new ApiResponseListDTO<List<CheckListHeaderDTO>>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.GetFilteredCheckListHeaderAsync(dataTablesRequest);
retVal.Data = result.Data;
retVal.Total = result.Total;
retVal.Filtered = result.Filtered;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("CreatePDF/{id}")]
public async Task<ApiResponseDTO<byte[]>> CreatePDF(int id)
{
var retVal = new ApiResponseDTO<byte[]>()
{
IsSuccess = true,
};
var checkListHeader = await _checkListService.GetCheckListHeaderAsync(id);
var response = await _checkListService.CreateCheckListHeaderPDFAsync(id);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllCheckListHeaders/{mode}")]
public async Task<ApiResponseDTO<List<CheckListHeaderDTO>>> GetAllCheckListHeadersAsync(int mode = 0)
{
var retVal = new ApiResponseDTO<List<CheckListHeaderDTO>>()
{
IsSuccess = true,
};
var checkPointListDTO = await _checkListService.GetAllCheckListHeaderAsync(mode);
if (checkPointListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckListHeader")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> UpdateCheckListHeader([FromBody] CheckListHeaderDTO checkListHeaderDTO)
{
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.UpdateCheckListHeaderAsync(checkListHeaderDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpPost("StartNewCheckList")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew([FromBody] CheckListHeaderNewDTO checkListHeaderNewDTO)
{
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true
};
try
{
var response = await _checkListService.StartNewCheckListAsync(checkListHeaderNewDTO);
if (response != null)
{
retVal.Data = response;
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpPost("CloseCheckListHeader")]
public async Task<ApiResponseDTO<bool>> CloseCheckListHeader([FromBody] CheckListHeaderCloseDTO checkListHeaderCloseDTO)
{
var retVal = new ApiResponseDTO<bool>() { IsSuccess = false };
try
{
var result = await _checkListService.CloseCheckListHeader(checkListHeaderCloseDTO);
retVal.Data = result;
retVal.IsSuccess = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("AcceptCheckListHeader/{id}/{userId}")]
public async Task<ApiResponseDTO<bool>> AcceptCheckListHeader(int id, int userId)
{
var retVal = new ApiResponseDTO<bool> { IsSuccess = false };
var response = await _checkListService.AcceptCheckListHeaderAsync(id, userId);
if (response)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("BlockCheckListHeader/{id}/{userId}")]
public async Task<ApiResponseDTO<bool>> BlockCheckListHeader(int id, int userId)
{
var retVal = new ApiResponseDTO<bool> { IsSuccess = false };
var response = await _checkListService.BlockCheckListHeaderAsync(id, userId);
if (response)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("UnBlockCheckListHeader/{id}/{userId}")]
public async Task<ApiResponseDTO<bool>> UnBlockCheckListHeader(int id, int userId)
{
var retVal = new ApiResponseDTO<bool> { IsSuccess = false };
var response = await _checkListService.UnBlockCheckListHeaderAsync(id, userId);
if (response)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetCheckListTemplateHeader/{id}")]
public async Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> GetCheckListTemplateHeader(int id)
{
var retVal = new ApiResponseDTO<CheckListTemplateHeaderDTO>()
{
IsSuccess = true,
};
var CheckListTemplateHeaderDTO = await _checkListService.GetCheckListTemplateHeaderAsync(id);
if (CheckListTemplateHeaderDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = CheckListTemplateHeaderDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllCheckListTemplateHeaders")]
public async Task<ApiResponseDTO<List<CheckListTemplateHeaderDTO>>> GetAllCheckListTemplateHeadersAsync()
{
var retVal = new ApiResponseDTO<List<CheckListTemplateHeaderDTO>>()
{
IsSuccess = true,
};
var checkPointListDTO = await _checkListService.GetAllCheckListTemplateHeaderAsync();
if (checkPointListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckListTemplateHeader")]
public async Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> UpdateCheckListTemplateHeader([FromBody] CheckListTemplateHeaderDTO CheckListTemplateHeaderDTO)
{
var retVal = new ApiResponseDTO<CheckListTemplateHeaderDTO>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("DeleteCheckListTemplateHeader/{id}")]
public async Task<ApiResponseDTO<bool>> DeleteCheckListTemplateHeader(int id)
{
var retVal = new ApiResponseDTO<bool>()
{
IsSuccess = true,
};
var result = await _checkListService.DeleteCheckListTemplateHeaderAsync(id);
if (result != null)
{
retVal.IsSuccess = true;
retVal.Data = result;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("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}")]
public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> GetCheckListTemplateRow(int id)
{
var retVal = new ApiResponseDTO<CheckListTemplateRowDTO>()
{
IsSuccess = true,
};
var checkListTemplateRowDTO = await _checkListService.GetCheckListTemplateRowAsync(id);
if (checkListTemplateRowDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListTemplateRowDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("DeleteCheckListTemplateRow/{id}")]
public async Task<ApiResponseDTO<bool>> DeleteCheckListTemplateRow(int id)
{
var retVal = new ApiResponseDTO<bool>()
{
IsSuccess = true,
};
var result = await _checkListService.DeleteCheckListTemplateRowAsync(id);
if (result != null)
{
retVal.IsSuccess = true;
retVal.Data = result;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckListTemplateRow")]
public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow([FromBody] CheckListTemplateRowDTO CheckListTemplateRowDTO)
{
var retVal = new ApiResponseDTO<CheckListTemplateRowDTO>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetCheckListRow/{id}")]
public async Task<ApiResponseDTO<CheckListRowDTO>> GetCheckListRow(int id)
{
var retVal = new ApiResponseDTO<CheckListRowDTO>()
{
IsSuccess = true,
};
var checkListRowDTO = await _checkListService.GetCheckListRowAsync(id);
if (checkListRowDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListRowDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckListRow")]
public async Task<ApiResponseDTO<CheckListRowDTO>> UpdateCheckListRow([FromBody] CheckListRowDTO CheckListRowDTO)
{
var retVal = new ApiResponseDTO<CheckListRowDTO>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.UpdateCheckListRowAsync(CheckListRowDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
}
}
@@ -0,0 +1,83 @@
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;
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,399 +1,399 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Serilog;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class SystemController : ControllerBase
{
private readonly ISystemService _systemService;
public SystemController(ISystemService systemService)
{
_systemService = systemService;
}
[HttpGet("GetDatabaseAndVersionInfo")]
public async Task<ApiResponseDTO<string>> GetDatabaseAndVersionInfo()
{
var retVal = new ApiResponseDTO<string>()
{
IsSuccess = true,
};
var result = await _systemService.GetDatabaseAndVersionInfoAsync();
if (result != null)
{
retVal.IsSuccess = true;
retVal.Data = result;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllImageFiles")]
public async Task<ApiResponseDTO<List<ImageFileDTO>>> GetAllImageFilesAsync()
{
var retVal = new ApiResponseDTO<List<ImageFileDTO>>()
{
IsSuccess = true,
};
try
{
var allowedExtensions = new[] { ".png", ".jpg", ".jpeg", ".bmp", ".gif", ".webp", ".tiff" };
var imageFolder = Path.Combine(Directory.GetCurrentDirectory(), "Images");
var files = Directory.GetFiles(imageFolder)
.Where(f => allowedExtensions.Contains(Path.GetExtension(f).ToLower()))
.Select(f =>
{
var fileInfo = new FileInfo(f);
return new
{
FileName = fileInfo.Name,
FileSize = FormatFileSize(fileInfo.Length),
CreatedDate = fileInfo.CreationTime.ToString("yyyy.MM.dd HH:mm"),
};
});
var checkListFileInfos = new List<ImageFileDTO>();
foreach (var file in files.OrderBy(o => o.FileName).ToList())
{
var checkListFileInfoDTO = new ImageFileDTO()
{
FileName = file.FileName,
FileSize = file.FileSize,
CreateDate = file.CreatedDate,
};
checkListFileInfos.Add(checkListFileInfoDTO);
}
if (checkListFileInfos != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListFileInfos;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetAllPDFFiles")]
public async Task<ApiResponseDTO<List<ImageFileDTO>>> GetAllPDFilesAsync()
{
var retVal = new ApiResponseDTO<List<ImageFileDTO>>()
{
IsSuccess = true,
};
try
{
var pdfFolder = Path.Combine(Directory.GetCurrentDirectory(), "PDF");
var files = Directory.GetFiles(pdfFolder, "*.pdf")
.Select(f =>
{
var fileInfo = new FileInfo(f);
return new
{
FileName = fileInfo.Name,
FileSize = FormatFileSize(fileInfo.Length),
CreatedDate = fileInfo.CreationTime.ToString("yyyy.MM.dd HH:mm"),
};
});
var checkListFileInfos = new List<ImageFileDTO>();
foreach (var file in files.OrderBy(o => o.FileName).ToList())
{
var checkListFileInfoDTO = new ImageFileDTO()
{
FileName = file.FileName,
FileSize = file.FileSize,
CreateDate = file.CreatedDate,
};
checkListFileInfos.Add(checkListFileInfoDTO);
}
if (checkListFileInfos != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListFileInfos;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetAllLogAuditFiles")]
public async Task<ApiResponseDTO<List<LogFileDTO>>> GetAllLogAuditFilesAsync()
{
var retVal = new ApiResponseDTO<List<LogFileDTO>>()
{
IsSuccess = true,
};
try
{
var logAuditFiles = Path.Combine(Directory.GetCurrentDirectory(), "Logs\\AuditFlow");
var files = Directory.GetFiles(logAuditFiles, "*.log")
.Select(f =>
{
var fileInfo = new FileInfo(f);
return new
{
FileName = fileInfo.Name,
FileSize = FormatFileSize(fileInfo.Length),
CreatedDate = fileInfo.CreationTime.ToString("yyyy.MM.dd HH:mm"),
};
});
var checkListFileInfos = new List<LogFileDTO>();
foreach (var file in files.OrderBy(o => o.FileName).ToList())
{
var checkListFileInfoDTO = new LogFileDTO()
{
FileName = file.FileName,
FileSize = file.FileSize,
CreateDate = file.CreatedDate,
};
checkListFileInfos.Add(checkListFileInfoDTO);
}
if (checkListFileInfos != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListFileInfos;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetAllLogBusinessFiles")]
public async Task<ApiResponseDTO<List<LogFileDTO>>> GetAllLogBusinessFilesAsync()
{
var retVal = new ApiResponseDTO<List<LogFileDTO>>()
{
IsSuccess = true,
};
try
{
var logBusinessFiles = Path.Combine(Directory.GetCurrentDirectory(), "Logs\\BusinessFlow");
var files = Directory.GetFiles(logBusinessFiles, "*.log")
.Select(f =>
{
var fileInfo = new FileInfo(f);
return new
{
FileName = fileInfo.Name,
FileSize = FormatFileSize(fileInfo.Length),
CreatedDate = fileInfo.CreationTime.ToString("yyyy.MM.dd HH:mm"),
};
});
var checkListFileInfos = new List<LogFileDTO>();
foreach (var file in files.OrderBy(o => o.FileName).ToList())
{
var checkListFileInfoDTO = new LogFileDTO()
{
FileName = file.FileName,
FileSize = file.FileSize,
CreateDate = file.CreatedDate,
};
checkListFileInfos.Add(checkListFileInfoDTO);
}
if (checkListFileInfos != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListFileInfos;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("DownloadFile/{filename}")]
public async Task<ApiResponseDTO<byte[]>> DownloadFile(string filename)
{
var retVal = new ApiResponseDTO<byte[]>()
{
IsSuccess = false,
};
var imageFile = Path.Combine(Directory.GetCurrentDirectory(), "Images", filename);
if (!System.IO.File.Exists(imageFile))
{
retVal.Errors.Add($"{filename} does not exist");
return retVal;
}
byte[] response = System.IO.File.ReadAllBytes(imageFile);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("DownloadPDFFile/{filename}")]
public async Task<ApiResponseDTO<byte[]>> DownloadPDFFile(string filename)
{
var retVal = new ApiResponseDTO<byte[]>()
{
IsSuccess = false,
};
var imageFile = Path.Combine(Directory.GetCurrentDirectory(), "PDF", filename);
if (!System.IO.File.Exists(imageFile))
{
retVal.Errors.Add($"{filename} does not exist");
return retVal;
}
byte[] response = System.IO.File.ReadAllBytes(imageFile);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("DownloadAuditLogFile/{filename}")]
public async Task<ApiResponseDTO<byte[]>> DownloadAuditLogFile(string filename)
{
var retVal = new ApiResponseDTO<byte[]>()
{
IsSuccess = false,
};
var imageFile = Path.Combine(Directory.GetCurrentDirectory(), "Logs\\AuditFlow", filename);
if (!System.IO.File.Exists(imageFile))
{
retVal.Errors.Add($"{filename} does not exist");
return retVal;
}
byte[] response = System.IO.File.ReadAllBytes(imageFile);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("DownloadBusinessLogFile/{filename}")]
public async Task<ApiResponseDTO<byte[]>> DownloadBusinessLogFile(string filename)
{
var retVal = new ApiResponseDTO<byte[]>()
{
IsSuccess = false,
};
var imageFile = Path.Combine(Directory.GetCurrentDirectory(), "Logs\\BusinessFlow", filename);
if (!System.IO.File.Exists(imageFile))
{
retVal.Errors.Add($"{filename} does not exist");
return retVal;
}
byte[] response = System.IO.File.ReadAllBytes(imageFile);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
private string FormatFileSize(long bytes)
{
string[] sizes = { "B", "KB", "MB", "GB", "TB" };
double len = bytes;
int order = 0;
while (len >= 1024 && order < sizes.Length - 1)
{
order++;
len /= 1024;
}
return $"{len:0.##} {sizes[order]}";
}
}
}
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Serilog;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class SystemController : ControllerBase
{
private readonly ISystemService _systemService;
public SystemController(ISystemService systemService)
{
_systemService = systemService;
}
[HttpGet("GetDatabaseAndVersionInfo")]
public async Task<ApiResponseDTO<string>> GetDatabaseAndVersionInfo()
{
var retVal = new ApiResponseDTO<string>()
{
IsSuccess = true,
};
var result = await _systemService.GetDatabaseAndVersionInfoAsync();
if (result != null)
{
retVal.IsSuccess = true;
retVal.Data = result;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllImageFiles")]
public async Task<ApiResponseDTO<List<ImageFileDTO>>> GetAllImageFilesAsync()
{
var retVal = new ApiResponseDTO<List<ImageFileDTO>>()
{
IsSuccess = true,
};
try
{
var allowedExtensions = new[] { ".png", ".jpg", ".jpeg", ".bmp", ".gif", ".webp", ".tiff" };
var imageFolder = Path.Combine(Directory.GetCurrentDirectory(), "Images");
var files = Directory.GetFiles(imageFolder)
.Where(f => allowedExtensions.Contains(Path.GetExtension(f).ToLower()))
.Select(f =>
{
var fileInfo = new FileInfo(f);
return new
{
FileName = fileInfo.Name,
FileSize = FormatFileSize(fileInfo.Length),
CreatedDate = fileInfo.CreationTime.ToString("yyyy.MM.dd HH:mm"),
};
});
var checkListFileInfos = new List<ImageFileDTO>();
foreach (var file in files.OrderBy(o => o.FileName).ToList())
{
var checkListFileInfoDTO = new ImageFileDTO()
{
FileName = file.FileName,
FileSize = file.FileSize,
CreateDate = file.CreatedDate,
};
checkListFileInfos.Add(checkListFileInfoDTO);
}
if (checkListFileInfos != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListFileInfos;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetAllPDFFiles")]
public async Task<ApiResponseDTO<List<ImageFileDTO>>> GetAllPDFilesAsync()
{
var retVal = new ApiResponseDTO<List<ImageFileDTO>>()
{
IsSuccess = true,
};
try
{
var pdfFolder = Path.Combine(Directory.GetCurrentDirectory(), "PDF");
var files = Directory.GetFiles(pdfFolder, "*.pdf")
.Select(f =>
{
var fileInfo = new FileInfo(f);
return new
{
FileName = fileInfo.Name,
FileSize = FormatFileSize(fileInfo.Length),
CreatedDate = fileInfo.CreationTime.ToString("yyyy.MM.dd HH:mm"),
};
});
var checkListFileInfos = new List<ImageFileDTO>();
foreach (var file in files.OrderBy(o => o.FileName).ToList())
{
var checkListFileInfoDTO = new ImageFileDTO()
{
FileName = file.FileName,
FileSize = file.FileSize,
CreateDate = file.CreatedDate,
};
checkListFileInfos.Add(checkListFileInfoDTO);
}
if (checkListFileInfos != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListFileInfos;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetAllLogAuditFiles")]
public async Task<ApiResponseDTO<List<LogFileDTO>>> GetAllLogAuditFilesAsync()
{
var retVal = new ApiResponseDTO<List<LogFileDTO>>()
{
IsSuccess = true,
};
try
{
var logAuditFiles = Path.Combine(Directory.GetCurrentDirectory(), "Logs\\AuditFlow");
var files = Directory.GetFiles(logAuditFiles, "*.log")
.Select(f =>
{
var fileInfo = new FileInfo(f);
return new
{
FileName = fileInfo.Name,
FileSize = FormatFileSize(fileInfo.Length),
CreatedDate = fileInfo.CreationTime.ToString("yyyy.MM.dd HH:mm"),
};
});
var checkListFileInfos = new List<LogFileDTO>();
foreach (var file in files.OrderBy(o => o.FileName).ToList())
{
var checkListFileInfoDTO = new LogFileDTO()
{
FileName = file.FileName,
FileSize = file.FileSize,
CreateDate = file.CreatedDate,
};
checkListFileInfos.Add(checkListFileInfoDTO);
}
if (checkListFileInfos != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListFileInfos;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetAllLogBusinessFiles")]
public async Task<ApiResponseDTO<List<LogFileDTO>>> GetAllLogBusinessFilesAsync()
{
var retVal = new ApiResponseDTO<List<LogFileDTO>>()
{
IsSuccess = true,
};
try
{
var logBusinessFiles = Path.Combine(Directory.GetCurrentDirectory(), "Logs\\BusinessFlow");
var files = Directory.GetFiles(logBusinessFiles, "*.log")
.Select(f =>
{
var fileInfo = new FileInfo(f);
return new
{
FileName = fileInfo.Name,
FileSize = FormatFileSize(fileInfo.Length),
CreatedDate = fileInfo.CreationTime.ToString("yyyy.MM.dd HH:mm"),
};
});
var checkListFileInfos = new List<LogFileDTO>();
foreach (var file in files.OrderBy(o => o.FileName).ToList())
{
var checkListFileInfoDTO = new LogFileDTO()
{
FileName = file.FileName,
FileSize = file.FileSize,
CreateDate = file.CreatedDate,
};
checkListFileInfos.Add(checkListFileInfoDTO);
}
if (checkListFileInfos != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListFileInfos;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("DownloadFile/{filename}")]
public async Task<ApiResponseDTO<byte[]>> DownloadFile(string filename)
{
var retVal = new ApiResponseDTO<byte[]>()
{
IsSuccess = false,
};
var imageFile = Path.Combine(Directory.GetCurrentDirectory(), "Images", filename);
if (!System.IO.File.Exists(imageFile))
{
retVal.Errors.Add($"{filename} does not exist");
return retVal;
}
byte[] response = System.IO.File.ReadAllBytes(imageFile);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("DownloadPDFFile/{filename}")]
public async Task<ApiResponseDTO<byte[]>> DownloadPDFFile(string filename)
{
var retVal = new ApiResponseDTO<byte[]>()
{
IsSuccess = false,
};
var imageFile = Path.Combine(Directory.GetCurrentDirectory(), "PDF", filename);
if (!System.IO.File.Exists(imageFile))
{
retVal.Errors.Add($"{filename} does not exist");
return retVal;
}
byte[] response = System.IO.File.ReadAllBytes(imageFile);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("DownloadAuditLogFile/{filename}")]
public async Task<ApiResponseDTO<byte[]>> DownloadAuditLogFile(string filename)
{
var retVal = new ApiResponseDTO<byte[]>()
{
IsSuccess = false,
};
var imageFile = Path.Combine(Directory.GetCurrentDirectory(), "Logs\\AuditFlow", filename);
if (!System.IO.File.Exists(imageFile))
{
retVal.Errors.Add($"{filename} does not exist");
return retVal;
}
byte[] response = System.IO.File.ReadAllBytes(imageFile);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("DownloadBusinessLogFile/{filename}")]
public async Task<ApiResponseDTO<byte[]>> DownloadBusinessLogFile(string filename)
{
var retVal = new ApiResponseDTO<byte[]>()
{
IsSuccess = false,
};
var imageFile = Path.Combine(Directory.GetCurrentDirectory(), "Logs\\BusinessFlow", filename);
if (!System.IO.File.Exists(imageFile))
{
retVal.Errors.Add($"{filename} does not exist");
return retVal;
}
byte[] response = System.IO.File.ReadAllBytes(imageFile);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
private string FormatFileSize(long bytes)
{
string[] sizes = { "B", "KB", "MB", "GB", "TB" };
double len = bytes;
int order = 0;
while (len >= 1024 && order < sizes.Length - 1)
{
order++;
len /= 1024;
}
return $"{len:0.##} {sizes[order]}";
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,42 +1,42 @@
namespace WorkFlowCheck.API.Middleware
{
public class ApiKeyMiddleware
{
private readonly RequestDelegate _next;
private const string ApiKeyHeaderName = "X-Api-Key";
private readonly ILogger<ApiKeyMiddleware> _logger;
public ApiKeyMiddleware(RequestDelegate next, ILogger<ApiKeyMiddleware> logger)
{
_next = next;
_logger = logger;
}
public async Task InvokeAsync(HttpContext context)
{
if (!context.Request.Headers.TryGetValue(ApiKeyHeaderName, out var extractedApiKey))
{
_logger.LogWarning("API Key is missing.");
context.Response.StatusCode = 401; // Unauthorized
context.Response.ContentType = "text/html; charset=utf-8";
await context.Response.WriteAsync("API Key hiányzik.");
return;
}
var appSettings = context.RequestServices.GetRequiredService<IConfiguration>();
var apiKey = appSettings.GetValue<string>("ApiKey");
if (!apiKey.Equals(extractedApiKey))
{
_logger.LogWarning("Invalid API Key.");
context.Response.StatusCode = 403; // Forbidden
context.Response.ContentType = "text/html; charset=utf-8";
await context.Response.WriteAsync("Helytelen API Key.");
return;
}
await _next(context);
}
}
}
namespace WorkFlowCheck.API.Middleware
{
public class ApiKeyMiddleware
{
private readonly RequestDelegate _next;
private const string ApiKeyHeaderName = "X-Api-Key";
private readonly ILogger<ApiKeyMiddleware> _logger;
public ApiKeyMiddleware(RequestDelegate next, ILogger<ApiKeyMiddleware> logger)
{
_next = next;
_logger = logger;
}
public async Task InvokeAsync(HttpContext context)
{
if (!context.Request.Headers.TryGetValue(ApiKeyHeaderName, out var extractedApiKey))
{
_logger.LogWarning("API Key is missing.");
context.Response.StatusCode = 401; // Unauthorized
context.Response.ContentType = "text/html; charset=utf-8";
await context.Response.WriteAsync("API Key hiányzik.");
return;
}
var appSettings = context.RequestServices.GetRequiredService<IConfiguration>();
var apiKey = appSettings.GetValue<string>("ApiKey");
if (!apiKey.Equals(extractedApiKey))
{
_logger.LogWarning("Invalid API Key.");
context.Response.StatusCode = 403; // Forbidden
context.Response.ContentType = "text/html; charset=utf-8";
await context.Response.WriteAsync("Helytelen API Key.");
return;
}
await _next(context);
}
}
}
@@ -1,55 +1,55 @@
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
namespace WorkFlowCheck.API.Middleware
{
public class JwtMiddleware
{
private readonly RequestDelegate _next;
public readonly IConfiguration _configuration;
public JwtMiddleware(RequestDelegate next, IConfiguration configuration)
{
_next = next;
_configuration = configuration;
}
public async Task Invoke(HttpContext context)
{
var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();
if (!string.IsNullOrEmpty(token) && ValidateToken(token, out var claims))
{
context.User = new ClaimsPrincipal(new ClaimsIdentity(claims, "jwt"));
}
await _next(context);
}
private bool ValidateToken(string token, out Claim[] claims)
{
var jwtSettings = _configuration.GetSection("Jwt");
var secretKey = jwtSettings["SecretKey"];
claims = null;
var tokenHandler = new JwtSecurityTokenHandler();
var key = Encoding.UTF8.GetBytes(secretKey);
try
{
var principal = tokenHandler.ValidateToken(token, new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(key),
ValidateIssuer = false,
ValidateAudience = false,
ClockSkew = TimeSpan.Zero
}, out var validatedToken);
claims = principal.Claims.ToArray();
return true;
}
catch
{
return false;
}
}
}
}
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
namespace WorkFlowCheck.API.Middleware
{
public class JwtMiddleware
{
private readonly RequestDelegate _next;
public readonly IConfiguration _configuration;
public JwtMiddleware(RequestDelegate next, IConfiguration configuration)
{
_next = next;
_configuration = configuration;
}
public async Task Invoke(HttpContext context)
{
var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();
if (!string.IsNullOrEmpty(token) && ValidateToken(token, out var claims))
{
context.User = new ClaimsPrincipal(new ClaimsIdentity(claims, "jwt"));
}
await _next(context);
}
private bool ValidateToken(string token, out Claim[] claims)
{
var jwtSettings = _configuration.GetSection("Jwt");
var secretKey = jwtSettings["SecretKey"];
claims = null;
var tokenHandler = new JwtSecurityTokenHandler();
var key = Encoding.UTF8.GetBytes(secretKey);
try
{
var principal = tokenHandler.ValidateToken(token, new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(key),
ValidateIssuer = false,
ValidateAudience = false,
ClockSkew = TimeSpan.Zero
}, out var validatedToken);
claims = principal.Claims.ToArray();
return true;
}
catch
{
return false;
}
}
}
}
Binary file not shown.
+177 -177
View File
@@ -1,177 +1,177 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Models;
using System.Text.Json;
using System.Text.Json.Serialization;
using WorkFlowCheck.DL;
using Microsoft.AspNetCore.Mvc;
using Serilog;
using WorkFlowCheck.BL.Mappings;
using WorkFlowCheck.BL.Infra;
using WorkFlowCheck.DL.Seed;
using WorkFlowCheck.Common.RequestContext;
using WorkFlowCheck.API.RequestContext;
using WorkFlowCheck.API.Middleware;
using Serilog.Filters;
var builder = WebApplication.CreateBuilder(args);
//------------------------------------------------------------------------------------------------------------------
string baseLogPath = Path.Combine(Directory.GetCurrentDirectory(), "Logs");
if (!Directory.Exists(baseLogPath))
Directory.CreateDirectory(baseLogPath);
string auditLogPath = Path.Combine(Directory.GetCurrentDirectory(), "Logs", "AuditFlow");
if (!Directory.Exists(auditLogPath))
Directory.CreateDirectory(auditLogPath);
string businessLogPath = Path.Combine(Directory.GetCurrentDirectory(), "Logs", "BusinessFlow");
if (!Directory.Exists(businessLogPath))
Directory.CreateDirectory(businessLogPath);
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(builder.Configuration) // Konfiguráció betöltése
.WriteTo.Console()
.WriteTo.File("logs/log-.log", rollingInterval: RollingInterval.Day)
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(Matching.WithProperty("TAG", "AuditFlow"))
.WriteTo.File("Logs/AuditFlow/au-.log", rollingInterval: RollingInterval.Day)
)
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(Matching.WithProperty("TAG", "BusinessFlow"))
.WriteTo.File("Logs/BusinessFlow/bs-.log", rollingInterval: RollingInterval.Day)
)
.CreateLogger();
//------------------------------------------------------------------------------------------------------------------
Log.ForContext("TAG", "BusinessFlow").Information("API indítása...");
builder.Services.AddAutoMapper(typeof(MapperProfile));
builder.Services.AddMemoryCache();
builder.Services.AddHttpContextAccessor();
builder.Services.AddScoped<IRequestContext, HttpRequestContext>();
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddDbContext<AppDbContext>(options =>
options.UseSqlServer(connectionString, x => x.MigrationsAssembly("WorkFlowCheck.DL")));
//DI
DIConfig.DIInit(builder.Services);
// SWAGGER !!!
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WorkFlowCheck API", Version = "v1" });
// API Key Auth definíció
c.AddSecurityDefinition("ApiKey", new OpenApiSecurityScheme
{
Description = "API Key szükséges. Használat: 'ApiKey: {kulcs}'",
Name = "X-Api-Key", // A fejlécek között keresendõ
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey,
Scheme = "ApiKey"
});
c.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "ApiKey"
},
Scheme = "ApiKey",
Name = "ApiKey",
In = ParameterLocation.Header,
},
Array.Empty<string>()
}
});
});
builder.Host.UseSerilog();
builder.Services.AddControllers()
.AddNewtonsoftJson(options =>
{
// Itt konfigurálhatod az egyedi beállításokat
options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
});
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(policy =>
{
policy.WithOrigins("*").AllowAnyMethod().AllowAnyHeader();
});
});
builder.WebHost.ConfigureKestrel(options =>
{
var kestrelConfig = builder.Configuration.GetSection("Kestrel");
options.Configure(kestrelConfig);
});
var app = builder.Build();
//----------------- Munkakönyvtárak létrehozása -----------------------------
string imageDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Images");
if (!Directory.Exists(imageDirectory))
{
Directory.CreateDirectory(imageDirectory);
}
string pdfDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Pdf");
// Ensure the Images directory exists
if (!Directory.Exists(pdfDirectory))
{
Directory.CreateDirectory(pdfDirectory);
}
string downloadDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Downloads");
if (!Directory.Exists(downloadDirectory))
{
Directory.CreateDirectory(downloadDirectory);
}
string downloadAPKDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Downloads","APK");
if (!Directory.Exists(downloadAPKDirectory))
{
Directory.CreateDirectory(downloadAPKDirectory);
}
//---------------------------------------------------------------------------
using (var scope = app.Services.CreateScope())
{
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
DBInitializer.Seed(context);
}
// Swagger middleware
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "WorkFlowCheck API v1");
});
}
// Routing és endpointok
//app.UseHttpsRedirection();
app.UseRouting();
app.UseMiddleware<ApiKeyMiddleware>();
app.UseMiddleware<JwtMiddleware>();
app.MapControllers();
app.UseAuthorization();
app.UseCors();
Log.ForContext("TAG", "BusinessFlow").Information("API fut.");
app.Run();
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Models;
using System.Text.Json;
using System.Text.Json.Serialization;
using WorkFlowCheck.DL;
using Microsoft.AspNetCore.Mvc;
using Serilog;
using WorkFlowCheck.BL.Mappings;
using WorkFlowCheck.BL.Infra;
using WorkFlowCheck.DL.Seed;
using WorkFlowCheck.Common.RequestContext;
using WorkFlowCheck.API.RequestContext;
using WorkFlowCheck.API.Middleware;
using Serilog.Filters;
var builder = WebApplication.CreateBuilder(args);
//------------------------------------------------------------------------------------------------------------------
string baseLogPath = Path.Combine(Directory.GetCurrentDirectory(), "Logs");
if (!Directory.Exists(baseLogPath))
Directory.CreateDirectory(baseLogPath);
string auditLogPath = Path.Combine(Directory.GetCurrentDirectory(), "Logs", "AuditFlow");
if (!Directory.Exists(auditLogPath))
Directory.CreateDirectory(auditLogPath);
string businessLogPath = Path.Combine(Directory.GetCurrentDirectory(), "Logs", "BusinessFlow");
if (!Directory.Exists(businessLogPath))
Directory.CreateDirectory(businessLogPath);
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(builder.Configuration) // Konfiguráció betöltése
.WriteTo.Console()
.WriteTo.File("logs/log-.log", rollingInterval: RollingInterval.Day)
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(Matching.WithProperty("TAG", "AuditFlow"))
.WriteTo.File("Logs/AuditFlow/au-.log", rollingInterval: RollingInterval.Day)
)
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(Matching.WithProperty("TAG", "BusinessFlow"))
.WriteTo.File("Logs/BusinessFlow/bs-.log", rollingInterval: RollingInterval.Day)
)
.CreateLogger();
//------------------------------------------------------------------------------------------------------------------
Log.ForContext("TAG", "BusinessFlow").Information("API indítása...");
builder.Services.AddAutoMapper(typeof(MapperProfile));
builder.Services.AddMemoryCache();
builder.Services.AddHttpContextAccessor();
builder.Services.AddScoped<IRequestContext, HttpRequestContext>();
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddDbContext<AppDbContext>(options =>
options.UseSqlServer(connectionString, x => x.MigrationsAssembly("WorkFlowCheck.DL")));
//DI
DIConfig.DIInit(builder.Services);
// SWAGGER !!!
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WorkFlowCheck API", Version = "v1" });
// API Key Auth definíció
c.AddSecurityDefinition("ApiKey", new OpenApiSecurityScheme
{
Description = "API Key szükséges. Használat: 'ApiKey: {kulcs}'",
Name = "X-Api-Key", // A fejlécek között keresendõ
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey,
Scheme = "ApiKey"
});
c.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "ApiKey"
},
Scheme = "ApiKey",
Name = "ApiKey",
In = ParameterLocation.Header,
},
Array.Empty<string>()
}
});
});
builder.Host.UseSerilog();
builder.Services.AddControllers()
.AddNewtonsoftJson(options =>
{
// Itt konfigurálhatod az egyedi beállításokat
options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
});
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(policy =>
{
policy.WithOrigins("*").AllowAnyMethod().AllowAnyHeader();
});
});
builder.WebHost.ConfigureKestrel(options =>
{
var kestrelConfig = builder.Configuration.GetSection("Kestrel");
options.Configure(kestrelConfig);
});
var app = builder.Build();
//----------------- Munkakönyvtárak létrehozása -----------------------------
string imageDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Images");
if (!Directory.Exists(imageDirectory))
{
Directory.CreateDirectory(imageDirectory);
}
string pdfDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Pdf");
// Ensure the Images directory exists
if (!Directory.Exists(pdfDirectory))
{
Directory.CreateDirectory(pdfDirectory);
}
string downloadDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Downloads");
if (!Directory.Exists(downloadDirectory))
{
Directory.CreateDirectory(downloadDirectory);
}
string downloadAPKDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Downloads","APK");
if (!Directory.Exists(downloadAPKDirectory))
{
Directory.CreateDirectory(downloadAPKDirectory);
}
//---------------------------------------------------------------------------
using (var scope = app.Services.CreateScope())
{
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
DBInitializer.Seed(context);
}
// Swagger middleware
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "WorkFlowCheck API v1");
});
}
// Routing és endpointok
//app.UseHttpsRedirection();
app.UseRouting();
app.UseMiddleware<ApiKeyMiddleware>();
app.UseMiddleware<JwtMiddleware>();
app.MapControllers();
app.UseAuthorization();
app.UseCors();
Log.ForContext("TAG", "BusinessFlow").Information("API fut.");
app.Run();
@@ -1,31 +1,41 @@
{
"profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:5069"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59027/",
"sslPort": 44382
}
}
{
"profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:5069"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"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",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59027/",
"sslPort": 44382
}
}
}
@@ -1,37 +1,37 @@
using Microsoft.Extensions.Caching.Memory;
using System.Diagnostics;
using System.Security.Claims;
using WorkFlowCheck.Common.Constants;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Common.RequestContext;
namespace WorkFlowCheck.API.RequestContext
{
public class HttpRequestContext : IRequestContext
{
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IMemoryCache _memoryCache;
public HttpRequestContext(IHttpContextAccessor httpContextAccessor, IMemoryCache memoryCache)
{
_httpContextAccessor = httpContextAccessor;
_memoryCache = memoryCache;
TraceId = Activity.Current?.Id;
}
public string TraceId { get; }
public int? CurrentUserId => CurrentDbUser?.Id;
public string CurrentUsername => CurrentHttpUser?.Identity.Name;
public string CurrentUserEmail => CurrentHttpUser?.FindFirst(System.Security.Claims.ClaimTypes.Email)?.Value;
public CancellationToken RequestAborted => _httpContextAccessor.HttpContext.RequestAborted;
private UserDTO CurrentDbUser => _memoryCache.Get<UserDTO>(MemoryCacheNames.UsersNamePrefix + CurrentUserEmail);
private ClaimsPrincipal CurrentHttpUser => _httpContextAccessor.HttpContext.User;
}
}
using Microsoft.Extensions.Caching.Memory;
using System.Diagnostics;
using System.Security.Claims;
using WorkFlowCheck.Common.Constants;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Common.RequestContext;
namespace WorkFlowCheck.API.RequestContext
{
public class HttpRequestContext : IRequestContext
{
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IMemoryCache _memoryCache;
public HttpRequestContext(IHttpContextAccessor httpContextAccessor, IMemoryCache memoryCache)
{
_httpContextAccessor = httpContextAccessor;
_memoryCache = memoryCache;
TraceId = Activity.Current?.Id;
}
public string TraceId { get; }
public int? CurrentUserId => CurrentDbUser?.Id;
public string CurrentUsername => CurrentHttpUser?.Identity.Name;
public string CurrentUserEmail => CurrentHttpUser?.FindFirst(System.Security.Claims.ClaimTypes.Email)?.Value;
public CancellationToken RequestAborted => _httpContextAccessor.HttpContext.RequestAborted;
private UserDTO CurrentDbUser => _memoryCache.Get<UserDTO>(MemoryCacheNames.UsersNamePrefix + CurrentUserEmail);
private ClaimsPrincipal CurrentHttpUser => _httpContextAccessor.HttpContext.User;
}
}
+57 -55
View File
@@ -1,55 +1,57 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>false</InvariantGlobalization>
<PublishAot>false</PublishAot>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\WorkFlowCheck.BL\WorkFlowCheck.BL.csproj" />
<ProjectReference Include="..\WorkFlowCheck.DL\WorkFlowCheck.DL.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MailKit" Version="4.11.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.12">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
</ItemGroup>
<ItemGroup>
<None Update="Certs\SwaggerCert.pfx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Pdf\CheckList_Template_V1.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="Logs\" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>false</InvariantGlobalization>
<PublishAot>false</PublishAot>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
<UserSecretsId>4081cb25-5ca2-40a1-a788-0d8396b4f50e</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\WorkFlowCheck.BL\WorkFlowCheck.BL.csproj" />
<ProjectReference Include="..\WorkFlowCheck.DL\WorkFlowCheck.DL.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Apis.Auth" Version="1.69.0" />
<PackageReference Include="MailKit" Version="4.11.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.12">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
</ItemGroup>
<ItemGroup>
<None Update="Certs\SwaggerCert.pfx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Pdf\CheckList_Template_V1.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="Logs\" />
</ItemGroup>
</Project>
+11 -11
View File
@@ -1,11 +1,11 @@
@WorkFlowCheck.API_HostAddress = http://localhost:5069
GET {{WorkFlowCheck.API_HostAddress}}/todos/
Accept: application/json
###
GET {{WorkFlowCheck.API_HostAddress}}/todos/1
Accept: application/json
###
@WorkFlowCheck.API_HostAddress = http://localhost:5069
GET {{WorkFlowCheck.API_HostAddress}}/todos/
Accept: application/json
###
GET {{WorkFlowCheck.API_HostAddress}}/todos/1
Accept: application/json
###
@@ -1,11 +1,20 @@
{
"ConnectionStrings": {
"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"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
{
"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=MASERVER;Initial Catalog=WFCUAT;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://localhost:59027"
}
}
}
}
+74 -74
View File
@@ -1,74 +1,74 @@
{
"ConnectionStrings": {
"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"
},
"ApiKey": "RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=",
"Jwt": {
"SecretKey": "9aLxV2t7RpM8BfKqZwXy3GehYJDUNTCrHkVZ",
"Issuer": "https://wfcapi.nuvolar.hu/",
"Audience": "wfc-application",
"TokenLifetimeMinutes": 1440
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Information"
}
},
"Serilog": {
"MinimumLevel": "Information",
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "Logger",
"Args": {
"filter": "Equals(TAG, 'AuditFlow')",
"writeTo": [
{
"Name": "File",
"Args": {
"path": "Logs/AuditFlow/log-.txt",
"rollingInterval": "Day",
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"
}
}
]
}
},
{
"Name": "Logger",
"Args": {
"filter": "Equals(TAG, 'BusinessFlow')",
"writeTo": [
{
"Name": "File",
"Args": {
"path": "Logs/BusinessFlow/log-.txt",
"rollingInterval": "Day",
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"
}
}
]
}
}
],
"Enrich": [ "FromLogContext" ]
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://localhost:8660"
}
}
},
"EmailSettings": {
"SmtpServer": "smtp.gmail.com",
"SmtpPort": 587,
"Username": "nuvolarsetup@gmail.com",
"Password": "reiq pgfr nxub pvrb",
"SenderName": "Nuvolar System"
}
}
{
"ConnectionStrings": {
"DefaultConnection": "Data Source=MASERVER;Initial Catalog=WFCUAT;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False"
},
"ApiKey": "RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=",
"Jwt": {
"SecretKey": "9aLxV2t7RpM8BfKqZwXy3GehYJDUNTCrHkVZ",
"Issuer": "https://wfcapi.nuvolar.hu/",
"Audience": "wfc-application",
"TokenLifetimeMinutes": 1440
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Information"
}
},
"Serilog": {
"MinimumLevel": "Information",
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "Logger",
"Args": {
"filter": "Equals(TAG, 'AuditFlow')",
"writeTo": [
{
"Name": "File",
"Args": {
"path": "Logs/AuditFlow/log-.txt",
"rollingInterval": "Day",
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"
}
}
]
}
},
{
"Name": "Logger",
"Args": {
"filter": "Equals(TAG, 'BusinessFlow')",
"writeTo": [
{
"Name": "File",
"Args": {
"path": "Logs/BusinessFlow/log-.txt",
"rollingInterval": "Day",
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"
}
}
]
}
}
],
"Enrich": [ "FromLogContext" ]
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://localhost:8660"
}
}
},
"EmailSettings": {
"SmtpServer": "smtp.gmail.com",
"SmtpPort": 587,
"Username": "nuvolarsetup@gmail.com",
"Password": "reiq pgfr nxub pvrb",
"SenderName": "Nuvolar System"
}
}
@@ -0,0 +1,13 @@
{
"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"
}
+14 -2
View File
@@ -1,2 +1,14 @@
dotnet publish -c Release -o e:\wfcapi\
pause
@echo off
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
@@ -1,222 +1,225 @@
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using System.Diagnostics;
namespace WorkFlowCheck.BL.DocumentGenerator
{
public class DokumentumGenerator
{
public static byte[] DocxToPdfL(byte[] wordBytes, List<string> imagePaths = null)
{
string pdfDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Pdf");
string fileName = Guid.NewGuid().ToString();
string tempWordPath = Path.Combine(pdfDirectory, fileName + ".docx");
string tempPdfPath = Path.Combine(pdfDirectory, fileName + ".pdf");
try
{
// Word fájl mentése ideiglenes fájlba
File.WriteAllBytes(tempWordPath, wordBytes);
if (imagePaths != null && imagePaths.Count > 0)
{
using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(tempWordPath, true))
{
MainDocumentPart mainPart = wordDoc.MainDocumentPart;
foreach (string imagePath in imagePaths)
{
if (File.Exists(imagePath))
{
InsertImageAsNewPage(mainPart, imagePath);
}
}
wordDoc.MainDocumentPart.Document.Save();
}
}
// LibreOffice parancssori konverzió
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = "e:\\LibreOffice\\program\\soffice", // LibreOffice parancs
Arguments = $"--headless --convert-to pdf \"{tempWordPath}\" --outdir \"{pdfDirectory}",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
};
using (Process process = Process.Start(startInfo))
{
process.WaitForExit();
}
// Ellenőrzés, hogy létrejött-e a PDF
if (File.Exists(tempPdfPath))
{
byte[] pdfBytes = File.ReadAllBytes(tempPdfPath);
// Ideiglenes fájlok törlése
File.Delete(tempWordPath);
File.Delete(tempPdfPath);
return pdfBytes;
}
else
{
throw new Exception("PDF konverzió sikertelen.");
}
}
catch (Exception ex)
{
Console.WriteLine("Hiba a PDF konverzió során: " + ex.Message);
return null;
}
}
private static void InsertImageAsNewPage(MainDocumentPart mainPart, string imagePath)
{
string fileName = Path.GetFileName(imagePath);
// Kép méretezés – max szélesség/magasság A4 hasznos területhez igazítva
using var image = SixLabors.ImageSharp.Image.Load(imagePath);
int pixelWidth = image.Width;
int pixelHeight = image.Height;
long maxWidth = 5760000L; // kb. 16 cm
long maxHeight = 7200000L; // kb. 20 cm
double aspectRatio = (double)pixelHeight / pixelWidth;
long finalWidth = maxWidth;
long finalHeight = (long)(maxWidth * aspectRatio);
if (finalHeight > maxHeight)
{
finalHeight = maxHeight;
finalWidth = (long)(maxHeight / aspectRatio);
}
// Kép hozzáadása Word dokumentumhoz
ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Jpeg);
using (FileStream stream = new FileStream(imagePath, FileMode.Open))
{
imagePart.FeedData(stream);
}
string imagePartId = mainPart.GetIdOfPart(imagePart);
Drawing drawing = CreateImageDrawing(imagePartId, finalWidth, finalHeight);
// Kép beillesztése középre igazítva
Paragraph imageParagraph = new Paragraph(new Run(drawing))
{
ParagraphProperties = new ParagraphProperties(
new Justification() { Val = JustificationValues.Center }
)
};
TableCell imageCell = new TableCell(imageParagraph,
new TableCellProperties(
new TableCellVerticalAlignment { Val = TableVerticalAlignmentValues.Center },
new TableCellWidth() { Type = TableWidthUnitValues.Pct, Width = "10000" }
));
// Képes sor (magas, kitölti az oldalt)
TableRow imageRow = new TableRow(imageCell);
imageRow.AppendChild(new TableRowProperties(
new TableRowHeight() { Val = 9000, HeightType = HeightRuleValues.Exact }
));
// Fájlnév beillesztése középre
Paragraph fileNamePara = new Paragraph(new Run(new Text(fileName)))
{
ParagraphProperties = new ParagraphProperties(
new Justification() { Val = JustificationValues.Center }
)
};
TableCell fileNameCell = new TableCell(fileNamePara,
new TableCellProperties(
new TableCellVerticalAlignment { Val = TableVerticalAlignmentValues.Center },
new TableCellWidth() { Type = TableWidthUnitValues.Pct, Width = "10000" }
));
// Fájlnév sor (normál magasság)
TableRow fileNameRow = new TableRow(fileNameCell);
fileNameRow.AppendChild(new TableRowProperties(
new TableRowHeight() { Val = 400, HeightType = HeightRuleValues.Auto }
));
// Táblázat – szegély nélkül, teljes oldalszélességben
Table table = new Table(
new TableProperties(
new TableWidth { Width = "10000", Type = TableWidthUnitValues.Pct },
new TableBorders(
new TopBorder { Val = BorderValues.None },
new BottomBorder { Val = BorderValues.None },
new LeftBorder { Val = BorderValues.None },
new RightBorder { Val = BorderValues.None },
new InsideHorizontalBorder { Val = BorderValues.None },
new InsideVerticalBorder { Val = BorderValues.None }
)
),
imageRow,
fileNameRow
);
// Új oldal és a táblázat beszúrása a dokumentum végére
Body body = mainPart.Document.Body;
body.Append(new Paragraph(new Run(new Break() { Type = BreakValues.Page })));
body.Append(table);
}
private static Drawing CreateImageDrawing(string relationshipId, long width, long height)
{
return new Drawing(
new DocumentFormat.OpenXml.Drawing.Wordprocessing.Inline(
new DocumentFormat.OpenXml.Drawing.Wordprocessing.Extent() { Cx = width, Cy = height },
new DocumentFormat.OpenXml.Drawing.Wordprocessing.EffectExtent()
{
LeftEdge = 0L,
TopEdge = 0L,
RightEdge = 0L,
BottomEdge = 0L
},
new DocumentFormat.OpenXml.Drawing.Wordprocessing.DocProperties()
{
Id = (UInt32Value)1U,
Name = "Inserted Image"
},
new DocumentFormat.OpenXml.Drawing.Graphic(
new DocumentFormat.OpenXml.Drawing.GraphicData(
new DocumentFormat.OpenXml.Drawing.Pictures.Picture(
new DocumentFormat.OpenXml.Drawing.Pictures.NonVisualPictureProperties(
new DocumentFormat.OpenXml.Drawing.Pictures.NonVisualDrawingProperties()
{
Id = (UInt32Value)0U,
Name = "Picture"
},
new DocumentFormat.OpenXml.Drawing.Pictures.NonVisualPictureDrawingProperties()),
new DocumentFormat.OpenXml.Drawing.Pictures.BlipFill(
new DocumentFormat.OpenXml.Drawing.Blip()
{
Embed = relationshipId
},
new DocumentFormat.OpenXml.Drawing.Stretch(
new DocumentFormat.OpenXml.Drawing.FillRectangle())),
new DocumentFormat.OpenXml.Drawing.Pictures.ShapeProperties(
new DocumentFormat.OpenXml.Drawing.Transform2D(
new DocumentFormat.OpenXml.Drawing.Offset() { X = 0L, Y = 0L },
new DocumentFormat.OpenXml.Drawing.Extents() { Cx = width, Cy = height }),
new DocumentFormat.OpenXml.Drawing.PresetGeometry(
new DocumentFormat.OpenXml.Drawing.AdjustValueList())
{ Preset = DocumentFormat.OpenXml.Drawing.ShapeTypeValues.Rectangle }))
)
{ Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" })
)
{ DistanceFromTop = 0U, DistanceFromBottom = 0U, DistanceFromLeft = 0U, DistanceFromRight = 0U });
}
}
}
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using System.Diagnostics;
namespace WorkFlowCheck.BL.DocumentGenerator
{
public class DokumentumGenerator
{
public static byte[] DocxToPdfL(byte[] wordBytes, List<string> imagePaths = null)
{
string pdfDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Pdf");
string fileName = Guid.NewGuid().ToString();
string tempWordPath = Path.Combine(pdfDirectory, fileName + ".docx");
string tempPdfPath = Path.Combine(pdfDirectory, fileName + ".pdf");
try
{
// Word fájl mentése ideiglenes fájlba
File.WriteAllBytes(tempWordPath, wordBytes);
if (imagePaths != null && imagePaths.Count > 0)
{
using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(tempWordPath, true))
{
MainDocumentPart mainPart = wordDoc.MainDocumentPart;
foreach (string imagePath in imagePaths)
{
if (File.Exists(imagePath))
{
InsertImageAsNewPage(mainPart, imagePath);
}
}
wordDoc.MainDocumentPart.Document.Save();
}
}
// LibreOffice parancssori konverzió
ProcessStartInfo startInfo = new ProcessStartInfo
{
#if !DEBUG
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}",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
};
using (Process process = Process.Start(startInfo))
{
process.WaitForExit();
}
// Ellenőrzés, hogy létrejött-e a PDF
if (File.Exists(tempPdfPath))
{
byte[] pdfBytes = File.ReadAllBytes(tempPdfPath);
// Ideiglenes fájlok törlése
File.Delete(tempWordPath);
File.Delete(tempPdfPath);
return pdfBytes;
}
else
{
throw new Exception("PDF konverzió sikertelen.");
}
}
catch (Exception ex)
{
Console.WriteLine("Hiba a PDF konverzió során: " + ex.Message);
return null;
}
}
private static void InsertImageAsNewPage(MainDocumentPart mainPart, string imagePath)
{
string fileName = Path.GetFileName(imagePath);
// Kép méretezés – max szélesség/magasság A4 hasznos területhez igazítva
using var image = SixLabors.ImageSharp.Image.Load(imagePath);
int pixelWidth = image.Width;
int pixelHeight = image.Height;
long maxWidth = 5760000L; // kb. 16 cm
long maxHeight = 7200000L; // kb. 20 cm
double aspectRatio = (double)pixelHeight / pixelWidth;
long finalWidth = maxWidth;
long finalHeight = (long)(maxWidth * aspectRatio);
if (finalHeight > maxHeight)
{
finalHeight = maxHeight;
finalWidth = (long)(maxHeight / aspectRatio);
}
// Kép hozzáadása Word dokumentumhoz
ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Jpeg);
using (FileStream stream = new FileStream(imagePath, FileMode.Open))
{
imagePart.FeedData(stream);
}
string imagePartId = mainPart.GetIdOfPart(imagePart);
Drawing drawing = CreateImageDrawing(imagePartId, finalWidth, finalHeight);
// Kép beillesztése középre igazítva
Paragraph imageParagraph = new Paragraph(new Run(drawing))
{
ParagraphProperties = new ParagraphProperties(
new Justification() { Val = JustificationValues.Center }
)
};
TableCell imageCell = new TableCell(imageParagraph,
new TableCellProperties(
new TableCellVerticalAlignment { Val = TableVerticalAlignmentValues.Center },
new TableCellWidth() { Type = TableWidthUnitValues.Pct, Width = "10000" }
));
// Képes sor (magas, kitölti az oldalt)
TableRow imageRow = new TableRow(imageCell);
imageRow.AppendChild(new TableRowProperties(
new TableRowHeight() { Val = 9000, HeightType = HeightRuleValues.Exact }
));
// Fájlnév beillesztése középre
Paragraph fileNamePara = new Paragraph(new Run(new Text(fileName)))
{
ParagraphProperties = new ParagraphProperties(
new Justification() { Val = JustificationValues.Center }
)
};
TableCell fileNameCell = new TableCell(fileNamePara,
new TableCellProperties(
new TableCellVerticalAlignment { Val = TableVerticalAlignmentValues.Center },
new TableCellWidth() { Type = TableWidthUnitValues.Pct, Width = "10000" }
));
// Fájlnév sor (normál magasság)
TableRow fileNameRow = new TableRow(fileNameCell);
fileNameRow.AppendChild(new TableRowProperties(
new TableRowHeight() { Val = 400, HeightType = HeightRuleValues.Auto }
));
// Táblázat – szegély nélkül, teljes oldalszélességben
Table table = new Table(
new TableProperties(
new TableWidth { Width = "10000", Type = TableWidthUnitValues.Pct },
new TableBorders(
new TopBorder { Val = BorderValues.None },
new BottomBorder { Val = BorderValues.None },
new LeftBorder { Val = BorderValues.None },
new RightBorder { Val = BorderValues.None },
new InsideHorizontalBorder { Val = BorderValues.None },
new InsideVerticalBorder { Val = BorderValues.None }
)
),
imageRow,
fileNameRow
);
// Új oldal és a táblázat beszúrása a dokumentum végére
Body body = mainPart.Document.Body;
body.Append(new Paragraph(new Run(new Break() { Type = BreakValues.Page })));
body.Append(table);
}
private static Drawing CreateImageDrawing(string relationshipId, long width, long height)
{
return new Drawing(
new DocumentFormat.OpenXml.Drawing.Wordprocessing.Inline(
new DocumentFormat.OpenXml.Drawing.Wordprocessing.Extent() { Cx = width, Cy = height },
new DocumentFormat.OpenXml.Drawing.Wordprocessing.EffectExtent()
{
LeftEdge = 0L,
TopEdge = 0L,
RightEdge = 0L,
BottomEdge = 0L
},
new DocumentFormat.OpenXml.Drawing.Wordprocessing.DocProperties()
{
Id = (UInt32Value)1U,
Name = "Inserted Image"
},
new DocumentFormat.OpenXml.Drawing.Graphic(
new DocumentFormat.OpenXml.Drawing.GraphicData(
new DocumentFormat.OpenXml.Drawing.Pictures.Picture(
new DocumentFormat.OpenXml.Drawing.Pictures.NonVisualPictureProperties(
new DocumentFormat.OpenXml.Drawing.Pictures.NonVisualDrawingProperties()
{
Id = (UInt32Value)0U,
Name = "Picture"
},
new DocumentFormat.OpenXml.Drawing.Pictures.NonVisualPictureDrawingProperties()),
new DocumentFormat.OpenXml.Drawing.Pictures.BlipFill(
new DocumentFormat.OpenXml.Drawing.Blip()
{
Embed = relationshipId
},
new DocumentFormat.OpenXml.Drawing.Stretch(
new DocumentFormat.OpenXml.Drawing.FillRectangle())),
new DocumentFormat.OpenXml.Drawing.Pictures.ShapeProperties(
new DocumentFormat.OpenXml.Drawing.Transform2D(
new DocumentFormat.OpenXml.Drawing.Offset() { X = 0L, Y = 0L },
new DocumentFormat.OpenXml.Drawing.Extents() { Cx = width, Cy = height }),
new DocumentFormat.OpenXml.Drawing.PresetGeometry(
new DocumentFormat.OpenXml.Drawing.AdjustValueList())
{ Preset = DocumentFormat.OpenXml.Drawing.ShapeTypeValues.Rectangle }))
)
{ Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture" })
)
{ DistanceFromTop = 0U, DistanceFromBottom = 0U, DistanceFromLeft = 0U, DistanceFromRight = 0U });
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,18 @@
<!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>
@@ -1,18 +1,18 @@
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<title>Megerősítő kód</title>
</head>
<body style="font-family: Arial, sans-serif; background-color: #f9f9f9; padding: 20px;">
<p style="font-size: 18px;">
<strong>Workflow Check Application Web</strong> megerősítő kódja:
</p>
<p style="font-size: 28px; font-weight: bold; color: #333; margin-top: 10px;">
#token2F#
</p>
</body>
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<title>Megerősítő kód</title>
</head>
<body style="font-family: Arial, sans-serif; background-color: #f9f9f9; padding: 20px;">
<p style="font-size: 18px;">
<strong>Workflow Check Application Web</strong> megerősítő kódja:
</p>
<p style="font-size: 28px; font-weight: bold; color: #333; margin-top: 10px;">
#token2F#
</p>
</body>
</html>
+24 -24
View File
@@ -1,24 +1,24 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.BL.Services;
using WorkFlowCheck.BL.Services.Interfaces;
namespace WorkFlowCheck.BL.Infra
{
public static class DIConfig
{
public static void DIInit(IServiceCollection service)
{
service.AddScoped<IUserService, UserService>();
service.AddScoped<ISyncService, SyncService>();
service.AddScoped<ICheckListService, CheckListService>();
service.AddScoped<INumberGeneratorService, NumberGeneratorService>();
service.AddScoped<IMessageService, MessageService>();
service.AddScoped<ISystemService, SystemService>();
}
}
}
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.BL.Services;
using WorkFlowCheck.BL.Services.Interfaces;
namespace WorkFlowCheck.BL.Infra
{
public static class DIConfig
{
public static void DIInit(IServiceCollection service)
{
service.AddScoped<IUserService, UserService>();
service.AddScoped<ISyncService, SyncService>();
service.AddScoped<ICheckListService, CheckListService>();
service.AddScoped<INumberGeneratorService, NumberGeneratorService>();
service.AddScoped<IMessageService, MessageService>();
service.AddScoped<ISystemService, SystemService>();
}
}
}
+91 -91
View File
@@ -1,91 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoMapper;
using AutoMapper.Configuration.Conventions;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Mappings
{
public class MapperProfile : Profile
{
public MapperProfile()
{
CreateMap<User, UserDTO>().ForMember(dest => dest.RoleDTO, opt => opt.MapFrom(src => src.UserRoles.Select(ur => ur.Role)));
CreateMap<Role, RoleDTO>()
.ForMember(dest => dest.ParentId, opt => opt.MapFrom(src => src.ParentId))
.ForMember(dest => dest.ParentRoleName, opt => opt.MapFrom(src => src.Parent != null ? src.Parent.RoleName : null));
CreateMap<UserRole, UserRoleDTO>()
.ForMember(dest => dest.RoleDTO, opt => opt.MapFrom(src => src.Role))
.ForMember(dest => dest.UserDTO, opt => opt.MapFrom(src => src.User));
CreateMap<UserDTO, User>()
.ForMember(dest => dest.PasswordHash, opt => opt.MapFrom<PasswordHashResolver>());
CreateMap<CheckListTemplateHeader, CheckListTemplateHeaderDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckListTemplateRow, CheckListTemplateRowDTO>()
.ForMember(dest => dest.EquipmentDTO, opt => opt.MapFrom(src => src.Equipment))
.ForMember(dest => dest.CheckPointDTO, opt => opt.MapFrom(src => src.CheckPoint));
CreateMap<CheckPoint, CheckPointDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckPoint, CheckPointDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckPointDTO, CheckPoint>();
CreateMap<Location, LocationDTO>();
CreateMap<LocationDTO, Location>();
CreateMap<Equipment, EquipmentDTO>();
CreateMap<EquipmentDTO, Equipment>();
CreateMap<DeviceMessage, DeviceMessageDTO>();
CreateMap<DeviceMessageDTO, DeviceMessage>();
CreateMap<CheckListHeader, CheckListHeaderDTO>()
.ForMember(dest => dest.UserDTO, opt => opt.MapFrom(src => src.User))
.ForMember(dest => dest.AcceptUserId, opt => opt.MapFrom(src => src.AcceptUser != null ? src.AcceptUser.Id : (int?)null))
.ForMember(dest => dest.AcceptUserDTO, opt => opt.MapFrom(src => src.AcceptUser))
.ForMember(dest => dest.CheckListRowDTO, opt => opt.MapFrom(src => src.CheckListRows));
CreateMap<CheckListRow, CheckListRowDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRow))
.ForMember(dest => dest.Photo, opt => opt.MapFrom(src => GetImageBytes(src.PhotoFileName)));
CreateMap<RoleCheckListTemplateHeader, RoleCheckListTemplateHeaderDTO>()
.ForMember(dest => dest.RoleDTO, opt => opt.MapFrom(src => src.Role))
.ForMember(dest => dest.CheckListTemplateHeaderDTO, opt => opt.MapFrom(src => src.CheckListTemplateHeader));
}
private byte[] GetImageBytes(string fileName)
{
try
{
var filePath = Path.Combine(Directory.GetCurrentDirectory(), "Images", fileName);
if (File.Exists(filePath))
{
return File.ReadAllBytes(filePath);
}
return Array.Empty<byte>(); // Visszaad egy üres byte[]-ot, ha a fájl nem található
}
catch (Exception)
{
return Array.Empty<byte>(); // Hiba esetén is üres byte[]-ot ad vissza
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoMapper;
using AutoMapper.Configuration.Conventions;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Mappings
{
public class MapperProfile : Profile
{
public MapperProfile()
{
CreateMap<User, UserDTO>().ForMember(dest => dest.RoleDTO, opt => opt.MapFrom(src => src.UserRoles.Select(ur => ur.Role)));
CreateMap<Role, RoleDTO>()
.ForMember(dest => dest.ParentId, opt => opt.MapFrom(src => src.ParentId))
.ForMember(dest => dest.ParentRoleName, opt => opt.MapFrom(src => src.Parent != null ? src.Parent.RoleName : null));
CreateMap<UserRole, UserRoleDTO>()
.ForMember(dest => dest.RoleDTO, opt => opt.MapFrom(src => src.Role))
.ForMember(dest => dest.UserDTO, opt => opt.MapFrom(src => src.User));
CreateMap<UserDTO, User>()
.ForMember(dest => dest.PasswordHash, opt => opt.MapFrom<PasswordHashResolver>());
CreateMap<CheckListTemplateHeader, CheckListTemplateHeaderDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckListTemplateRow, CheckListTemplateRowDTO>()
.ForMember(dest => dest.EquipmentDTO, opt => opt.MapFrom(src => src.Equipment))
.ForMember(dest => dest.CheckPointDTO, opt => opt.MapFrom(src => src.CheckPoint));
CreateMap<CheckPoint, CheckPointDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckPoint, CheckPointDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckPointDTO, CheckPoint>();
CreateMap<Location, LocationDTO>();
CreateMap<LocationDTO, Location>();
CreateMap<Equipment, EquipmentDTO>();
CreateMap<EquipmentDTO, Equipment>();
CreateMap<DeviceMessage, DeviceMessageDTO>();
CreateMap<DeviceMessageDTO, DeviceMessage>();
CreateMap<CheckListHeader, CheckListHeaderDTO>()
.ForMember(dest => dest.UserDTO, opt => opt.MapFrom(src => src.User))
.ForMember(dest => dest.AcceptUserId, opt => opt.MapFrom(src => src.AcceptUser != null ? src.AcceptUser.Id : (int?)null))
.ForMember(dest => dest.AcceptUserDTO, opt => opt.MapFrom(src => src.AcceptUser))
.ForMember(dest => dest.CheckListRowDTO, opt => opt.MapFrom(src => src.CheckListRows));
CreateMap<CheckListRow, CheckListRowDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRow))
.ForMember(dest => dest.Photo, opt => opt.MapFrom(src => GetImageBytes(src.PhotoFileName)));
CreateMap<RoleCheckListTemplateHeader, RoleCheckListTemplateHeaderDTO>()
.ForMember(dest => dest.RoleDTO, opt => opt.MapFrom(src => src.Role))
.ForMember(dest => dest.CheckListTemplateHeaderDTO, opt => opt.MapFrom(src => src.CheckListTemplateHeader));
}
private byte[] GetImageBytes(string fileName)
{
try
{
var filePath = Path.Combine(Directory.GetCurrentDirectory(), "Images", fileName);
if (File.Exists(filePath))
{
return File.ReadAllBytes(filePath);
}
return Array.Empty<byte>(); // Visszaad egy üres byte[]-ot, ha a fájl nem található
}
catch (Exception)
{
return Array.Empty<byte>(); // Hiba esetén is üres byte[]-ot ad vissza
}
}
}
}
@@ -1,20 +1,20 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Common.Security;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Mappings
{
public class PasswordHashResolver : IValueResolver<UserDTO, User, string>
{
public string Resolve(UserDTO source, User destination, string destMember, ResolutionContext context)
{
return PasswordHasher.HashPassword(source.Password);
}
}
}
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Common.Security;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Mappings
{
public class PasswordHashResolver : IValueResolver<UserDTO, User, string>
{
public string Resolve(UserDTO source, User destination, string destMember, ResolutionContext context)
{
return PasswordHasher.HashPassword(source.Password);
}
}
}
+17 -17
View File
@@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.BL.Models
{
public class EmailSettings
{
public string SmtpServer { get; set; } = string.Empty;
public int SmtpPort { get; set; }
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string SenderName { get; set; } = string.Empty;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.BL.Models
{
public class EmailSettings
{
public string SmtpServer { get; set; } = string.Empty;
public int SmtpPort { get; set; }
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string SenderName { get; set; } = string.Empty;
}
}
+149 -149
View File
@@ -1,149 +1,149 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL;
namespace WorkFlowCheck.BL.Services
{
public class BaseService
{
public readonly AppDbContext _dbContext;
public readonly IMapper _mapper;
private readonly ILogger _logger;
public BaseService(AppDbContext db_dbContext, IMapper mapper)
{
_dbContext = db_dbContext;
_mapper = mapper;
_logger = Log.ForContext("Tag", "PROGSEC");
}
public async Task<bool> DeleteEntityByIdAsync<T>(int id) where T : class
{
try
{
var entity = await _dbContext.Set<T>().FindAsync(id);
if (entity == null)
return false;
_dbContext.Set<T>().Remove(entity);
await _dbContext.SaveChangesAsync();
return true;
}
catch (Exception ex)
{
Log.Error($"Hiba történt a törlés során: {ex.Message}");
return false;
}
}
public async Task<T?> GetEntityByIdAsync<T>(int id) where T : class
{
try
{
var entity = await _dbContext.Set<T>().FindAsync(id);
return entity;
}
catch (Exception ex)
{
Log.Error($"Hiba történt a lekérdezés során: {ex.Message}");
return null;
}
}
public async Task<List<TEntity>> GetEntityByFilterAsync<TEntity, TFilter>(TFilter filter) where TEntity : class where TFilter : class
{
try
{
IQueryable<TEntity> query = _dbContext.Set<TEntity>();
foreach (var property in typeof(TFilter).GetProperties())
{
var value = property.GetValue(filter);
if (value != null)
{
var parameter = Expression.Parameter(typeof(TEntity), "x");
var member = Expression.Property(parameter, property.Name);
var constant = Expression.Constant(value);
var equal = Expression.Equal(member, constant);
var lambda = Expression.Lambda<Func<TEntity, bool>>(equal, parameter);
query = query.Where(lambda);
}
}
// Adatok lekérdezése
return await query.ToListAsync();
}
catch (Exception ex)
{
Log.Error($"Hiba történt a lekérdezés során: {ex.Message}");
return new List<TEntity>();
}
}
public async Task<PagedResult<TEntity>> GetPagedEntityByFilterAsync<TEntity, TFilter>(TFilter filter, int pageNumber, int pageSize) where TEntity : class where TFilter : class
{
try
{
// Az IQueryable típusú lista létrehozása
IQueryable<TEntity> query = _dbContext.Set<TEntity>();
// Dinamikus szűrés a filter tulajdonságai alapján
foreach (var property in typeof(TFilter).GetProperties())
{
var value = property.GetValue(filter);
if (value != null)
{
var parameter = Expression.Parameter(typeof(TEntity), "x");
var member = Expression.Property(parameter, property.Name);
var constant = Expression.Constant(value);
var equal = Expression.Equal(member, constant);
var lambda = Expression.Lambda<Func<TEntity, bool>>(equal, parameter);
query = query.Where(lambda);
}
}
// Teljes rekordok száma a szűrő után
int totalCount = await query.CountAsync();
// Lapozás alkalmazása
var items = await query
.Skip((pageNumber - 1) * pageSize)
.Take(pageSize)
.ToListAsync();
// Lapozási eredmény összerakása
return new PagedResult<TEntity>
{
Items = items,
TotalCount = totalCount,
PageNumber = pageNumber,
PageSize = pageSize
};
}
catch (Exception ex)
{
Console.WriteLine($"Hiba történt a lekérdezés során: {ex.Message}");
return new PagedResult<TEntity>();
}
}
}
public class PagedResult<TEntity>
{
public List<TEntity> Items { get; set; } = new List<TEntity>();
public int TotalCount { get; set; }
public int PageNumber { get; set; }
public int PageSize { get; set; }
}
}
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL;
namespace WorkFlowCheck.BL.Services
{
public class BaseService
{
public readonly AppDbContext _dbContext;
public readonly IMapper _mapper;
private readonly ILogger _logger;
public BaseService(AppDbContext db_dbContext, IMapper mapper)
{
_dbContext = db_dbContext;
_mapper = mapper;
_logger = Log.ForContext("Tag", "PROGSEC");
}
public async Task<bool> DeleteEntityByIdAsync<T>(int id) where T : class
{
try
{
var entity = await _dbContext.Set<T>().FindAsync(id);
if (entity == null)
return false;
_dbContext.Set<T>().Remove(entity);
await _dbContext.SaveChangesAsync();
return true;
}
catch (Exception ex)
{
Log.Error($"Hiba történt a törlés során: {ex.Message}");
return false;
}
}
public async Task<T?> GetEntityByIdAsync<T>(int id) where T : class
{
try
{
var entity = await _dbContext.Set<T>().FindAsync(id);
return entity;
}
catch (Exception ex)
{
Log.Error($"Hiba történt a lekérdezés során: {ex.Message}");
return null;
}
}
public async Task<List<TEntity>> GetEntityByFilterAsync<TEntity, TFilter>(TFilter filter) where TEntity : class where TFilter : class
{
try
{
IQueryable<TEntity> query = _dbContext.Set<TEntity>();
foreach (var property in typeof(TFilter).GetProperties())
{
var value = property.GetValue(filter);
if (value != null)
{
var parameter = Expression.Parameter(typeof(TEntity), "x");
var member = Expression.Property(parameter, property.Name);
var constant = Expression.Constant(value);
var equal = Expression.Equal(member, constant);
var lambda = Expression.Lambda<Func<TEntity, bool>>(equal, parameter);
query = query.Where(lambda);
}
}
// Adatok lekérdezése
return await query.ToListAsync();
}
catch (Exception ex)
{
Log.Error($"Hiba történt a lekérdezés során: {ex.Message}");
return new List<TEntity>();
}
}
public async Task<PagedResult<TEntity>> GetPagedEntityByFilterAsync<TEntity, TFilter>(TFilter filter, int pageNumber, int pageSize) where TEntity : class where TFilter : class
{
try
{
// Az IQueryable típusú lista létrehozása
IQueryable<TEntity> query = _dbContext.Set<TEntity>();
// Dinamikus szűrés a filter tulajdonságai alapján
foreach (var property in typeof(TFilter).GetProperties())
{
var value = property.GetValue(filter);
if (value != null)
{
var parameter = Expression.Parameter(typeof(TEntity), "x");
var member = Expression.Property(parameter, property.Name);
var constant = Expression.Constant(value);
var equal = Expression.Equal(member, constant);
var lambda = Expression.Lambda<Func<TEntity, bool>>(equal, parameter);
query = query.Where(lambda);
}
}
// Teljes rekordok száma a szűrő után
int totalCount = await query.CountAsync();
// Lapozás alkalmazása
var items = await query
.Skip((pageNumber - 1) * pageSize)
.Take(pageSize)
.ToListAsync();
// Lapozási eredmény összerakása
return new PagedResult<TEntity>
{
Items = items,
TotalCount = totalCount,
PageNumber = pageNumber,
PageSize = pageSize
};
}
catch (Exception ex)
{
Console.WriteLine($"Hiba történt a lekérdezés során: {ex.Message}");
return new PagedResult<TEntity>();
}
}
}
public class PagedResult<TEntity>
{
public List<TEntity> Items { get; set; } = new List<TEntity>();
public int TotalCount { get; set; }
public int PageNumber { get; set; }
public int PageSize { get; set; }
}
}
File diff suppressed because it is too large Load Diff
@@ -1,34 +1,37 @@
using Microsoft.AspNetCore.Mvc.Rendering;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface ICheckListService
{
Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id);
Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync();
Task<CheckListHeaderDTO> UpdateCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> AcceptCheckListHeaderAsync(int id, int userid);
Task<bool> BlockCheckListHeaderAsync(int id, int userid);
Task<bool> UnBlockCheckListHeaderAsync(int id, int userid);
Task<bool> CloseCheckListHeader(CheckListHeaderCloseDTO closeCheckListHeaderCloseDTO);
Task<byte[]> CreateCheckListHeaderPDFAsync(int checkListHeaderId);
Task<CheckListHeaderDTO> StartNewCheckListAsync(CheckListHeaderNewDTO checkListHeaderNewDTO);
Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeaderAsync(int Id);
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync();
Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
Task<bool> DeleteCheckListTemplateHeaderAsync(int id);
Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id);
Task<bool> DeleteCheckListTemplateRowAsync(int id);
Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO);
Task<CheckListRowDTO> GetCheckListRowAsync(int id);
Task<CheckListRowDTO> UpdateCheckListRowAsync(CheckListRowDTO checkListRowDTO);
}
}
using Microsoft.AspNetCore.Mvc.Rendering;
using WorkFlowCheck.Common.DataTables;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface ICheckListService
{
Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id);
Task<ApiResponseListDTO<List<CheckListHeaderDTO>>> GetFilteredCheckListHeaderAsync(DataTablesRequest dataTablesRequest);
Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync(int mode = 0);
Task<CheckListHeaderDTO> UpdateCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> AcceptCheckListHeaderAsync(int id, int userid);
Task<bool> BlockCheckListHeaderAsync(int id, int userid);
Task<bool> UnBlockCheckListHeaderAsync(int id, int userid);
Task<bool> CloseCheckListHeader(CheckListHeaderCloseDTO closeCheckListHeaderCloseDTO);
Task<byte[]> CreateCheckListHeaderPDFAsync(int checkListHeaderId);
Task<CheckListHeaderDTO> StartNewCheckListAsync(CheckListHeaderNewDTO checkListHeaderNewDTO);
Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeaderAsync(int Id);
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync();
Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
Task<bool> DeleteCheckListTemplateHeaderAsync(int id);
Task<bool> CloneCheckListTemplateHeaderAsync(int id);
Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id);
Task<bool> DeleteCheckListTemplateRowAsync(int id);
Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO);
Task<CheckListRowDTO> GetCheckListRowAsync(int id);
Task<CheckListRowDTO> UpdateCheckListRowAsync(CheckListRowDTO checkListRowDTO);
}
}
@@ -1,13 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface IMessageService
{
Task<bool> SendMailAsync(List<string> recipients, string subject, string htmlBody);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface IMessageService
{
Task<bool> SendMailAsync(List<string> recipients, string subject, string htmlBody, string? attachmentFilePath = null);
Task<bool> SendFCMTokenAsync(string token);
Task<string> GetLastFCMTokensAsync();
Task<bool> SendFCMMessage(FCMMessageDTO fCMMessageDTO);
Task<bool> SendFCMMessageToLastToken(FCMMessageDTO fCMMessageDTO);
}
}
@@ -1,17 +1,17 @@
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface INumberGeneratorService
{
Task<string> GenerateNextNumberAsync(int templateId, IDbContextTransaction transaction, DateTime? baseDate = null);
Task<string> GetSampleAsync(int templateId, DateTime? baseDate = null);
Task<List<NumberGeneratorTemplateDTO>> GetAllNumbergeneratorsAsync();
}
}
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface INumberGeneratorService
{
Task<string> GenerateNextNumberAsync(int templateId, IDbContextTransaction transaction, DateTime? baseDate = null);
Task<string> GetSampleAsync(int templateId, DateTime? baseDate = null);
Task<List<NumberGeneratorTemplateDTO>> GetAllNumbergeneratorsAsync();
}
}
@@ -1,39 +1,39 @@
using Microsoft.AspNetCore.Mvc;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface ISyncService
{
Task<List<CheckPointDTO>> GetAllCheckPointAsync();
Task<CheckPointDTO> GetCheckPointAsync(int id);
Task<bool> DeleteCheckPointAsync(int id);
Task<CheckPointDTO> UpdateCheckPointAsync(CheckPointDTO checkPointDTO);
Task<List<CheckPointDTO>> UpdateAllCheckPointAsync(List<CheckPointDTO> checkPointListDTO);
Task<List<LocationDTO>> GetAllLocationAsync();
Task<LocationDTO> GetLocationAsync(int id);
Task<bool> DeleteLocationAsync(int id);
Task<LocationDTO> UpdateLocationAsync(LocationDTO LocationDTO);
Task<List<EquipmentDTO>> GetAllEquipmentAsync();
Task<EquipmentDTO> GetEquipmentAsync(int id);
Task<bool> DeleteEquipmentAsync(int id);
Task<EquipmentDTO> UpdateEquipmentAsync(EquipmentDTO EquipmentDTO);
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateAsync(int userId);
Task<List<CheckListHeaderDTO>> GetAllCheckListAsync(int userId);
Task<CheckListHeaderDTO> SendCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> DeviceMessageSend(DeviceMessageDTO deviceMessageDTO);
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreaded(string deviceId);
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreadedRole(int roleId);
}
}
using Microsoft.AspNetCore.Mvc;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface ISyncService
{
Task<List<CheckPointDTO>> GetAllCheckPointAsync();
Task<CheckPointDTO> GetCheckPointAsync(int id);
Task<bool> DeleteCheckPointAsync(int id);
Task<CheckPointDTO> UpdateCheckPointAsync(CheckPointDTO checkPointDTO);
Task<List<CheckPointDTO>> UpdateAllCheckPointAsync(List<CheckPointDTO> checkPointListDTO);
Task<List<LocationDTO>> GetAllLocationAsync();
Task<LocationDTO> GetLocationAsync(int id);
Task<bool> DeleteLocationAsync(int id);
Task<LocationDTO> UpdateLocationAsync(LocationDTO LocationDTO);
Task<List<EquipmentDTO>> GetAllEquipmentAsync();
Task<EquipmentDTO> GetEquipmentAsync(int id);
Task<bool> DeleteEquipmentAsync(int id);
Task<EquipmentDTO> UpdateEquipmentAsync(EquipmentDTO EquipmentDTO);
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateAsync(int userId);
Task<List<CheckListHeaderDTO>> GetAllCheckListAsync(int userId);
Task<CheckListHeaderDTO> SendCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> DeviceMessageSend(DeviceMessageDTO deviceMessageDTO);
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreaded(string deviceId);
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreadedRole(int roleId);
}
}
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface ISystemService
{
Task<string> GetDatabaseAndVersionInfoAsync();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface ISystemService
{
Task<string> GetDatabaseAndVersionInfoAsync();
}
}
@@ -1,45 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface IUserService
{
Task<UserDTO> GetUserAsync(int Id);
Task<List<UserDTO>> GetAllUserAsync();
Task<bool> DeleteUserAsync(int Id);
Task<UserDTO> UpdateUserAsync(UserDTO userDTO);
Task<UserDTO> Authenticate(string UserName, string Password);
Task<string> Authenticate2F1(string UserName, string Password);
Task<UserDTO> Authenticate2F2(string UserName, string Password, string Code, string token2FA);
Task<UserDTO> Authenticate2F2ChangePassword(string UserName, string OldPassword, string NewPassword, string Code, string token2FA);
Task<UserDTO> AuthenticateNFC(string NFCCode);
Task<RoleDTO> GetRoleAsync(int Id);
Task<List<RoleDTO>> GetAllRoleAsync();
Task<bool> DeleteRoleAsync(int Id);
Task<RoleDTO> UpdateRoleAsync(RoleDTO roleDTO);
Task<UserRoleDTO> GetUserRoleAsync(int Id);
Task<List<UserRoleDTO>> GetAllUserRoleAsync();
Task<bool> DeleteUserRoleAsync(int Id);
Task<UserRoleDTO> UpdateUserRoleAsync(UserRoleDTO userRoleDTO);
Task<RoleCheckListTemplateHeaderDTO> GetRoleCheckListTemplateHeaderAsync(int Id);
Task<List<RoleCheckListTemplateHeaderDTO>> GetAllRoleCheckListTemplateHeadersAsync();
Task<bool> DeleteRoleCheckListTemplateHeaderAsync(int Id);
Task<RoleCheckListTemplateHeaderDTO> UpdateRoleCheckListTemplateHeaderAsync(RoleCheckListTemplateHeaderDTO roleCheckListTemplateHeaderDTO);
Task<RoleCheckPointDTO> GetRoleCheckPointAsync(int Id);
Task<List<RoleCheckPointDTO>> GetAllRoleCheckPointsAsync();
Task<bool> DeleteRoleCheckPointAsync(int Id);
Task<RoleCheckPointDTO> UpdateRoleCheckPointAsync(RoleCheckPointDTO roleCheckPointDTO);
string GenerateJwtToken(UserDTO userDTO);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface IUserService
{
Task<UserDTO> GetUserAsync(int Id);
Task<List<UserDTO>> GetAllUserAsync();
Task<bool> DeleteUserAsync(int Id);
Task<UserDTO> UpdateUserAsync(UserDTO userDTO);
Task<UserDTO> Authenticate(string UserName, string Password);
Task<string> Authenticate2F1(string UserName, string Password);
Task<UserDTO> Authenticate2F2(string UserName, string Password, string Code, string token2FA);
Task<UserDTO> Authenticate2F2ChangePassword(string UserName, string OldPassword, string NewPassword, string Code, string token2FA);
Task<UserDTO> AuthenticateNFC(string NFCCode);
Task<RoleDTO> GetRoleAsync(int Id);
Task<List<RoleDTO>> GetAllRoleAsync();
Task<bool> DeleteRoleAsync(int Id);
Task<RoleDTO> UpdateRoleAsync(RoleDTO roleDTO);
Task<UserRoleDTO> GetUserRoleAsync(int Id);
Task<List<UserRoleDTO>> GetAllUserRoleAsync();
Task<bool> DeleteUserRoleAsync(int Id);
Task<UserRoleDTO> UpdateUserRoleAsync(UserRoleDTO userRoleDTO);
Task<RoleCheckListTemplateHeaderDTO> GetRoleCheckListTemplateHeaderAsync(int Id);
Task<List<RoleCheckListTemplateHeaderDTO>> GetAllRoleCheckListTemplateHeadersAsync();
Task<bool> DeleteRoleCheckListTemplateHeaderAsync(int Id);
Task<RoleCheckListTemplateHeaderDTO> UpdateRoleCheckListTemplateHeaderAsync(RoleCheckListTemplateHeaderDTO roleCheckListTemplateHeaderDTO);
Task<RoleCheckPointDTO> GetRoleCheckPointAsync(int Id);
Task<List<RoleCheckPointDTO>> GetAllRoleCheckPointsAsync();
Task<bool> DeleteRoleCheckPointAsync(int Id);
Task<RoleCheckPointDTO> UpdateRoleCheckPointAsync(RoleCheckPointDTO roleCheckPointDTO);
string GenerateJwtToken(UserDTO userDTO);
}
}
+216 -46
View File
@@ -1,46 +1,216 @@
using MailKit.Net.Smtp;
using MailKit.Security;
using MimeKit;
using Microsoft.Extensions.Configuration;
using WorkFlowCheck.BL.Models;
using WorkFlowCheck.BL.Services.Interfaces;
namespace WorkFlowCheck.BL.Services
{
public class MessageService : IMessageService
{
private readonly EmailSettings _settings;
public MessageService(IConfiguration configuration)
{
_settings = configuration.GetSection("EmailSettings").Get<EmailSettings>()!;
}
public async Task<bool> SendMailAsync(List<string> recipients, string subject, string htmlBody)
{
var message = new MimeMessage();
message.From.Add(new MailboxAddress(_settings.SenderName, _settings.Username));
foreach (var recipient in recipients)
{
message.To.Add(MailboxAddress.Parse(recipient));
}
message.Subject = subject;
message.Body = new TextPart("html")
{
Text = htmlBody
};
using var smtp = new SmtpClient();
await smtp.ConnectAsync(_settings.SmtpServer, _settings.SmtpPort, SecureSocketOptions.StartTls);
await smtp.AuthenticateAsync(_settings.Username, _settings.Password);
await smtp.SendAsync(message);
await smtp.DisconnectAsync(true);
return true;
}
}
}
using MailKit.Net.Smtp;
using MailKit.Security;
using MimeKit;
using Microsoft.Extensions.Configuration;
using WorkFlowCheck.BL.Models;
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
{
public class MessageService : BaseService, IMessageService
{
private readonly EmailSettings _settings;
public MessageService(AppDbContext dbContext,
IMapper mapper,
IConfiguration configuration) : base(dbContext, mapper)
{
_settings = configuration.GetSection("EmailSettings").Get<EmailSettings>()!;
}
public async Task<bool> SendMailAsync(List<string> recipients, string subject, string htmlBody, string? attachmentFilePath = null)
{
var message = new MimeMessage();
message.From.Add(new MailboxAddress(_settings.SenderName, _settings.Username));
foreach (var recipient in recipients)
{
message.To.Add(MailboxAddress.Parse(recipient));
}
message.Subject = subject;
var builder = new BodyBuilder
{
HtmlBody = 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();
await smtp.ConnectAsync(_settings.SmtpServer, _settings.SmtpPort, SecureSocketOptions.StartTls);
await smtp.AuthenticateAsync(_settings.Username, _settings.Password);
await smtp.SendAsync(message);
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;
}
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;
}
}
}
@@ -1,164 +1,164 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.DL;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Services
{
public class NumberGeneratorService : INumberGeneratorService
{
private readonly AppDbContext _dbContext;
private static readonly Dictionary<int, SemaphoreSlim> _templateLocks = new();
public NumberGeneratorService(AppDbContext dbContext)
{
_dbContext = dbContext;
}
public async Task<string> GenerateNextNumberAsync(int templateId, IDbContextTransaction transaction, DateTime? baseDate = null)
{
var semaphore = GetOrCreateSemaphore(templateId);
await semaphore.WaitAsync();
try
{
var template = await _dbContext.Set<NumberGeneratorTemplate>()
.FirstOrDefaultAsync(t => t.Id == templateId);
if (template == null)
throw new InvalidOperationException($"Template with ID {templateId} not found.");
var now = baseDate ?? DateTime.Now;
var (year, month) = GetKeyDateParts(template, now);
var templateDate = await _dbContext.Set<NumberGeneratorTemplateDate>()
.FirstOrDefaultAsync(td => td.NumberGeneratorTemplateId == templateId && td.Year == year && td.Month == month);
if (templateDate == null)
{
templateDate = new NumberGeneratorTemplateDate
{
NumberGeneratorTemplateId = template.Id,
Year = year,
Month = month,
CurrentNumber = 0
};
_dbContext.Add(templateDate);
}
templateDate.CurrentNumber++;
var formatted = templateDate.CurrentNumber.ToString(template.DigitFormat);
var dynamicSuffix = BuildDynamicSuffix(template, now);
var result = BuildFormattedNumber(template, formatted, dynamicSuffix);
templateDate.LastGeneratedNumber = result;
await _dbContext.SaveChangesAsync();
return result;
}
catch
{
throw;
}
finally
{
semaphore.Release();
}
}
public async Task<string> GetSampleAsync(int templateId, DateTime? baseDate = null)
{
var template = await _dbContext.Set<NumberGeneratorTemplate>()
.AsNoTracking()
.FirstOrDefaultAsync(t => t.Id == templateId);
if (template == null)
throw new InvalidOperationException($"Template with ID {templateId} not found.");
var now = baseDate ?? DateTime.Now;
var formatted = 1.ToString(template.DigitFormat);
var dynamicSuffix = BuildDynamicSuffix(template, now);
return BuildFormattedNumber(template, formatted, dynamicSuffix);
}
public async Task<List<NumberGeneratorTemplateDTO>> GetAllNumbergeneratorsAsync()
{
var retVal = new List<NumberGeneratorTemplateDTO>();
try
{
var numbergenerators = await _dbContext.NumberGeneratorTemplates.ToListAsync();
foreach (var numbergenerator in numbergenerators)
{
var numbergeneratortemplateDTO = new NumberGeneratorTemplateDTO();
numbergeneratortemplateDTO.Id = numbergenerator.Id;
numbergeneratortemplateDTO.ShortName = numbergenerator.ShortName;
numbergeneratortemplateDTO.Sample = await this.GetSampleAsync(numbergenerator.Id, DateTime.Now);
retVal.Add(numbergeneratortemplateDTO);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
private SemaphoreSlim GetOrCreateSemaphore(int templateId)
{
lock (_templateLocks)
{
if (!_templateLocks.ContainsKey(templateId))
_templateLocks[templateId] = new SemaphoreSlim(1, 1);
return _templateLocks[templateId];
}
}
private static (int year, int? month) GetKeyDateParts(NumberGeneratorTemplate template, DateTime date)
{
int year = date.Year;
int? month = template.GenerateType == GenerateType.YearAndMonth ? date.Month : null;
return (year, month);
}
private static string BuildDynamicSuffix(NumberGeneratorTemplate template, DateTime date)
{
return template.GenerateType switch
{
GenerateType.OnlyYear => date.Year.ToString(),
GenerateType.YearAndMonth => $"{date.Year}/{date.Month:D2}",
_ => template.Suffix
};
}
private static string BuildFormattedNumber(NumberGeneratorTemplate template, string formattedNumber, string dynamicSuffix)
{
var sb = new StringBuilder();
if (!string.IsNullOrEmpty(template.Prefix))
sb.Append(template.Prefix);
if (!string.IsNullOrEmpty(template.PrefixSeparator) && !string.IsNullOrEmpty(template.Prefix))
sb.Append(template.PrefixSeparator);
sb.Append(formattedNumber);
if (!string.IsNullOrEmpty(dynamicSuffix))
{
if (!string.IsNullOrEmpty(template.SuffixSeparator))
sb.Append(template.SuffixSeparator);
sb.Append(dynamicSuffix);
}
return sb.ToString();
}
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.DL;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Services
{
public class NumberGeneratorService : INumberGeneratorService
{
private readonly AppDbContext _dbContext;
private static readonly Dictionary<int, SemaphoreSlim> _templateLocks = new();
public NumberGeneratorService(AppDbContext dbContext)
{
_dbContext = dbContext;
}
public async Task<string> GenerateNextNumberAsync(int templateId, IDbContextTransaction transaction, DateTime? baseDate = null)
{
var semaphore = GetOrCreateSemaphore(templateId);
await semaphore.WaitAsync();
try
{
var template = await _dbContext.Set<NumberGeneratorTemplate>()
.FirstOrDefaultAsync(t => t.Id == templateId);
if (template == null)
throw new InvalidOperationException($"Template with ID {templateId} not found.");
var now = baseDate ?? DateTime.Now;
var (year, month) = GetKeyDateParts(template, now);
var templateDate = await _dbContext.Set<NumberGeneratorTemplateDate>()
.FirstOrDefaultAsync(td => td.NumberGeneratorTemplateId == templateId && td.Year == year && td.Month == month);
if (templateDate == null)
{
templateDate = new NumberGeneratorTemplateDate
{
NumberGeneratorTemplateId = template.Id,
Year = year,
Month = month,
CurrentNumber = 0
};
_dbContext.Add(templateDate);
}
templateDate.CurrentNumber++;
var formatted = templateDate.CurrentNumber.ToString(template.DigitFormat);
var dynamicSuffix = BuildDynamicSuffix(template, now);
var result = BuildFormattedNumber(template, formatted, dynamicSuffix);
templateDate.LastGeneratedNumber = result;
await _dbContext.SaveChangesAsync();
return result;
}
catch
{
throw;
}
finally
{
semaphore.Release();
}
}
public async Task<string> GetSampleAsync(int templateId, DateTime? baseDate = null)
{
var template = await _dbContext.Set<NumberGeneratorTemplate>()
.AsNoTracking()
.FirstOrDefaultAsync(t => t.Id == templateId);
if (template == null)
throw new InvalidOperationException($"Template with ID {templateId} not found.");
var now = baseDate ?? DateTime.Now;
var formatted = 1.ToString(template.DigitFormat);
var dynamicSuffix = BuildDynamicSuffix(template, now);
return BuildFormattedNumber(template, formatted, dynamicSuffix);
}
public async Task<List<NumberGeneratorTemplateDTO>> GetAllNumbergeneratorsAsync()
{
var retVal = new List<NumberGeneratorTemplateDTO>();
try
{
var numbergenerators = await _dbContext.NumberGeneratorTemplates.ToListAsync();
foreach (var numbergenerator in numbergenerators)
{
var numbergeneratortemplateDTO = new NumberGeneratorTemplateDTO();
numbergeneratortemplateDTO.Id = numbergenerator.Id;
numbergeneratortemplateDTO.ShortName = numbergenerator.ShortName;
numbergeneratortemplateDTO.Sample = await this.GetSampleAsync(numbergenerator.Id, DateTime.Now);
retVal.Add(numbergeneratortemplateDTO);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
private SemaphoreSlim GetOrCreateSemaphore(int templateId)
{
lock (_templateLocks)
{
if (!_templateLocks.ContainsKey(templateId))
_templateLocks[templateId] = new SemaphoreSlim(1, 1);
return _templateLocks[templateId];
}
}
private static (int year, int? month) GetKeyDateParts(NumberGeneratorTemplate template, DateTime date)
{
int year = date.Year;
int? month = template.GenerateType == GenerateType.YearAndMonth ? date.Month : null;
return (year, month);
}
private static string BuildDynamicSuffix(NumberGeneratorTemplate template, DateTime date)
{
return template.GenerateType switch
{
GenerateType.OnlyYear => date.Year.ToString(),
GenerateType.YearAndMonth => $"{date.Year}/{date.Month:D2}",
_ => template.Suffix
};
}
private static string BuildFormattedNumber(NumberGeneratorTemplate template, string formattedNumber, string dynamicSuffix)
{
var sb = new StringBuilder();
if (!string.IsNullOrEmpty(template.Prefix))
sb.Append(template.Prefix);
if (!string.IsNullOrEmpty(template.PrefixSeparator) && !string.IsNullOrEmpty(template.Prefix))
sb.Append(template.PrefixSeparator);
sb.Append(formattedNumber);
if (!string.IsNullOrEmpty(dynamicSuffix))
{
if (!string.IsNullOrEmpty(template.SuffixSeparator))
sb.Append(template.SuffixSeparator);
sb.Append(dynamicSuffix);
}
return sb.ToString();
}
}
}
File diff suppressed because it is too large Load Diff
+49 -49
View File
@@ -1,49 +1,49 @@
using AutoMapper;
using DocumentFormat.OpenXml.InkML;
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.DL;
namespace WorkFlowCheck.BL.Services
{
public class SystemService : ISystemService
{
public readonly AppDbContext _dbContext;
public readonly IMapper _mapper;
public readonly IConfiguration _config;
public SystemService(AppDbContext dbContext,
IMapper mapper,
IConfiguration configuration)
{
_config = configuration;
_dbContext = dbContext;
_mapper = mapper;
}
public async Task<string> GetDatabaseAndVersionInfoAsync()
{
var retVal = "";
var connection = _dbContext.Database.GetDbConnection();
var typeName = connection.GetType().Name;
//if (typeName.Contains("Npgsql"))
//{
// var builder = new NpgsqlConnectionStringBuilder(connection.ConnectionString);
// retVal= builder.Database;
//}
if (typeName.Contains("SqlConnection"))
{
var builder = new SqlConnectionStringBuilder(connection.ConnectionString);
retVal= builder.InitialCatalog;
}
return retVal;
}
}
}
using AutoMapper;
using DocumentFormat.OpenXml.InkML;
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.DL;
namespace WorkFlowCheck.BL.Services
{
public class SystemService : ISystemService
{
public readonly AppDbContext _dbContext;
public readonly IMapper _mapper;
public readonly IConfiguration _config;
public SystemService(AppDbContext dbContext,
IMapper mapper,
IConfiguration configuration)
{
_config = configuration;
_dbContext = dbContext;
_mapper = mapper;
}
public async Task<string> GetDatabaseAndVersionInfoAsync()
{
var retVal = "";
var connection = _dbContext.Database.GetDbConnection();
var typeName = connection.GetType().Name;
//if (typeName.Contains("Npgsql"))
//{
// var builder = new NpgsqlConnectionStringBuilder(connection.ConnectionString);
// retVal= builder.Database;
//}
if (typeName.Contains("SqlConnection"))
{
var builder = new SqlConnectionStringBuilder(connection.ConnectionString);
retVal= builder.InitialCatalog;
}
return retVal;
}
}
}
File diff suppressed because it is too large Load Diff
+72 -72
View File
@@ -1,72 +1,72 @@
using Microsoft.IdentityModel.Tokens;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.BL.Static
{
public static class CodeGenerator2F
{
private static readonly Random _random = new Random();
private const string SecretKey = "874512WcfApplicationNuvolar.hu!%mBX210jUUKL";
private static readonly byte[] KeyBytes = Encoding.UTF8.GetBytes(SecretKey);
public static string GenerateSixDigitCode()
{
return _random.Next(100000, 1000000).ToString(); // 100000 - 999999
}
public static string GenerateToken2F(string value1, string value2, string value3)
{
var tokenHandler = new JwtSecurityTokenHandler();
var claims = new[]
{
new Claim("val1", value1),
new Claim("val2", value2),
new Claim("val3", value3)
};
var descriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(claims),
Expires = DateTime.UtcNow.AddSeconds(60 * 60 * 2),
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(KeyBytes), SecurityAlgorithms.HmacSha256Signature)
};
var token = tokenHandler.CreateToken(descriptor);
return tokenHandler.WriteToken(token);
}
public static bool ValidateToken2F(string token, string expected1, string expected2, string expected3)
{
var tokenHandler = new JwtSecurityTokenHandler();
try
{
var parameters = new TokenValidationParameters
{
ValidateIssuer = false,
ValidateAudience = false,
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(KeyBytes),
ClockSkew = TimeSpan.Zero // nincs türelmi idő
};
var principal = tokenHandler.ValidateToken(token, parameters, out var validatedToken);
var val1 = principal.FindFirst("val1")?.Value;
var val2 = principal.FindFirst("val2")?.Value;
var val3 = principal.FindFirst("val3")?.Value;
return val1 == expected1 && val2 == expected2 && val3 == expected3;
}
catch
{
return false;
}
}
}
}
using Microsoft.IdentityModel.Tokens;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.BL.Static
{
public static class CodeGenerator2F
{
private static readonly Random _random = new Random();
private const string SecretKey = "874512WcfApplicationNuvolar.hu!%mBX210jUUKL";
private static readonly byte[] KeyBytes = Encoding.UTF8.GetBytes(SecretKey);
public static string GenerateSixDigitCode()
{
return _random.Next(100000, 1000000).ToString(); // 100000 - 999999
}
public static string GenerateToken2F(string value1, string value2, string value3)
{
var tokenHandler = new JwtSecurityTokenHandler();
var claims = new[]
{
new Claim("val1", value1),
new Claim("val2", value2),
new Claim("val3", value3)
};
var descriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(claims),
Expires = DateTime.UtcNow.AddSeconds(60 * 60 * 2),
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(KeyBytes), SecurityAlgorithms.HmacSha256Signature)
};
var token = tokenHandler.CreateToken(descriptor);
return tokenHandler.WriteToken(token);
}
public static bool ValidateToken2F(string token, string expected1, string expected2, string expected3)
{
var tokenHandler = new JwtSecurityTokenHandler();
try
{
var parameters = new TokenValidationParameters
{
ValidateIssuer = false,
ValidateAudience = false,
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(KeyBytes),
ClockSkew = TimeSpan.Zero // nincs türelmi idő
};
var principal = tokenHandler.ValidateToken(token, parameters, out var validatedToken);
var val1 = principal.FindFirst("val1")?.Value;
var val2 = principal.FindFirst("val2")?.Value;
var val3 = principal.FindFirst("val3")?.Value;
return val1 == expected1 && val2 == expected2 && val3 == expected3;
}
catch
{
return false;
}
}
}
}
+35 -33
View File
@@ -1,33 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Remove="HtmlTemplates\Token2FBody.html" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="HtmlTemplates\Token2FBody.html" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="DocumentFormat.OpenXml" Version="3.3.0" />
<PackageReference Include="MailKit" Version="4.11.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WorkFlowCheck.Common\WorkFlowCheck.Common.csproj" />
<ProjectReference Include="..\WorkFlowCheck.DL\WorkFlowCheck.DL.csproj" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Remove="HtmlTemplates\Token2FBody.html" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="HtmlTemplates\AcceptCheckListHeaderBody.html" />
<EmbeddedResource Include="HtmlTemplates\Token2FBody.html" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" />
<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="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WorkFlowCheck.Common\WorkFlowCheck.Common.csproj" />
<ProjectReference Include="..\WorkFlowCheck.DL\WorkFlowCheck.DL.csproj" />
</ItemGroup>
</Project>
File diff suppressed because it is too large Load Diff
@@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.Constants
{
public static class MemoryCacheNames
{
public const string UsersNamePrefix = "Users_";
public const string TranslationsNamePrefix = "Translations_";
public const string Languages = "Languages";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.Constants
{
public static class MemoryCacheNames
{
public const string UsersNamePrefix = "Users_";
public const string TranslationsNamePrefix = "Translations_";
public const string Languages = "Languages";
}
}
+14 -14
View File
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class ApiRequestDTO<T>
{
public UserDTO UserDTO { get; set; }
public T Data { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class ApiRequestDTO<T>
{
public UserDTO UserDTO { get; set; }
public T Data { get; set; }
}
}
+45 -43
View File
@@ -1,43 +1,45 @@
using System.Text.Json.Serialization;
namespace WorkFlowCheck.Common.DTO
{
public class ApiResponseBaseDTO
{
public ApiResponseBaseDTO()
{
Errors = new List<string>();
}
public bool IsSuccess { get; set; }
public List<string> Errors { get; set; }
public bool HandleError { get; set; }
public string Error
{
get
{
if (Errors == null || Errors.Count() == 0) return string.Empty;
return string.Join(';', Errors);
}
}
}
public class ApiResponseDTO : ApiResponseBaseDTO
{
public object Data { get; set; }
}
public interface IApiResponseDTO<out T>
{
}
public class ApiResponseDTO<T> : ApiResponseBaseDTO, IApiResponseDTO<T>
{
public T Data { get; set; }
}
public class ApiResponseListDTO<T> : ApiResponseBaseDTO
{
public T[] Data { get; set; }
public int Total { get; set; }
}
}
using System.Text.Json.Serialization;
namespace WorkFlowCheck.Common.DTO
{
public class ApiResponseBaseDTO
{
public ApiResponseBaseDTO()
{
Errors = new List<string>();
}
public bool IsSuccess { get; set; }
public List<string> Errors { get; set; }
public bool HandleError { get; set; }
public string Error
{
get
{
if (Errors == null || Errors.Count() == 0) return string.Empty;
return string.Join(';', Errors);
}
}
}
public class ApiResponseDTO : ApiResponseBaseDTO
{
public object Data { get; set; }
}
public interface IApiResponseDTO<out T>
{
}
public class ApiResponseDTO<T> : ApiResponseBaseDTO, IApiResponseDTO<T>
{
public T Data { get; set; }
}
public class ApiResponseListDTO<T> : ApiResponseBaseDTO
{
public T Data { get; set; }
public int Total { get; set; }
public int Filtered { get; set; }
}
}
@@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListHeaderCloseDTO
{
public int Id { get; set; }
public string CloseReason { get; set; } = null!;
public int UserId { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListHeaderCloseDTO
{
public int Id { get; set; }
public string CloseReason { get; set; } = null!;
public int UserId { get; set; }
}
}
@@ -1,59 +1,59 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.Enums;
using WorkFlowCheck.Common.Helper;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListHeaderDTO
{
public int Id { get; set; }
public int CheckListTemplateHeaderId { get; set; }
public CheckListTemplateHeaderDTO? CheckListTemplateHeaderDTO { get; set; }
[DisplayName("Státusz")]
public CheckStatus CheckStatus { get; set; }
public string StatusName => DisplayNameHelper.GetEnumDisplayName(CheckStatus);
[DisplayName("Dátum")]
public DateTime DateExecution { get; set; }
[DisplayName("Ellenőrző")]
public int UserId { get; set; }
public UserDTO? UserDTO { get; set; }
[DisplayName("Jóváhagyó")]
public int? AcceptUserId { get; set; }
public UserDTO? AcceptUserDTO { get; set; }
[DisplayName("Megnevezés")]
public string ShortName { get; set; } = null!;
[DisplayName("Leírás")]
public string Description { get; set; } = null!;
[DisplayName("Sorszám")]
public string DocumentNumber { get; set; } = null!;
[DisplayName("Azonosító")]
public Guid GuidNumber { get; set; }
[DisplayName("Stornózva")]
public bool IsStorno { get; set; }
[DisplayName("Szerkeszthető")]
public bool IsEditable { get; set; }
public ICollection<CheckListRowDTO>? CheckListRowDTO { get; set; } = new List<CheckListRowDTO>();
public CheckListHeaderDTO()
{
CheckListRowDTO = new List<CheckListRowDTO>();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.Enums;
using WorkFlowCheck.Common.Helper;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListHeaderDTO
{
public int Id { get; set; }
public int CheckListTemplateHeaderId { get; set; }
public CheckListTemplateHeaderDTO? CheckListTemplateHeaderDTO { get; set; }
[DisplayName("Státusz")]
public CheckStatus CheckStatus { get; set; }
public string StatusName => DisplayNameHelper.GetEnumDisplayName(CheckStatus);
[DisplayName("Dátum")]
public DateTime DateExecution { get; set; }
[DisplayName("Ellenőrző")]
public int UserId { get; set; }
public UserDTO? UserDTO { get; set; }
[DisplayName("Jóváhagyó")]
public int? AcceptUserId { get; set; }
public UserDTO? AcceptUserDTO { get; set; }
[DisplayName("Megnevezés")]
public string ShortName { get; set; } = null!;
[DisplayName("Leírás")]
public string Description { get; set; } = null!;
[DisplayName("Sorszám")]
public string DocumentNumber { get; set; } = null!;
[DisplayName("Azonosító")]
public Guid GuidNumber { get; set; }
[DisplayName("Stornózva")]
public bool IsStorno { get; set; }
[DisplayName("Szerkeszthető")]
public bool IsEditable { get; set; }
public ICollection<CheckListRowDTO>? CheckListRowDTO { get; set; } = new List<CheckListRowDTO>();
public CheckListHeaderDTO()
{
CheckListRowDTO = new List<CheckListRowDTO>();
}
}
}
@@ -1,26 +1,28 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListHeaderInfoDTO
{
public int Id { get; set; }
[DisplayName("Összes ellenőrzési szám")]
public int TotalRowCount { get; set; }
[DisplayName("Még ellenőrizendő száma")]
public int EmptyAnswerCount { get; set; }
[DisplayName("Készültség %")]
public string ReadyPercent { get; set; }
[DisplayName("Ellenőrzési pontok száma")]
public int CheckPointCount { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListHeaderInfoDTO
{
public int Id { get; set; }
[DisplayName("Összes ellenőrzési szám")]
public int TotalRowCount { get; set; }
[DisplayName("Még ellenőrizendő száma")]
public int EmptyAnswerCount { get; set; }
[DisplayName("Készültség %")]
public string ReadyPercent { get; set; }
[DisplayName("Ellenőrzési pontok száma")]
public int CheckPointCount { get; set; }
}
}
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListHeaderNewDTO
{
public int CheckListTemplateHeaderId { get; set; }
public int UserId { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListHeaderNewDTO
{
public int CheckListTemplateHeaderId { get; set; }
public int UserId { get; set; }
}
}
+29 -29
View File
@@ -1,29 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListRowDTO
{
public int Id { get; set; }
public int CheckListHeaderId { get; set; }
public int CheckListTemplateRowId { get; set; }
public CheckListTemplateRowDTO? CheckListTemplateRowDTO { get; set; }
public string GroupName => $"AnswerGroup_{CheckListTemplateRowDTO?.RowIndex ?? 0}";
[DisplayName("Eredmény")]
public string Answer { get; set; } = null!;
public bool? AnswerYes { get; set; } = null!;
public bool? AnswerNo { get; set; } = null!;
[DisplayName("Kép")]
public byte[]? Photo { get; set; } = null!;
public Guid GuidNumber { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListRowDTO
{
public int Id { get; set; }
public int CheckListHeaderId { get; set; }
public int CheckListTemplateRowId { get; set; }
public CheckListTemplateRowDTO? CheckListTemplateRowDTO { get; set; }
public string GroupName => $"AnswerGroup_{CheckListTemplateRowDTO?.Id ?? 0}";
[DisplayName("Eredmény")]
public string Answer { get; set; } = null!;
public bool? AnswerYes { get; set; } = null!;
public bool? AnswerNo { get; set; } = null!;
[DisplayName("Kép")]
public byte[]? Photo { get; set; } = null!;
public Guid GuidNumber { get; set; }
}
}
@@ -1,22 +1,22 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListTemplateHeaderDTO
{
public int Id { get; set; }
[DisplayName("Megnevezés")]
public string ShortName { get; set; } = null!;
[DisplayName("Leírás")]
public string Description { get; set; } = null!;
[DisplayName("Sorszám (munkalap)")]
public int? NumberGenerator1Id { get; set; }
[DisplayName("Sorszám (dokumentum)")]
public int? NumberGenerator2Id { get; set; }
public NumberGeneratorTemplateDTO? NumberGenerator1 { get; set; }
public NumberGeneratorTemplateDTO? NumberGenerator2 { get; set; }
public ICollection<CheckListTemplateRowDTO>? CheckListTemplateRowDTO { get; set; } = new List<CheckListTemplateRowDTO>();
}
}
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListTemplateHeaderDTO
{
public int Id { get; set; }
[DisplayName("Megnevezés")]
public string ShortName { get; set; } = null!;
[DisplayName("Leírás")]
public string Description { get; set; } = null!;
[DisplayName("Sorszám (munkalap)")]
public int? NumberGenerator1Id { get; set; }
[DisplayName("Sorszám (dokumentum)")]
public int? NumberGenerator2Id { get; set; }
public NumberGeneratorTemplateDTO? NumberGenerator1 { get; set; }
public NumberGeneratorTemplateDTO? NumberGenerator2 { get; set; }
public ICollection<CheckListTemplateRowDTO>? CheckListTemplateRowDTO { get; set; } = new List<CheckListTemplateRowDTO>();
}
}
@@ -1,43 +1,43 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListTemplateRowDTO
{
public int Id { get; set; }
[Required(ErrorMessage = "A sorrend megadása kötelező.")]
[DisplayName("Sorrend")]
public int RowIndex { get; set; }
public int CheckListTemplateHeaderId { get; set; }
[DisplayName("Berendezés")]
public int EquipmentId { get; set; }
public EquipmentDTO? EquipmentDTO { get; set; } = null!;
public int CheckPointId { get; set; }
public CheckPointDTO? CheckPointDTO { get; set; } = null!;
[DisplayName("Tevékenység leírása")]
public string OperationDescription { get; set; } = null!;
/// <summary>
///
/// I-N (Igen, nem)
/// P (Fénykép készítése)
/// PN (Fénykép nem kötelező készítése)
/// SI-N (Sárga igen,fehér nem)
/// I-SN (Fehér igen, sárga nem)
/// PI-N (Piros igen,fehér nem)
/// I-PN (Fehér igen, piros nem)
/// V (Érték megadása)
///
/// </summary>
[DisplayName("Válasz tipus")]
public string AnswerType { get; set; } = null!;
}
}
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListTemplateRowDTO
{
public int Id { get; set; }
[Required(ErrorMessage = "A sorrend megadása kötelező.")]
[DisplayName("Sorrend")]
public int RowIndex { get; set; }
public int CheckListTemplateHeaderId { get; set; }
[DisplayName("Berendezés")]
public int EquipmentId { get; set; }
public EquipmentDTO? EquipmentDTO { get; set; } = null!;
public int CheckPointId { get; set; }
public CheckPointDTO? CheckPointDTO { get; set; } = null!;
[DisplayName("Tevékenység leírása")]
public string OperationDescription { get; set; } = null!;
/// <summary>
///
/// I-N (Igen, nem)
/// P (Fénykép készítése)
/// PN (Fénykép nem kötelező készítése)
/// SI-N (Sárga igen,fehér nem)
/// I-SN (Fehér igen, sárga nem)
/// PI-N (Piros igen,fehér nem)
/// I-PN (Fehér igen, piros nem)
/// V (Érték megadása)
///
/// </summary>
[DisplayName("Válasz tipus")]
public string AnswerType { get; set; } = null!;
}
}
+31 -31
View File
@@ -1,31 +1,31 @@

using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace WorkFlowCheck.Common.DTO
{
public class CheckPointDTO
{
public int Id { get; set; }
[Required(ErrorMessage = "A megnevezés megadása kötelező.")]
[DisplayName("Megnevezés")]
public string ShortName { get; set; }
[Required(ErrorMessage = "A kód megadása kötelező.")]
[DisplayName("Kód")]
public string Code { get; set; }
[DisplayName("Használatban")]
public bool IsEnabled { get; set; }
[DisplayName("Szabály")]
public int? RoleId { get; set; }
[DisplayName("Szabály neve")]
public string? RoleName { get; set; }
public List<CheckListTemplateRowDTO>? CheckListTemplateRowDTO { get; set; } = new List<CheckListTemplateRowDTO>();
}
}

using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace WorkFlowCheck.Common.DTO
{
public class CheckPointDTO
{
public int Id { get; set; }
[Required(ErrorMessage = "A megnevezés megadása kötelező.")]
[DisplayName("Megnevezés")]
public string ShortName { get; set; }
[Required(ErrorMessage = "A kód megadása kötelező.")]
[DisplayName("Kód")]
public string Code { get; set; }
[DisplayName("Használatban")]
public bool IsEnabled { get; set; }
[DisplayName("Szabály")]
public int? RoleId { get; set; }
[DisplayName("Szabály neve")]
public string? RoleName { get; set; }
public List<CheckListTemplateRowDTO>? CheckListTemplateRowDTO { get; set; } = new List<CheckListTemplateRowDTO>();
}
}
@@ -1,22 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class DeviceMessageDTO
{
public int Id { get; set; }
public DateTime? SendDate { get; set; }
public DateTime? ReceiveDate { get; set; }
public string DeviceIdFrom { get; set; } = null!;
public string DeviceIdTo { get; set; } = null!;
public string Message { get; set; } = null!;
public string ExtraDataJSON { get; set; } = null!;
public bool IsReaded { get; set; }
public int? RoleId { get; set; }
public RoleDTO? RoleDTO { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class DeviceMessageDTO
{
public int Id { get; set; }
public DateTime? SendDate { get; set; }
public DateTime? ReceiveDate { get; set; }
public string DeviceIdFrom { get; set; } = null!;
public string DeviceIdTo { get; set; } = null!;
public string Message { get; set; } = null!;
public string ExtraDataJSON { get; set; } = null!;
public bool IsReaded { get; set; }
public int? RoleId { get; set; }
public RoleDTO? RoleDTO { get; set; }
}
}
+23 -15
View File
@@ -1,15 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class EquipmentDTO
{
public int Id { get; set; }
public string ShortName { get; set; } = null!;
public string EquipmentNumber { get; set; } = null!;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class EquipmentDTO
{
public int Id { get; set; }
[Required(ErrorMessage = "A megnevezést megadása kötelező.")]
[DisplayName("Megnevezés")]
public string ShortName { get; set; } = null!;
[Required(ErrorMessage = "Az azonosító megadása kötelező.")]
[DisplayName("Azonosító")]
public string EquipmentNumber { get; set; } = null!;
}
}
@@ -0,0 +1,17 @@
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; }
}
}
+16 -16
View File
@@ -1,16 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class ImageFileDTO
{
public string Id { get; set; }
public string FileName { get; set; }
public string FileSize { get; set; }
public string CreateDate { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class ImageFileDTO
{
public string Id { get; set; }
public string FileName { get; set; }
public string FileSize { get; set; }
public string CreateDate { get; set; }
}
}
+19 -14
View File
@@ -1,14 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class LocationDTO
{
public int Id { get; set; }
public string FullName { get; set; } = null!;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class LocationDTO
{
public int Id { get; set; }
[Required(ErrorMessage = "A megnevezést megadása kötelező.")]
[DisplayName("Megnevezés")]
public string FullName { get; set; } = null!;
}
}
+16 -16
View File
@@ -1,16 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class LogFileDTO
{
public string Id { get; set; }
public string FileName { get; set; }
public string FileSize { get; set; }
public string CreateDate { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class LogFileDTO
{
public string Id { get; set; }
public string FileName { get; set; }
public string FileSize { get; set; }
public string CreateDate { get; set; }
}
}
+20 -20
View File
@@ -1,20 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class MobileUserDTO
{
public int Id { get; set; }
public string? UserName { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public string? FullName => $"{LastName} {FirstName}";
public string? Email { get; set; }
public bool NFCActive { get; set; }
public string NFCCode { get; set; } = null!;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class MobileUserDTO
{
public int Id { get; set; }
public string? UserName { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public string? FullName => $"{LastName} {FirstName}";
public string? Email { get; set; }
public bool NFCActive { get; set; }
public string NFCCode { get; set; } = null!;
}
}
@@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class NumberGeneratorTemplateDTO
{
public int Id { get; set; }
public string ShortName { get; set; }
public string Sample { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class NumberGeneratorTemplateDTO
{
public int Id { get; set; }
public string ShortName { get; set; }
public string Sample { get; set; }
}
}
+16 -16
View File
@@ -1,16 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class PDFFileDTO
{
public string Id { get; set; }
public string FileName { get; set; }
public string FileSize { get; set; }
public string CreateDate { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class PDFFileDTO
{
public string Id { get; set; }
public string FileName { get; set; }
public string FileSize { get; set; }
public string CreateDate { get; set; }
}
}
@@ -1,19 +1,30 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class RoleCheckListTemplateHeaderDTO
{
public int Id { get; set; }
public int RoleId { get; set; }
public RoleDTO? RoleDTO { get; set; } = null!;
public int CheckListTemplateHeaderId { get; set; }
public CheckListTemplateHeaderDTO? CheckListTemplateHeaderDTO { get; set; } = null!;
public bool Enabled { get; set; } = false;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class RoleCheckListTemplateHeaderDTO
{
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 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 CheckListTemplateHeaderDTO? CheckListTemplateHeaderDTO { get; set; } = null!;
[DisplayName("Engedélyezve?")]
public bool Enabled { get; set; } = false;
}
}
@@ -1,19 +1,29 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class RoleCheckPointDTO
{
public int Id { get; set; }
public int RoleId { get; set; }
public RoleDTO? RoleDTO { get; set; } = null!;
public int CheckPointId { get; set; }
public CheckPointDTO? CheckPointDTO { get; set; } = null!;
public bool Enabled { get; set; } = false;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class RoleCheckPointDTO
{
public int Id { get; set; }
[Required(ErrorMessage = "A szabály megadása kötelező.")]
[DisplayName("Szabály")]
public int RoleId { get; set; }
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 CheckPointDTO? CheckPointDTO { get; set; } = null!;
[DisplayName("Engedélyezve?")]
public bool Enabled { get; set; } = false;
}
}
+35 -35
View File
@@ -1,35 +1,35 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace WorkFlowCheck.Common.DTO
{
public class RoleDTO
{
public int Id { get; set; }
[Required(ErrorMessage = "A szabály megnevezésének megadása kötelező.")]
[DisplayName("Megnevezés")]
public string RoleName { get; set; } = null!;
public int? ParentId { get; set; }
[DisplayName("Szülő szerepkör neve")]
public string? ParentRoleName { get; set; }
[DisplayName("Adminisztrátor?")]
public bool IsAdmin { get; set; }
[DisplayName("Új program letöltés?")]
public bool CanDownloadAPK { get; set; }
[DisplayName("Folyamat blokk/engedélyez?")]
public bool CanEnableBlocked { get; set; }
[DisplayName("WEB felület?")]
public bool CanUseWebAdmin { get; set; }
[DisplayName("Mobil App?")]
public bool CanUseMobilApp { get; set; }
}
}
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace WorkFlowCheck.Common.DTO
{
public class RoleDTO
{
public int Id { get; set; }
[Required(ErrorMessage = "A szabály megnevezésének megadása kötelező.")]
[DisplayName("Megnevezés")]
public string RoleName { get; set; } = null!;
public int? ParentId { get; set; }
[DisplayName("Szülő szerepkör neve")]
public string? ParentRoleName { get; set; }
[DisplayName("Adminisztrátor?")]
public bool IsAdmin { get; set; }
[DisplayName("Új program letöltés?")]
public bool CanDownloadAPK { get; set; }
[DisplayName("Folyamat blokk/engedélyez?")]
public bool CanEnableBlocked { get; set; }
[DisplayName("WEB felület?")]
public bool CanUseWebAdmin { get; set; }
[DisplayName("Mobil App?")]
public bool CanUseMobilApp { get; set; }
}
}
+17 -17
View File
@@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class User2FADTO
{
public string UserName { get; set; } = null!;
public string Password { get; set; } = null!;
public string Code { get; set; } = null!;
public string Token2FA { get; set; } = null!;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class User2FADTO
{
public string UserName { get; set; } = null!;
public string Password { get; set; } = null!;
public string Code { get; set; } = null!;
public string Token2FA { get; set; } = null!;
}
}
@@ -1,29 +1,34 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class UserChangePassword2FADTO
{
public int UserId { get; set; }
[DisplayName("Felhasználó")]
public string UserName { get; set; } = null!;
[DisplayName("Régi jelszó")]
public string OldPassword { get; set; } = null!;
[DisplayName("Új jelszó")]
public string NewPassword1 { get; set; } = null!;
[DisplayName("Jelszó megerősítése")]
public string NewPassword2 { get; set; } = null!;
[DisplayName("Ellenőrző kód")]
public string Code { get; set; } = null!;
public string Token2FA { get; set; } = null!;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class UserChangePassword2FADTO
{
public int UserId { get; set; }
[DisplayName("Felhasználó")]
public string UserName { get; set; } = null!;
[DisplayName("Régi jelszó")]
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ó")]
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")]
public string NewPassword2 { get; set; } = null!;
[DisplayName("Ellenőrző kód")]
public string Code { get; set; } = null!;
public string Token2FA { get; set; } = null!;
}
}
+47 -44
View File
@@ -1,44 +1,47 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace WorkFlowCheck.Common.DTO
{
public class UserDTO
{
public int Id { get; set; }
[Required(ErrorMessage = "Az utónév kötelező.")]
[EmailAddress(ErrorMessage = "Érvénytelen email cím.")]
[RegularExpression(@"^[^@\s]+@[^@\s]+\.[^@\s]+$", ErrorMessage = "Az email formátum nem megfelelő.")]
[DisplayName("E-mail")]
public string Email { get; set; } = null!;
[Required(ErrorMessage = "Az utónév kötelező.")]
[DisplayName("Utónév")]
public string FirstName { get; set; } = null!;
[Required(ErrorMessage = "Az vezetéknév kötelező.")]
[DisplayName("Vezetéknév")]
public string LastName { get; set; } = null!;
[Required(ErrorMessage = "A felhasználónév kötelező.")]
[DisplayName("Felhasználó neve")]
public string UserName { get;set; } = null!;
[DisplayName("Jelszó")]
public string Password { get; set; }
public string JwtToken { get; set; } = null!;
[DisplayName("Aktív")]
public bool Active { get; set; }
[DisplayName("NFC belépés")]
public bool NFCActive { get; set; }
[DisplayName("NFC kód")]
public string NFCCode { get; set; } = null!;
public ICollection<RoleDTO>? RoleDTO { get; set; } = new List<RoleDTO>();
}
}
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace WorkFlowCheck.Common.DTO
{
public class UserDTO
{
public int Id { get; set; }
[Required(ErrorMessage = "Az utónév kötelező.")]
[EmailAddress(ErrorMessage = "Érvénytelen email cím.")]
[RegularExpression(@"^[^@\s]+@[^@\s]+\.[^@\s]+$", ErrorMessage = "Az email formátum nem megfelelő.")]
[DisplayName("E-mail")]
public string Email { get; set; } = null!;
[Required(ErrorMessage = "Az utónév kötelező.")]
[DisplayName("Utónév")]
public string FirstName { get; set; } = null!;
[Required(ErrorMessage = "Az vezetéknév kötelező.")]
[DisplayName("Vezetéknév")]
public string LastName { get; set; } = null!;
[Required(ErrorMessage = "A felhasználónév kötelező.")]
[DisplayName("Felhasználó neve")]
public string UserName { get;set; } = null!;
[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ó")]
public string Password { get; set; } = null!;
public string JwtToken { get; set; } = null!;
[DisplayName("Aktív")]
public bool Active { get; set; }
[DisplayName("NFC belépés")]
public bool NFCActive { get; set; }
[DisplayName("NFC kód")]
public string NFCCode { get; set; } = null!;
public ICollection<RoleDTO>? RoleDTO { get; set; } = new List<RoleDTO>();
}
}
+19 -19
View File
@@ -1,19 +1,19 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class UserRoleDTO
{
public int Id { get; set; }
public int? RoleId { get; set; } = 0;
public RoleDTO? RoleDTO { get; set; }
public int UserId { get; set; }
public UserDTO? UserDTO { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class UserRoleDTO
{
public int Id { get; set; }
public int? RoleId { get; set; } = 0;
public RoleDTO? RoleDTO { get; set; }
public int UserId { get; set; }
public UserDTO? UserDTO { get; set; }
}
}
+17 -17
View File
@@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class UserSimpleDTO
{
[Required(ErrorMessage = "A felhasználónév kötelező.")]
public string UserName { get; set; } = null!;
[Required(ErrorMessage = "A jelszó megadása kötelező.")]
public string Password { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class UserSimpleDTO
{
[Required(ErrorMessage = "A felhasználónév kötelező.")]
public string UserName { get; set; } = null!;
[Required(ErrorMessage = "A jelszó megadása kötelező.")]
public string Password { get; set; }
}
}
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DataTables
{
public class DataTablesRequest
{
public int Mode { get; set; }
public int Draw { get; set; }
public int Start { get; set; }
public int Length { get; set; }
public DataTablesSearch Search { get; set; } = new();
public List<DataTablesOrder> Order { get; set; } = new();
public List<DataTablesColumn> Columns { get; set; } = new();
}
public class DataTablesSearch { public string? Value { get; set; } }
public class DataTablesOrder { public int Column { get; set; } public string? Dir { get; set; } }
public class DataTablesColumn { public string? Data { get; set; } public bool Searchable { get; set; } public bool Orderable { get; set; } }
}
+35 -35
View File
@@ -1,35 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace WorkFlowCheck.Common.Enums
{
public enum CheckStatus
{
[Display(Name = "Nyitott")]
Open = 0,
[Display(Name = "Folyamatban")]
InProgress = 1,
[Display(Name = "Blokkolt")]
Blocked = 2,
[Display(Name = "Sztornózva")]
Storno = 3,
[Display(Name = "Beküldött")]
Sent = 4,
[Display(Name = "Jóváhagyva")]
Signed = 5,
[Display(Name = "Lezárva")]
Closed = 6
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace WorkFlowCheck.Common.Enums
{
public enum CheckStatus
{
[Display(Name = "Nyitott")]
Open = 0,
[Display(Name = "Folyamatban")]
InProgress = 1,
[Display(Name = "Blokkolt")]
Blocked = 2,
[Display(Name = "Sztornózva")]
Storno = 3,
[Display(Name = "Beküldött")]
Sent = 4,
[Display(Name = "Jóváhagyva")]
Signed = 5,
[Display(Name = "Lezárva")]
Closed = 6
}
}
@@ -1,33 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.Helper
{
public static class DisplayNameHelper
{
public static string GetDisplayName(string propertyName, Type modelType)
{
var property = modelType.GetProperty(propertyName);
var displayNameAttribute = property?.GetCustomAttributes(typeof(DisplayNameAttribute), false)
.FirstOrDefault() as DisplayNameAttribute;
return displayNameAttribute?.DisplayName ?? propertyName;
}
public static string GetEnumDisplayName(this Enum enumValue)
{
return enumValue
.GetType()
.GetMember(enumValue.ToString())
.First()
.GetCustomAttribute<DisplayAttribute>()?
.Name ?? enumValue.ToString();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.Helper
{
public static class DisplayNameHelper
{
public static string GetDisplayName(string propertyName, Type modelType)
{
var property = modelType.GetProperty(propertyName);
var displayNameAttribute = property?.GetCustomAttributes(typeof(DisplayNameAttribute), false)
.FirstOrDefault() as DisplayNameAttribute;
return displayNameAttribute?.DisplayName ?? propertyName;
}
public static string GetEnumDisplayName(this Enum enumValue)
{
return enumValue
.GetType()
.GetMember(enumValue.ToString())
.First()
.GetCustomAttribute<DisplayAttribute>()?
.Name ?? enumValue.ToString();
}
}
}
@@ -1,18 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.RequestContext
{
public interface IRequestContext
{
string TraceId { get; }
string CurrentUsername { get; }
string CurrentUserEmail { get; }
int? CurrentUserId { get; }
CancellationToken RequestAborted { get; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.RequestContext
{
public interface IRequestContext
{
string TraceId { get; }
string CurrentUsername { get; }
string CurrentUserEmail { get; }
int? CurrentUserId { get; }
CancellationToken RequestAborted { get; }
}
}
@@ -1,55 +1,57 @@
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.Security
{
public static class PasswordHasher
{
// Jelszó hashelése
private const string _saltstring = "xc45DDfrt!!ED210:";
public static string HashPassword(string password)
{
// Generate a random salt
byte[] salt = Encoding.UTF8.GetBytes(_saltstring);
// Hash the password with the salt
using (var rfc2898 = new Rfc2898DeriveBytes(password, salt, 10000, HashAlgorithmName.SHA256))
{
byte[] hash = rfc2898.GetBytes(32); // 256-bit hash
byte[] hashBytes = new byte[48]; // Salt (16 bytes) + Hash (32 bytes)
Array.Copy(salt, 0, hashBytes, 0, 16);
Array.Copy(hash, 0, hashBytes, 16, 32);
return Convert.ToBase64String(hashBytes);
}
}
// Jelszó ellenőrzése
public static bool VerifyPassword(string storedPasswordHash, string inputPassword)
{
byte[] hashBytes = Convert.FromBase64String(storedPasswordHash);
// Extract salt (first 16 bytes) and stored hash (next 32 bytes)
byte[] salt = Encoding.UTF8.GetBytes(_saltstring);
byte[] storedHash = new byte[32];
Array.Copy(hashBytes, 0, salt, 0, 16);
Array.Copy(hashBytes, 16, storedHash, 0, 32);
// Hash the input password with the same salt
using (var rfc2898 = new Rfc2898DeriveBytes(inputPassword, salt, 10000, HashAlgorithmName.SHA256))
{
byte[] inputHash = rfc2898.GetBytes(32);
// Compare the stored hash and the calculated hash
return CryptographicOperations.FixedTimeEquals(storedHash, inputHash);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.Security
{
public static class PasswordHasher
{
// Jelszó hashelése
private const string _saltstring = "xc45DDfrt!!ED210:";
public static string HashPassword(string password)
{
// Generate a random salt
byte[] salt = Encoding.UTF8.GetBytes(_saltstring);
// Hash the password with the salt
using (var rfc2898 = new Rfc2898DeriveBytes(password, salt, 10000, HashAlgorithmName.SHA256))
{
byte[] hash = rfc2898.GetBytes(32); // 256-bit hash
byte[] hashBytes = new byte[48]; // Salt (16 bytes) + Hash (32 bytes)
Array.Copy(salt, 0, hashBytes, 0, 16);
Array.Copy(hash, 0, hashBytes, 16, 32);
return Convert.ToBase64String(hashBytes);
}
}
// Jelszó ellenőrzése
public static bool VerifyPassword(string storedPasswordHash, string inputPassword)
{
var inputPasswordHash = HashPassword(inputPassword);
byte[] hashBytes = Convert.FromBase64String(storedPasswordHash);
// Extract salt (first 16 bytes) and stored hash (next 32 bytes)
byte[] salt = Encoding.UTF8.GetBytes(_saltstring);
byte[] storedHash = new byte[32];
Array.Copy(hashBytes, 0, salt, 0, 16);
Array.Copy(hashBytes, 16, storedHash, 0, 32);
// Hash the input password with the same salt
using (var rfc2898 = new Rfc2898DeriveBytes(inputPassword, salt, 10000, HashAlgorithmName.SHA256))
{
byte[] inputHash = rfc2898.GetBytes(32);
// Compare the stored hash and the calculated hash
return CryptographicOperations.FixedTimeEquals(storedHash, inputHash);
}
}
}
}
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
+191 -189
View File
@@ -1,189 +1,191 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using System;
using WorkFlowCheck.Common.RequestContext;
using WorkFlowCheck.Common.Security;
using WorkFlowCheck.DL.Configurations;
using WorkFlowCheck.DL.Entities;
using WorkFlowCheck.DL.Extensions;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL
{
public class AppDbContext : DbContext
{
private readonly IRequestContext _requestContext;
public AppDbContext(DbContextOptions<AppDbContext> options, IRequestContext requestContext)
: base(options)
{
_requestContext = requestContext;
}
#region Entities DbSet
public DbSet<Entities.CheckListHeader> CheckListHeaders { get; set; } = null!;
public DbSet<Entities.CheckListRow> CheckListRows { get; set; } = null!;
public DbSet<Entities.CheckListTemplateHeader> CheckListTemplateHeaders { get; set; } = null!;
public DbSet<Entities.CheckListTemplateRow> CheckListTemplateRows { get; set; } = null!;
public DbSet<Entities.CheckPoint> CheckPoints { get; set; } = null!;
public DbSet<DeviceMessage> DeviceMessages { get; set; } = null!;
public DbSet<Entities.Equipment> Equipments { get; set; } = null!;
public DbSet<Entities.Location> Locations { get; set; } = null!;
public DbSet<Entities.NumberGeneratorTemplate> NumberGeneratorTemplates { get; set; } = null!;
public DbSet<Entities.NumberGeneratorTemplateDate> NumberGeneratorTemplateDates { get; set; } = null!;
public DbSet<Entities.Role> Roles { get; set; } = null!;
public DbSet<Entities.User> Users { get; set; } = null!;
public DbSet<Entities.UserRole> UserRoles { get; set; } = null!;
public DbSet<Entities.RoleCheckListTemplateHeader> RoleCheckListTemplateHeaders { get; set; } = null!;
public DbSet<Entities.RoleCheckPoint> RoleCheckPoints { get; set; } = null!;
#endregion
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfiguration(new CheckListHeaderTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckListRowTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckListTemplateHeaderTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckListTemplateRowTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckPointTypeConfiguration());
modelBuilder.ApplyConfiguration(new DeviceMessageTypeConfiguration());
modelBuilder.ApplyConfiguration(new EquipmentTypeConfiguration());
modelBuilder.ApplyConfiguration(new LocationTypeConfiguration());
modelBuilder.ApplyConfiguration(new NumberGeneratorTypeConfiguration());
modelBuilder.ApplyConfiguration(new NumberGeneratorDateTypeConfiguration());
modelBuilder.ApplyConfiguration(new RoleTypeConfiguration());
modelBuilder.ApplyConfiguration(new RoleCheckListTemplateHeaderTypeConfiguration());
modelBuilder.ApplyConfiguration(new RoleCheckPointTypeConfiguration());
modelBuilder.ApplyConfiguration(new UserTypeConfiguration());
modelBuilder.ApplyConfiguration(new UserRoleTypeConfiguration());
modelBuilder.RegisterSoftDeleteQueryFilters();
SeedInit(modelBuilder);
}
public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
{
SaveChangesCore();
return await base.SaveChangesAsync(cancellationToken);
}
protected virtual void SaveChangesCore()
{
var utcNow = DateTime.UtcNow;
var deletedEntries = ChangeTracker
.Entries()
.Where(e => e.Entity is ISoftDeletableEntity && e.State == EntityState.Deleted);
UpdateDeletedEntries(deletedEntries);
var modifiedEntries = ChangeTracker
.Entries()
.Where(e => e.Entity is IAuditableEntity && e.State == EntityState.Modified);
UpdateModifiedEntires(modifiedEntries, utcNow);
var addedEntries = ChangeTracker
.Entries()
.Where(e => e.Entity is IAuditableEntity && e.State == EntityState.Added);
UpdateAddedEntries(addedEntries, utcNow);
}
private void UpdateAddedEntries(IEnumerable<EntityEntry> addedEntries, DateTime utcNow)
{
foreach (var entry in addedEntries)
{
((IAuditableEntity)entry.Entity).CreatedAt = utcNow;
((IAuditableEntity)entry.Entity).LastModAt = utcNow;
((IAuditableEntity)entry.Entity).CreatedBy = _requestContext.CurrentUsername ?? "Admin";
((IAuditableEntity)entry.Entity).LastModBy = _requestContext.CurrentUsername ?? "Admin";
}
}
private void UpdateModifiedEntires(IEnumerable<EntityEntry> modifiedEntries, DateTime utcNow)
{
foreach (var entry in modifiedEntries)
{
((IAuditableEntity)entry.Entity).LastModAt = utcNow;
((IAuditableEntity)entry.Entity).LastModBy = _requestContext.CurrentUsername ?? "Admin";
}
}
private void UpdateDeletedEntries(IEnumerable<EntityEntry> deletedEntries)
{
foreach (var entry in deletedEntries)
{
((ISoftDeletableEntity)entry.Entity).IsDeleted = true;
entry.State = EntityState.Modified;
}
}
private void SeedInit(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>().HasData(
new User
{
Id = 1,
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
LastName = "System",
IsDeleted = false,
UserName = "admin",
PasswordHash = PasswordHasher.HashPassword("111111"),
CreatedAt = DateTime.UtcNow,
CreatedBy = "System",
LastModAt = DateTime.UtcNow,
LastModBy = "System",
JwtToken = "",
Active = true,
Token2FA = "",
NFCActive = true,
NFCCode = "00000000"
},
new User
{
Id = 2,
Email = "user@nuvolar.hu",
FirstName = "User",
LastName = "System",
IsDeleted = false,
UserName = "user",
PasswordHash = PasswordHasher.HashPassword("222222"),
CreatedAt = DateTime.UtcNow,
CreatedBy = "System",
LastModAt = DateTime.UtcNow,
LastModBy = "System",
JwtToken = "",
Active = true,
Token2FA = "",
NFCActive = true,
NFCCode = "00000000"
}
);
modelBuilder.Entity<NumberGeneratorTemplate>().HasData(
new NumberGeneratorTemplate
{
Id = 1,
CurrentNumber = 0,
DigitFormat = "D4",
GenerateType = GenerateType.OnlyYear,
LastGeneratedNumber = "",
Prefix = "CHK",
PrefixSeparator = "-",
ShortName = "Ellenőrzési dokumentum sorszámozása",
Suffix = "",
SuffixSeparator = "-",
}
);
modelBuilder.Entity<NumberGeneratorTemplateDate>().HasData(
new NumberGeneratorTemplateDate
{
Id = 1,
CurrentNumber = 0,
LastGeneratedNumber = "",
Month = 0,
Year = 1,
NumberGeneratorTemplateId = 1,
}
);
}
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using System;
using WorkFlowCheck.Common.RequestContext;
using WorkFlowCheck.Common.Security;
using WorkFlowCheck.DL.Configurations;
using WorkFlowCheck.DL.Entities;
using WorkFlowCheck.DL.Extensions;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL
{
public class AppDbContext : DbContext
{
private readonly IRequestContext _requestContext;
public AppDbContext(DbContextOptions<AppDbContext> options, IRequestContext requestContext)
: base(options)
{
_requestContext = requestContext;
}
#region Entities DbSet
public DbSet<Entities.CheckListHeader> CheckListHeaders { get; set; } = null!;
public DbSet<Entities.CheckListRow> CheckListRows { get; set; } = null!;
public DbSet<Entities.CheckListTemplateHeader> CheckListTemplateHeaders { get; set; } = null!;
public DbSet<Entities.CheckListTemplateRow> CheckListTemplateRows { get; set; } = null!;
public DbSet<Entities.CheckPoint> CheckPoints { get; set; } = null!;
public DbSet<DeviceMessage> DeviceMessages { 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.NumberGeneratorTemplate> NumberGeneratorTemplates { get; set; } = null!;
public DbSet<Entities.NumberGeneratorTemplateDate> NumberGeneratorTemplateDates { get; set; } = null!;
public DbSet<Entities.Role> Roles { get; set; } = null!;
public DbSet<Entities.User> Users { get; set; } = null!;
public DbSet<Entities.UserRole> UserRoles { get; set; } = null!;
public DbSet<Entities.RoleCheckListTemplateHeader> RoleCheckListTemplateHeaders { get; set; } = null!;
public DbSet<Entities.RoleCheckPoint> RoleCheckPoints { get; set; } = null!;
#endregion
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfiguration(new CheckListHeaderTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckListRowTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckListTemplateHeaderTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckListTemplateRowTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckPointTypeConfiguration());
modelBuilder.ApplyConfiguration(new DeviceMessageTypeConfiguration());
modelBuilder.ApplyConfiguration(new EquipmentTypeConfiguration());
modelBuilder.ApplyConfiguration(new FCMTokenTypeConfiguration());
modelBuilder.ApplyConfiguration(new LocationTypeConfiguration());
modelBuilder.ApplyConfiguration(new NumberGeneratorTypeConfiguration());
modelBuilder.ApplyConfiguration(new NumberGeneratorDateTypeConfiguration());
modelBuilder.ApplyConfiguration(new RoleTypeConfiguration());
modelBuilder.ApplyConfiguration(new RoleCheckListTemplateHeaderTypeConfiguration());
modelBuilder.ApplyConfiguration(new RoleCheckPointTypeConfiguration());
modelBuilder.ApplyConfiguration(new UserTypeConfiguration());
modelBuilder.ApplyConfiguration(new UserRoleTypeConfiguration());
modelBuilder.RegisterSoftDeleteQueryFilters();
SeedInit(modelBuilder);
}
public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
{
SaveChangesCore();
return await base.SaveChangesAsync(cancellationToken);
}
protected virtual void SaveChangesCore()
{
var utcNow = DateTime.UtcNow;
var deletedEntries = ChangeTracker
.Entries()
.Where(e => e.Entity is ISoftDeletableEntity && e.State == EntityState.Deleted);
UpdateDeletedEntries(deletedEntries);
var modifiedEntries = ChangeTracker
.Entries()
.Where(e => e.Entity is IAuditableEntity && e.State == EntityState.Modified);
UpdateModifiedEntires(modifiedEntries, utcNow);
var addedEntries = ChangeTracker
.Entries()
.Where(e => e.Entity is IAuditableEntity && e.State == EntityState.Added);
UpdateAddedEntries(addedEntries, utcNow);
}
private void UpdateAddedEntries(IEnumerable<EntityEntry> addedEntries, DateTime utcNow)
{
foreach (var entry in addedEntries)
{
((IAuditableEntity)entry.Entity).CreatedAt = utcNow;
((IAuditableEntity)entry.Entity).LastModAt = utcNow;
((IAuditableEntity)entry.Entity).CreatedBy = _requestContext.CurrentUsername ?? "Admin";
((IAuditableEntity)entry.Entity).LastModBy = _requestContext.CurrentUsername ?? "Admin";
}
}
private void UpdateModifiedEntires(IEnumerable<EntityEntry> modifiedEntries, DateTime utcNow)
{
foreach (var entry in modifiedEntries)
{
((IAuditableEntity)entry.Entity).LastModAt = utcNow;
((IAuditableEntity)entry.Entity).LastModBy = _requestContext.CurrentUsername ?? "Admin";
}
}
private void UpdateDeletedEntries(IEnumerable<EntityEntry> deletedEntries)
{
foreach (var entry in deletedEntries)
{
((ISoftDeletableEntity)entry.Entity).IsDeleted = true;
entry.State = EntityState.Modified;
}
}
private void SeedInit(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>().HasData(
new User
{
Id = 1,
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
LastName = "System",
IsDeleted = false,
UserName = "admin",
PasswordHash = PasswordHasher.HashPassword("111111"),
CreatedAt = DateTime.UtcNow,
CreatedBy = "System",
LastModAt = DateTime.UtcNow,
LastModBy = "System",
JwtToken = "",
Active = true,
Token2FA = "",
NFCActive = true,
NFCCode = "00000000"
},
new User
{
Id = 2,
Email = "user@nuvolar.hu",
FirstName = "User",
LastName = "System",
IsDeleted = false,
UserName = "user",
PasswordHash = PasswordHasher.HashPassword("222222"),
CreatedAt = DateTime.UtcNow,
CreatedBy = "System",
LastModAt = DateTime.UtcNow,
LastModBy = "System",
JwtToken = "",
Active = true,
Token2FA = "",
NFCActive = true,
NFCCode = "00000000"
}
);
modelBuilder.Entity<NumberGeneratorTemplate>().HasData(
new NumberGeneratorTemplate
{
Id = 1,
CurrentNumber = 0,
DigitFormat = "D4",
GenerateType = GenerateType.OnlyYear,
LastGeneratedNumber = "",
Prefix = "CHK",
PrefixSeparator = "-",
ShortName = "Ellenőrzési dokumentum sorszámozása",
Suffix = "",
SuffixSeparator = "-",
}
);
modelBuilder.Entity<NumberGeneratorTemplateDate>().HasData(
new NumberGeneratorTemplateDate
{
Id = 1,
CurrentNumber = 0,
LastGeneratedNumber = "",
Month = 0,
Year = 1,
NumberGeneratorTemplateId = 1,
}
);
}
}
}
@@ -1,27 +1,27 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.DL.Configurations
{
public class CheckListHeaderTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListHeader>
{
public void Configure(EntityTypeBuilder<Entities.CheckListHeader> builder)
{
builder.ToTable("CheckListHeader");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
builder
.HasOne(ch => ch.AcceptUser)
.WithMany()
.HasForeignKey(ch => ch.AcceptUserId)
.OnDelete(DeleteBehavior.Restrict); // Elkerüljük a cascade delete-et
}
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.DL.Configurations
{
public class CheckListHeaderTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListHeader>
{
public void Configure(EntityTypeBuilder<Entities.CheckListHeader> builder)
{
builder.ToTable("CheckListHeader");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
builder
.HasOne(ch => ch.AcceptUser)
.WithMany()
.HasForeignKey(ch => ch.AcceptUserId)
.OnDelete(DeleteBehavior.Restrict); // Elkerüljük a cascade delete-et
}
}
}
@@ -1,21 +1,21 @@
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 CheckListRowTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListRow>
{
public void Configure(EntityTypeBuilder<Entities.CheckListRow> builder)
{
builder.ToTable("CheckListRow");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
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 CheckListRowTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListRow>
{
public void Configure(EntityTypeBuilder<Entities.CheckListRow> builder)
{
builder.ToTable("CheckListRow");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -1,21 +1,21 @@
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 CheckListTemplateHeaderTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListTemplateHeader>
{
public void Configure(EntityTypeBuilder<Entities.CheckListTemplateHeader> builder)
{
builder.ToTable("CheckListTemplateHeader");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
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 CheckListTemplateHeaderTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListTemplateHeader>
{
public void Configure(EntityTypeBuilder<Entities.CheckListTemplateHeader> builder)
{
builder.ToTable("CheckListTemplateHeader");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -1,21 +1,21 @@
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 CheckListTemplateRowTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListTemplateRow>
{
public void Configure(EntityTypeBuilder<Entities.CheckListTemplateRow> builder)
{
builder.ToTable("CheckListTemplateRow");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
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 CheckListTemplateRowTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListTemplateRow>
{
public void Configure(EntityTypeBuilder<Entities.CheckListTemplateRow> builder)
{
builder.ToTable("CheckListTemplateRow");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -1,21 +1,21 @@
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 CheckPointTypeConfiguration : IEntityTypeConfiguration<Entities.CheckPoint>
{
public void Configure(EntityTypeBuilder<Entities.CheckPoint> builder)
{
builder.ToTable("CheckPoint");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
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 CheckPointTypeConfiguration : IEntityTypeConfiguration<Entities.CheckPoint>
{
public void Configure(EntityTypeBuilder<Entities.CheckPoint> builder)
{
builder.ToTable("CheckPoint");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -1,24 +1,24 @@
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 DeviceMessageTypeConfiguration : IEntityTypeConfiguration<Entities.DeviceMessage>
{
public void Configure(EntityTypeBuilder<Entities.DeviceMessage> builder)
{
builder.ToTable("DeviceMessage");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
builder.HasIndex(e => e.DeviceIdTo)
.HasDatabaseName("IX_DeviceMessage_DeviceIdTo");
}
}
}
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 DeviceMessageTypeConfiguration : IEntityTypeConfiguration<Entities.DeviceMessage>
{
public void Configure(EntityTypeBuilder<Entities.DeviceMessage> builder)
{
builder.ToTable("DeviceMessage");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
builder.HasIndex(e => e.DeviceIdTo)
.HasDatabaseName("IX_DeviceMessage_DeviceIdTo");
}
}
}
@@ -1,21 +1,21 @@
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 EquipmentTypeConfiguration : IEntityTypeConfiguration<Entities.Equipment>
{
public void Configure(EntityTypeBuilder<Entities.Equipment> builder)
{
builder.ToTable("Equipment");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
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 EquipmentTypeConfiguration : IEntityTypeConfiguration<Entities.Equipment>
{
public void Configure(EntityTypeBuilder<Entities.Equipment> builder)
{
builder.ToTable("Equipment");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}

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