diff --git a/.gitignore b/.gitignore index 7ab57c1..cbe8e13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,263 +1,4 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# BExIS-specific files -[Ww]orkspace/ - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -Workspace/ - -# Visual Studio 2015 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# 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 - -# DNX -project.lock.json -artifacts/ - -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.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 - -# 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 - -# 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 -# TODO: 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 -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -!**/packages/repositories.config -# NuGet v3's project.json files produces more ignoreable 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 - -# 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 -*.pfx -*.publishsettings -node_modules/ -orleans.codegen.cs - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# 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 - -# SQL Server files -*.mdf -*.ldf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# 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 - -# SPECIFIC -/Console/BExIS.Web.Shell/Credentials.config -/Console/BExIS.Web.Shell/Areas/DCM/Content/Images/Help -/Console/BExIS.Web.Shell/Areas/RPM/Content/Images/Help -/Console/BExIS.Web.Shell/Areas/SAM/Content/Images/Help -/Console/*.zip +/BExIS.Emm.Entities/bin +/BExIS.Emm.Orm.NH/obj +bin +Debug diff --git a/Entities/BExIS.Emm.Entities/BExIS.Emm.Entities.csproj b/BExIS.Emm.Entities/BExIS.Emm.Entities.csproj similarity index 51% rename from Entities/BExIS.Emm.Entities/BExIS.Emm.Entities.csproj rename to BExIS.Emm.Entities/BExIS.Emm.Entities.csproj index 8190d19..d52e61d 100644 --- a/Entities/BExIS.Emm.Entities/BExIS.Emm.Entities.csproj +++ b/BExIS.Emm.Entities/BExIS.Emm.Entities.csproj @@ -9,15 +9,16 @@ Debug AnyCPU - {2A701141-381E-4AD0-A446-094E4D22BEE4} + {74D74928-8394-4518-9A59-EB8885EDC747} Library Properties BExIS.Emm.Entities BExIS.Emm.Entities - v4.5.2 + v4.8 512 + true @@ -36,62 +37,36 @@ prompt 4 - - - - - - - - - - - ..\..\..\..\..\..\Libraries\Vaiona\Vaiona.Entities.dll - - - ..\..\..\..\..\..\Libraries\Vaiona\Vaiona.Persistence.Api.dll - - - + {c230693b-d780-438b-b26c-82257642dd5c} BExIS.Security.Entities - - {b4e7b1bf-01b4-40af-8d19-b8f362167261} + + {B4E7B1BF-01B4-40AF-8D19-B8F362167261} BExIS.Dlm.Entities + + {0815D220-3625-4E23-BBBC-8152345637FE} + Vaiona.Entities + - - - - - - - - - Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". - - - - - - + diff --git a/Orm/BExIS.Emm.Orm.NH/Mappings/Default/Event/EventRegistration.hbm.xml b/BExIS.Emm.Orm.NH/Mappings/Default/Event/EventRegistration.hbm.xml similarity index 84% rename from Orm/BExIS.Emm.Orm.NH/Mappings/Default/Event/EventRegistration.hbm.xml rename to BExIS.Emm.Orm.NH/Mappings/Default/Event/EventRegistration.hbm.xml index ced7524..cc59356 100644 --- a/Orm/BExIS.Emm.Orm.NH/Mappings/Default/Event/EventRegistration.hbm.xml +++ b/BExIS.Emm.Orm.NH/Mappings/Default/Event/EventRegistration.hbm.xml @@ -20,9 +20,12 @@ - + + + + diff --git a/Orm/BExIS.Emm.Orm.NH/Properties/AssemblyInfo.cs b/BExIS.Emm.Orm.NH/Properties/AssemblyInfo.cs similarity index 100% rename from Orm/BExIS.Emm.Orm.NH/Properties/AssemblyInfo.cs rename to BExIS.Emm.Orm.NH/Properties/AssemblyInfo.cs diff --git a/Orm/BExIS.Emm.Orm.NH/packages.config b/BExIS.Emm.Orm.NH/packages.config similarity index 100% rename from Orm/BExIS.Emm.Orm.NH/packages.config rename to BExIS.Emm.Orm.NH/packages.config diff --git a/BExIS.Emm.Services/.vs/BExIS.Emm.Services.csproj.dtbcache.json b/BExIS.Emm.Services/.vs/BExIS.Emm.Services.csproj.dtbcache.json new file mode 100644 index 0000000..fe01e55 --- /dev/null +++ b/BExIS.Emm.Services/.vs/BExIS.Emm.Services.csproj.dtbcache.json @@ -0,0 +1 @@ +{"RootPath":"C:\\_work\\_bexisV3\\Core\\Console\\BExIS.Web.Shell\\Areas\\EMM\\BExIS.Emm.Services","ProjectFileName":"BExIS.Emm.Services.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[],"References":[],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\_work\\_bexisV3\\Core\\Console\\BExIS.Web.Shell\\Areas\\EMM\\BExIS.Emm.Services\\bin\\Debug\\BExIS.Emm.Services.dll","OutputItemRelativePath":"BExIS.Emm.Services.dll"},{"OutputItemFullPath":"C:\\_work\\_bexisV3\\Core\\Console\\BExIS.Web.Shell\\Areas\\EMM\\BExIS.Emm.Services\\bin\\Debug\\BExIS.Emm.Services.pdb","OutputItemRelativePath":"BExIS.Emm.Services.pdb"}],"CopyToOutputEntries":[]} \ No newline at end of file diff --git a/Services/BExIS.Emm.Services/BExIS.Emm.Services.csproj b/BExIS.Emm.Services/BExIS.Emm.Services.csproj similarity index 55% rename from Services/BExIS.Emm.Services/BExIS.Emm.Services.csproj rename to BExIS.Emm.Services/BExIS.Emm.Services.csproj index 0f23b1c..46f8b42 100644 --- a/Services/BExIS.Emm.Services/BExIS.Emm.Services.csproj +++ b/BExIS.Emm.Services/BExIS.Emm.Services.csproj @@ -9,15 +9,16 @@ Debug AnyCPU - {0A9199F6-3CD0-4EEE-9EBD-5D4AE7916C9D} + {003E707F-B2B1-4A0B-8D16-5CD45E3A9E9D} Library Properties BExIS.Emm.Services BExIS.Emm.Services - v4.5.2 + v4.8 512 + true @@ -37,6 +38,10 @@ 4 + + False + ..\BExIS.Modules.EMM.UI\bin\Newtonsoft.Json.dll + @@ -45,15 +50,6 @@ - - ..\..\..\..\..\..\Libraries\Vaiona\Vaiona.Entities.dll - - - ..\..\..\..\..\..\Libraries\Vaiona\Vaiona.Persistence.Api.dll - - - ..\..\..\..\..\..\Libraries\Vaiona\Vaiona.Utils.dll - @@ -62,48 +58,46 @@ - + {681C8BC4-55F0-4F43-A685-90E246A88CB1} BExIS.Security.Services - + {b4e7b1bf-01b4-40af-8d19-b8f362167261} BExIS.Dlm.Entities - - {2a701141-381e-4ad0-a446-094e4d22bee4} - BExIS.Emm.Entities + + {0815d220-3625-4e23-bbbc-8152345637fe} + Vaiona.Entities - + + {640bf81d-354a-4bf0-85fc-f0ad587cf8a2} + Vaiona.Persistence.Api + + + {63fcacaa-9534-4fdd-a082-78dcc06baf28} + Vaiona.Utils + + {c230693b-d780-438b-b26c-82257642dd5c} BExIS.Security.Entities + + {74d74928-8394-4518-9a59-eb8885edc747} + BExIS.Emm.Entities + - - - - - - - - - Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". - - - - - + + + + + + + + + Allow waiting list + + + + Allow edit + + + + + { + const input = e.target; + if (input && 'files' in input && input.files && input.files[0]) { + onFileChange(input.files[0]); + } + }} + /> + {#if selectedFile} +

Datei ausgewählt: {selectedFile.name}

+ {/if} + + {#if event.jsonFile} +
+ Aktuelles JSON: +
{typeof event.jsonFile === 'string' ? event.jsonFile : JSON.stringify(event.jsonFile, null, 2)}
+
+ {/if} + + + + + + Closed + + +
+ + + +
+ + + + + \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/components/entry.svelte b/BExIS.Modules.EMM.UI.Svelte/src/components/entry.svelte new file mode 100644 index 0000000..c22a2e3 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/components/entry.svelte @@ -0,0 +1,135 @@ + + +
+ {#if entry.options && entry.options.length >= 1} +
helpStore.show(entry.key)}> + +
+ {:else if entry.type.toLowerCase() === 'string'} + + {:else if entry.type.toLowerCase().includes('int')} + + {:else if entry.type.toLowerCase() === 'boolean'} +
helpStore.show(entry.key)}> + {entry.title}) +
+ {:else if entry.type.toLowerCase() === 'json'} +
helpStore.show(entry.key)}> + (entry.value = JSON.parse(JSONValue))} + /> +
+ {:else if entry.type === 'EntryList'} +
helpStore.show(entry.key)}> + {entry.title} (key: {entry.key}) + {#each Object.values(entry.value) as e, index} +
+
+ +
+
+ {#if Object.values(entry.value).length > 1} + + {/if} +
+
+ {/each} + + +
+ {/if} + + {#if isChild} + + {/if} +
diff --git a/BExIS.Modules.EMM.UI.Svelte/src/components/tableAction.svelte b/BExIS.Modules.EMM.UI.Svelte/src/components/tableAction.svelte new file mode 100644 index 0000000..a3ca9ac --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/components/tableAction.svelte @@ -0,0 +1,31 @@ + + +{#if !row.alreadyRegistered} + +{:else} +
+ {#if row.editAllowed} + + {/if} + +
+{/if} diff --git a/BExIS.Modules.EMM.UI.Svelte/src/components/tableActionResults.svelte b/BExIS.Modules.EMM.UI.Svelte/src/components/tableActionResults.svelte new file mode 100644 index 0000000..d3cf423 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/components/tableActionResults.svelte @@ -0,0 +1,42 @@ + + +
+ {#each buttons as button} + + {/each} +
\ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/components/tableActionsEventRegs.svelte b/BExIS.Modules.EMM.UI.Svelte/src/components/tableActionsEventRegs.svelte new file mode 100644 index 0000000..2e506c9 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/components/tableActionsEventRegs.svelte @@ -0,0 +1,42 @@ + + +
+ {#each buttons as button} + + {/each} +
\ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/components/tableOptions.svelte b/BExIS.Modules.EMM.UI.Svelte/src/components/tableOptions.svelte new file mode 100644 index 0000000..670c252 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/components/tableOptions.svelte @@ -0,0 +1,47 @@ + + +
+ {#each buttons as button} + + {/each} +
\ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/index.test.ts b/BExIS.Modules.EMM.UI.Svelte/src/index.test.ts new file mode 100644 index 0000000..e07cbbd --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/index.test.ts @@ -0,0 +1,7 @@ +import { describe, it, expect } from 'vitest'; + +describe('sum test', () => { + it('adds 1 + 2 to equal 3', () => { + expect(1 + 2).toBe(3); + }); +}); diff --git a/Docs/Manual/Manual.md b/BExIS.Modules.EMM.UI.Svelte/src/lib/index.ts similarity index 100% rename from Docs/Manual/Manual.md rename to BExIS.Modules.EMM.UI.Svelte/src/lib/index.ts diff --git a/BExIS.Modules.EMM.UI.Svelte/src/lib/themes/theme-bexis2.ts b/BExIS.Modules.EMM.UI.Svelte/src/lib/themes/theme-bexis2.ts new file mode 100644 index 0000000..51b3d55 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/lib/themes/theme-bexis2.ts @@ -0,0 +1,101 @@ +import type { CustomThemeConfig } from '@skeletonlabs/tw-plugin'; + +export const bexis2Theme: CustomThemeConfig = { + name: 'bexis2Theme', + properties: { + // =~= Theme Properties =~= + '--theme-font-family-base': `system-ui`, + '--theme-font-family-heading': `system-ui`, + '--theme-font-color-base': 'var(--color-surface-900)', + '--theme-font-color-dark': '255 255 255', + '--theme-rounded-base': '4px', + '--theme-rounded-container': '4px', + '--theme-border-base': '1px', + // =~= Theme On-X Colors =~= + '--on-primary': '255 255 255', + '--on-secondary': '255 255 255', + '--on-tertiary': '0 0 0', + '--on-success': '255 255 255', + '--on-warning': '255 255 255', + '--on-error': '255 255 255', + '--on-surface': '255 255 255', + // =~= Theme Colors =~= + // primary | #45b2a1 + '--color-primary-50': '227 243 241', // #e3f3f1 + '--color-primary-100': '218 240 236', // #daf0ec + '--color-primary-200': '209 236 232', // #d1ece8 + '--color-primary-300': '181 224 217', // #b5e0d9 + '--color-primary-400': '125 201 189', // #7dc9bd + '--color-primary-500': '69 178 161', // #45b2a1 + '--color-primary-600': '62 160 145', // #3ea091 + '--color-primary-700': '52 134 121', // #348679 + '--color-primary-800': '41 107 97', // #296b61 + '--color-primary-900': '34 87 79', // #22574f + // secondary | #ff9700 + '--color-secondary-50': '255 239 217', // #ffefd9 + '--color-secondary-100': '255 234 204', // #ffeacc + '--color-secondary-200': '255 229 191', // #ffe5bf + '--color-secondary-300': '255 213 153', // #ffd599 + '--color-secondary-400': '255 182 77', // #ffb64d + '--color-secondary-500': '255 151 0', // #ff9700 + '--color-secondary-600': '230 136 0', // #e68800 + '--color-secondary-700': '191 113 0', // #bf7100 + '--color-secondary-800': '153 91 0', // #995b00 + '--color-secondary-900': '125 74 0', // #7d4a00 + // tertiary | #bee1da + '--color-tertiary-50': '245 251 249', // #f5fbf9 + '--color-tertiary-100': '242 249 248', // #f2f9f8 + '--color-tertiary-200': '239 248 246', // #eff8f6 + '--color-tertiary-300': '229 243 240', // #e5f3f0 + '--color-tertiary-400': '210 234 229', // #d2eae5 + '--color-tertiary-500': '190 225 218', // #bee1da + '--color-tertiary-600': '171 203 196', // #abcbc4 + '--color-tertiary-700': '143 169 164', // #8fa9a4 + '--color-tertiary-800': '114 135 131', // #728783 + '--color-tertiary-900': '93 110 107', // #5d6e6b + // success | #4BB543 + '--color-success-50': '228 244 227', // #e4f4e3 + '--color-success-100': '219 240 217', // #dbf0d9 + '--color-success-200': '210 237 208', // #d2edd0 + '--color-success-300': '183 225 180', // #b7e1b4 + '--color-success-400': '129 203 123', // #81cb7b + '--color-success-500': '75 181 67', // #4BB543 + '--color-success-600': '68 163 60', // #44a33c + '--color-success-700': '56 136 50', // #388832 + '--color-success-800': '45 109 40', // #2d6d28 + '--color-success-900': '37 89 33', // #255921 + // warning | #EAB308 + '--color-warning-50': '252 244 218', // #fcf4da + '--color-warning-100': '251 240 206', // #fbf0ce + '--color-warning-200': '250 236 193', // #faecc1 + '--color-warning-300': '247 225 156', // #f7e19c + '--color-warning-400': '240 202 82', // #f0ca52 + '--color-warning-500': '234 179 8', // #EAB308 + '--color-warning-600': '211 161 7', // #d3a107 + '--color-warning-700': '176 134 6', // #b08606 + '--color-warning-800': '140 107 5', // #8c6b05 + '--color-warning-900': '115 88 4', // #735804 + // error | #FF0000 + '--color-error-50': '255 217 217', // #ffd9d9 + '--color-error-100': '255 204 204', // #ffcccc + '--color-error-200': '255 191 191', // #ffbfbf + '--color-error-300': '255 153 153', // #ff9999 + '--color-error-400': '255 77 77', // #ff4d4d + '--color-error-500': '255 0 0', // #FF0000 + '--color-error-600': '230 0 0', // #e60000 + '--color-error-700': '191 0 0', // #bf0000 + '--color-error-800': '153 0 0', // #990000 + '--color-error-900': '125 0 0', // #7d0000 + // surface | #c7c7c7 + '--color-surface-50': '247 247 247', // #f7f7f7 + '--color-surface-100': '244 244 244', // #f4f4f4 + '--color-surface-200': '241 241 241', // #f1f1f1 + '--color-surface-300': '233 233 233', // #e9e9e9 + '--color-surface-400': '216 216 216', // #d8d8d8 + '--color-surface-500': '199 199 199', // #c7c7c7 + '--color-surface-600': '179 179 179', // #b3b3b3 + '--color-surface-700': '149 149 149', // #959595 + '--color-surface-800': '119 119 119', // #777777 + '--color-surface-900': '98 98 98' // #626262 + } +}; diff --git a/BExIS.Modules.EMM.UI.Svelte/src/models/FileUpload.ts b/BExIS.Modules.EMM.UI.Svelte/src/models/FileUpload.ts new file mode 100644 index 0000000..e8bd9fa --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/models/FileUpload.ts @@ -0,0 +1,9 @@ +import type { fileUploaderType, asciiFileReaderInfoType } from '@bexis2/bexis2-core-ui'; + +export interface FileUploadModel { + fileUploader: fileUploaderType; + allFilesReadable: boolean; + hasStructure: boolean; + asciiFileReaderInfo: asciiFileReaderInfoType; + lastModification: string | null; +} diff --git a/BExIS.Modules.EMM.UI.Svelte/src/models/eventModels.ts b/BExIS.Modules.EMM.UI.Svelte/src/models/eventModels.ts new file mode 100644 index 0000000..0c54b55 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/models/eventModels.ts @@ -0,0 +1,45 @@ + +export interface EventListItem { + id: number; + name: string; + participants: string; + startDate: string; + deadline: string; + editAllowed: boolean; + alreadyRegistered: boolean; + inUse: boolean; + deleted: boolean; + +} + +export interface EditEvent { + id: number; + name: string; + eventDate: string; + importantInformation: string; + location: string; + mailInformation: string; + selectedEventLanguage: string; + jsonFile: string; + startDate: string; + deadline: string; + participantsLimitation: number; + waitingList: boolean; + waitingListLimitation: number; + editAllowed: boolean; + closed: boolean; + logInPassword: string; + emailBCC: string; + emailCC: string; + emailReply: string; + javaScriptPath: string; + inUse: boolean; + editAccess: string; + jsonsKeys:string[]; + jsonKeyEmail:string; + jsonKeyFirstName:string; + jsonKeyLastName:string; +} + + + diff --git a/BExIS.Modules.EMM.UI.Svelte/src/models/eventregistrationModel.ts b/BExIS.Modules.EMM.UI.Svelte/src/models/eventregistrationModel.ts new file mode 100644 index 0000000..261d4cb --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/models/eventregistrationModel.ts @@ -0,0 +1,110 @@ +// Generic interface +export interface EventRegistration{ + eventId: number; + jsonFile: string; +} + + +export class ReadEventModel { + id: string; + name: string; + description: string; + entries: Array = []; + + constructor(json: any) { + this.id = json.id; + this.name = json.name; + this.description = json.description; + + json.entries.forEach((entry) => { + this.entries.push(entry); + }); + } +} + +export class EventRegistrationLoadModel +{ + name: string; + date: string; + location: string; + language: string; + importantInformation: string; + jsonFile: string; + + constructor(json: any) { + this.name = json.name; + this.date = json.date; + this.location = json.location; + this.language = json.language; + this.importantInformation = json.importantInformation; + this.jsonFile = json.jsonFile; + + + } +} + + + +export class UpdateEventRegistrationModel { + registration: Array; + //entries: Array; + + constructor(json: any) { + + this.registration = new Array(); + + Object.values(json.registration).forEach((section) => { + this.registration.push(new UpdateSectionModel(section)); + }); + } +} + +export class UpdateSectionModel{ + title: string; + entries: Array; + + constructor(json: any) { + this.title = json.title; + this.entries = new Array(); + + json.entries.forEach((entry) => { + this.entries.push(new UpdateEntryModel(entry)); + }); + } +} + +export class ReadEntryModel { + key: string; + title: string; + value: any; + type: string; + description: string; + options: string[]; + + constructor(json: any) { + this.key = json.key; + this.title = json.title; + this.value = json.value; + this.type = json.type; + this.description = json.description; + this.options = json.options; + } +} + +export class UpdateEntryModel { + key: string; + title: string; + value: any; + type: string; + description: string; + options: string[]; + + constructor(json: any) { + this.key = json.key; + this.title = json.title; + this.type = json.type; + this.description = json.description; + this.options = json.options; + this.value = JSON.stringify(json.value); + } +} \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/+layout.js b/BExIS.Modules.EMM.UI.Svelte/src/routes/+layout.js new file mode 100644 index 0000000..1e62f0b --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/+layout.js @@ -0,0 +1,3 @@ +export const prerender = true; +export const ssr = false; +export const trailingSlash = 'always'; diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/+layout.svelte b/BExIS.Modules.EMM.UI.Svelte/src/routes/+layout.svelte new file mode 100644 index 0000000..2da70d8 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/+layout.svelte @@ -0,0 +1,12 @@ + + + diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/+page.js b/BExIS.Modules.EMM.UI.Svelte/src/routes/+page.js new file mode 100644 index 0000000..b6e46aa --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/+page.js @@ -0,0 +1,11 @@ +import { setApiConfig } from '@bexis2/bexis2-core-ui'; + +/** @type {import('./$types').PageLoad} */ +export function load() { + if (import.meta.env.DEV) { + console.log('dev'); + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + } + + return {}; +} \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/eventregistration/+page.js b/BExIS.Modules.EMM.UI.Svelte/src/routes/eventregistration/+page.js new file mode 100644 index 0000000..b6e46aa --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/eventregistration/+page.js @@ -0,0 +1,11 @@ +import { setApiConfig } from '@bexis2/bexis2-core-ui'; + +/** @type {import('./$types').PageLoad} */ +export function load() { + if (import.meta.env.DEV) { + console.log('dev'); + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + } + + return {}; +} \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/eventregistration/+page.svelte b/BExIS.Modules.EMM.UI.Svelte/src/routes/eventregistration/+page.svelte new file mode 100644 index 0000000..448d859 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/eventregistration/+page.svelte @@ -0,0 +1,130 @@ + + + +
+ handleTableAction(e)} +/> + + + {#if showPasswordModal} +
+
+

Enter password

+ e.key === 'Enter' && checkPassword()} + /> + {#if passwordError} +
{passwordError}
+ {/if} +
+ + +
+
+
+{/if} + + \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/events/+page.js b/BExIS.Modules.EMM.UI.Svelte/src/routes/events/+page.js new file mode 100644 index 0000000..b6e46aa --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/events/+page.js @@ -0,0 +1,11 @@ +import { setApiConfig } from '@bexis2/bexis2-core-ui'; + +/** @type {import('./$types').PageLoad} */ +export function load() { + if (import.meta.env.DEV) { + console.log('dev'); + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + } + + return {}; +} \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/events/+page.svelte b/BExIS.Modules.EMM.UI.Svelte/src/routes/events/+page.svelte new file mode 100644 index 0000000..8d15e5e --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/events/+page.svelte @@ -0,0 +1,78 @@ + + + + +
+
+ Create new Event +
+
+ + + +
+
+ + +
+
handleTableAction(e)}/> + + \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/events/create/+page.js b/BExIS.Modules.EMM.UI.Svelte/src/routes/events/create/+page.js new file mode 100644 index 0000000..b6e46aa --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/events/create/+page.js @@ -0,0 +1,11 @@ +import { setApiConfig } from '@bexis2/bexis2-core-ui'; + +/** @type {import('./$types').PageLoad} */ +export function load() { + if (import.meta.env.DEV) { + console.log('dev'); + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + } + + return {}; +} \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/events/create/+page.svelte b/BExIS.Modules.EMM.UI.Svelte/src/routes/events/create/+page.svelte new file mode 100644 index 0000000..29873e0 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/events/create/+page.svelte @@ -0,0 +1,77 @@ + + + \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/events/edit/[id]/+page.svelte b/BExIS.Modules.EMM.UI.Svelte/src/routes/events/edit/[id]/+page.svelte new file mode 100644 index 0000000..dd7cbfc --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/events/edit/[id]/+page.svelte @@ -0,0 +1,101 @@ + + +{#if !loading} + +{:else} +

Lade Eventdaten ...

+{/if} \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/results/+page.js b/BExIS.Modules.EMM.UI.Svelte/src/routes/results/+page.js new file mode 100644 index 0000000..b6e46aa --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/results/+page.js @@ -0,0 +1,11 @@ +import { setApiConfig } from '@bexis2/bexis2-core-ui'; + +/** @type {import('./$types').PageLoad} */ +export function load() { + if (import.meta.env.DEV) { + console.log('dev'); + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + } + + return {}; +} \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/results/+page.svelte b/BExIS.Modules.EMM.UI.Svelte/src/routes/results/+page.svelte new file mode 100644 index 0000000..8520cab --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/results/+page.svelte @@ -0,0 +1,66 @@ + + + +
+
handleTableAction(e)}/> + + \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/routes/results/show/[id]/+page.svelte b/BExIS.Modules.EMM.UI.Svelte/src/routes/results/show/[id]/+page.svelte new file mode 100644 index 0000000..e52a530 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/routes/results/show/[id]/+page.svelte @@ -0,0 +1,212 @@ + + + +
+

Event Results

+
+
+ +
+ +
+
handleTableAction(e)}/> + +
Waiting List
+
+
handleTableAction(e)}/> + + \ No newline at end of file diff --git a/BExIS.Modules.EMM.UI.Svelte/src/services/eventCaller.ts b/BExIS.Modules.EMM.UI.Svelte/src/services/eventCaller.ts new file mode 100644 index 0000000..963b40e --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/services/eventCaller.ts @@ -0,0 +1,61 @@ +import { Api } from '@bexis2/bexis2-core-ui'; +import { setApiConfig } from '@bexis2/bexis2-core-ui'; +import type { EditEvent } from '../models/eventModels'; +// Fetch data from API and return as JSON object +export const getEvents = async () => { + + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + let url = "/EMM/Event/GetEvents"; + + const res = await Api.get(url); + console.log("events:", res.data); + + return res.data; +} + +export const getEvent = async (id) => { + + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + let url = "/EMM/Event/Get/" + id; + + const res = await Api.get(url); + + + return res.data; +} + +export const saveEvent = async (event: EditEvent) => { + console.log("saveEvent called with:", event); + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + try { + const response = await Api.post('/EMM/Event/Create', event); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +}; + +export const updateEvent = async (event: EditEvent) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + try { + const response = await Api.post('/EMM/Event/Update', event); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +}; + +export const deleteEvent = async (id) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + try { + console.log("deleteEvent called with id:", id); + // Ensure id is a number or string that can be converted to a number + const response = await Api.post('/EMM/Event/Delete', { id }); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +}; diff --git a/BExIS.Modules.EMM.UI.Svelte/src/services/eventRegistrationCaller.ts b/BExIS.Modules.EMM.UI.Svelte/src/services/eventRegistrationCaller.ts new file mode 100644 index 0000000..e8073be --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/services/eventRegistrationCaller.ts @@ -0,0 +1,94 @@ +import { Api } from '@bexis2/bexis2-core-ui'; +import { setApiConfig } from '@bexis2/bexis2-core-ui'; +import type { EventRegistration } from '../models/eventregistrationModel'; + + +export const getEvents = async () => { + + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + let url = "/EMM/EventRegistration/GetEvents"; + + const res = await Api.get(url); + console.log("events:", res.data); + + return res.data; +} + +export const getEventRegistrationJson = async (eventId: number) => { + + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + let url = "/EMM/EventRegistration/GetEventRegistrationJson/" + eventId; + + const res = await Api.get(url); + + + return res.data; +} + + +export const saveEventRegistration = async (eventReg: EventRegistration) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + try { + const response = await Api.post('/emm/EventRegistration/Create', eventReg); + return response.data; + } catch (error) { + console.error(error); + + throw error; + } +}; + +export const getEventRegistration = async (id: number) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + try { + const response = await Api.get(`/emm/EventRegistration/Get/${id}`); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +}; + +export const getEventRegistrationPassword = async (id: number) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + try { + const response = await Api.get(`/emm/EventRegistration/GetEventPassword/${id}`); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +}; + +export const editEventRegistration = async (eventReg: EventRegistration) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + try { + const response = await Api.post('/emm/EventRegistration/Edit', eventReg); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +}; + +export const deleteEventRegistration = async (id: number) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + try { + const response = await Api.get(`/emm/EventRegistration/Delete/${id}`); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +}; + +export const userAllreadyRegister = async (eventReg: EventRegistration) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + try { + const response = await Api.post(`/emm/EventRegistration/UserAlreadyRegistered/`, eventReg); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +}; diff --git a/BExIS.Modules.EMM.UI.Svelte/src/services/eventResultCaller.ts b/BExIS.Modules.EMM.UI.Svelte/src/services/eventResultCaller.ts new file mode 100644 index 0000000..f32745d --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/src/services/eventResultCaller.ts @@ -0,0 +1,98 @@ +import { Api } from '@bexis2/bexis2-core-ui'; +import { setApiConfig } from '@bexis2/bexis2-core-ui'; + +export const getEvents = async () => { + + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + let url = "/EMM/EventRegistrationResult/GetEvents"; + + const res = await Api.get(url); + + return res.data; +} + +export const getEventResults = async (eventId: number) => { + + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + let url = "/EMM/EventRegistrationResult/GetEventRegistrations/" + eventId; + + const res = await Api.get(url); + + return res.data; +} + + +export const getEventWaitingListResults = async (eventId: number) => { + + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + let url = "/EMM/EventRegistrationResult/GetWaitingListRegistrations/" + eventId; + + const res = await Api.get(url); + + return res.data; +} + +export const deleteEvent = async (id) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + + try { + console.log("deleteEvent called with id:", id); + const response = await Api.get('/EMM/EventRegistrationResult/DeleteAll/' + id); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +} + +export const deleteRegistration = async (id) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + + try { + console.log("deleteRegistration called with id:", id); + const response = await Api.get('/EMM/EventRegistrationResult/Delete/' + id); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +} + + +export const moveEvent = async (id) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + + try { + const response = await Api.get('/EMM/EventRegistrationResult/MoveFromWaitingList' + id); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +} + +export const Resend = async (id) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + console.log("Resend called with id:", id); + try { + const response = await Api.get('/EMM/EventRegistrationResult/ResendNotification/' + id ); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +} + +export const clearEvent = async (id) => { + setApiConfig('http://localhost:44345/', 'epetzold', '2021.B2.Go$On'); + + try { + const response = await Api.get('/EMM/EventRegistrationResult/Clear/' + id); + return response.data; + } catch (error) { + console.error(error); + throw error; + } +} + + diff --git a/BExIS.Modules.EMM.UI.Svelte/static/favicon.png b/BExIS.Modules.EMM.UI.Svelte/static/favicon.png new file mode 100644 index 0000000..d6c8e80 Binary files /dev/null and b/BExIS.Modules.EMM.UI.Svelte/static/favicon.png differ diff --git a/BExIS.Modules.EMM.UI.Svelte/svelte.config.js b/BExIS.Modules.EMM.UI.Svelte/svelte.config.js new file mode 100644 index 0000000..5bfda05 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/svelte.config.js @@ -0,0 +1,33 @@ +// import adapter from '@sveltejs/adapter-auto'; +import adapter from '@sveltejs/adapter-static'; + +import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; +import { build } from 'vite'; + +/** @type {import('@sveltejs/kit').Config} */ +const config = { + // Consult https://kit.svelte.dev/docs/integrations#preprocessors + // for more information about preprocessors + preprocess: vitePreprocess(), + kit: { + adapter: adapter({ + pages: '../BExIS.Modules.DQM/Scripts/svelte', // ../BExIS.Modules.Dcm.UI/Scripts/svelte + assets: '../BExIS.Modules.DQM/Scripts/svelte', // ../BExIS.Modules.Dcm.UI/Scripts/svelte + fallback: null, + precompress: true, + preprocess: true, + strict: false + }), + paths: { + relative: true, + base: process.env.NODE_ENV === 'production' ? '/dqm' : '' // add module id here, + }, + + alias: { + $models: './src/models', + $services: './src/services' + } + } +}; + +export default config; diff --git a/BExIS.Modules.EMM.UI.Svelte/tailwind.config.cjs b/BExIS.Modules.EMM.UI.Svelte/tailwind.config.cjs new file mode 100644 index 0000000..f219bc6 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/tailwind.config.cjs @@ -0,0 +1,34 @@ +/** @type {import('tailwindcss').Config} */ + +// @ts-check +import { join } from 'path'; + +// 1. Import the Skeleton plugin +import { skeleton } from '@skeletonlabs/tw-plugin'; + +// add custom theme +import { bexis2theme } from './node_modules/@bexis2/bexis2-core-ui/dist/themes/theme-bexis2'; + +module.exports = { + darkMode: 'class', + content: [ + './src/**/*.{html,js,svelte,ts}', + require('path').join(require.resolve('@skeletonlabs/skeleton'), '../**/*.{html,js,svelte,ts}'), + require('path').join('node_modules/@bexis2/bexis2-core-ui', '../**/*.{html,js,svelte,ts}') + // 'C:/Users/admin/source/repos/Bexis2/BEXIS2 - Core - Workspace/Core/Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI.Svelte/node_modules/@bexis2/bexis2-core-ui/src/**/*.{html,js,svelte,ts}'], + ], + + theme: { + extend: {} + }, + plugins: [ + require('@tailwindcss/forms'), + require('@tailwindcss/typography'), + skeleton({ + themes: { + // Register each theme within this array: + custom: [bexis2theme] + } + }) + ] +}; diff --git a/BExIS.Modules.EMM.UI.Svelte/tests/test.ts b/BExIS.Modules.EMM.UI.Svelte/tests/test.ts new file mode 100644 index 0000000..5816be4 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/tests/test.ts @@ -0,0 +1,6 @@ +import { expect, test } from '@playwright/test'; + +test('index page has expected h1', async ({ page }) => { + await page.goto('/'); + await expect(page.getByRole('heading', { name: 'Welcome to SvelteKit' })).toBeVisible(); +}); diff --git a/BExIS.Modules.EMM.UI.Svelte/tsconfig.json b/BExIS.Modules.EMM.UI.Svelte/tsconfig.json new file mode 100644 index 0000000..8b93f9f --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "./.svelte-kit/tsconfig.json", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "sourceMap": true, + "strict": true, + "noImplicitAny": false + } + // "exclude": ["node_modules", "src"] + // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias + // + // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes + // from the referenced tsconfig.json - TypeScript does not merge them in +} + diff --git a/BExIS.Modules.EMM.UI.Svelte/vite.config.ts b/BExIS.Modules.EMM.UI.Svelte/vite.config.ts new file mode 100644 index 0000000..37b6a84 --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/vite.config.ts @@ -0,0 +1,9 @@ +import { sveltekit } from '@sveltejs/kit/vite'; +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + plugins: [sveltekit()], + test: { + include: ['src/**/*.{test,spec}.{js,ts}'] + } +}); diff --git a/BExIS.Modules.EMM.UI.Svelte/vite.config.ts.timestamp-1688989700122-d1b693d027fde.mjs b/BExIS.Modules.EMM.UI.Svelte/vite.config.ts.timestamp-1688989700122-d1b693d027fde.mjs new file mode 100644 index 0000000..40457ee --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/vite.config.ts.timestamp-1688989700122-d1b693d027fde.mjs @@ -0,0 +1,11 @@ +// vite.config.ts +import { sveltekit } from 'file:///C:/Users/admin/source/repos/Bexis2/BEXIS2%20-%20Core%20-%20Workspace/Core/Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI.Svelte/node_modules/@sveltejs/kit/src/exports/vite/index.js'; +import { defineConfig } from 'file:///C:/Users/admin/source/repos/Bexis2/BEXIS2%20-%20Core%20-%20Workspace/Core/Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI.Svelte/node_modules/vitest/dist/config.js'; +var vite_config_default = defineConfig({ + plugins: [sveltekit()], + test: { + include: ['src/**/*.{test,spec}.{js,ts}'] + } +}); +export { vite_config_default as default }; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCJDOlxcXFxVc2Vyc1xcXFxhZG1pblxcXFxzb3VyY2VcXFxccmVwb3NcXFxcQmV4aXMyXFxcXEJFWElTMiAtIENvcmUgLSBXb3Jrc3BhY2VcXFxcQ29yZVxcXFxDb25zb2xlXFxcXEJFeElTLldlYi5TaGVsbFxcXFxBcmVhc1xcXFxEQ01cXFxcQkV4SVMuTW9kdWxlcy5EY20uVUkuU3ZlbHRlXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCJDOlxcXFxVc2Vyc1xcXFxhZG1pblxcXFxzb3VyY2VcXFxccmVwb3NcXFxcQmV4aXMyXFxcXEJFWElTMiAtIENvcmUgLSBXb3Jrc3BhY2VcXFxcQ29yZVxcXFxDb25zb2xlXFxcXEJFeElTLldlYi5TaGVsbFxcXFxBcmVhc1xcXFxEQ01cXFxcQkV4SVMuTW9kdWxlcy5EY20uVUkuU3ZlbHRlXFxcXHZpdGUuY29uZmlnLnRzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9DOi9Vc2Vycy9hZG1pbi9zb3VyY2UvcmVwb3MvQmV4aXMyL0JFWElTMiUyMC0lMjBDb3JlJTIwLSUyMFdvcmtzcGFjZS9Db3JlL0NvbnNvbGUvQkV4SVMuV2ViLlNoZWxsL0FyZWFzL0RDTS9CRXhJUy5Nb2R1bGVzLkRjbS5VSS5TdmVsdGUvdml0ZS5jb25maWcudHNcIjtpbXBvcnQgeyBzdmVsdGVraXQgfSBmcm9tICdAc3ZlbHRlanMva2l0L3ZpdGUnO1xyXG5pbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tICd2aXRlc3QvY29uZmlnJztcclxuXHJcbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XHJcblx0cGx1Z2luczogW3N2ZWx0ZWtpdCgpXSxcclxuXHR0ZXN0OiB7XHJcblx0XHRpbmNsdWRlOiBbJ3NyYy8qKi8qLnt0ZXN0LHNwZWN9Lntqcyx0c30nXVxyXG5cdH1cclxufSk7Il0sCiAgIm1hcHBpbmdzIjogIjtBQUFpbEIsU0FBUyxpQkFBaUI7QUFDM21CLFNBQVMsb0JBQW9CO0FBRTdCLElBQU8sc0JBQVEsYUFBYTtBQUFBLEVBQzNCLFNBQVMsQ0FBQyxVQUFVLENBQUM7QUFBQSxFQUNyQixNQUFNO0FBQUEsSUFDTCxTQUFTLENBQUMsOEJBQThCO0FBQUEsRUFDekM7QUFDRCxDQUFDOyIsCiAgIm5hbWVzIjogW10KfQo= diff --git a/BExIS.Modules.EMM.UI.Svelte/vite.config.ts.timestamp-1690355962076-c09a00157f041.mjs b/BExIS.Modules.EMM.UI.Svelte/vite.config.ts.timestamp-1690355962076-c09a00157f041.mjs new file mode 100644 index 0000000..40457ee --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/vite.config.ts.timestamp-1690355962076-c09a00157f041.mjs @@ -0,0 +1,11 @@ +// vite.config.ts +import { sveltekit } from 'file:///C:/Users/admin/source/repos/Bexis2/BEXIS2%20-%20Core%20-%20Workspace/Core/Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI.Svelte/node_modules/@sveltejs/kit/src/exports/vite/index.js'; +import { defineConfig } from 'file:///C:/Users/admin/source/repos/Bexis2/BEXIS2%20-%20Core%20-%20Workspace/Core/Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI.Svelte/node_modules/vitest/dist/config.js'; +var vite_config_default = defineConfig({ + plugins: [sveltekit()], + test: { + include: ['src/**/*.{test,spec}.{js,ts}'] + } +}); +export { vite_config_default as default }; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCJDOlxcXFxVc2Vyc1xcXFxhZG1pblxcXFxzb3VyY2VcXFxccmVwb3NcXFxcQmV4aXMyXFxcXEJFWElTMiAtIENvcmUgLSBXb3Jrc3BhY2VcXFxcQ29yZVxcXFxDb25zb2xlXFxcXEJFeElTLldlYi5TaGVsbFxcXFxBcmVhc1xcXFxEQ01cXFxcQkV4SVMuTW9kdWxlcy5EY20uVUkuU3ZlbHRlXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCJDOlxcXFxVc2Vyc1xcXFxhZG1pblxcXFxzb3VyY2VcXFxccmVwb3NcXFxcQmV4aXMyXFxcXEJFWElTMiAtIENvcmUgLSBXb3Jrc3BhY2VcXFxcQ29yZVxcXFxDb25zb2xlXFxcXEJFeElTLldlYi5TaGVsbFxcXFxBcmVhc1xcXFxEQ01cXFxcQkV4SVMuTW9kdWxlcy5EY20uVUkuU3ZlbHRlXFxcXHZpdGUuY29uZmlnLnRzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9DOi9Vc2Vycy9hZG1pbi9zb3VyY2UvcmVwb3MvQmV4aXMyL0JFWElTMiUyMC0lMjBDb3JlJTIwLSUyMFdvcmtzcGFjZS9Db3JlL0NvbnNvbGUvQkV4SVMuV2ViLlNoZWxsL0FyZWFzL0RDTS9CRXhJUy5Nb2R1bGVzLkRjbS5VSS5TdmVsdGUvdml0ZS5jb25maWcudHNcIjtpbXBvcnQgeyBzdmVsdGVraXQgfSBmcm9tICdAc3ZlbHRlanMva2l0L3ZpdGUnO1xyXG5pbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tICd2aXRlc3QvY29uZmlnJztcclxuXHJcbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XHJcblx0cGx1Z2luczogW3N2ZWx0ZWtpdCgpXSxcclxuXHR0ZXN0OiB7XHJcblx0XHRpbmNsdWRlOiBbJ3NyYy8qKi8qLnt0ZXN0LHNwZWN9Lntqcyx0c30nXVxyXG5cdH1cclxufSk7Il0sCiAgIm1hcHBpbmdzIjogIjtBQUFpbEIsU0FBUyxpQkFBaUI7QUFDM21CLFNBQVMsb0JBQW9CO0FBRTdCLElBQU8sc0JBQVEsYUFBYTtBQUFBLEVBQzNCLFNBQVMsQ0FBQyxVQUFVLENBQUM7QUFBQSxFQUNyQixNQUFNO0FBQUEsSUFDTCxTQUFTLENBQUMsOEJBQThCO0FBQUEsRUFDekM7QUFDRCxDQUFDOyIsCiAgIm5hbWVzIjogW10KfQo= diff --git a/BExIS.Modules.EMM.UI.Svelte/vite.config.ts.timestamp-1690355962086-dcb566e3136fc.mjs b/BExIS.Modules.EMM.UI.Svelte/vite.config.ts.timestamp-1690355962086-dcb566e3136fc.mjs new file mode 100644 index 0000000..40457ee --- /dev/null +++ b/BExIS.Modules.EMM.UI.Svelte/vite.config.ts.timestamp-1690355962086-dcb566e3136fc.mjs @@ -0,0 +1,11 @@ +// vite.config.ts +import { sveltekit } from 'file:///C:/Users/admin/source/repos/Bexis2/BEXIS2%20-%20Core%20-%20Workspace/Core/Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI.Svelte/node_modules/@sveltejs/kit/src/exports/vite/index.js'; +import { defineConfig } from 'file:///C:/Users/admin/source/repos/Bexis2/BEXIS2%20-%20Core%20-%20Workspace/Core/Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI.Svelte/node_modules/vitest/dist/config.js'; +var vite_config_default = defineConfig({ + plugins: [sveltekit()], + test: { + include: ['src/**/*.{test,spec}.{js,ts}'] + } +}); +export { vite_config_default as default }; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCJDOlxcXFxVc2Vyc1xcXFxhZG1pblxcXFxzb3VyY2VcXFxccmVwb3NcXFxcQmV4aXMyXFxcXEJFWElTMiAtIENvcmUgLSBXb3Jrc3BhY2VcXFxcQ29yZVxcXFxDb25zb2xlXFxcXEJFeElTLldlYi5TaGVsbFxcXFxBcmVhc1xcXFxEQ01cXFxcQkV4SVMuTW9kdWxlcy5EY20uVUkuU3ZlbHRlXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCJDOlxcXFxVc2Vyc1xcXFxhZG1pblxcXFxzb3VyY2VcXFxccmVwb3NcXFxcQmV4aXMyXFxcXEJFWElTMiAtIENvcmUgLSBXb3Jrc3BhY2VcXFxcQ29yZVxcXFxDb25zb2xlXFxcXEJFeElTLldlYi5TaGVsbFxcXFxBcmVhc1xcXFxEQ01cXFxcQkV4SVMuTW9kdWxlcy5EY20uVUkuU3ZlbHRlXFxcXHZpdGUuY29uZmlnLnRzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9DOi9Vc2Vycy9hZG1pbi9zb3VyY2UvcmVwb3MvQmV4aXMyL0JFWElTMiUyMC0lMjBDb3JlJTIwLSUyMFdvcmtzcGFjZS9Db3JlL0NvbnNvbGUvQkV4SVMuV2ViLlNoZWxsL0FyZWFzL0RDTS9CRXhJUy5Nb2R1bGVzLkRjbS5VSS5TdmVsdGUvdml0ZS5jb25maWcudHNcIjtpbXBvcnQgeyBzdmVsdGVraXQgfSBmcm9tICdAc3ZlbHRlanMva2l0L3ZpdGUnO1xyXG5pbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tICd2aXRlc3QvY29uZmlnJztcclxuXHJcbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XHJcblx0cGx1Z2luczogW3N2ZWx0ZWtpdCgpXSxcclxuXHR0ZXN0OiB7XHJcblx0XHRpbmNsdWRlOiBbJ3NyYy8qKi8qLnt0ZXN0LHNwZWN9Lntqcyx0c30nXVxyXG5cdH1cclxufSk7Il0sCiAgIm1hcHBpbmdzIjogIjtBQUFpbEIsU0FBUyxpQkFBaUI7QUFDM21CLFNBQVMsb0JBQW9CO0FBRTdCLElBQU8sc0JBQVEsYUFBYTtBQUFBLEVBQzNCLFNBQVMsQ0FBQyxVQUFVLENBQUM7QUFBQSxFQUNyQixNQUFNO0FBQUEsSUFDTCxTQUFTLENBQUMsOEJBQThCO0FBQUEsRUFDekM7QUFDRCxDQUFDOyIsCiAgIm5hbWVzIjogW10KfQo= diff --git a/BExIS.Modules.EMM.UI/.gitignore b/BExIS.Modules.EMM.UI/.gitignore new file mode 100644 index 0000000..7ab57c1 --- /dev/null +++ b/BExIS.Modules.EMM.UI/.gitignore @@ -0,0 +1,263 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# BExIS-specific files +[Ww]orkspace/ + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +Workspace/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# 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 + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.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 + +# 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 + +# 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 +# TODO: 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 +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable 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 + +# 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 +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# 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 + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# 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 + +# SPECIFIC +/Console/BExIS.Web.Shell/Credentials.config +/Console/BExIS.Web.Shell/Areas/DCM/Content/Images/Help +/Console/BExIS.Web.Shell/Areas/RPM/Content/Images/Help +/Console/BExIS.Web.Shell/Areas/SAM/Content/Images/Help +/Console/*.zip diff --git a/BExIS.Modules.EMM.UI.csproj b/BExIS.Modules.EMM.UI/BExIS.Modules.EMM.UI.csproj similarity index 70% rename from BExIS.Modules.EMM.UI.csproj rename to BExIS.Modules.EMM.UI/BExIS.Modules.EMM.UI.csproj index be4ab77..a9ffa4b 100644 --- a/BExIS.Modules.EMM.UI.csproj +++ b/BExIS.Modules.EMM.UI/BExIS.Modules.EMM.UI.csproj @@ -12,13 +12,13 @@ 2.0 - {0E5F4B53-398A-4634-9921-03B9CACBE8E0} + {0293940A-E024-43F5-8473-EFAC9D609B0C}{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}LibraryPropertiesBExIS.Modules.EMM.UIBExIS.Modules.EMM.UI - v4.5.2 + v4.8falsetrue @@ -30,6 +30,7 @@ ..\..\..\..\packages\WebGrease.1.5.2\lib + true @@ -58,6 +59,9 @@ ..\..\..\..\packages\Microsoft.AspNet.Identity.Core.2.2.3\lib\net45\Microsoft.AspNet.Identity.Core.dll + + ..\..\..\..\..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + ..\..\..\..\packages\Microsoft.AspNet.WebHelpers.3.2.3\lib\net45\Microsoft.Web.Helpers.dll @@ -72,15 +76,41 @@ ..\..\..\..\packages\NHibernate.4.1.1.4000\lib\net40\NHibernate.dll + + ..\..\..\..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + - + + ..\..\..\..\..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + ..\..\..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + + + ..\..\..\..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\..\..\..\..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\..\..\..\..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll + + + + ..\..\..\..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + ..\..\..\..\..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + + + + + ..\..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll @@ -108,42 +138,15 @@ ..\..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll - + ..\..\..\..\packages\TelerikMvcExtensions.2012.3.1018\lib\net40\Telerik.Web.Mvc.dll True - - ..\..\..\..\Libraries\Vaiona\Vaiona.Entities.dll - False - - - False - ..\..\..\..\Libraries\Vaiona\Vaiona.Logging.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Model.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Persistence.Api.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Utils.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Web.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Web.Mvc.dll - - - False - ..\..\..\..\Libraries\Vaiona\Vaiona.Web.Mvc.Modularity.dll - ..\..\..\..\packages\WebActivatorEx.2.2.0\lib\net40\WebActivatorEx.dll @@ -164,19 +167,9 @@ - - - - - - - - - - - + @@ -195,9 +188,11 @@ + - + + @@ -220,72 +215,111 @@ - + {c230693b-d780-438b-b26c-82257642dd5c} BExIS.Security.Entities - + {681c8bc4-55f0-4f43-a685-90e246a88cb1} BExIS.Security.Services - + + {7D7FBF8E-37D7-4A4C-B40E-3F267E9B9760} + BExIS.App.Bootstrap + + {b4e7b1bf-01b4-40af-8d19-b8f362167261} BExIS.Dlm.Entities True - + {c4ca0a99-0af3-4372-a9b7-b9073599bd8b} BExIS.Dlm.Services True - + {8B2EC2B0-6870-456B-BE2D-B0FB4EA68D83} BExIS.IO.DataType.DisplayPattern - + {455ec826-9a92-40ff-bd3b-388c288955ce} BExIS.IO.Transform.Output True - + {C8A05313-B960-406E-92EC-C1E5B3F47FCD} BExIS.IO.Transform.Validation - + {e4795f06-20c2-4c4c-a720-9a79896384df} BExIS.IO - + + {DE0AD99C-C559-422F-8132-CC4D7C46FF83} + BExIS.UI + + {A7FBCC13-7E29-4710-82A1-BD6D6F811FDA} BExIS.Utils.Data - + + {0815d220-3625-4e23-bbbc-8152345637fe} + Vaiona.Entities + + + {e8b37581-1cac-463d-903b-b4bee8b2b0e3} + Vaiona.Logging + + + {a60ac05f-8c9a-4efd-9826-452e6049da4d} + Vaiona.Model + + + {640bf81d-354a-4bf0-85fc-f0ad587cf8a2} + Vaiona.Persistence.Api + + + {63fcacaa-9534-4fdd-a082-78dcc06baf28} + Vaiona.Utils + + + {705f8751-e58a-453e-a7fd-0c310fd3cae8} + Vaiona.Web.Mvc.Modularity + + + {5f5d22e8-8c05-49cd-854e-8fe8eff1aa6c} + Vaiona.Web.Mvc + + + {5b48b5a8-eae8-4ef8-8f2c-7fedb1b095d3} + Vaiona.Web + + {252f7872-a69c-43a6-84b4-4d2abdbdd9ab} BExIS.Xml.Helpers - + {93eeeda5-6d79-41a1-947b-0a3fc9e46abc} BExIS.Dcm.CreateDatasetWizard - + {d17cdd9d-b87b-441b-9248-5c54e92ffc81} BExIS.Dcm.Wizard - + {34CAD2A2-6928-458B-B8DC-AF71D55F20CC} BExIS.Dim.Entities - + {81EF18E8-DCED-4980-96F9-E99124075B82} BExIS.Dim.Helpers - - {2a701141-381e-4ad0-a446-094e4d22bee4} + + {74d74928-8394-4518-9a59-eb8885edc747} BExIS.Emm.Entities - True - - {0a9199f6-3cd0-4eee-9ebd-5d4ae7916c9d} + + {003e707f-b2b1-4a0b-8d16-5cd45e3a9e9d} BExIS.Emm.Services @@ -293,15 +327,6 @@ - - - - - - - - - 10.0 @@ -339,11 +364,6 @@ C:\Windows\System32\xcopy "$(ProjectDir)Emm.Settings.xml" "$(SolutionDir)Console Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". - - - - - - - - + + @@ -55,7 +62,7 @@ - + @@ -85,13 +92,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + - + - \ No newline at end of file + + \ No newline at end of file diff --git a/Controllers/EventController.cs b/Controllers/EventController.cs deleted file mode 100644 index 135c3a6..0000000 --- a/Controllers/EventController.cs +++ /dev/null @@ -1,319 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; -using BExIS.Security.Entities.Objects; -using Vaiona.Web.Mvc.Models; -using Vaiona.Web.Extensions; -using BExIS.Emm.Services.Event; -using System.IO; -using System.Xml; -using BExIS.Emm.Entities.Event; -using BExIS.Dlm.Services.MetadataStructure; -using BExIS.Dlm.Entities.MetadataStructure; -using BExIS.Xml.Helpers; -using Vaiona.Utils.Cfg; -using System; -using BExIS.Modules.EMM.UI.Models; -using BExIS.Security.Services.Subjects; -using BExIS.Security.Services.Authorization; -using BExIS.Security.Services.Objects; -using BExIS.Security.Entities.Authorization; -using Vaiona.Persistence.Api; -using System.Xml.Linq; -using Newtonsoft.Json; - -namespace BExIS.Modules.EMM.UI.Controllers -{ - public class EventController : Controller - { - public ActionResult EventManager() - { - ViewBag.Title = PresentationModel.GetViewTitleForTenant("Manage Events", this.Session.GetTenant()); - - using (EventManager eManger = new EventManager()) - using (var eventRegistrationManager = new EventRegistrationManager()) - { - - List model = new List(); - List data = eManger.GetAllEvents().ToList(); - - foreach (Event e in data) - { - EventModel m = new EventModel(e); - List eventRegistrations = eventRegistrationManager.GetAllRegistrationsByEvent(e.Id); - if (eventRegistrations.Count > 0) - m.InUse = true; - else - m.InUse = false; - - model.Add(m); - } - - //data.ToList().ForEach(r => model.Add(new EventModel(r))); - - return View("EventManager", model); - } - } - - - #region Create, Edit Delete ans Save Event - - public ActionResult Create() - { - ViewBag.Title = PresentationModel.GetViewTitleForTenant("Create Event", this.Session.GetTenant()); - - EventModel model = new EventModel(); - model.MetadataStructureList = GetMetadataStructureList(); - return View("EditEvent", model); - } - - public ActionResult Edit(long id) - { - using (EventManager eManger = new EventManager()) - { - EventModel model = new EventModel(eManger.GetEventById(id)); - model.MetadataStructureList = GetMetadataStructureList(); - model.EditMode = true; - - return View("EditEvent", model); - } - } - - public ActionResult Delete(long id) - { - using (EventManager eManger = new EventManager()) - { - eManger.DeleteEvent(eManger.GetEventById(id)); - } - - return RedirectToAction("EventManager"); - } - - public ActionResult GetMetadataNodes(long id) - { - if(id != 0) - { - List list = GetAllXPathsOfSimpleAttributes(id); - - return Json(JsonConvert.SerializeObject(list), JsonRequestBehavior.AllowGet); - } - else - return new EmptyResult(); - - } - - [HttpPost] - public ActionResult Save(EventModel model, HttpPostedFileBase file) - { - XmlDocument schema = new XmlDocument(); - string schemaFileName = ""; - - /** Event Validation -------------------------------- **/ - - if (model.Name == null) - ModelState.AddModelError("Name", "Name is required."); - - if (model.Location == null) - ModelState.AddModelError("Location", "Location is required."); - - if (model.LogInPassword == null) - ModelState.AddModelError("LogInPassword", "Login password is required."); - - if (model.StartDate > model.Deadline) - ModelState.AddModelError("StartDate", "Start date needs to be before deadline."); - - if (model.EventDate == null) - ModelState.AddModelError("EventDate", "Event time period is required."); - - if (model.SelectedEventLanguage == null) - ModelState.AddModelError("EventLanguage", "Event language is required."); - - if (model.ImportantInformation == null) - ModelState.AddModelError("ImportantInformation", "Important information is required."); - - if(model.ParticipantsLimitation == 0 && model.WaitingList == true) - ModelState.AddModelError("WaitingList", "You don't need a waiting list if there is no participants limitation."); - - if (model.WaitingListLimitation > 0 && model.WaitingList == false) - ModelState.AddModelError("WaitingListLimitation", "You don't need a waiting list limitation if you dont use the waiting list."); - - - //check if schema file is uploaded - //if (attachments ==null &&model.Id == 0) - // ModelState.AddModelError("Schema", "Schema is required."); - - /** Event Validation End -------------------------------- **/ - - if (ModelState.IsValid) - { - using (MetadataStructureManager mManager = new MetadataStructureManager()) - using (EventManager eManager = new EventManager()) - { - MetadataStructure ms = mManager.Repo.Get(model.MetadataStructureId); - - if (model.Id == 0) - { - Event newEvent = eManager.CreateEvent(model.Name, model.EventDate, model.ImportantInformation, model.Location, model.MailInformation, model.SelectedEventLanguage, model.StartDate, model.Deadline, model.ParticipantsLimitation, model.WaitingList,model.WaitingListLimitation, model.EditAllowed, model.Closed, model.LogInPassword, model.XPathToEmail, model.XPathToFirstName, model.XPathToLastName, model.EmailBCC, model.EmailCC, model.EmailReply, ms, null); - - newEvent = SaveFile(file, newEvent, eManager); - eManager.UpdateEvent(newEvent); - - //add security - using (var groupManager = new GroupManager()) - using (var entityTypeManager = new EntityManager()) - using (EntityPermissionManager pManager = new EntityPermissionManager()) - { - Entity entityType = entityTypeManager.FindByName("Event"); - string[] eventAdminGroups = Helper.Settings.get("EventAdminGroups").ToString().Split(','); - if (eventAdminGroups != null && eventAdminGroups.Length > 0) - { - foreach(var g in eventAdminGroups) - { - int fullRights = (int)RightType.Read + (int)RightType.Write + (int)RightType.Delete + (int)RightType.Grant; - var group = groupManager.FindByNameAsync(g).Result; - if (group != null) - { - if (pManager.GetRights(group.Id, entityType.Id, newEvent.Id) == 0) - pManager.Create(group.Id, entityType.Id, newEvent.Id, fullRights); - } - - } - } - } - } - else - { - Event e = eManager.GetEventById(model.Id); - e.Name = model.Name; - e.EventDate = model.EventDate; - e.ImportantInformation = model.ImportantInformation; - e.MailInformation = model.MailInformation; - e.Location = model.Location; - e.EventLanguage = model.SelectedEventLanguage; - e.StartDate = model.StartDate; - e.Deadline = model.Deadline; - e.ParticipantsLimitation = model.ParticipantsLimitation; - e.WaitingList = model.WaitingList; - e.WaitingListLimitation = model.WaitingListLimitation; - e.EditAllowed = model.EditAllowed; - e.Closed = model.Closed; - e.LogInPassword = model.LogInPassword; - e.XPathToEmail = model.XPathToEmail; - e.XPathToFirstName = model.XPathToFirstName; - e.XPathToLastName = model.XPathToLastName; - e.EmailCC = model.EmailCC; - e.EmailBCC = model.EmailBCC; - e.EmailReply = model.EmailReply; - e.MetadataStructure = ms; - - e = SaveFile(file, e, eManager); - eManager.UpdateEvent(e); - } - - return RedirectToAction("EventManager"); - } - } - else - model.MetadataStructureList = GetMetadataStructureList(); - return View("EditEvent", model); - - } - - #endregion - - - #region helpers - - private Event SaveFile(HttpPostedFileBase file, Event e, EventManager eManager) - { - string filename = "ext.js"; - string path = Path.Combine(AppConfiguration.DataPath, "MetadataStructures", e.MetadataStructure.Id.ToString(), filename); - - if (System.IO.File.Exists(path) && file != null && file.ContentLength > 0) - { - var deletedFilePath = Path.Combine(AppConfiguration.DataPath, "EMM\\Deleted JS Files"); - BExIS.IO.FileHelper.CreateDicrectoriesIfNotExist(deletedFilePath); - - var des = deletedFilePath + "\\" + Path.GetFileName(path); - - // Check if file already exists in the "Deleted Files" folder and rename the file if yes. - if (System.IO.File.Exists(des)) - { - des = deletedFilePath + "\\" + new Random().Next(1, 1000) + "_" + Path.GetFileName(path); - } - - System.IO.File.Move(path, des); - } - - if (file != null && file.ContentLength > 0) - { - try - { - file.SaveAs(path); - e.JavaScriptPath = path; - } - catch { } - } - - return e; - } - - public List GetMetadataStructureList() - { - MetadataStructureManager metadataStructureManager = new MetadataStructureManager(); - XmlDatasetHelper xmlDatasetHelper = new XmlDatasetHelper(); - try - { - IEnumerable metadataStructureList = metadataStructureManager.Repo.Get(); - - List temp = new List(); - ListItem item = new ListItem(0, ""); - temp.Add(item); - foreach (MetadataStructure metadataStructure in metadataStructureList) - { - if (xmlDatasetHelper.IsActive(metadataStructure.Id) && - xmlDatasetHelper.HasEntityType(metadataStructure.Id, "BExIS.Emm.Entities.Event.Event")) - { - string title = metadataStructure.Name; - - temp.Add(new ListItem(metadataStructure.Id, title)); - } - } - - return temp.OrderBy(p => p.Name).ToList(); - } - finally - { - metadataStructureManager.Dispose(); - } - } - - public List GetAllXPathsOfSimpleAttributes(long metadataStrutureId) - { - List list = new List(); - - using (IUnitOfWork unitOfWork = this.GetUnitOfWork()) - { - - string title = unitOfWork.GetReadOnlyRepository().Get(metadataStrutureId).Name; - - XmlMetadataWriter xmlMetadatWriter = new XmlMetadataWriter(XmlNodeMode.xPath); - XDocument metadataXml = xmlMetadatWriter.CreateMetadataXml(metadataStrutureId); - - List elements = metadataXml.Root.Descendants().Where(e => e.HasElements.Equals(false)).ToList(); - - foreach (XElement element in elements) - { - list.Add( - new SearchMetadataNode(title, XExtentsions.GetAbsoluteXPath(element).Substring(1)) - ); - } - } - - return list; - } - - #endregion - } - } \ No newline at end of file diff --git a/Controllers/EventRegistrationController.cs b/Controllers/EventRegistrationController.cs deleted file mode 100644 index 863b8f3..0000000 --- a/Controllers/EventRegistrationController.cs +++ /dev/null @@ -1,1951 +0,0 @@ -using BExIS.Dcm.CreateDatasetWizard; -using BExIS.Dcm.Wizard; -using BExIS.Dlm.Entities.Common; -using BExIS.Dlm.Entities.MetadataStructure; -using BExIS.Dlm.Services.MetadataStructure; -using BExIS.Dlm.Services.Party; -using BExIS.Dlm.Services.TypeSystem; -using BExIS.Emm.Entities.Event; -using BExIS.Emm.Services.Event; -using BExIS.IO.Transform.Validation.Exceptions; -using BExIS.Modules.EMM.UI.Helper; -using BExIS.Modules.EMM.UI.Helpers; -using BExIS.Modules.EMM.UI.Models; -using BExIS.Security.Entities.Subjects; -using BExIS.Security.Services.Subjects; -using BExIS.Security.Services.Utilities; -using BExIS.Utils.Data.MetadataStructure; -using BExIS.Xml.Helpers; -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.IO; -using System.Linq; -using System.Web; -using System.Web.Mvc; -using System.Xml; -using System.Xml.Linq; -using Vaiona.Persistence.Api; -using Vaiona.Utils.Cfg; -using Vaiona.Web.Extensions; -using Vaiona.Web.Mvc.Models; - - -namespace BExIS.Modules.EMM.UI.Controllers -{ - public class EventRegistrationController : Controller - { - private CreateTaskmanager TaskManager; - private MetadataStructureUsageHelper metadataStructureUsageHelper = new MetadataStructureUsageHelper(); - - public ActionResult EventRegistration(string ref_id = "") - { - ViewBag.Title = PresentationModel.GetViewTitleForTenant("Event Registrations", this.Session.GetTenant()); - - List model = GetAvailableEvents(ref_id); - return View("AvailableEventsList", model); - } - - public ActionResult EventRegistrationPatial(string message, string ref_id = "") - { - ViewBag.Title = PresentationModel.GetViewTitleForTenant("Event Registrations", this.Session.GetTenant()); - - List model = GetAvailableEvents(ref_id); - ViewBag.Message = message; - return PartialView("AvailableEventsList", model); - } - - #region Register to Event - - private List GetAvailableEvents(string ref_id = "") - { - using (EventManager eManger = new EventManager()) - using (SubjectManager subManager = new SubjectManager()) - { - List allEvents = eManger.GetAllEvents().ToList(); - - List availableEvents = new List(); - - using (EventRegistrationManager erManager = new EventRegistrationManager()) - { - User user = subManager.Subjects.Where(a => a.Name == HttpContext.User.Identity.Name).FirstOrDefault() as User; - - foreach (Event e in allEvents) - { - DateTime today = DateTime.Now; - if (today >= e.StartDate) - { - EventRegistrationModel model = new EventRegistrationModel(e); - model.NumberOfRegistration = erManager.GetAllRegistrationsNotDeletedByEvent(e.Id).Count; - model.NrOfRegistrationWaitingList = erManager.GetAllWaitingListRegsByEvent(e.Id).Count; - - model.Closed = e.Closed; - List regs = new List(); - if (ref_id.Length > 0) - { - regs = erManager.GetRegistrationsByRefIdAndEvent(ref_id, e.Id); - } - else if(user != null) - { - regs = erManager.GetRegistrationByUserAndEvent(user.Id, e.Id); - } - - if (regs.Count > 0) - { - //if there is any registration where deleted == false there is an activ registration for that user - EventRegistration reg = regs.Where(a => a.Deleted == false).FirstOrDefault(); - if (reg != null) - { - model.AlreadyRegistered = true; - model.Deleted = reg.Deleted; - } - //else there are only one or more deleted registrations and the user is not registered - else - { - model.AlreadyRegistered = false; - model.Deleted = true; - } - } - model.AlreadyRegisteredRefId = ref_id; - - - // Show event if deadline is not over - if (today <= e.Deadline.AddDays(1)) - availableEvents.Add(model); - } - } - } - - return availableEvents; - } - } - - public ActionResult LogInToEvent(string id, string view_only = "false", string ref_id = "") - { - Session["DefaultEventInformation"] = null; - LogInToEventModel model = new LogInToEventModel(long.Parse(id), bool.Parse(view_only), ref_id); - - //check if it is an edit - using (SubjectManager subManager = new SubjectManager()) - { - using (EventRegistrationManager erManager = new EventRegistrationManager()) - { - User user = subManager.Subjects.Where(a => a.Name == HttpContext.User.Identity.Name).FirstOrDefault() as User; - - if(ref_id.Length > 0) - { - List regs = erManager.GetRegistrationsByRefIdAndEvent(model.RefId, long.Parse(id)); - EventRegistration reg = regs.Where(a => a.Deleted == false).FirstOrDefault(); - if (reg != null) - model.Edit = true; - - } - else if (user != null) - { - List regs = erManager.GetRegistrationByUserAndEvent(user.Id, long.Parse(id)); - EventRegistration reg = regs.Where(a => a.Deleted == false).FirstOrDefault(); - if (reg != null) - model.Edit = true; - - } - - } - } - - return PartialView("_logInToEvent", model); - } - - #endregion - - #region Load Registration Form - - public ActionResult LoadFormEdit(string id, string ref_id = "") - { - using (EventManager eManager = new EventManager()) - { - Event e = eManager.EventRepo.Get(long.Parse(id)); - using (EventRegistrationManager erManager = new EventRegistrationManager()) - using (SubjectManager subManager = new SubjectManager()) - { - User user = subManager.Subjects.Where(a => a.Name == HttpContext.User.Identity.Name).FirstOrDefault() as User; - - //add default value to session - DefaultEventInformation defaultEventInformation = new DefaultEventInformation(); - defaultEventInformation.EventName = e.Name; - defaultEventInformation.Location = e.Location; - defaultEventInformation.Eventid = e.Id.ToString(); - - //xpath - var emailList = e.XPathToEmail.Split('/').ToList(); - var fNameList = e.XPathToFirstName.Split('/').ToList(); - var lNameList = e.XPathToLastName.Split('/').ToList(); - - var firstE = emailList.First(); - var lastE = emailList.Last(); - foreach (var m in emailList) - { - if (firstE == m) - defaultEventInformation.XPathToEmail += m + "//"; - else if(lastE == m) - defaultEventInformation.XPathToEmail += m + "[1]"; - else - defaultEventInformation.XPathToEmail += m + "[1]//"; - } - - var firstF = fNameList.First(); - var lastF = fNameList.Last(); - foreach (var m in fNameList) - { - if (firstF == m) - defaultEventInformation.XPathToFirstName += m + "//"; - else if (lastF == m) - defaultEventInformation.XPathToFirstName += m + "[1]"; - else - defaultEventInformation.XPathToFirstName += m + "[1]//"; - } - - var firstL = lNameList.First(); - var lastL = lNameList.Last(); - foreach (var m in lNameList) - { - if (firstL == m) - defaultEventInformation.XPathToLastName += m + "//"; - else if (lastL == m) - defaultEventInformation.XPathToLastName += m + "[1]"; - else - defaultEventInformation.XPathToLastName += m + "[1]//"; - } - - - if (user != null) - { - using (var partyManager = new PartyManager()) - { - defaultEventInformation.Email = user.Email; - var party = partyManager.GetPartyByUser(user.Id); - defaultEventInformation.FirstName = party.CustomAttributeValues.Where(b => b.CustomAttribute.Name == "FirstName").Select(v => v.Value).FirstOrDefault(); - defaultEventInformation.LastName = party.CustomAttributeValues.Where(b => b.CustomAttribute.Name == "LastName").Select(v => v.Value).FirstOrDefault(); - } - } - - if (!String.IsNullOrEmpty(e.EventDate)) - defaultEventInformation.Date = e.EventDate; - if (!String.IsNullOrEmpty(e.EventLanguage)) - if (e.Id == 12) - defaultEventInformation.Language = "English"; - else - defaultEventInformation.Language = e.EventLanguage; - - if (!String.IsNullOrEmpty(e.ImportantInformation)) - defaultEventInformation.ImportantInformation = e.ImportantInformation; - - Session["DefaultEventInformation"] = defaultEventInformation; - - //CreateTaskmanager taskManager = new CreateTaskmanager(); - if (TaskManager == null) - TaskManager = new CreateTaskmanager(); - - TaskManager.AddToBus(CreateTaskmanager.METADATASTRUCTURE_ID, e.MetadataStructure.Id); - TaskManager.AddToBus(CreateTaskmanager.ENTITY_ID, e.Id); - - if (ref_id.Length > 0) - { - List regs = erManager.GetRegistrationsByRefIdAndEvent(ref_id, e.Id); - EventRegistration reg = regs.Where(a => a.Deleted == false).FirstOrDefault(); - defaultEventInformation.RegistrationId = reg.Id; - XmlNodeReader xmlNodeReader = new XmlNodeReader(reg.Data); - TaskManager.AddToBus(CreateTaskmanager.METADATA_XML, reg.Data); - xmlNodeReader.Dispose(); - } - else if (user != null) - { - List regs = erManager.GetRegistrationByUserAndEvent(user.Id, e.Id); - EventRegistration reg = regs.Where(a => a.Deleted == false).FirstOrDefault(); - defaultEventInformation.RegistrationId = reg.Id; - - XmlNodeReader xmlNodeReader = new XmlNodeReader(reg.Data); - TaskManager.AddToBus(CreateTaskmanager.METADATA_XML, reg.Data); - xmlNodeReader.Dispose(); - } - - } - - TaskManager.AddToBus(CreateTaskmanager.SAVE_WITH_ERRORS, false); - TaskManager.AddToBus(CreateTaskmanager.NO_IMPORT_ACTION, true); - TaskManager.AddToBus(CreateTaskmanager.INFO_ON_TOP_TITLE, "Event registration"); - TaskManager.AddToBus(CreateTaskmanager.INFO_ON_TOP_DESCRIPTION, "

help

"); - - - Session["EventRegistrationTaskmanager"] = TaskManager; - - setAdditionalFunctions(); - - return new EmptyResult(); - - } - - } - - public ActionResult LoadForm(LogInToEventModel model) - { - using (EventManager eManager = new EventManager()) - using (EventRegistrationManager erManager = new EventRegistrationManager()) - using (SubjectManager subManager = new SubjectManager()) - { - Event e = eManager.EventRepo.Get(model.EventId); - User user = subManager.Subjects.Where(a => a.Name == HttpContext.User.Identity.Name).FirstOrDefault() as User; - - if (e.LogInPassword != model.LogInPassword) - ModelState.AddModelError("passwort", "The event passwort is wrong."); - - if (ModelState.IsValid) - { - //add default value to session - DefaultEventInformation defaultEventInformation = new DefaultEventInformation(); - defaultEventInformation.EventName = HttpUtility.HtmlDecode(e.Name); - defaultEventInformation.Location = HttpUtility.HtmlDecode(e.Location); - defaultEventInformation.Eventid = e.Id.ToString(); - - //xpath - //xpath - var emailList = e.XPathToEmail.Split('/').ToList(); - var fNameList = e.XPathToFirstName.Split('/').ToList(); - var lNameList = e.XPathToLastName.Split('/').ToList(); - - var firstE = emailList.First(); - var lastE = emailList.Last(); - foreach (var m in emailList) - { - if (firstE == m) - defaultEventInformation.XPathToEmail += m + "//"; - else if (lastE == m) - defaultEventInformation.XPathToEmail += m + "[1]"; - else - defaultEventInformation.XPathToEmail += m + "[1]//"; - } - - var firstF = fNameList.First(); - var lastF = fNameList.Last(); - foreach (var m in fNameList) - { - if (firstF == m) - defaultEventInformation.XPathToFirstName += m + "//"; - else if (lastF == m) - defaultEventInformation.XPathToFirstName += m + "[1]"; - else - defaultEventInformation.XPathToFirstName += m + "[1]//"; - } - - var firstL = lNameList.First(); - var lastL = lNameList.Last(); - foreach (var m in lNameList) - { - if (firstL == m) - defaultEventInformation.XPathToLastName += m + "//"; - else if (lastL == m) - defaultEventInformation.XPathToLastName += m + "[1]"; - else - defaultEventInformation.XPathToLastName += m + "[1]//"; - } - - //user information - if (user != null) - { - using (var partyManager = new PartyManager()) - { - defaultEventInformation.Email = user.Email; - var party = partyManager.GetPartyByUser(user.Id); - defaultEventInformation.FirstName = HttpUtility.HtmlDecode(party.CustomAttributeValues.Where(b => b.CustomAttribute.Name == "FirstName").Select(v => v.Value).FirstOrDefault()); - defaultEventInformation.LastName = HttpUtility.HtmlDecode(party.CustomAttributeValues.Where(b => b.CustomAttribute.Name == "LastName").Select(v => v.Value).FirstOrDefault()); - } - } - - if (!String.IsNullOrEmpty(e.EventDate)) - defaultEventInformation.Date = e.EventDate; - if (!String.IsNullOrEmpty(e.EventLanguage)) - if(e.Id ==12) - defaultEventInformation.Language = "English"; - else - defaultEventInformation.Language = e.EventLanguage; - - if (!String.IsNullOrEmpty(e.ImportantInformation)) - defaultEventInformation.ImportantInformation = HttpUtility.HtmlDecode(e.ImportantInformation); - - Session["DefaultEventInformation"] = defaultEventInformation; - - //CreateTaskmanager taskManager = new CreateTaskmanager(); - if (TaskManager == null) - TaskManager = new CreateTaskmanager(); - - TaskManager.AddToBus(CreateTaskmanager.METADATASTRUCTURE_ID, e.MetadataStructure.Id); - TaskManager.AddToBus(CreateTaskmanager.ENTITY_ID, e.Id); - - if (model.Edit) - { - if(model.RefId.Length > 0) - { - List regs = erManager.GetRegistrationsByRefIdAndEvent(model.RefId, e.Id); - EventRegistration reg = regs.Where(a => a.Deleted == false).FirstOrDefault(); - defaultEventInformation.RegistrationId = reg.Id; - XmlNodeReader xmlNodeReader = new XmlNodeReader(reg.Data); - TaskManager.AddToBus(CreateTaskmanager.METADATA_XML, reg.Data); - xmlNodeReader.Dispose(); - } - else if (user != null) - { - List regs = erManager.GetRegistrationByUserAndEvent(user.Id, e.Id); - EventRegistration reg = regs.Where(a => a.Deleted == false).FirstOrDefault(); - defaultEventInformation.RegistrationId = reg.Id; - - XmlNodeReader xmlNodeReader = new XmlNodeReader(reg.Data); - TaskManager.AddToBus(CreateTaskmanager.METADATA_XML, reg.Data); - xmlNodeReader.Dispose(); - } - //todo error message - - - - } - - TaskManager.AddToBus(CreateTaskmanager.SAVE_WITH_ERRORS, false); - - if (model.ViewOnly == true) - { - TaskManager.AddToBus(CreateTaskmanager.LOCKED, true); - } - - TaskManager.AddToBus(CreateTaskmanager.NO_IMPORT_ACTION, true); - TaskManager.AddToBus(CreateTaskmanager.INFO_ON_TOP_TITLE, "Event registration"); - TaskManager.AddToBus(CreateTaskmanager.INFO_ON_TOP_DESCRIPTION, "

help

"); - - - Session["EventRegistrationTaskmanager"] = TaskManager; - - setAdditionalFunctions(); - - return Json(new { success = true, edit = model.Edit }); - } - else - { - return PartialView("_logInToEvent", model); - } - } - - } - - - public ActionResult LoadMetadataForm(string edit, bool fromEditMode = true) - { - ViewBag.Title = PresentationModel.GetViewTitleForTenant("Register to Event", this.Session.GetTenant()); - - var Model = new MetadataEditorModel(); - Model.EditRegistration = Convert.ToBoolean(edit); - - if (TaskManager == null) TaskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - - if (TaskManager != null) - { - //FromCreateOrEditMode - TaskManager.AddToBus(CreateTaskmanager.EDIT_MODE, fromEditMode); - Model.FromEditMode = (bool)TaskManager.Bus[CreateTaskmanager.EDIT_MODE]; - - //load empty metadata xml if needed - if (!TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_XML)) - { - CreateXml(); - } - - var loaded = false; - //check if formsteps are loaded - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.FORM_STEPS_LOADED)) - { - loaded = (bool)TaskManager.Bus[CreateTaskmanager.FORM_STEPS_LOADED]; - } - - // load form steps - if (loaded == false && TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATASTRUCTURE_ID)) - { - var metadataStrutureId = Convert.ToInt64(TaskManager.Bus[CreateTaskmanager.METADATASTRUCTURE_ID]); - // generate all steps - // one step for each complex type in the metadata structure - AdvanceTaskManager(metadataStrutureId); - } - - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.LOCKED)) - { - ViewData["Locked"] = (bool)TaskManager.Bus[CreateTaskmanager.LOCKED]; - } - - //save with errors? - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.SAVE_WITH_ERRORS)) - { - Model.SaveWithErrors = (bool)TaskManager.Bus[CreateTaskmanager.SAVE_WITH_ERRORS]; - } - - var stepInfoModelHelpers = new List(); - - // foreach step and the childsteps... generate a stepModelhelper - foreach (var stepInfo in TaskManager.StepInfos) - { - var stepModelHelper = GetStepModelhelper(stepInfo.Id); - - if (stepModelHelper.Model == null) - { - if (stepModelHelper.UsageType.Equals(typeof(MetadataPackageUsage))) - stepModelHelper.Model = createPackageModel(stepInfo.Id, false); - - if (stepModelHelper.UsageType.Equals(typeof(MetadataNestedAttributeUsage))) - stepModelHelper.Model = createCompoundModel(stepInfo.Id, false); - - getChildModelsHelper(stepModelHelper); - } - - stepInfoModelHelpers.Add(stepModelHelper); - } - - Model.StepModelHelpers = stepInfoModelHelpers; - - } - - //set addtionaly functions - Model.Actions = getAddtionalActions(); - - if (TaskManager == null) TaskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - - ViewData["MetadataStructureID"] = TaskManager.Bus["MetadataStructureId"]; - return View("MetadataEditor", Model); - - } - - public ActionResult ReloadMetadataEditor( - bool locked = false, - bool show = false, - bool created = false, - long entityId = -1, - bool fromEditMode = false, - bool latestVersion = false, - bool registered = false - ) - { - ViewData["Locked"] = locked; - ViewData["ShowOptional"] = show; - - ViewBag.Title = PresentationModel.GetViewTitleForTenant("Create Dataset", this.Session.GetTenant()); - TaskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - - TaskManager?.AddToBus(CreateTaskmanager.SAVE_WITH_ERRORS, false); - - var stepInfoModelHelpers = new List(); - - foreach (var stepInfo in TaskManager.StepInfos) - { - var stepModelHelper = GetStepModelhelper(stepInfo.Id); - - if (stepModelHelper.Model == null) - { - if (stepModelHelper.UsageType.Equals(typeof(MetadataPackageUsage))) - stepModelHelper.Model = createPackageModel(stepInfo.Id, false); - - if (stepModelHelper.UsageType.Equals(typeof(MetadataNestedAttributeUsage))) - stepModelHelper.Model = createCompoundModel(stepInfo.Id, false); - - getChildModelsHelper(stepModelHelper); - } - - stepInfoModelHelpers.Add(stepModelHelper); - } - - var Model = new MetadataEditorModel(); - Model.Registered = registered; - Model.StepModelHelpers = stepInfoModelHelpers; - Model.SaveWithErrors = Model.StepModelHelpers.Any(s => s.Model.ErrorList.Count() > 0); - - #region security permissions and authorisations check - - // set edit rigths - - bool hasAuthorizationRights = true; - bool hasAuthenticationRigths = true; - - //Model.FromEditMode = true; - - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATASTRUCTURE_ID)) - { - long metadataStructureId = Convert.ToInt64(TaskManager.Bus[CreateTaskmanager.METADATASTRUCTURE_ID]); - //Model.Import = IsImportAvavilable(metadataStructureId); - Model.Import = false; - - } - - #endregion security permissions and authorisations check - - //set addtionaly functions - Model.Actions = getAddtionalActions(); - - //save with errors? - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.SAVE_WITH_ERRORS)) - { - Model.SaveWithErrors = (bool)TaskManager.Bus[CreateTaskmanager.SAVE_WITH_ERRORS]; - } - - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.NO_IMPORT_ACTION)) - { - Model.Import = !(bool)TaskManager.Bus[CreateTaskmanager.NO_IMPORT_ACTION]; - } - - //Replace the title of the info box on top - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.INFO_ON_TOP_TITLE)) - { - ViewBag.Title = PresentationModel.GetViewTitleForTenant(Convert.ToString(TaskManager.Bus[CreateTaskmanager.INFO_ON_TOP_TITLE]), this.Session.GetTenant()); - } - - //Replace the description in the info box on top - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.INFO_ON_TOP_DESCRIPTION)) - { - Model.HeaderHelp = Convert.ToString(TaskManager.Bus[CreateTaskmanager.INFO_ON_TOP_DESCRIPTION]); - } - - Model.Created = created; - Model.FromEditMode = fromEditMode; - Model.DatasetId = entityId; - Model.LatestVersion = latestVersion; - - //set title - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.ENTITY_TITLE)) - { - if (TaskManager.Bus[CreateTaskmanager.ENTITY_TITLE] != null) - Model.DatasetTitle = TaskManager.Bus[CreateTaskmanager.ENTITY_TITLE].ToString(); - } - else - Model.DatasetTitle = "No Title available."; - - ViewData["MetadataStructureID"] = TaskManager.Bus["MetadataStructureId"]; - return PartialView("MetadataEditor", Model); - } - - private Dictionary getAddtionalActions() - { - var TaskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - if (TaskManager.Actions.Any()) - { - return TaskManager.Actions; - } - - return new Dictionary(); - } - - public ActionResult Cancel() - { - return Json(new { result = "redirect", url = Url.Action("EventRegistration", "EventRegistration", new { area = "EMM" }) }, JsonRequestBehavior.AllowGet); - } - - /// - /// User deleted registration, this function set flag deleted in event registration = true - /// - /// event registration id - /// event registration ref id - /// - public ActionResult DeleteRegistration(string id, string ref_id = "") - { - string url = Request.Url.GetLeftPart(UriPartial.Authority); - - using (SubjectManager subManager = new SubjectManager()) - { - using (EventRegistrationManager erManager = new EventRegistrationManager()) - using (var eventManager = new EventManager()) - { - User user = subManager.Subjects.Where(a => a.Name == HttpContext.User.Identity.Name).FirstOrDefault() as User; - if (user != null) - { - List regs = erManager.GetRegistrationByUserAndEvent(user.Id, long.Parse(id)); - EventRegistration reg = regs.Where(a => a.Deleted == false).FirstOrDefault(); - - if (reg != null) - { - reg.Deleted = true; - erManager.UpdateEventRegistration(reg); - MoveFromWaitingList(reg.Event.Id); - - string email = ""; - if (user != null) - email = user.Email; - else - email = reg.Data.GetElementsByTagName("Email")[0].InnerText; - - EmailHelper.SendEmailNotification("deleted",email, ref_id, reg.Data, reg.Event, url); - } - } - else if (ref_id.Length > 0) - { - List regs = erManager.GetRegistrationsByRefIdAndEvent(ref_id, long.Parse(id)); - EventRegistration reg = regs.Where(a => a.Deleted == false).FirstOrDefault(); - if (reg != null) - { - reg.Deleted = true; - erManager.UpdateEventRegistration(reg); - MoveFromWaitingList(reg.Event.Id); - string email = ""; - if (user != null) - email = user.Email; - else - email = reg.Data.GetElementsByTagName("Email")[0].InnerText; - - EmailHelper.SendEmailNotification("deleted", email, ref_id, reg.Data, reg.Event, url); - } - } - } - - - - - } - return Json(new { result = "redirect", url = Url.Action("EventRegistration", "EventRegistration", new { area = "EMM" }) }, JsonRequestBehavior.AllowGet); - } - - private void MoveFromWaitingList(long eventId) - { - string url = Request.Url.GetLeftPart(UriPartial.Authority); - - using (var erManager = new EventRegistrationManager()) - using (var eventManager = new EventManager()) - { - int countWaitingList = erManager.GetAllWaitingListRegsByEvent(eventId).Count; - if (countWaitingList > 0) - { - var reg = erManager.GetLatestWaitingListEntry(eventId); - reg.WaitingList = false; - erManager.UpdateEventRegistration(reg); - var e = eventManager.GetEventById(eventId); - string email = ""; - if (reg.Person != null) - email = reg.Person.Email; - else - email = reg.Data.GetElementsByTagName("Email")[0].InnerText; - - EmailHelper.SendEmailNotification("remove_from_waiting_list", email, "", reg.Data, reg.Event, url); - - } - } - } - - private void SendWaitingListNotification(XmlDocument data, Event e) - { - // todo: add not allowed / log in info to mail - - EmailStructure emailStructure = new EmailStructure(); - emailStructure = EmailHelper.ReadFile(e.EventLanguage); - - string first_name = data.GetElementsByTagName(emailStructure.lableFirstName)[0].InnerText; - string last_name = data.GetElementsByTagName(emailStructure.lableLastname)[0].InnerText; - string email = data.GetElementsByTagName(emailStructure.lableEmail)[0].InnerText; - - string url = Request.Url.GetLeftPart(UriPartial.Authority); - - string mail_message = ""; - string subject = emailStructure.removeFromWaitingListSubject + e.Name; - - string body = emailStructure.bodyTitle + first_name + " " + last_name + ", " + "

" + - emailStructure.removeFromWaitingList1 + "

" + - emailStructure.bodyClosing + "
" + - emailStructure.bodyClosingName; - - - var es = new EmailService(); - - // If no explicit Reply to mail is set use the SystemEmail - string replyTo = ""; - if (String.IsNullOrEmpty(e.EmailReply)) - { - replyTo = ConfigurationManager.AppSettings["SystemEmail"]; - } - else - { - replyTo = e.EmailReply; - } - - es.Send( - subject, - body, - new List { email }, // to - new List { e.EmailCC }, // CC - new List { ConfigurationManager.AppSettings["SystemEmail"], e.EmailBCC }, // Allways send BCC to SystemEmail + additional set - new List { replyTo } - ); - - } - - public ActionResult Save() - { - using (EventManager eManager = new EventManager()) - using (EventRegistrationManager erManager = new EventRegistrationManager()) - using (SubjectManager subManager = new SubjectManager()) - { - CreateTaskmanager taskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - DefaultEventInformation defaultEventInformation = (DefaultEventInformation)Session["DefaultEventInformation"]; - - XDocument data = new XDocument(); - if (taskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_XML)) - { - if (taskManager.Bus[CreateTaskmanager.METADATA_XML].GetType() == typeof(XmlDocument)) - { - using (var nodeReader = new XmlNodeReader((XmlDocument)taskManager.Bus[CreateTaskmanager.METADATA_XML])) - { - nodeReader.MoveToContent(); - data = XDocument.Load(nodeReader); - } - } - else - data = (XDocument)taskManager.Bus[CreateTaskmanager.METADATA_XML]; - } - - long eventId = 0; - if (taskManager.Bus.ContainsKey(CreateTaskmanager.ENTITY_ID)) - eventId = (long)taskManager.Bus[CreateTaskmanager.ENTITY_ID]; - - Event e = new Event(); - if (eventId != 0) - e = eManager.EventRepo.Get(eventId); - - // get email adress from XML && get ref_id based on email adress - string email = XmlMetadataWriter.ToXmlDocument(data).GetElementsByTagName("Email")[0].InnerText; - string ref_id = EmailHelper.GetRefIdFromEmail(email); - - string notificationType = ""; - - string url = Request.Url.GetLeftPart(UriPartial.Authority); - - - // Check for logged in user - User user = subManager.Subjects.Where(a => a.Name == HttpContext.User.Identity.Name).FirstOrDefault() as User; - - // Check if event registration already exists - update registration - //EventRegistration reg = CheckEventRegistration(ref_id, e.Id, erManager); - // get reg bei id - EventRegistration reg = erManager.GetRegistrationById(defaultEventInformation.RegistrationId); - - // Update event registration - if (reg != null) - { - if (reg.Deleted == false) - { - if (e.EditAllowed != true) - { - EmailHelper.SendEmailNotification("resend", email, ref_id, XmlMetadataWriter.ToXmlDocument(data), e, url); - return RedirectToAction("EventRegistrationPatial", new { message = "Update of your previous registration is not allowed. You registration details are send to your Email adress again.", message_type = "error" }); - } - - reg.Data = XmlMetadataWriter.ToXmlDocument(data); - erManager.UpdateEventRegistration(reg); - - EmailHelper.SendEmailNotification("updated", email, ref_id, XmlMetadataWriter.ToXmlDocument(data), e, url); - } - else - CreateNewEventRegistration(e, data, user, email, notificationType, ref_id); - } - // New event registration - else - CreateNewEventRegistration(e, data, user, email, notificationType, ref_id); - - return Json(new { result = "redirect", url = Url.Action("EventRegistration", "EventRegistration", new { area = "EMM", ref_id = ref_id }) }, JsonRequestBehavior.AllowGet); - } - } - - /// - /// Create a new event registration - /// - /// - /// - private void CreateNewEventRegistration(Event e, XDocument data, User user, string email, string notificationType, string ref_id) - { - bool waitingList = false; - using (var erManager = new EventRegistrationManager()) - using(var eventManager = new EventManager()) - { - //check Participants Limitation - if (e.ParticipantsLimitation != 0) - { - int countRegs = erManager.GetNumerOfRegistrationsByEvent(e.Id) + 1; - int countWaitingList = erManager.GetAllWaitingListRegsByEvent(e.Id).Count + 1; - - if (countRegs > e.ParticipantsLimitation) - { - if(e.WaitingList && !e.Closed) - { - if(countWaitingList == e.WaitingListLimitation) - { - e.Closed = true; - eventManager.UpdateEvent(e); - } - - notificationType = "succesfully_registered_waiting_list"; - waitingList = true; - - } - else - { - e.Closed = true; - eventManager.UpdateEvent(e); - notificationType = "succesfully_registered"; - } - } - else - { - notificationType = "succesfully_registered"; - } - } - else - { - notificationType = "succesfully_registered"; - } - - // Save registration and send notification - erManager.CreateEventRegistration(XmlMetadataWriter.ToXmlDocument(data), e, user, false, ref_id, waitingList, DateTime.Now); - - string url = Request.Url.GetLeftPart(UriPartial.Authority); - - EmailHelper.SendEmailNotification(notificationType, email, ref_id, XmlMetadataWriter.ToXmlDocument(data), e, url); - } - } - - #endregion - - #region Validation - - public ActionResult Validate(string edit) - { - TaskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - bool inEvent = false; - if (TaskManager != null && TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_STEP_MODEL_HELPER)) - { - var stepInfoModelHelpers = (List)TaskManager.Bus[CreateTaskmanager.METADATA_STEP_MODEL_HELPER]; - - //check if email allready used in this event, only if we are not in edit reg mode - if(!Convert.ToBoolean(edit)) - inEvent = UserAllreadyRegister(); - - ValidateModels(stepInfoModelHelpers.Where(s => s.Activated && s.IsParentActive()).ToList()); - } - - return RedirectToAction("ReloadMetadataEditor", "EventRegistration", new { registered = inEvent }); - } - - //XX number of index des values nötig - [HttpPost] - [ValidateInput(false)] - public ActionResult ValidateMetadataAttributeUsage(string value, int id, int parentid, string parentname, int number, int parentModelNumber, int parentStepId) - { - //delete all white spaces from start and end - value = value.Trim(); - - TaskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - var stepModelHelper = GetStepModelhelper(parentStepId); - - var ParentUsageId = stepModelHelper.UsageId; - var parentUsage = loadUsage(stepModelHelper.UsageId, stepModelHelper.UsageType); - var pNumber = stepModelHelper.Number; - - metadataStructureUsageHelper = new MetadataStructureUsageHelper(); - - var metadataAttributeUsage = metadataStructureUsageHelper.GetChildren(parentUsage.Id, parentUsage.GetType()).Where(u => u.Id.Equals(id)).FirstOrDefault(); - - //Path.Combine(AppConfiguration.GetModuleWorkspacePath("dcm"),"x","file.xml"); - - //UpdateXml - var metadataStructureId = Convert.ToInt64(TaskManager.Bus[CreateTaskmanager.METADATASTRUCTURE_ID]); - var model = FormHelper.CreateMetadataAttributeModel(metadataAttributeUsage, parentUsage, metadataStructureId, parentModelNumber, stepModelHelper.StepId); - - //check if datatype is a datetime then check display pattern and manipulate the incoming string - if (model.SystemType.Equals(typeof(DateTime).Name)) - { - if (!string.IsNullOrEmpty(model.DisplayPattern)) - { - var dt = DateTime.Parse(value); - value = dt.ToString(model.DisplayPattern); - } - } - - model.Value = value; - model.Number = number; - - UpdateAttribute(parentUsage, parentModelNumber, metadataAttributeUsage, number, value, stepModelHelper.XPath); - - ViewData["Xpath"] = stepModelHelper.XPath; // set Xpath for idbyxapth - - if (stepModelHelper.Model.MetadataAttributeModels.Where(a => a.Id.Equals(id) && a.Number.Equals(number)).Count() > 0) - { - var selectedMetadatAttributeModel = stepModelHelper.Model.MetadataAttributeModels.Where(a => a.Id.Equals(id) && a.Number.Equals(number)).FirstOrDefault(); - // select the attributeModel and change the value - selectedMetadatAttributeModel.Value = model.Value; - selectedMetadatAttributeModel.Errors = validateAttribute(selectedMetadatAttributeModel); - - Session["EventRegistrationTaskmanager"] = TaskManager; - - return PartialView("_metadataAttributeView", selectedMetadatAttributeModel); - } - else - { - stepModelHelper.Model.MetadataAttributeModels.Add(model); - return PartialView("_metadataAttributeView", model); - } - } - - private void UpdateAttribute(BaseUsage parentUsage, int packageNumber, BaseUsage attribute, int number, object value, string parentXpath) - { - TaskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - var metadataXml = getMetadata(); - var xmlMetadataWriter = new XmlMetadataWriter(XmlNodeMode.xPath); - - metadataXml = xmlMetadataWriter.Update(metadataXml, attribute, number, value, metadataStructureUsageHelper.GetNameOfType(attribute), parentXpath); - - TaskManager.Bus[CreateTaskmanager.METADATA_XML] = metadataXml; - // locat path - var path = Path.Combine(AppConfiguration.GetModuleWorkspacePath("DCM"), "metadataTemp.Xml"); - metadataXml.Save(path); - } - - private List validateAttribute(MetadataAttributeModel aModel) - { - var errors = new List(); - //optional check - if (aModel.MinCardinality > 0 && (aModel.Value == null || String.IsNullOrEmpty(aModel.Value.ToString()))) - errors.Add(new Error(ErrorType.MetadataAttribute, "is required", new object[] { aModel.DisplayName, aModel.Value, aModel.Number, aModel.ParentModelNumber, aModel.Parent.Label })); - else - if (aModel.MinCardinality > 0 && String.IsNullOrEmpty(aModel.Value.ToString())) - errors.Add(new Error(ErrorType.MetadataAttribute, "is required", new object[] { aModel.DisplayName, aModel.Value, aModel.Number, aModel.ParentModelNumber, aModel.Parent.Label })); - - //check datatype - if (aModel.Value != null && !String.IsNullOrEmpty(aModel.Value.ToString())) - { - if (!DataTypeUtility.IsTypeOf(aModel.Value, aModel.SystemType)) - { - errors.Add(new Error(ErrorType.MetadataAttribute, "Value can´t convert to the type: " + aModel.SystemType + ".", new object[] { aModel.DisplayName, aModel.Value, aModel.Number, aModel.ParentModelNumber, aModel.Parent.Label })); - } - else - { - var type = Type.GetType("System." + aModel.SystemType); - var value = Convert.ChangeType(aModel.Value, type); - - // check Constraints - foreach (var constraint in aModel.GetMetadataAttribute().Constraints) - { - if (value != null && !constraint.IsSatisfied(value)) - { - errors.Add(new Error(ErrorType.MetadataAttribute, constraint.ErrorMessage, new object[] { aModel.DisplayName, aModel.Value, aModel.Number, aModel.ParentModelNumber, aModel.Parent.Label })); - } - } - } - } - - //// dataset title node should be check if its exit or not - //if (errors.Count == 0 && aModel.DataType.ToLower().Contains("string")) - //{ - // XmlReader reader =; - //} - - if (errors.Count == 0) - return null; - else - return errors; - } - - private void ValidateModels(List stepModelHelpers) - { - List tmp = new List(); - - foreach (var stepModelHelper in stepModelHelpers) - { - //only check if step is a instance - if (stepModelHelper.Model.StepInfo.IsInstanze) - { - // if model exist then validate attributes - if (stepModelHelper.Model != null) - { - foreach (var metadataAttrModel in stepModelHelper.Model.MetadataAttributeModels) - { - metadataAttrModel.Errors = validateAttribute(metadataAttrModel); - - if (metadataAttrModel.Errors != null) tmp.AddRange(metadataAttrModel.Errors); - - //if (metadataAttrModel.Errors.Count > 0) - // step.stepStatus = StepStatus.error; - } - } - // else check for required elements - else - { - if (metadataStructureUsageHelper.HasUsagesWithSimpleType(stepModelHelper.UsageId, stepModelHelper.UsageType)) - { - //foreach (var metadataAttrModel in stepModeHelper.Model.MetadataAttributeModels) - //{ - // metadataAttrModel.Errors = validateAttribute(metadataAttrModel); - // if (metadataAttrModel.Errors.Count>0) - // step.stepStatus = StepStatus.error; - //} - - //if(MetadataStructureUsageHelper.HasRequiredSimpleTypes(stepModeHelper.Usage)) - //{ - // StepInfo step = TaskManager.Get(stepModeHelper.StepId); - // if (step != null && step.IsInstanze) - // { - // Error error = new Error(ErrorType.Other, String.Format("{0} : {1} {2}", "Step: ", stepModeHelper.Usage.Label, "is not valid. There are fields that are required and not yet completed are.")); - - // errors.Add(new Tuple>(step, tempErrors)); - - // step.stepStatus = StepStatus.error; - // } - //} - } - } - } - } - } - - private List validateStep(AbstractMetadataStepModel pModel) - { - var errorList = new List(); - - if (pModel != null) - { - foreach (var m in pModel.MetadataAttributeModels) - { - var temp = validateAttribute(m); - if (temp != null) - errorList.AddRange(temp); - } - } - - if (errorList.Count == 0) - return null; - else - return errorList; - } - - - #endregion - - #region Show Event Registration Results - - public ActionResult Show() - { - ViewBag.Title = PresentationModel.GetViewTitleForTenant("Show Event Results", this.Session.GetTenant()); - - return View("EventRegistrationResults", new DataTable()); - } - - // public ActionResult ExportToExcel(string eventName, string eventId) - // { - // eventName = "eventName"; - // ExcelWriter excelWriter = new ExcelWriter(); - - // string path = excelWriter.CreateFile(eventName); - - //excelWriter.AddDataTableToExcel(GetEventResults(long.Parse(eventId)), path); - - // return File(path, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - // } - - public ActionResult FillTree() - { - using (EventManager eManager = new EventManager()) - { - List events = eManager.GetAllEvents().ToList(); - List model = new List(); - - EventRegistrationFilterModel closed = new EventRegistrationFilterModel(); - closed.Status = "closed"; - closed.EventFilterItems = new List(); - - EventRegistrationFilterModel open = new EventRegistrationFilterModel(); - open.Status = "open"; - open.EventFilterItems = new List(); - - foreach (Event e in events) - { - if (e.Deadline < DateTime.Now) - closed.EventFilterItems.Add(new EventFilterItem(e)); - else - open.EventFilterItems.Add(new EventFilterItem(e)); - } - - model.Add(open); - model.Add(closed); - - return PartialView("_selectEvent", model); - } - } - - public ActionResult OnSelectTreeViewItem(long id) - { - return View("EventRegistrationResults", GetEventResults(id)); - } - - - #endregion - - #region Xml to DataTable - - private DataTable GetEventResults(long eventId) - { - //string path = AppConfiguration.GetModuleWorkspacePath("EMM"); - //XDocument xDoc = XDocument.Load(Path.Combine(path, "workshopReg4.xml")); - - DataTable results = new DataTable(); - - using (EventRegistrationManager erManager = new EventRegistrationManager()) - { - List eventRegistrations = erManager.GetAllRegistrationsByEvent(eventId); - - if (eventRegistrations.Count != 0) - { - XmlNodeReader xmlNodeReader = new XmlNodeReader(eventRegistrations[0].Data); - results = CreateDataTableColums(results, XElement.Load(xmlNodeReader)); - xmlNodeReader.Dispose(); - } - - foreach (EventRegistration er in eventRegistrations) - { - XmlNodeReader xmlNodeReader = new XmlNodeReader(er.Data); - results.Rows.Add(AddDataRow(XElement.Load(xmlNodeReader), results)); - xmlNodeReader.Dispose(); - - } - } - - return results; - } - - private DataTable GetEventRegistration(long eventId, XDocument data) - { - DataTable results = new DataTable(); - using (EventRegistrationManager erManager = new EventRegistrationManager()) - { - - results = CreateDataTableColums(results, XElement.Parse(data.ToString())); - results.Rows.Add(AddDataRow(XElement.Parse(data.ToString()), results)); - - return results; - } - } - - private DataTable CreateDataTableColums(DataTable dataTable, XElement x) - { - DataTable dt = dataTable; - // build your DataTable - foreach (XElement xe in x.Descendants()) - { - //if (xe.Attribute("input") != null) - //{ - //if (xe.Attribute("input").Value != "intern" && !xe.HasElements) - if (!xe.HasElements) - { - DataColumn dc = new DataColumn(); - dc.Caption = xe.Name.ToString(); - dc.ColumnName = xe.GetAbsoluteXPath(); - - dt.Columns.Add(dc); // add columns to your dt - } - // } - - //if (!xe.HasElements) - //{ - // DataColumn dc = new DataColumn(); - // dc.Caption = xe.Name.ToString(); - // dc.ColumnName =xe.GetAbsoluteXPath(); - // dt.Columns.Add(dc); // add columns to your dt - //} - - - } - - return dt; - } - - private DataRow AddDataRow(XElement x, DataTable dt) - { - //var all = from p in x.Descendants(x.Name.ToString()) select p; - DataRow dr = dt.NewRow(); - foreach (XElement xe in x.Descendants()) - { - //if (xe.Attribute("input") != null) - //{ - if (!xe.HasElements) - { - //dr[xe.Name.ToString()] = xe.Value; //add in the values - dr[xe.GetAbsoluteXPath()] = xe.Value; - } - // } - } - - return dr; - } - - #endregion - - #region Helper - - /// - /// Check if user allready register with the given email adress - /// - /// true or false - private bool UserAllreadyRegister() - { - CreateTaskmanager taskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - //get event id id exsit - long eventId = 0; - if (taskManager.Bus.ContainsKey(CreateTaskmanager.ENTITY_ID)) - eventId = (long)taskManager.Bus[CreateTaskmanager.ENTITY_ID]; - - if (eventId != 0) - { - //get xml data - XDocument data = new XDocument(); - if (taskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_XML)) - { - //check if xml data is in XmLformat and convert to Xdoc ToDO: find a why without converting(DCM: XDoc EMM: XmlDoc) - if (taskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_XML).GetType() == typeof(XmlDocument)) - { - using (var nodeReader = new XmlNodeReader((XmlDocument)taskManager.Bus[CreateTaskmanager.METADATA_XML])) - { - nodeReader.MoveToContent(); - data = XDocument.Load(nodeReader); - } - } - else - data = (XDocument)taskManager.Bus[CreateTaskmanager.METADATA_XML]; - } - - //get email adress to check if it already exsits in thsi event - string email = XmlMetadataWriter.ToXmlDocument(data).GetElementsByTagName("Email")[0].InnerText; - - using (var eventRegistrationManager = new EventRegistrationManager()) - { - //get all registrations from the selected event - var eventRegistrations = eventRegistrationManager.GetAllRegistrationsByEvent(eventId); - foreach (var er in eventRegistrations) - { - //return true if we have a match and the registration is not deleted. Id deleted == true registration with same email possible - if (email == er.Data.GetElementsByTagName("Email")[0].InnerText && er.Deleted == false) - return true; - } - } - } - - return false; - } - - private EventRegistration CheckEventRegistration(string ref_id, long event_id, EventRegistrationManager erManager) - { - EventRegistration reg_ref_id = erManager.GetRegistrationByRefIdAndEvent(ref_id, event_id); - //if (user != null) - //{ - // List regs = erManager.GetRegistrationByUserAndEvent(user.Id, event_id); - // EventRegistration reg = regs.Where(a => a.Deleted == false).FirstOrDefault(); - - // return reg; // user is logged in - //} - //else - if (reg_ref_id != null) - { - return reg_ref_id; // provided ref_id fits to event - } - else - { - return null; - } - } - - - private void setAdditionalFunctions() - { - CreateTaskmanager taskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - - - ActionInfo submitAction = new ActionInfo(); - submitAction.ActionName = "Save"; - submitAction.ControllerName = "EventRegistration"; - submitAction.AreaName = "EMM"; - - ActionInfo cancelAction = new ActionInfo(); - cancelAction.ActionName = "Cancel"; - cancelAction.ControllerName = "EventRegistration"; - cancelAction.AreaName = "EMM"; - - taskManager.Actions.Add(CreateTaskmanager.SUBMIT_ACTION, submitAction); - taskManager.Actions.Add(CreateTaskmanager.CANCEL_ACTION, cancelAction); - - Session["EventRegistrationTaskmanager"] = taskManager; - - } - - private void CreateXml() - { - TaskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - - // load metadatastructure with all packages and attributes - - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATASTRUCTURE_ID)) - { - var xmlMetadatWriter = new XmlMetadataWriter(XmlNodeMode.xPath); - - var metadataXml = xmlMetadatWriter.CreateMetadataXml(Convert.ToInt64(TaskManager.Bus[CreateTaskmanager.METADATASTRUCTURE_ID])); - - //local path - //string path = Path.Combine(AppConfiguration.GetModuleWorkspacePath("DCM"), "metadataTemp.Xml"); - - TaskManager.AddToBus(CreateTaskmanager.METADATA_XML, metadataXml); - - - - //setup loaded - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.SETUP_LOADED)) - TaskManager.Bus[CreateTaskmanager.SETUP_LOADED] = true; - else - TaskManager.Bus.Add(CreateTaskmanager.SETUP_LOADED, true); - - } - } - - private void AdvanceTaskManager(long MetadataStructureId) - { - TaskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - - var metadataStructureManager = new MetadataStructureManager(); - - try - { - var metadataPackageList = metadataStructureManager.GetEffectivePackages(MetadataStructureId).ToList(); - - var stepModelHelperList = new List(); - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_STEP_MODEL_HELPER)) - { - TaskManager.Bus[CreateTaskmanager.METADATA_STEP_MODEL_HELPER] = stepModelHelperList; - } - else - { - TaskManager.Bus.Add(CreateTaskmanager.METADATA_STEP_MODEL_HELPER, stepModelHelperList); - } - - TaskManager.StepInfos = new List(); - - StepModelHelper stepModelHelper; - StepInfo si; - foreach (var mpuId in metadataPackageList.Select(p => p.Id)) - { - MetadataPackageUsage mpu = metadataStructureManager.PackageUsageRepo.Get(mpuId); - - //only add none optional usages - si = new StepInfo(mpu.Label) - { - Id = TaskManager.GenerateStepId(), - parentTitle = mpu.MetadataPackage.Name, - Parent = TaskManager.Root, - IsInstanze = false, - }; - - TaskManager.StepInfos.Add(si); - stepModelHelper = new StepModelHelper(si.Id, 1, mpu.Id, mpu.Label, GetUsageAttrName(mpu), mpu.GetType(), "Metadata//" + mpu.Label.Replace(" ", string.Empty) + "[1]", null, mpu.Extra); - - stepModelHelperList.Add(stepModelHelper); - - si = AddStepsBasedOnUsage(mpu, si, "Metadata//" + mpu.Label.Replace(" ", string.Empty) + "[1]", stepModelHelper); - TaskManager.Root.Children.Add(si); - - //TaskManager.Bus[CreateTaskmanager.METADATA_STEP_MODEL_HELPER] = stepModelHelperList; - } - - TaskManager.Bus[CreateTaskmanager.METADATA_STEP_MODEL_HELPER] = stepModelHelperList; - Session["EventRegistrationTaskmanager"] = TaskManager; - } - finally - { - metadataStructureManager.Dispose(); - } - } - - private StepInfo AddStepsBasedOnUsage(BaseUsage usage, StepInfo current, string parentXpath, StepModelHelper parent) - { - // genertae action, controller base on usage - var actionName = ""; - var childName = ""; - var min = usage.MinCardinality; - - if (usage is MetadataPackageUsage) - { - actionName = "SetMetadataPackageInstanze"; - childName = ((MetadataPackageUsage)usage).MetadataPackage.Name; - } - else - { - actionName = "SetMetadataCompoundAttributeInstanze"; - - if (usage is MetadataNestedAttributeUsage) - childName = ((MetadataNestedAttributeUsage)usage).Member.Name; - - if (usage is MetadataAttributeUsage) - childName = ((MetadataAttributeUsage)usage).MetadataAttribute.Name; - } - - var list = new List(); - var stepHelperModelList = (List)TaskManager.Bus[CreateTaskmanager.METADATA_STEP_MODEL_HELPER]; - - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_XML)) - { - var xMetadata = getMetadata(); - - var x = new XElement("null"); - var elements = new List(); - - var keyValueDic = new Dictionary(); - keyValueDic.Add("id", usage.Id.ToString()); - - if (usage is MetadataPackageUsage) - { - keyValueDic.Add("type", BExIS.Xml.Helpers.XmlNodeType.MetadataPackageUsage.ToString()); - elements = XmlUtility.GetXElementsByAttribute(usage.Label, keyValueDic, xMetadata).ToList(); - } - else - { - keyValueDic.Add("type", BExIS.Xml.Helpers.XmlNodeType.MetadataAttributeUsage.ToString()); - elements = XmlUtility.GetXElementsByAttribute(usage.Label, keyValueDic, xMetadata).ToList(); - } - - x = elements.FirstOrDefault(); - - if (x != null && !x.Name.Equals("null")) - { - var xelements = x.Elements(); - - if (xelements.Count() > 0) - { - var counter = 0; - var title = ""; - Int64 id = 0; - var xPath = ""; - StepInfo s; - StepModelHelper newStepModelHelper = new StepModelHelper(); - - foreach (var element in xelements) - { - counter++; - title = counter.ToString(); //usage.Label+" (" + counter + ")"; - id = Convert.ToInt64((element.Attribute("roleId")).Value.ToString()); - - s = new StepInfo(title) - { - Id = TaskManager.GenerateStepId(), - Parent = current, - IsInstanze = true, - HasContent = metadataStructureUsageHelper.HasUsagesWithSimpleType(usage.Id, usage.GetType()), - }; - - xPath = parentXpath + "//" + childName.Replace(" ", string.Empty) + "[" + counter + "]"; - - if (TaskManager.Root.Children.Where(z => z.title.Equals(title)).Count() == 0) - { - newStepModelHelper = new StepModelHelper(s.Id, counter, usage.Id, usage.Label, GetUsageAttrName(usage), usage.GetType(), xPath, parent, usage.Extra); - stepHelperModelList.Add(newStepModelHelper); - - s.Children = GetChildrenSteps(usage.Id, usage.GetType(), s, xPath, newStepModelHelper); - - current.Children.Add(s); - } - } - } - } - - //TaskManager.AddToBus(CreateDatasetTaskmanager.METADATAPACKAGE_IDS, MetadataPackageDic); - } - return current; - } - - private List GetChildrenSteps(long usageId, Type type, StepInfo parent, string parentXpath, StepModelHelper parentStepModelHelper) - { - var childrenSteps = new List(); - var childrenUsages = metadataStructureUsageHelper.GetCompoundChildrens(usageId, type); - var stepHelperModelList = (List)TaskManager.Bus[CreateTaskmanager.METADATA_STEP_MODEL_HELPER]; - - if (childrenUsages.Count() > 0) - { - var xPath = ""; - var complex = false; - var actionName = ""; - var attrName = ""; - - StepInfo s; - var newStepModelHelper = new StepModelHelper(); - - foreach (var u in childrenUsages) - { - //var u = loadUsage(id, type); - xPath = parentXpath + "//" + u.Label.Replace(" ", string.Empty) + "[1]"; - complex = false; - actionName = ""; - attrName = ""; - - if (u is MetadataPackageUsage) - { - actionName = "SetMetadataPackage"; - } - else - { - actionName = "SetMetadataCompoundAttribute"; - - if (u is MetadataAttributeUsage) - { - var mau = (MetadataAttributeUsage)u; - if (mau.MetadataAttribute.Self is MetadataCompoundAttribute) - { - complex = true; - attrName = mau.MetadataAttribute.Self.Name; - } - } - - if (u is MetadataNestedAttributeUsage) - { - var mau = (MetadataNestedAttributeUsage)u; - if (mau.Member.Self is MetadataCompoundAttribute) - { - complex = true; - attrName = mau.Member.Self.Name; - } - } - } - - if (complex) - { - s = new StepInfo(u.Label) - { - Id = TaskManager.GenerateStepId(), - parentTitle = attrName, - Parent = parent, - IsInstanze = false, - GetActionInfo = new ActionInfo - { - ActionName = actionName, - ControllerName = "CreateSetMetadataPackage", - AreaName = "DCM" - }, - - PostActionInfo = new ActionInfo - { - ActionName = actionName, - ControllerName = "CreateSetMetadataPackage", - AreaName = "DCM" - } - }; - - if (TaskManager.StepInfos.Where(z => z.Id.Equals(s.Id)).Count() == 0) - { - newStepModelHelper = new StepModelHelper(s.Id, 1, u.Id, u.Label, GetUsageAttrName(u), u.GetType(), xPath, - parentStepModelHelper, u.Extra); - stepHelperModelList.Add(newStepModelHelper); - - s = AddStepsBasedOnUsage(u, s, xPath, newStepModelHelper); - childrenSteps.Add(s); - } - } - } - } - - return childrenSteps; - } - - private StepModelHelper GetStepModelhelper(int stepId) - { - TaskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_STEP_MODEL_HELPER)) - { - return ((List)TaskManager.Bus[CreateTaskmanager.METADATA_STEP_MODEL_HELPER]).Where(s => s.StepId.Equals(stepId)).FirstOrDefault(); - } - - return null; - } - - private string GetUsageAttrName(BaseUsage usage) - { - if (usage.GetType().Equals(typeof(MetadataAttributeUsage))) - { - var u = (MetadataAttributeUsage)usage; - return u.MetadataAttribute.Name; - } - if (usage.GetType().Equals(typeof(MetadataNestedAttributeUsage))) - { - var u = (MetadataNestedAttributeUsage)usage; - return u.Member.Name; - } - if (usage.GetType().Equals(typeof(MetadataPackageUsage))) - { - var u = (MetadataPackageUsage)usage; - return u.MetadataPackage.Name; - } - - return null; - } - - private XDocument getMetadata() - { - try - { - if (TaskManager == null) TaskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_XML)) - { - var metadata = TaskManager.Bus[CreateTaskmanager.METADATA_XML]; - - if (metadata is XDocument) return (XDocument)metadata; - else - { - if (metadata is XmlDocument) - { - return XmlUtility.ToXDocument((XmlDocument)metadata); - } - } - } - - return new XDocument(); - } - catch - { - return new XDocument(); - } - } - - private MetadataPackageModel createPackageModel(int stepId, bool validateIt) - { - var stepInfo = TaskManager.Get(stepId); - var stepModelHelper = GetStepModelhelper(stepId); - - var metadataPackageId = stepModelHelper.UsageId; - var metadataStructureId = Convert.ToInt64(TaskManager.Bus[CreateTaskmanager.METADATASTRUCTURE_ID]); - - var mpu = (MetadataPackageUsage)loadUsage(stepModelHelper.UsageId, stepModelHelper.UsageType); - var model = new MetadataPackageModel(); - - model = FormHelper.CreateMetadataPackageModel(mpu, stepModelHelper.Number); - model.ConvertMetadataAttributeModels(mpu, metadataStructureId, stepId); - - if (stepInfo.IsInstanze == false) - { - //get Instance - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_XML)) - { - var xMetadata = getMetadata(); - model.ConvertInstance(xMetadata, stepModelHelper.XPath); - } - } - else - { - if (stepModelHelper.Model != null) - { - model = (MetadataPackageModel)stepModelHelper.Model; - } - else - { - stepModelHelper.Model = model; - } - } - - model.StepInfo = stepInfo; - - return model; - } - - private BaseUsage loadUsage(long Id, Type type) - { - if (type.Equals(typeof(MetadataAttributeUsage))) - return this.GetUnitOfWork().GetReadOnlyRepository().Get(Id); - if (type.Equals(typeof(MetadataNestedAttributeUsage))) - return this.GetUnitOfWork().GetReadOnlyRepository().Get(Id); - if (type.Equals(typeof(MetadataPackageUsage))) - return this.GetUnitOfWork().GetReadOnlyRepository().Get(Id); - - return null; - } - - private MetadataCompoundAttributeModel createCompoundModel(int stepId, bool validateIt) - { - var stepInfo = TaskManager.Get(stepId); - var stepModelHelper = GetStepModelhelper(stepId); - - var metadataStructureId = Convert.ToInt64(TaskManager.Bus[CreateTaskmanager.METADATASTRUCTURE_ID]); - var Id = stepModelHelper.UsageId; - - BaseUsage usage = loadUsage(stepModelHelper.UsageId, stepModelHelper.UsageType); - var model = FormHelper.CreateMetadataCompoundAttributeModel(usage, stepModelHelper.Number); - - // get children - model.ConvertMetadataAttributeModels(usage, metadataStructureId, stepInfo.Id); - model.StepInfo = TaskManager.Get(stepId); - - if (stepInfo.IsInstanze == false) - { - //get Instance - if (TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_XML)) - { - var xMetadata = getMetadata(); - model.ConvertInstance(xMetadata, stepModelHelper.XPath); - } - } - else - { - if (stepModelHelper.Model != null) - { - model = (MetadataCompoundAttributeModel)stepModelHelper.Model; - } - else - { - stepModelHelper.Model = model; - } - } - - //if (validateIt) - //{ - // //validate packages - // List errors = validateStep(stepModelHelper.Model); - // if (errors != null) - // model.ErrorList = errors; - // else - // model.ErrorList = new List(); - - //} - - model.StepInfo = stepInfo; - - return model; - } - - private StepModelHelper getChildModelsHelper(StepModelHelper stepModelHelper) - { - StepInfo currentStepInfo = stepModelHelper.Model.StepInfo; - - if (currentStepInfo.Children.Count > 0) - { - StepModelHelper childStepModelHelper; - - foreach (var childStep in currentStepInfo.Children) - { - childStepModelHelper = GetStepModelhelper(childStep.Id); - - if (childStepModelHelper.Model == null) - { - childStepModelHelper.Model = createModel(childStep.Id, false, childStepModelHelper.UsageType); - - if (childStepModelHelper.Model.StepInfo.IsInstanze) - LoadSimpleAttributesForModelFromXml(childStepModelHelper); - } - - childStepModelHelper = getChildModelsHelper(childStepModelHelper); - - stepModelHelper.Childrens.Add(childStepModelHelper); - } - } - - return stepModelHelper; - } - - - #endregion - - #region Models - - private AbstractMetadataStepModel createModel(int stepId, bool validateIt, Type usageType) - { - if (usageType.Equals(typeof(MetadataPackageUsage))) - { - return createPackageModel(stepId, validateIt); - } - - return createCompoundModel(stepId, validateIt); - } - - private void setStepModelActive(StepModelHelper model) - { - model.Activated = true; - if (model.Parent != null) - setStepModelActive(model.Parent); - } - - private AbstractMetadataStepModel LoadSimpleAttributesForModelFromXml(StepModelHelper stepModelHelper) - { - TaskManager = (CreateTaskmanager)Session["CreateDatasetTaskmanager"]; - var metadata = getMetadata(); - - var complexElement = XmlUtility.GetXElementByXPath(stepModelHelper.XPath, metadata); - var additionalyMetadataAttributeModel = new List(); - - foreach (var simpleMetadataAttributeModel in stepModelHelper.Model.MetadataAttributeModels) - { - var numberOfSMM = 1; - if (complexElement != null) - { - //Debug.WriteLine("XXXXXXXXXXXXXXXXXXXX"); - //Debug.WriteLine(simpleMetadataAttributeModel.Source.Label); - var childs = XmlUtility.GetChildren(complexElement).Where(e => e.Attribute("id").Value.Equals(simpleMetadataAttributeModel.Id.ToString())); - - if (childs.Any()) - numberOfSMM = childs.First().Elements().Count(); - } - - for (var i = 1; i <= numberOfSMM; i++) - { - var xpath = stepModelHelper.GetXPathFromSimpleAttribute(simpleMetadataAttributeModel.Id, i); - var simpleElement = XmlUtility.GetXElementByXPath(xpath, metadata); - - if (i == 1) - { - if (simpleElement != null && !String.IsNullOrEmpty(simpleElement.Value)) - { - simpleMetadataAttributeModel.Value = simpleElement.Value; - - #region entity mapping - - // if this simple attr is linked to a enity, some attr need to get from the xelement and create a url for the model - if (simpleElement.Attributes().Any(a => a.Name.LocalName.ToLowerInvariant().Equals("entityid"))) - { - long id = 0; - int version = 0; - string idAsString = simpleElement.Attributes().FirstOrDefault(a => a.Name.LocalName.ToLowerInvariant().Equals("entityid"))?.Value; - string versionAsString = simpleElement.Attributes().FirstOrDefault(a => a.Name.LocalName.ToLowerInvariant().Equals("entityversion"))?.Value; - - if (Int64.TryParse(idAsString, out id) && - Int32.TryParse(versionAsString, out version)) - { - string server = this.Request.Url.GetLeftPart(UriPartial.Authority); - string url = server + "/DDM/Data/Show/" + id.ToString() + "?version=" + version; - - simpleMetadataAttributeModel.EntityUrl = url; - } - } - - #endregion entity mapping - - // if at least on item has a value, the parent should be activated - setStepModelActive(stepModelHelper); - } - } - else - { - var newMetadataAttributeModel = simpleMetadataAttributeModel.Kopie(i, numberOfSMM); - newMetadataAttributeModel.Value = simpleElement.Value; - if (i == numberOfSMM) newMetadataAttributeModel.last = true; - additionalyMetadataAttributeModel.Add(newMetadataAttributeModel); - } - } - } - - foreach (var item in additionalyMetadataAttributeModel) - { - var tempList = stepModelHelper.Model.MetadataAttributeModels; - - var indexOfLastSameAttribute = tempList.IndexOf(tempList.Where(a => a.Id.Equals(item.Id)).Last()); - tempList.Insert(indexOfLastSameAttribute + 1, item); - } - - return stepModelHelper.Model; - } - - #endregion - } - -} diff --git a/Controllers/EventRegistrationResultController.cs b/Controllers/EventRegistrationResultController.cs deleted file mode 100644 index 16f9d28..0000000 --- a/Controllers/EventRegistrationResultController.cs +++ /dev/null @@ -1,547 +0,0 @@ -using BExIS.Dcm.CreateDatasetWizard; -using BExIS.Dcm.Wizard; -using BExIS.Emm.Entities.Event; -using BExIS.Emm.Services.Event; -using BExIS.IO.Transform.Output; -using BExIS.Modules.EMM.UI.Helper; -using BExIS.Modules.EMM.UI.Models; -using BExIS.Security.Entities.Authorization; -using BExIS.Security.Entities.Objects; -using BExIS.Security.Entities.Subjects; -using BExIS.Security.Services.Authorization; -using BExIS.Security.Services.Objects; -using BExIS.Security.Services.Subjects; -using BExIS.Security.Services.Utilities; -using BExIS.Xml.Helpers; -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.IO; -using System.Linq; -using System.Security.Cryptography; -using System.Text; -using System.Web; -using System.Web.Mvc; -using System.Xml; -using System.Xml.Linq; -using Vaiona.Utils.Cfg; -using Vaiona.Web.Extensions; -using Vaiona.Web.Mvc.Models; - -namespace BExIS.Modules.EMM.UI.Controllers -{ - public class EventRegistrationResultController : Controller - { - - private CreateTaskmanager TaskManager; - - #region Show Event Registration Results - - public ActionResult Show() - { - ViewBag.Title = PresentationModel.GetViewTitleForTenant(" Show Reservation", this.Session.GetTenant()); - EventRegistrationResultModel model = new EventRegistrationResultModel(); - model.Results = new DataTable(); - return View("EventRegistrationResults", model); - } - - /// - /// delete event with all registrations - /// - /// event id - /// csv file - public ActionResult Delete(string id) - { - long eventId = Convert.ToInt64(id); - using (var eventRegistrationManager = new EventRegistrationManager()) - using (var eventManager = new EventManager()) - { - //delete first all registrations - List eventRegistrations = eventRegistrationManager.GetAllRegistrationsByEvent(eventId); - eventRegistrations.ForEach(a => eventRegistrationManager.DeleteEventRegistration(a)); - - eventManager.DeleteEvent(eventManager.GetEventById(eventId)); - } - - return RedirectToAction("Show"); - } - - /// - /// clear, that means delete all registrations from one event - /// - /// event id - /// csv file - public ActionResult Clear(string id) - { - long eventId = Convert.ToInt64(id); - using (var eventRegistrationManager = new EventRegistrationManager()) - using (var eventManager = new EventManager()) - { - //delete first all registrations - List eventRegistrations = eventRegistrationManager.GetAllRegistrationsByEvent(eventId); - eventRegistrations.ForEach(a => eventRegistrationManager.DeleteEventRegistration(a)); - - var e = eventManager.GetEventById(eventId); - if(e.Closed == true) - { - e.Closed = false; - eventManager.UpdateEvent(e); - } - } - - return RedirectToAction("Show"); - } - - /// - /// export as comma seperatred csv - /// - /// event id - /// csv file - public ActionResult Export(string id) - { - DataTable dataTable = GetEventResults(long.Parse(id)); - - var lines = new List(); - string[] columnNames = dataTable.Columns - .Cast() - .Select(column => column.ColumnName) - .ToArray(); - - var header = string.Join(",", columnNames.Select(name => $"\"{name}\"")); - lines.Add(header); - - var valueLines = dataTable.AsEnumerable() - .Select(row => string.Join(",", row.ItemArray.Select(val => $"\"{val}\""))); - - lines.AddRange(valueLines); - - string eventName; - - using (EventManager eventManager = new EventManager()) - { - eventName = eventManager.GetEventById(long.Parse(id)).Name; - } - //remove invaid chars in eventname for filename - string filename = string.Join("_", eventName.Split(Path.GetInvalidFileNameChars())); - - string dataPath = AppConfiguration.DataPath; - string storePath = Path.Combine(dataPath, "EMM", "Temp", filename + ".csv"); - - System.IO.File.WriteAllLines(storePath, lines, new UTF8Encoding(true)); - - return File(storePath, MimeMapping.GetMimeMapping(eventName + ".csv"), Path.GetFileName(storePath)); - } - - public ActionResult FillTree() - { - using (EventManager eManager = new EventManager()) - { - List events = eManager.GetAllEvents().ToList(); - List model = new List(); - - EventRegistrationFilterModel closed = new EventRegistrationFilterModel(); - closed.Status = "closed"; - closed.EventFilterItems = new List(); - - EventRegistrationFilterModel open = new EventRegistrationFilterModel(); - open.Status = "open"; - open.EventFilterItems = new List(); - - foreach (Event e in events) - { - if (e.Deadline < DateTime.Now) - closed.EventFilterItems.Add(new EventFilterItem(e)); - else - open.EventFilterItems.Add(new EventFilterItem(e)); - } - - open.EventFilterItems = open.EventFilterItems.OrderBy(a => a.Id).ToList(); - closed.EventFilterItems = closed.EventFilterItems.OrderBy(a => a.Id).ToList(); - open.EventFilterItems = Enumerable.Reverse(open.EventFilterItems).ToList(); - closed.EventFilterItems = Enumerable.Reverse(closed.EventFilterItems).ToList(); - - model.Add(open); - model.Add(closed); - - return PartialView("_selectEvent", model); - } - } - - public ActionResult OnSelectTreeViewItem(long id) - { - EventRegistrationResultModel model = new EventRegistrationResultModel(); - model.Results = GetEventResults(id); - model.WaitingListResults = GetWaitingListResults(id); - - model.EventId = id; - - //check rights on event - using (var permissionManager = new EntityPermissionManager()) - using (var entityTypeManager = new EntityManager()) - using (var userManager = new UserManager()) - { - var user = userManager.FindByNameAsync(HttpContext.User.Identity.Name).Result; - Entity entity = entityTypeManager.FindByName("Event"); - model.UserHasRights = permissionManager.HasEffectiveRight(user.Name, entity.EntityType, id, RightType.Read); - } - - return View("EventRegistrationResults", model); - } - - public ActionResult MoveFromWaitingList(long id, long eventId) - { - using (EventRegistrationManager erManager = new EventRegistrationManager()) - using (EventManager eventManager = new EventManager()) - { - var registration = erManager.EventRegistrationRepo.Get(a => a.Id == id).FirstOrDefault(); - if (registration.WaitingList == true) - registration.WaitingList = false; - - erManager.UpdateEventRegistration(registration); - - var e = eventManager.GetEventById(eventId); - SendNotification(registration.Data, e); - - } - - return RedirectToAction("OnSelectTreeViewItem", new { id = eventId }); - } - - public ActionResult ResendNotification(long id, long eventId) - { - using (EventRegistrationManager erManager = new EventRegistrationManager()) - using (EventManager eventManager = new EventManager()) - { - var registration = erManager.EventRegistrationRepo.Get(a => a.Id == id).FirstOrDefault(); - - var e = eventManager.GetEventById(eventId); - Resend(registration.Data, e); - } - - return RedirectToAction("OnSelectTreeViewItem", new { id = eventId }); - } - - private void Resend(XmlDocument data, Event e) - { - // get email adress from XML && get ref_id based on email adress - string email = data.GetElementsByTagName("Email")[0].InnerText; - string ref_id = EmailHelper.GetRefIdFromEmail(email); - string url = Request.Url.GetLeftPart(UriPartial.Authority); - EmailHelper.SendEmailNotification("resend", email, ref_id, data, e, url); - } - - - - private void SendNotification(XmlDocument data, Event e) - { - // todo: add not allowed / log in info to mail - - EmailStructure emailStructure = new EmailStructure(); - emailStructure = EmailHelper.ReadFile(e.EventLanguage); - - string first_name = data.GetElementsByTagName(emailStructure.lableFirstName)[0].InnerText; - string last_name = data.GetElementsByTagName(emailStructure.lableLastname)[0].InnerText; - string email = data.GetElementsByTagName(emailStructure.lableEmail)[0].InnerText; - - string url = Request.Url.GetLeftPart(UriPartial.Authority); - - string mail_message = ""; - string subject = emailStructure.removeFromWaitingListSubject + e.Name; - - string body = emailStructure.bodyTitle + first_name + " " + last_name + ", " + "

" + - emailStructure.removeFromWaitingList1 + "

" + - emailStructure.bodyClosing + "
" + - emailStructure.bodyClosingName; - - - var es = new EmailService(); - - // If no explicit Reply to mail is set use the SystemEmail - string replyTo = ""; - if (String.IsNullOrEmpty(e.EmailReply)) - { - replyTo = ConfigurationManager.AppSettings["SystemEmail"]; - } - else - { - replyTo = e.EmailReply; - } - - es.Send( - subject, - body, - new List { email }, // to - new List { e.EmailCC }, // CC - new List { ConfigurationManager.AppSettings["SystemEmail"], e.EmailBCC }, // Allways send BCC to SystemEmail + additional set - new List { replyTo } - ); - - } - - #endregion - - #region edit event registration - - public ActionResult LoadForm(long id, long eventid) - { - using (EventManager eManager = new EventManager()) - { - Event e = eManager.EventRepo.Get(eventid); - - //add default value to session - DefaultEventInformation defaultEventInformation = new DefaultEventInformation(); - defaultEventInformation.EventName = e.Name; - defaultEventInformation.Eventid = e.Id.ToString(); - if (!String.IsNullOrEmpty(e.EventDate)) - defaultEventInformation.Date = e.EventDate; - if (!String.IsNullOrEmpty(e.EventLanguage)) - defaultEventInformation.Language = e.EventLanguage; - - if (!String.IsNullOrEmpty(e.ImportantInformation)) - defaultEventInformation.ImportantInformation = e.ImportantInformation; - - Session["DefaultEventInformation"] = defaultEventInformation; - - //CreateTaskmanager taskManager = new CreateTaskmanager(); - if (TaskManager == null) - TaskManager = new CreateTaskmanager(); - - TaskManager.AddToBus(CreateTaskmanager.METADATASTRUCTURE_ID, e.MetadataStructure.Id); - TaskManager.AddToBus(CreateTaskmanager.ENTITY_ID, e.Id); - - using (EventRegistrationManager erManager = new EventRegistrationManager()) - { - - EventRegistration reg = erManager.EventRegistrationRepo.Get(a => a.Id == id).FirstOrDefault(); - XmlNodeReader xmlNodeReader = new XmlNodeReader(reg.Data); - TaskManager.AddToBus(CreateTaskmanager.METADATA_XML, reg.Data); - xmlNodeReader.Dispose(); - } - - } - - TaskManager.AddToBus(CreateTaskmanager.SAVE_WITH_ERRORS, false); - - TaskManager.AddToBus(CreateTaskmanager.NO_IMPORT_ACTION, true); - TaskManager.AddToBus(CreateTaskmanager.INFO_ON_TOP_TITLE, "Event registration"); - TaskManager.AddToBus(CreateTaskmanager.INFO_ON_TOP_DESCRIPTION, "

help

"); - - - Session["EventRegistrationTaskmanager"] = TaskManager; - - setAdditionalFunctions(); - - return new EmptyResult(); - - } - private void setAdditionalFunctions() - { - CreateTaskmanager taskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"]; - - - ActionInfo submitAction = new ActionInfo(); - submitAction.ActionName = "Save"; - submitAction.ControllerName = "EventRegistration"; - submitAction.AreaName = "EMM"; - - ActionInfo cancelAction = new ActionInfo(); - cancelAction.ActionName = "Cancel"; - cancelAction.ControllerName = "EventRegistration"; - cancelAction.AreaName = "EMM"; - - taskManager.Actions.Add(CreateTaskmanager.SUBMIT_ACTION, submitAction); - taskManager.Actions.Add(CreateTaskmanager.CANCEL_ACTION, cancelAction); - - Session["EventRegistrationTaskmanager"] = taskManager; - - } - - - #endregion - - #region delete reg - - public ActionResult DeleteRegistration(long id) - { - using (EventRegistrationManager erManager = new EventRegistrationManager()) - using (UserManager userManager = new UserManager()) - { - EventRegistration reg = erManager.EventRegistrationRepo.Get(a => a.Id == id).FirstOrDefault(); - if (reg != null) - { - reg.Deleted = true; - erManager.UpdateEventRegistration(reg); - MoveFromWaitingList(reg.Event.Id); - } - - string url = Request.Url.GetLeftPart(UriPartial.Authority); - string email = ""; - - if (reg.Person != null) - { - User user = userManager.FindByIdAsync(reg.Person.Id).Result; - email = user.Email; - } - else - email = reg.Data.GetElementsByTagName("Email")[0].InnerText; - - EmailHelper.SendEmailNotification("deleted", email, "", reg.Data, reg.Event, url); - } - - return RedirectToAction("Show"); - - } - - private void MoveFromWaitingList(long eventId) - { - string url = Request.Url.GetLeftPart(UriPartial.Authority); - - using (var erManager = new EventRegistrationManager()) - using (var eventManager = new EventManager()) - { - int countWaitingList = erManager.GetAllWaitingListRegsByEvent(eventId).Count; - if (countWaitingList > 0) - { - var reg = erManager.GetLatestWaitingListEntry(eventId); - reg.WaitingList = false; - erManager.UpdateEventRegistration(reg); - var e = eventManager.GetEventById(eventId); - string email = ""; - if (reg.Person != null) - email = reg.Person.Email; - else - email = reg.Data.GetElementsByTagName("Email")[0].InnerText; - - //change Sataus if event if there is again space on waiting list - if((countWaitingList <= e.WaitingListLimitation) && e.Closed == true) - { - e.Closed = false; - eventManager.UpdateEvent(e); - } - - EmailHelper.SendEmailNotification("remove_from_waiting_list", email, "", reg.Data, reg.Event, url); - - } - } - } - - - #endregion - - #region Xml to DataTable - - private DataTable GetEventResults(long eventId) - { - DataTable results = new DataTable(); - results.Columns.Add("Id"); - results.Columns.Add("Deleted"); - - using (EventRegistrationManager erManager = new EventRegistrationManager()) - { - List eventRegistrations = erManager.GetAllRegistrationsByEvent(eventId); - - if (eventRegistrations.Count != 0) - { - XmlNodeReader xmlNodeReader = new XmlNodeReader(eventRegistrations[0].Data); - results = CreateDataTableColums(results, XElement.Load(xmlNodeReader)); - xmlNodeReader.Dispose(); - } - - foreach (EventRegistration er in eventRegistrations) - { - XmlNodeReader xmlNodeReader = new XmlNodeReader(er.Data); - results.Rows.Add(AddDataRow(XElement.Load(xmlNodeReader), results, er.Deleted.ToString(), er.Id)); - xmlNodeReader.Dispose(); - } - } - - return results; - } - - private DataTable GetWaitingListResults(long eventId) - { - DataTable results = new DataTable(); - results.Columns.Add("Id"); - results.Columns.Add("Deleted"); - //results.Columns.Add("Action"); - - using (EventRegistrationManager erManager = new EventRegistrationManager()) - { - List eventRegistrations = erManager.GetAllWaitingListRegsByEvent(eventId); - - if (eventRegistrations.Count != 0) - { - XmlNodeReader xmlNodeReader = new XmlNodeReader(eventRegistrations[0].Data); - results = CreateDataTableColums(results, XElement.Load(xmlNodeReader)); - xmlNodeReader.Dispose(); - } - - foreach (EventRegistration er in eventRegistrations) - { - XmlNodeReader xmlNodeReader = new XmlNodeReader(er.Data); - results.Rows.Add(AddDataRow(XElement.Load(xmlNodeReader), results, er.Deleted.ToString(), er.Id)); - xmlNodeReader.Dispose(); - } - } - - return results; - } - //private DataTable GetEventRegistration(long eventId, XDocument data) - //{ - // DataTable results = new DataTable(); - - // using (EventRegistrationManager erManager = new EventRegistrationManager()) - // { - // XmlNodeReader xmlNodeReader = new XmlNodeReader(XmlMetadataWriter.ToXmlDocument(data)); - // results = CreateDataTableColums(results, XElement.Load(xmlNodeReader)); - // results.Rows.Add(AddDataRow(XElement.Load(xmlNodeReader), results)); - // xmlNodeReader.Dispose(); - // } - // return results; - //} - - private DataTable CreateDataTableColums(DataTable dataTable, XElement x) - { - DataTable dt = dataTable; - // build your DataTable - foreach (XElement xe in x.Descendants()) - { - if (!xe.HasElements) - { - DataColumn dc = new DataColumn(); - string colName = xe.Name.ToString().Replace("Type", ""); - dc.Caption = colName; - dc.ColumnName = colName; - dt.Columns.Add(dc); // add columns to your dt - } - } - - return dt; - } - - private DataRow AddDataRow(XElement x, DataTable dt, string deleted, long id) - { - DataRow dr = dt.NewRow(); - dr["Id"] = id; - dr["Deleted"] = deleted; - foreach (XElement xe in x.Descendants()) - { - if (!xe.HasElements) - { - string value = xe.Value.Replace("\r\n", " "); - value = value.Replace("\n", " "); - value = HttpUtility.HtmlDecode(value); - dr[xe.Name.ToString().Replace("Type", "")] = value; //add in the values - } - } - - return dr; - } - - #endregion - - - } - -} diff --git a/Helper/FormHelper.cs b/Helper/FormHelper.cs deleted file mode 100644 index 9cb0251..0000000 --- a/Helper/FormHelper.cs +++ /dev/null @@ -1,207 +0,0 @@ -using BExIS.Dim.Entities.Mapping; -using BExIS.Dim.Helpers.Mapping; -using BExIS.Dlm.Entities.Common; -using BExIS.Dlm.Entities.DataStructure; -using BExIS.Dlm.Entities.MetadataStructure; -using BExIS.IO.DataType.DisplayPattern; -using BExIS.Modules.EMM.UI.Models; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace BExIS.Modules.EMM.UI.Helpers -{ - public class FormHelper - { - public static MetadataCompoundAttributeModel CreateMetadataCompoundAttributeModel(BaseUsage metadataAttributeUsage, int number) - { - return new MetadataCompoundAttributeModel - { - Id = metadataAttributeUsage.Id, - Number = number, - Source = metadataAttributeUsage, - DisplayName = metadataAttributeUsage.Label, - Discription = metadataAttributeUsage.Description, - MinCardinality = metadataAttributeUsage.MinCardinality, - MaxCardinality = metadataAttributeUsage.MaxCardinality, - NumberOfSourceInPackage = 1, - first = true, - last = true - }; - } - - public static MetadataPackageModel CreateMetadataPackageModel(BaseUsage mPUsage, int number) - { - MetadataPackageUsage metadataPackageUsage = (MetadataPackageUsage)mPUsage; - if (metadataPackageUsage != null) - { - return new MetadataPackageModel - { - Source = metadataPackageUsage, - Number = number, - MetadataAttributeModels = new List(), - DisplayName = metadataPackageUsage.Label, - Discription = metadataPackageUsage.Description, - MinCardinality = metadataPackageUsage.MinCardinality, - MaxCardinality = metadataPackageUsage.MaxCardinality - }; - } - else - return null; - } - - public static MetadataAttributeModel CreateMetadataAttributeModel(BaseUsage current, BaseUsage parent, long metadataStructureId, int packageModelNumber, long parentStepId) - { - MetadataAttribute metadataAttribute; - List domainConstraintList = new List(); - string constraintsDescription = ""; - double lowerBoundary = 0; - double upperBoundary = 0; - LinkElementType type = LinkElementType.MetadataNestedAttributeUsage; - bool locked = false; - bool entityMappingExist = false; - bool partyMappingExist = false; - - string metadataAttributeName = ""; - - //simple - bool partySimpleMappingExist = false; - //complex - bool partyComplexMappingExist = false; - - if (current is MetadataNestedAttributeUsage) - { - MetadataNestedAttributeUsage mnau = (MetadataNestedAttributeUsage)current; - metadataAttribute = mnau.Member; - type = LinkElementType.MetadataNestedAttributeUsage; - - } - else - { - MetadataAttributeUsage mau = (MetadataAttributeUsage)current; - metadataAttribute = mau.MetadataAttribute; - type = LinkElementType.MetadataAttributeUsage; - } - - if (metadataAttribute.Constraints.Where(c => (c is DomainConstraint)).Count() > 0) - domainConstraintList = createDomainContraintList(metadataAttribute); - - if (metadataAttribute.Constraints.Count > 0) - { - foreach (Constraint c in metadataAttribute.Constraints) - { - if (string.IsNullOrEmpty(constraintsDescription)) constraintsDescription = c.FormalDescription; - else constraintsDescription = String.Format("{0}\n{1}", constraintsDescription, c.FormalDescription); - } - if (metadataAttribute.DataType.Name == "string" && metadataAttribute.Constraints.Where(c => (c is RangeConstraint)).Count() > 0) - { - foreach (RangeConstraint r in metadataAttribute.Constraints.Where(c => (c is RangeConstraint))) - { - lowerBoundary = r.Lowerbound; - upperBoundary = r.Upperbound; - } - } - } - - //set metadata attr name - metadataAttributeName = metadataAttribute.Name; - - //load displayPattern - DataTypeDisplayPattern dtdp = DataTypeDisplayPattern.Materialize(metadataAttribute.DataType.Extra); - string displayPattern = ""; - if (dtdp != null) displayPattern = dtdp.StringPattern; - - //ToDO/Check if dim is active - //check if its linked with a system field - // - locked = MappingUtils.ExistSystemFieldMappings(current.Id, type); - - // check if a mapping for parties exits - partyMappingExist = MappingUtils.ExistMappingWithParty(current.Id, type); - - - // check if mapping to this metadata attribute is simple or complex. - // complex means, that the attribute is defined in the context of the parent - // e.g. name of User - // simple means, that the attribute is not defined in the context of the - // e.g. DataCreator Name in Contacts as list of contacts - partySimpleMappingExist = hasSimpleMapping(current.Id, type); - partyComplexMappingExist = hasComplexMapping(current.Id, type); - - // check if a mapping for entites exits - entityMappingExist = MappingUtils.ExistMappingWithEntity(current.Id, type); - - return new MetadataAttributeModel - { - Id = current.Id, - Number = 1, - ParentModelNumber = packageModelNumber, - MetadataStructureId = metadataStructureId, - MetadataAttributeName = metadataAttributeName, - Parent = parent, - Source = current, - DisplayName = current.Label, - Discription = current.Description, - ConstraintDescription = constraintsDescription, - DataType = metadataAttribute.DataType.Name, - SystemType = metadataAttribute.DataType.SystemType, - DisplayPattern = displayPattern, - MinCardinality = current.MinCardinality, - MaxCardinality = current.MaxCardinality, - NumberOfSourceInPackage = 1, - first = true, - DomainList = domainConstraintList, - last = true, - MetadataAttributeId = metadataAttribute.Id, - ParentStepId = parentStepId, - Errors = null, - Locked = locked, - EntityMappingExist = entityMappingExist, - PartyMappingExist = partyMappingExist, - PartySimpleMappingExist = partySimpleMappingExist, - PartyComplexMappingExist = partyComplexMappingExist, - LowerBoundary = lowerBoundary, - UpperBoundary = upperBoundary, - }; - } - - private static List createDomainContraintList(MetadataAttribute attribute) - { - List list = new List(); - - foreach (Constraint constraint in attribute.Constraints) - { - if (constraint is DomainConstraint) - { - DomainConstraint domainConstraint = (DomainConstraint)constraint; - domainConstraint.Materialize(); - domainConstraint.Items.ForEach(i => list.Add(i.Value)); - } - } - - return list; - } - - private static bool hasComplexMapping(long id, LinkElementType type) - { - if (MappingUtils.ExistComplexMappingWithParty(id, type) || - MappingUtils.ExistComplexMappingWithPartyCustomType(id,type)) - { - return true; - } - - return false; - } - - private static bool hasSimpleMapping(long id, LinkElementType type) - { - if (MappingUtils.ExistSimpleMappingWithParty(id, type) || - MappingUtils.ExistSimpleMappingWithPartyCustomType(id, type)) - { - return true; - } - - return false; - } - } -} diff --git a/Helper/Settings.cs b/Helper/Settings.cs deleted file mode 100644 index 2bec54e..0000000 --- a/Helper/Settings.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Xml; -using System.Xml.Linq; -using Vaiona.Utils.Cfg; - -namespace BExIS.Modules.EMM.UI.Helper -{ - static class Settings - { - - private static String filePath = Path.Combine(AppConfiguration.GetModuleWorkspacePath("EMM"), "Emm.settings.xml"); - private static Dictionary settings = new Dictionary(); - - /// - /// setup settings model - /// * load settings from settings.xml - /// - static Settings() - { - // intial loading of settings - reloadSettings(); - - // set up file watcher to listen for changes - using (FileSystemWatcher fw = new FileSystemWatcher()) - { - fw.Path = Path.GetDirectoryName(filePath); - fw.Filter = Path.GetFileName(filePath); - fw.Changed += new FileSystemEventHandler(fw_Changed); - fw.EnableRaisingEvents = true; - } - - } - - /// - /// retrieve a value from the settings file - /// - /// the key for the parameter - /// the respective value - public static object get(String key) - { - if (settings.ContainsKey(key)) - { - return settings[key]; - } - else - { - return null; - } - } - - /// - /// add or change an entry in the settings - /// TODO persist changes in workflow file - /// - /// - /// - public static void set(String key, object value) - { - if (settings.ContainsKey(key)) - { - settings[key] = value; - } - else - { - settings.Add(key, value); - } - } - - /// - /// Handler to listen for changes in settings file - /// - /// - /// - private static void fw_Changed(object sender, FileSystemEventArgs e) - { - reloadSettings(); - } - - /// - /// load settings anew from settings.xml - /// - private static void reloadSettings() - { - // get XML data - XDocument xDoc = XDocument.Load(filePath); - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.Load(xDoc.CreateReader()); - - // empty old settings list - settings.Clear(); - - // parse values - foreach (XmlNode node in xmlDoc.SelectNodes("//settings/entry")) - { - // shortcuts - var key = node.Attributes["key"] != null ? node.Attributes["key"].Value : null; - var value = node.Attributes["value"] != null ? node.Attributes["value"].Value : null; - var type = node.Attributes["type"] != null ? node.Attributes["type"].Value : null; - - // only parse valid entries - if ((null == key) || (null == value)) - { - continue; - } - - // convert types - switch (type) - { - case "int": - int intVal; - if (Int32.TryParse(value, out intVal)) - { - settings.Add(key, intVal); - } - else - { - settings.Add(key, value); - } - break; - - // default is string - default: - settings.Add(key, value); - break; - } - } - } - - } -} \ No newline at end of file diff --git a/Models/AbstractMetadataStepModel.cs b/Models/AbstractMetadataStepModel.cs deleted file mode 100644 index b126876..0000000 --- a/Models/AbstractMetadataStepModel.cs +++ /dev/null @@ -1,80 +0,0 @@ -using BExIS.Dlm.Entities.Common; -using BExIS.Modules.EMM.UI.Models; -using BExIS.Xml.Helpers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Xml.Linq; - -namespace BExIS.Modules.EMM.UI.Models -{ - public class AbstractMetadataStepModel : AbstractStepModel - { - public BaseUsage Source { get; set; } - public int Number { get; set; } - public long Id { get; set; } - - public String DisplayName { get; set; } - public String Discription { get; set; } - public int MinCardinality { get; set; } - public int MaxCardinality { get; set; } - - public List MetadataAttributeModels { get; set; } - public List Instance { get; set; } - - public AbstractMetadataStepModel() - { - Instance = new List(); - MetadataAttributeModels = new List(); - } - - public void ConvertInstance(XDocument metadata, string xpath) - { - var x = XmlUtility.GetXElementByXPath(xpath, metadata); - - if (x != null) - { - IEnumerable xelements = x.Elements(); - - if (xelements.Count() > 0) - { - int counter = 0; - ; - foreach (XElement element in xelements) - { - long id = Convert.ToInt64(element.Attribute("id").Value.ToString()); - string name = element.Parent.Attribute("name").Value.ToString(); - long usageId = Convert.ToInt64(element.Attribute("roleId").Value.ToString()); - int number = Convert.ToInt32(element.Attribute("number").Value.ToString()); - - MetadataInstanceModel temp = new MetadataInstanceModel() - { - Id = id, - UsageId = usageId, - Name = name, - Number = number - }; - - if (!Instance.Where(t => t.Id.Equals(temp.Id) && t.Number.Equals(temp.Number)).Any()) - { - Instance.Add( - - new MetadataInstanceModel() - { - Id = id, - UsageId = usageId, - Name = name, - Number = number - } - - ); - } - - } - } - } - - } - } -} \ No newline at end of file diff --git a/Models/AbstractStepModel.cs b/Models/AbstractStepModel.cs deleted file mode 100644 index c961a70..0000000 --- a/Models/AbstractStepModel.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using BExIS.Dcm.Wizard; -using BExIS.IO.Transform.Validation.Exceptions; - -namespace BExIS.Modules.EMM.UI.Models -{ - public enum PageStatus { - - FirstLoad, - Error, - NoError, - Saved, - Submited, - LastAndSubmitted - } - - public class AbstractStepModel - { - public StepInfo StepInfo { get; set; } - public List ErrorList { get; set; } - public bool Saved { get; set; } - public PageStatus PageStatus { get; set; } - - public AbstractStepModel() - { - ErrorList = new List(); - Saved = false; - } - } -} \ No newline at end of file diff --git a/Models/EventRegistrationModel.cs b/Models/EventRegistrationModel.cs deleted file mode 100644 index 5a973ac..0000000 --- a/Models/EventRegistrationModel.cs +++ /dev/null @@ -1,183 +0,0 @@ -using BExIS.Emm.Entities.Event; -using BExIS.Emm.Services.Event; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Data; -using System.Linq; -using System.Web; -using System.Xml; - -namespace BExIS.Modules.EMM.UI.Models -{ - - /// - /// The EventRegistrationModel represent all information which are needed to handel a event registration. - /// - /// - public class EventRegistrationModel - { - public EventModel Event { get; set; } - - /// - /// Number of participants limitation - /// - public string Participants { get; set; } - - /// - /// Number of already registered participants - /// - public int NumberOfRegistration { get; set; } - - /// - /// Number of already registered participants on waiting list - /// - public int NrOfRegistrationWaitingList { get; set; } - - /// - /// edit allowed by user - /// - public bool EditAllowed { get; set; } - - /// - /// user already registered, this will find out via user email - /// - public bool AlreadyRegistered { get; set; } - - /// - /// is registration deleted by user - /// - public bool Deleted { get; set; } - - /// - ///true if ParticipantsLimitation and WaitingListLimitation is reached - /// - public bool Closed { get; set; } - - /// - ///Already registered RefId - /// - public string AlreadyRegisteredRefId { get; set; } - - /// - /// - /// - //public string Message { get; set; } - - public EventRegistrationModel() - { - Event = new EventModel(); - } - - public EventRegistrationModel(Event e) - { - Event = new EventModel(e); - EditAllowed = e.EditAllowed; - - } - } - - public class DefaultEventInformation - { - //event default values - public string EventName { get; set; } - public string Date { get; set; } - public string Language { get; set; } - public string ImportantInformation { get; set; } - - public string Location { get; set; } - - public string Eventid { get; set; } - - public long RegistrationId { get; set; } - - public string XPathToEmail { get; set; } - public string XPathToFirstName { get; set; } - public string XPathToLastName { get; set; } - - public string Email { get; set; } - public string LastName { get; set; } - public string FirstName { get; set; } - - public DefaultEventInformation() - { - - } - - } - - public class LogInToEventModel - { - - public long EventId { get; set; } - - [DataType(DataType.Password)] - [Display(Name = "Event password")] - public string LogInPassword { get; set; } - - public bool Edit { get; set; } - public bool ViewOnly { get; set; } - - public string RefId { get; set; } - - public LogInToEventModel() - { - - } - - public LogInToEventModel(long id, bool view_only = false, string ref_id = null) - { - EventId = id; - ViewOnly = view_only; - RefId = ref_id; - } - - } - - public class EventRegistrationResultModel - { - public long EventId { get; set; } - public XmlDocument Form { get; set; } - public DataTable Results { get; set; } - public DataTable WaitingListResults { get; set; } - public bool UserHasRights { get; set; } - - public EventRegistrationResultModel() - { - UserHasRights = false; - } - } - - public class EventRegistrationFilterModel - { - public string Status { get; set; } - public List EventFilterItems { get; set; } - - public EventRegistrationFilterModel() - { - - } - } - - public class EventFilterItem - { - public long Id { get; set; } - public string Name { get; set; } - //public bool Closed { get; set; } - public bool Selected { get; set; } - - public EventFilterItem() - { - - } - - public EventFilterItem(Event eEvent) - { - Id = eEvent.Id; - Name = eEvent.Name; - - //if (eEvent.Deadline < DateTime.Now) - // Closed = true; - } - } -} \ No newline at end of file diff --git a/Models/MetadataAttributeModel.cs b/Models/MetadataAttributeModel.cs deleted file mode 100644 index 9b2cd7a..0000000 --- a/Models/MetadataAttributeModel.cs +++ /dev/null @@ -1,107 +0,0 @@ -using BExIS.Dlm.Entities.Common; -using BExIS.Dlm.Entities.MetadataStructure; -using BExIS.IO.Transform.Validation.Exceptions; -using System; -using System.Collections.Generic; -using Vaiona.Persistence.Api; - -namespace BExIS.Modules.EMM.UI.Models -{ - public class MetadataAttributeModel - { - public long Id { get; set; } - public long Number { get; set; } - public long ParentModelNumber { get; set; } - public long ParentStepId { get; set; } - public long MetadataStructureId { get; set; } - public BaseUsage Source { get; set; } - public BaseUsage Parent { get; set; } - public long MetadataAttributeId { get; set; } - public string MetadataAttributeName { get; set; } - public String DisplayName { get; set; } - public String Discription { get; set; } - public int MinCardinality { get; set; } - public int MaxCardinality { get; set; } - public String DataType { get; set; } - public String SystemType { get; set; } - public string DisplayPattern { get; set; } - public int NumberOfSourceInPackage { get; set; } - public List DomainList { get; set; } - public List Errors { get; set; } - public bool Locked { get; set; } - public double LowerBoundary { get; set; } - public double UpperBoundary { get; set; } - - #region Mapping Variables - - public bool PartyMappingExist { get; set; } - - public bool PartyComplexMappingExist { get; set; } - - public bool PartySimpleMappingExist { get; set; } - - public bool EntityMappingExist { get; set; } - - //url to the show view of the entity - public string EntityUrl { get; set; } - - #endregion Mapping Variables - - public string ConstraintDescription { get; set; } - - public bool last = false; - public bool first = false; - - public bool IsEmpty = true; - - private object _value; - - public object Value - { - get { return _value; } - set - { - _value = value; - IsEmpty = global::System.Convert.ChangeType(_value, _value.GetType()) == null || String.IsNullOrEmpty(_value.ToString()); - } - } - - public MetadataAttribute GetMetadataAttribute() - { - return this.GetUnitOfWork().GetReadOnlyRepository().Get(MetadataAttributeId); - } - - public MetadataAttributeModel Kopie(long number, int numberOfSourceInPackage) - { - return new MetadataAttributeModel - { - Id = this.Id, - Number = number, - ParentModelNumber = this.ParentModelNumber, - MetadataStructureId = this.MetadataStructureId, - Parent = this.Parent, - Source = this.Source, - DisplayName = this.DisplayName, - Discription = this.Discription, - ConstraintDescription = this.ConstraintDescription, - DataType = this.DataType, - SystemType = this.SystemType, - MinCardinality = this.MinCardinality, - MaxCardinality = this.MaxCardinality, - NumberOfSourceInPackage = numberOfSourceInPackage, - first = false, - DomainList = this.DomainList, - last = false, - MetadataAttributeId = this.MetadataAttributeId, - ParentStepId = this.ParentStepId, - Errors = null, - Locked = false, - PartyMappingExist = this.PartyMappingExist, - EntityMappingExist = this.EntityMappingExist, - EntityUrl = "", - UpperBoundary = this.UpperBoundary, - LowerBoundary = this.LowerBoundary - }; - } - } -} \ No newline at end of file diff --git a/Models/MetadataCompoundAttributeModel.cs b/Models/MetadataCompoundAttributeModel.cs deleted file mode 100644 index 24e0472..0000000 --- a/Models/MetadataCompoundAttributeModel.cs +++ /dev/null @@ -1,73 +0,0 @@ -using BExIS.Dlm.Entities.Common; -using BExIS.Dlm.Entities.MetadataStructure; -using BExIS.Modules.EMM.UI.Helpers; -using BExIS.Modules.EMM.UI.Models; -using BExIS.Utils.Data.MetadataStructure; -using System.Collections.Generic; - -namespace BExIS.Modules.EMM.UI.Models -{ - public class MetadataCompoundAttributeModel : AbstractMetadataStepModel - { - - public int NumberOfSourceInPackage { get; set; } - - public bool last = false; - public bool first = false; - - private MetadataStructureUsageHelper metadataStructureUsageHelper; - - public MetadataCompoundAttributeModel() - { - MetadataAttributeModels = new List(); - metadataStructureUsageHelper = new MetadataStructureUsageHelper(); - } - - public void ConvertMetadataAttributeModels(BaseUsage source, long metadataStructureId, long stepId) - { - Source = source; - - if (Source is MetadataAttributeUsage) - { - - MetadataAttributeUsage mau = (MetadataAttributeUsage)Source; - - if (mau.MetadataAttribute.Self is MetadataCompoundAttribute) - { - MetadataCompoundAttribute mca = (MetadataCompoundAttribute)mau.MetadataAttribute.Self; - - if (mca != null) - { - foreach (MetadataNestedAttributeUsage usage in mca.MetadataNestedAttributeUsages) - { - if (metadataStructureUsageHelper.IsSimple(usage)) - { - MetadataAttributeModels.Add(FormHelper.CreateMetadataAttributeModel(usage, mau, metadataStructureId, Number, stepId)); - } - } - } - } - } - - if (Source is MetadataNestedAttributeUsage) - { - MetadataNestedAttributeUsage mnau = (MetadataNestedAttributeUsage)Source; - if (mnau.Member.Self is MetadataCompoundAttribute) - { - MetadataCompoundAttribute mca = (MetadataCompoundAttribute)mnau.Member.Self; - - if (mca != null) - { - foreach (MetadataNestedAttributeUsage usage in mca.MetadataNestedAttributeUsages) - { - if (metadataStructureUsageHelper.IsSimple(usage)) - { - MetadataAttributeModels.Add(FormHelper.CreateMetadataAttributeModel(usage, mnau, metadataStructureId, Number, stepId)); - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/Models/MetadataEditorModel.cs b/Models/MetadataEditorModel.cs deleted file mode 100644 index 55a4eb1..0000000 --- a/Models/MetadataEditorModel.cs +++ /dev/null @@ -1,46 +0,0 @@ -using BExIS.Dcm.Wizard; -using BExIS.Modules.EMM.UI.Models; -using System.Collections.Generic; - -namespace BExIS.Modules.EMM.UI.Models -{ - public class MetadataEditorModel - { - public long DatasetId { get; set; } - public string DatasetTitle { get; set; } - public bool EditRight { get; set; } - public bool EditAccessRight { get; set; } - public bool Created { get; set; } - public bool FromEditMode { get; set; } - public bool Changed { get; set; } - public bool Import { get; set; } - public bool SaveWithErrors { get; set; } - public bool LatestVersion { get; set; } - public string HeaderHelp { get; set; } - public bool Registered { get; set; } - public bool EditRegistration { get; set; } - - public List StepModelHelpers { get; set; } - public Dictionary Actions { get; set; } - - public MetadataEditorModel() - { - DatasetId = -1; - DatasetTitle = ""; - Created = false; - FromEditMode = false; - Changed = false; - Import = false; - SaveWithErrors = true; - HeaderHelp = ""; - - EditRight = false; - EditAccessRight = false; - LatestVersion = false; - - Actions = new Dictionary(); - - Registered = false; - } - } -} diff --git a/Models/MetadataInstanceModel.cs b/Models/MetadataInstanceModel.cs deleted file mode 100644 index c546f47..0000000 --- a/Models/MetadataInstanceModel.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace BExIS.Modules.EMM.UI.Models -{ - public class MetadataInstanceModel - { - public long Id { get; set; } - public string Name { get; set; } - public int Number { get; set; } - public long UsageId { get; set; } - } -} \ No newline at end of file diff --git a/Models/MetadataPackageModel.cs b/Models/MetadataPackageModel.cs deleted file mode 100644 index cd2abfc..0000000 --- a/Models/MetadataPackageModel.cs +++ /dev/null @@ -1,89 +0,0 @@ -using BExIS.Dlm.Entities.Common; -using BExIS.Dlm.Entities.MetadataStructure; -using BExIS.IO.Transform.Validation.Exceptions; -using BExIS.Modules.EMM.UI.Helpers; -using BExIS.Utils.Data.MetadataStructure; -using System.Collections.Generic; - -namespace BExIS.Modules.EMM.UI.Models -{ - public class MetadataPackageModel : AbstractMetadataStepModel - { - private MetadataStructureUsageHelper metadataStructureUsageHelper; - - public MetadataPackageModel() - { - ErrorList = new List(); - metadataStructureUsageHelper = new MetadataStructureUsageHelper(); - } - - public void ConvertMetadataAttributeModels(BaseUsage source, long metadataStructureId, int stepId) - { - Source = source; - - - - //if (Source is MetadataAttributeUsage) - //{ - - // MetadataAttributeUsage mau = (MetadataAttributeUsage)Source; - - // if (mau.MetadataAttribute.Self is MetadataCompoundAttribute) - // { - // MetadataCompoundAttribute mca = (MetadataCompoundAttribute)mau.MetadataAttribute.Self; - - // if (mca != null) - // { - // foreach (MetadataNestedAttributeUsage usage in mca.MetadataNestedAttributeUsages) - // { - // if (UsageHelper.IsSimple(usage)) - // { - // MetadataAttributeModels.Add(MetadataAttributeModel.Convert(usage, mau, metadataStructureId, Number)); - // } - // } - // } - // } - //} - - //if (Source is MetadataNestedAttributeUsage) - //{ - // MetadataNestedAttributeUsage mnau = (MetadataNestedAttributeUsage)Source; - // if (mnau.Member.Self is MetadataCompoundAttribute) - // { - // MetadataCompoundAttribute mca = (MetadataCompoundAttribute)mnau.Member.Self; - - // if (mca != null) - // { - // foreach (MetadataNestedAttributeUsage usage in mca.MetadataNestedAttributeUsages) - // { - // if (UsageHelper.IsSimple(usage)) - // { - // MetadataAttributeModels.Add(MetadataAttributeModel.Convert(usage, mnau, metadataStructureId, Number)); - // } - // } - // } - // } - //} - - if (Source is MetadataPackageUsage) - { - MetadataPackageUsage mpu = (MetadataPackageUsage)Source; - if (mpu.MetadataPackage is MetadataPackage) - { - MetadataPackage mp = mpu.MetadataPackage; - - if (mp != null) - { - foreach (MetadataAttributeUsage usage in mp.MetadataAttributeUsages) - { - if (metadataStructureUsageHelper.IsSimple(usage)) - { - MetadataAttributeModels.Add(FormHelper.CreateMetadataAttributeModel(usage, mpu, metadataStructureId, Number, stepId)); - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/Models/SearchMetadataNode.cs b/Models/SearchMetadataNode.cs deleted file mode 100644 index eb326f6..0000000 --- a/Models/SearchMetadataNode.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace BExIS.Modules.EMM.UI.Models -{ - public class SearchMetadataNode - { - public SearchMetadataNode(string metadataStructureName, string xPath) - { - this.MetadataStructureName = metadataStructureName; - this.XPath = xPath; - DisplayName = generateDisplayName(xPath); - DisplayNameLong = "(" + MetadataStructureName + ") " + generateDisplayName(xPath); - } - - public string DisplayName { get; set; } - public string DisplayNameLong { get; set; } - public string MetadataStructureName { get; set; } - public string XPath { get; set; } - - private string generateDisplayName(string xPath) - { - string tmp = ""; - string[] tempArray = xPath.Split('/'); - - for (int i = 1; i < tempArray.Length; i = i + 2) - { - tmp += tempArray[i] + "/"; - } - - return tmp.Remove(tmp.Length - 1); - } - } -} \ No newline at end of file diff --git a/Models/StepModelHelper.cs b/Models/StepModelHelper.cs deleted file mode 100644 index c166876..0000000 --- a/Models/StepModelHelper.cs +++ /dev/null @@ -1,203 +0,0 @@ -using BExIS.Xml.Helpers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.RegularExpressions; -using System.Xml; - -namespace BExIS.Modules.EMM.UI.Models -{ - public class StepModelHelper - { - public int StepId { get; set; } - //public BaseUsage Usage { get; set; } - public long UsageId { get; set; } - public Type UsageType { get; set; } - public string UsageName { get; set; } - public string UsageAttrName { get; set; } - public int Number { get; set; } - public int Level { get; set; } - - public string XPath { get; set; } - public List Childrens { get; set; } - public StepModelHelper Parent { get; set; } - - public bool Activated { get; set; } - public bool Choice { get; set; } - public long ChoiceMax { get; set; } - - private AbstractMetadataStepModel _model; - - public AbstractMetadataStepModel Model - { - get { return _model; } - set - { - _model = value; - Activated = SetActiveByPreload(); - } - } - - public StepModelHelper() - { - StepId = 0; - UsageId = 0; - Number = 0; - XPath = ""; - Childrens = new List(); - Activated = SetActiveByPreload(); - Level = 0; - } - - public StepModelHelper(int stepId, int number, long usageId, string usageName, string usageAttrName, Type usageType, string xpath, StepModelHelper parent, XmlNode extra) - { - StepId = stepId; - UsageId = usageId; - UsageType = usageType; - UsageName = usageName; - UsageAttrName = usageAttrName; - Number = number; - XPath = xpath; - Childrens = new List(); - Parent = parent; - Choice = IsChoice(extra); - - if (Choice) ChoiceMax = GetChoiceMax(extra); - - if (parent != null) - Level = parent.Level + 1; - } - - public string GetXPathFromSimpleAttribute(long id) - { - if (Model != null && Model.MetadataAttributeModels != null && Model.MetadataAttributeModels.Any()) - { - MetadataAttributeModel temp = Model.MetadataAttributeModels.Where(a => a.Id.Equals(id) && a.Number.Equals(Number)).First(); - - return XPath + "//" + temp.Source.Label + "[1]//" + temp.GetMetadataAttribute().Self.Name; - } - - return ""; - } - - public string GetXPathFromSimpleAttribute(long id, long number) - { - if (Model != null && Model.MetadataAttributeModels != null && Model.MetadataAttributeModels.Any()) - { - MetadataAttributeModel temp = Model.MetadataAttributeModels.Where(a => a.Id.Equals(id)).First(); - - return XPath + "//" + temp.Source.Label + "[1]//" + temp.GetMetadataAttribute().Self.Name + "[" + number + "]"; - } - - return ""; - } - - public bool IsEmpty() - { - foreach (MetadataAttributeModel simpleAttr in Model.MetadataAttributeModels) - { - if (simpleAttr.IsEmpty != true) return false; - } - - foreach (StepModelHelper smh in Childrens) - { - if (smh.IsEmpty() != true) return false; - } - - return true; - - } - - public string DisplayName() - { - string displayName = ""; - - char tmp = ' '; - - foreach (char letter in UsageName) - { - if (UsageName.First() == letter) - { - tmp = letter; - displayName += letter; - } - else - { - if (Char.IsUpper(letter) && Char.IsLower(tmp)) - { - displayName += " " + letter; - } - else - { - displayName += letter; - } - - tmp = letter; - } - } - - displayName = Regex.Replace(displayName, "_", " "); - - return displayName; - } - - /// - /// When a Component is required and not in a choice object - /// then it will actived automaticlly - /// - /// - private bool SetActiveByPreload() - { - if (Model != null && - Model.MinCardinality > 0) Activated = true; - - return Activated; - } - - public bool IsParentActive() - { - if (Parent == null) - return Activated; - - if (Parent.Activated) - return Parent.IsParentActive(); - - return false; - - } - - private bool IsChoice(XmlNode xmlNode) - { - if (xmlNode != null) - { - XmlNode element = XmlUtility.GetXmlNodeByAttribute(xmlNode, "type", "name", "choice"); - if (element != null) return true; - } - return false; - - } - - private long GetChoiceMax(XmlNode xmlNode) - { - if (xmlNode != null) - { - XmlNode element = XmlUtility.GetXmlNodeByAttribute(xmlNode, "type", "name", "choice"); - if (element == null) return 0; - else - { - if (element.Attributes.Count > 0) - { - foreach (XmlAttribute attr in element.Attributes) - { - if (attr.Name.ToLower().Equals("max")) return Convert.ToInt64(attr.Value); - } - } - } - - } - return 0; - - } - - } -} \ No newline at end of file diff --git a/Properties/PublishProfiles/BexisServer_BE-Website.pubxml b/Properties/PublishProfiles/BexisServer_BE-Website.pubxml deleted file mode 100644 index 3ff4dc5..0000000 --- a/Properties/PublishProfiles/BexisServer_BE-Website.pubxml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - FileSystem - FileSystem - Release - Any CPU - - True - False - C:\inetpub\wwwroot\BE-Website\Site\Areas\EMM - False - - \ No newline at end of file