577 Commits

Author SHA1 Message Date
Samuele Locatelli 3066866c1e Merge tag 'FixWarningMysql_03' into develop
Update con reinserimento controlli health check (tranne redis full)
2025-09-23 10:34:27 +02:00
Samuele Locatelli 71ab37f101 Merge branch 'release/FixWarningMysql_03' 2025-09-23 10:34:10 +02:00
Samuele Locatelli 6aed95aa68 Ri abilitato controllo Health 2025-09-23 10:33:51 +02:00
Samuele Locatelli 8a8f9fd7e6 Merge tag 'FixWarningMysql_02' into develop
Sistemazione CI/CD x rename versioni SDK
2025-09-23 09:34:16 +02:00
Samuele Locatelli 21bbcccf76 Merge branch 'release/FixWarningMysql_02' 2025-09-23 09:33:52 +02:00
Samuele Locatelli 3c2370748e update yaml x evitare modifiche non necessarie 2025-09-23 09:32:55 +02:00
Samuele Locatelli 52819429cb commentata sezione che da problemi CI/CD 2025-09-23 09:26:02 +02:00
Samuele Locatelli 9385a4a974 Merge tag 'FixWarningMysql_01' into develop
Update conf x errori warning disconnessione frequenti (50sec)
2025-09-23 09:15:58 +02:00
Samuele Locatelli 9c9e3df572 Merge branch 'release/FixWarningMysql_01' 2025-09-23 09:15:32 +02:00
Samuele Locatelli 1c114905fc Update parametri connessione: NON scadono subito connessioni e non da warning così rapidi/ricorrenti 2025-09-23 09:15:02 +02:00
Samuele Locatelli 07464904a9 Merge branch 'SDK' into develop 2025-09-22 19:37:27 +02:00
Samuele Locatelli 7f78fe8f31 Inizio modifiche x evitare errori in MariaDB call 2025-09-22 19:37:14 +02:00
Samuele Locatelli 5a2dc3e797 Merge branch 'develop' into SDK 2024-08-08 11:09:03 +02:00
Samuele Locatelli 826b611e2e Fix ping se indirizzo contenesse "/" (subdomain) 2024-08-08 11:08:51 +02:00
Samuele Locatelli 63cdf6d60a Merge tag 'FixActiveDeleteMan02' into develop
Sistemazione naming attivo/eliminato x evitare confusioni future
2024-08-05 14:29:43 +02:00
Samuele Locatelli f5b2480b82 Merge branch 'release/FixActiveDeleteMan02' 2024-08-05 14:29:30 +02:00
Samuele Locatelli 101f36bcd4 Merge branch 'develop' into SDK 2024-08-05 14:29:04 +02:00
Samuele Locatelli cc3b7ccfe6 Migration x gestione rinomiina campo attivo/delete 2024-08-05 14:28:47 +02:00
Samuele Locatelli fae86288d0 Inversione logica attivo/deleted x gestione cancellazione logica barre 2024-08-05 14:28:35 +02:00
Samuele Locatelli f5f0a790ee Merge branch 'develop' into SDK 2024-08-05 13:55:47 +02:00
Samuele Locatelli 25d90f9967 Merge tag 'FixActiveDeleteMan01' into develop
Modifica comportamento active/delete
2024-08-05 13:55:23 +02:00
Samuele Locatelli 107625a8b7 Merge branch 'release/FixActiveDeleteMan01' 2024-08-05 13:55:06 +02:00
Samuele Locatelli 2a9e70fca4 Update gestione isActive aggiunta a ItemDTO x cancellazione logica + update SDK 2024-08-05 13:54:41 +02:00
Samuele Locatelli 6af19b8dd5 Merge tag 'FixSelMaccProj01' into develop
Fix condizione reload su cambio selettore macchina
2024-08-02 16:43:16 +02:00
Samuele Locatelli 5c9b16a7a0 Merge branch 'release/FixSelMaccProj01' 2024-08-02 16:43:07 +02:00
Samuele Locatelli 2ee76314af Fix cambio filtro proj 2024-08-02 16:42:45 +02:00
Samuele Locatelli aef2465d97 Merge tag 'GestRemn04' into develop
Aggiunto default isRemn a true
2024-08-02 11:21:35 +02:00
Samuele Locatelli 005c05818b Merge branch 'release/GestRemn04' 2024-08-02 11:21:27 +02:00
Samuele Locatelli 24cb3d11ec Default a true x remnant su ogni barra 2024-08-02 11:20:59 +02:00
Samuele Locatelli e1f960c0b0 Merge tag 'GestRemn03' into develop
Ignoro i remnant in update su cloud
2024-08-02 10:39:05 +02:00
Samuele Locatelli 55e1cbdbbf Merge branch 'release/GestRemn03' 2024-08-02 10:38:53 +02:00
Samuele Locatelli 78d9779306 Ignoro update remnant state da EBW 2024-08-02 10:38:36 +02:00
Samuele Locatelli 4e7e14cddc Merge tag 'GestRemn02' into develop
Update icone spezzoni/acquisto
2024-08-02 09:40:55 +02:00
Samuele Locatelli b7bc89a49b Merge branch 'release/GestRemn02' 2024-08-02 09:40:40 +02:00
Samuele Locatelli 00d27713b8 Update icone x gestione 2024-08-02 09:39:45 +02:00
Samuele Locatelli 8983b3c7a5 Merge tag 'GestRemn01' into develop
Fix gestione spezzoni iniziale, x ricerca, filtraggio, display
2024-08-02 09:11:16 +02:00
Samuele Locatelli 1ae633c263 Merge branch 'release/GestRemn01' 2024-08-02 09:10:49 +02:00
Samuele Locatelli b0804c78e7 Update gestioen spezzoni
- fix calcolo qta
- fix display
- fix stored ricerca
2024-08-02 09:10:25 +02:00
Samuele Locatelli 5b1a067fc3 COmpletata gestione spezzoni x editing e display dettaglio 2024-08-02 08:50:44 +02:00
Samuele Locatelli 305f65180a Bozza gestione spezzoni/acquisto (MANCA fix grafico) 2024-08-01 19:05:02 +02:00
Samuele Locatelli 3797cb8c83 Update note vers 24.08.01 2024-08-01 17:07:55 +02:00
Samuele Locatelli 85ceef1474 Merge tag 'FixChangeBeamWallMat01' into develop
Fix refresh a cambio sel materiale beam/wall
2024-08-01 17:06:55 +02:00
Samuele Locatelli c0cabb53dc Merge branch 'release/FixChangeBeamWallMat01' 2024-08-01 17:06:42 +02:00
Samuele Locatelli b290fc40bf Fix reload al cambio tipo materiale (beam/wall) 2024-08-01 17:06:16 +02:00
Samuele Locatelli 0b94b3bb56 Update REDME 2024-07-31 19:41:11 +02:00
Samuele Locatelli 47a37075e7 Aggiunta script x generare log commit x changelog, ora da modificare il README principale e il vero changelog 2024-07-31 19:17:37 +02:00
Samuele Locatelli 0cebf0a1a8 Merge tag 'FixRedisMasterFlush01' into develop
Fix gestione flush
2024-07-30 15:02:15 +02:00
Samuele Locatelli 46a0c55e29 Merge branch 'release/FixRedisMasterFlush01' 2024-07-30 15:02:08 +02:00
Samuele Locatelli e8b97708b3 Completato review gestione cache redis x MagMan 2024-07-30 15:01:41 +02:00
Samuele Locatelli 6bd3686f44 Continuo riscrittura metodi gestione redis cache su classi separate 2024-07-30 14:44:38 +02:00
Samuele Locatelli 83ed7d9d96 Merge tag 'TestSentinelGalera01' into develop
Reimpostato localhost x Galera cluster e sentinel redis
2024-07-29 09:41:05 +02:00
Samuele Locatelli 9054d42c32 Merge branch 'release/TestSentinelGalera01' 2024-07-29 09:40:00 +02:00
Samuele Locatelli 08e54ff364 Update conf x usare sentinel (localhost) e db locale (galera cluster) 2024-07-29 09:39:26 +02:00
Samuele Locatelli a775e90f6a Merge tag 'FixRedisConf01' into develop
Fix gestione redis esterna
2024-07-24 18:54:26 +02:00
Samuele Locatelli c145634ae2 Merge branch 'release/FixRedisConf01' 2024-07-24 18:48:43 +02:00
Samuele Locatelli 3016ac6122 Fix gestione utente admin x porting redis 2024-07-24 18:48:14 +02:00
Samuele Locatelli 23eba38c9c update rest call 2024-07-24 18:48:04 +02:00
Samuele Locatelli 3d45c158e1 Merge tag 'AddSyncArchived01' into develop
Aggiunti metodi sync controller x stato archived, testati con insomnia
2024-07-17 10:22:00 +02:00
Samuele Locatelli 4003530565 Merge branch 'release/AddSyncArchived01' 2024-07-17 10:21:36 +02:00
Samuele Locatelli 5f4e85df07 Update metodo controller x sync stato archiviato 2024-07-17 10:21:13 +02:00
Samuele Locatelli 1319496e52 OK metodo get proj modificati 2024-07-17 09:57:49 +02:00
Samuele Locatelli a0e23f60d5 Merge branch 'develop' into SDK 2024-07-17 08:13:43 +02:00
Samuele Locatelli 8c773a6d56 Merge branch 'SDK' into develop 2024-07-17 08:13:36 +02:00
Samuele Locatelli 513212515b Bozza controller proj 2024-07-17 08:13:25 +02:00
Samuele Locatelli b18403dc04 Fix refresh in ricezione eventi da remoto 2024-07-17 08:13:11 +02:00
Samuele Locatelli 52b57cd118 Aggiunta metodi x SDK 2024-07-17 08:12:54 +02:00
Samuele Locatelli c872cc7a83 Merge tag 'FixQtyDecimal01' into develop
Fix gestione campo decimal x calcolo DTO da trasferire
2024-07-11 11:32:31 +02:00
Samuele Locatelli 5fba356222 Merge branch 'release/FixQtyDecimal01' 2024-07-11 11:32:18 +02:00
Samuele Locatelli 54292d6c1b Merge branch 'develop' into SDK 2024-07-11 11:31:53 +02:00
Samuele Locatelli b9c1f92539 Fix gestione campo QTY come decimal 2024-07-11 11:31:38 +02:00
Samuele Locatelli 65ac2dad4e Merge tag 'FixLogOutLoop01' into develop
Fix gestione logout con ritorno errato alla pagina uscita
2024-07-09 19:17:29 +02:00
Samuele Locatelli 7cae4c7bd9 Merge branch 'release/FixLogOutLoop01' 2024-07-09 19:17:08 +02:00
Samuele Locatelli 76758b14fe Fix logout/login loop 2024-07-09 19:16:44 +02:00
Samuele Locatelli f2d5f2d421 Merge tag 'AddEditMat01' into develop
Aggiunta modalità ADD nuovo materiale da Cloud
2024-07-09 19:08:35 +02:00
Samuele Locatelli 3e617bf253 Merge branch 'release/AddEditMat01' 2024-07-09 19:08:05 +02:00
Samuele Locatelli 55b2fcebdc Fix editing materiali da online 2024-07-09 19:07:39 +02:00
Samuele Locatelli 5881c233bf Update x gestione editing (nuovi) materiali online 2024-07-09 17:52:07 +02:00
Samuele Locatelli d53cb7335e Merge tag 'FixToggleArchiv01' into develop
Fix toggle archiviati
2024-07-09 11:37:30 +02:00
Samuele Locatelli bd1b1b043b Merge branch 'release/FixToggleArchiv01' 2024-07-09 11:37:24 +02:00
Samuele Locatelli 2805cdb99a Fix toggle archiviati 2024-07-09 11:36:57 +02:00
Samuele Locatelli 04ff808eb4 altro test fix hostname error 2024-07-09 09:05:36 +02:00
Samuele Locatelli 929f5fc472 test modifica healthcheck ping 2024-07-09 08:58:22 +02:00
Samuele Locatelli 6d4d6d2c9f Update conf healthcheck 2024-07-09 08:47:53 +02:00
Samuele Locatelli b38b722140 Fix show alias attivi 2024-07-08 14:39:19 +02:00
Samuele Locatelli 865241f814 Fix conf redis cluster in test 2024-07-08 11:50:19 +02:00
Samuele Locatelli 64d1d7a071 Fix conf Staging x testare MDB Galera + redis cluster 2024-07-08 11:25:47 +02:00
Samuele Locatelli 4adce530f9 Merge tag 'FixHeathAndServVers01' into develop
Fix controllo health tab DbCount + fix check vers server POMELO
2024-07-08 11:24:22 +02:00
Samuele Locatelli b64fed6dd2 Merge branch 'release/FixHeathAndServVers01' 2024-07-08 11:24:03 +02:00
Samuele Locatelli df305a15d6 Update gestione vers server MySql in fase setup 2024-07-08 11:12:29 +02:00
Samuele Locatelli 3f699b6f5c Modifica DbSet TableCount x EFCore 6 e health check 2024-07-08 11:12:04 +02:00
Samuele Locatelli c23a8f69c5 Altra modifica init config DB 2024-07-05 17:29:30 +02:00
Samuele Locatelli 79e9f9ddad Aggiunta modifiche x filtro utente SuperUser 2024-07-05 17:29:20 +02:00
Samuele Locatelli fa73d39171 Ancora test detect mysql version 2024-07-05 16:45:06 +02:00
Samuele Locatelli 792b679475 Altra modifica autodetect vers mysql 2024-07-05 16:34:22 +02:00
Samuele Locatelli 34307417e7 modifica metodi ricerca DB in autoconnect 2024-07-05 16:20:02 +02:00
Samuele Locatelli 82cb2d7337 Aggiunta metodi calcolo serverVersion alternativo x errore visto in test ufficio 2024-07-05 15:53:06 +02:00
Samuele Locatelli ee2bdbb30e Aggiunta nuovo ruolo SuperUser + migrations 2024-07-05 15:52:49 +02:00
Samuele Locatelli 1d96bef8c6 Merge tag 'NewQtyCalc01' into develop
Aggiunta nuova modalità calcolo lunghezze/aree disponibili x
materiali + fix paginazione e update
2024-07-04 15:19:40 +02:00
Samuele Locatelli c9cd3889da Merge branch 'release/NewQtyCalc01' 2024-07-04 15:19:20 +02:00
Samuele Locatelli 627a9297f7 Update calcolo quantità
fix display cambio pagina
2024-07-04 15:17:46 +02:00
Samuele Locatelli faf8a83725 Merge tag 'FixDecimalDisplay01' into develop
Fix visualizzazione e calcolo decimali in upsert su DB x quote intere:wq
2024-07-03 14:16:50 +02:00
Samuele Locatelli 68d131bc84 Merge branch 'release/FixDecimalDisplay01' 2024-07-03 14:15:25 +02:00
Samuele Locatelli 815f81697e Gestione decimali: fix display e caricamento 2024-07-03 14:14:41 +02:00
Samuele Locatelli 63746e43fa Merge tag 'FixGenCloudId' into develop
Gestione cloud ID rivista: stacca sempre nuovo se non presente in
chiamata
2024-07-03 10:09:27 +02:00
Samuele Locatelli c0cb268afa Merge branch 'release/FixGenCloudId' 2024-07-03 10:09:15 +02:00
Samuele Locatelli 0dd5cc104c Refresh gestione creazione nuovi ProjCloudId 2024-07-03 10:08:47 +02:00
Samuele Locatelli 55f5ef6087 Merge tag 'FixReportUpdate01' into develop
Aggiunta gestione ordinamento default x progetti + report update da
update risorse
2024-07-02 18:43:50 +02:00
Samuele Locatelli 82e92a100b Merge branch 'release/FixReportUpdate01' 2024-07-02 18:43:34 +02:00
Samuele Locatelli ee7b93e547 Update gestione refresh progetto da update risorsa 2024-07-02 18:43:14 +02:00
Samuele Locatelli ffbdbfacc8 Merge tag 'FixSearch01' into develop
Fix gestione ordinamento e ricerca Alias e Progetti
2024-07-02 18:12:55 +02:00
Samuele Locatelli f9084900dc Merge branch 'release/FixSearch01' 2024-07-02 18:12:36 +02:00
Samuele Locatelli e980c2b26f Fix refresh ricerca 2024-07-02 18:12:09 +02:00
Samuele Locatelli 178369a27e Merge tag 'FixIcons01' into develop
Fix icona archiviato
2024-07-02 17:12:53 +02:00
Samuele Locatelli 73ed092fbf Merge branch 'release/FixIcons01' 2024-07-02 17:12:48 +02:00
Samuele Locatelli ed1db6975f Update icona archiavto 2024-07-02 17:12:26 +02:00
Samuele Locatelli 789fba6059 Merge tag 'FixPaging02' into develop
Update gestione ordinamento progetti (lastAction) + materiali
2024-07-02 17:00:32 +02:00
Samuele Locatelli 6cad64847c Merge branch 'release/FixPaging02' 2024-07-02 17:00:12 +02:00
Samuele Locatelli 71dda0d162 Update x ordinamento Proj + fix materiali 2024-07-02 16:59:40 +02:00
Samuele Locatelli 64ea545712 Merge tag 'FixPaging01' into develop
Fix paginazione x alias in async
2024-07-02 12:03:34 +02:00
Samuele Locatelli c411f9ce37 Merge branch 'release/FixPaging01' 2024-07-02 12:03:16 +02:00
Samuele Locatelli 7d7d610d54 Metodo async x cambio pagina in Alias 2024-07-02 12:02:53 +02:00
Samuele Locatelli 64c55d4c93 Merge tag 'AddRefreshRest2UI_04' into develop
Completata review x reset ricerca al cambio pagina
2024-07-02 08:08:25 +02:00
Samuele Locatelli 0753fcf0ca Merge branch 'release/AddRefreshRest2UI_04' 2024-07-02 08:08:13 +02:00
Samuele Locatelli 852befac18 Update x gestione reset ricerca al cambio pagina 2024-07-02 08:07:51 +02:00
Samuele Locatelli 2b5bf3803c Ancora update gestione numRec pagina 2024-07-01 19:10:51 +02:00
Samuele Locatelli 9979252361 Altri update su numRec pagina impostati 2024-07-01 19:08:38 +02:00
Samuele Locatelli b1487a3f3e Spostamento da onAfterRender a onInitialized lettura num righe 2024-07-01 19:02:39 +02:00
Samuele Locatelli 1b0ff7fd1d Update x salvataggio num righe selezionate utente 2024-07-01 19:00:55 +02:00
Samuele Locatelli 7df4d7e9de Fix show toggle tutti/solo attivi x alias 2024-07-01 18:14:12 +02:00
Samuele Locatelli d20bcd4a1a Merge tag 'AddRefreshRest2UI_03' into develop
Aggiunta gestione refresh REST-UI x alias e materiali
2024-07-01 16:20:59 +02:00
Samuele Locatelli 0d86cb099e Merge branch 'release/AddRefreshRest2UI_03' 2024-07-01 16:20:41 +02:00
Samuele Locatelli ffca896c5d Aggiunta gestione notifica udpate x
- alias
- materiali
2024-07-01 16:20:22 +02:00
Samuele Locatelli 748c5d32b0 Merge tag 'AddRefreshRest2UI_02' into develop
Update dettagli risorse in caso di aggiornamento inventario e/o stima
2024-07-01 15:56:30 +02:00
Samuele Locatelli b4a789cc74 Merge branch 'release/AddRefreshRest2UI_02' 2024-07-01 15:56:15 +02:00
Samuele Locatelli 004858cdae Update gestione refresh
- updateresurces setim x invio stima
- update res act x invio update giacenze (inve)
2024-07-01 15:56:00 +02:00
Samuele Locatelli 031f2dc426 Merge tag 'AddRefreshRest2UI_01' into develop
Aggiunto metodo x update da chiamata rest a interfaccia x update proj
automatico
2024-07-01 15:22:55 +02:00
Samuele Locatelli 6341e02079 Merge branch 'release/AddRefreshRest2UI_01' 2024-07-01 15:22:35 +02:00
Samuele Locatelli f39e5802dd Aggiunta refresh x update proj da REST a UI 2024-07-01 15:21:53 +02:00
Samuele Locatelli 1851a06041 Aggiunto forzatura update pagina dettaglio progetto 2024-06-29 13:18:31 +02:00
Samuele Locatelli b22a9d8f8d Merge tag 'AddProjProgSyncro03' into develop
Update x gestione visualizzazione progressbar
2024-06-29 12:12:27 +02:00
Samuele Locatelli 877f760de5 Merge branch 'release/AddProjProgSyncro03' 2024-06-29 12:12:11 +02:00
Samuele Locatelli e3883ba9c4 Fix display perc avanzamento 2024-06-29 12:04:58 +02:00
Samuele Locatelli eefc5bd65a Fix comportmaenti dispose vari 2024-06-29 11:55:15 +02:00
Samuele Locatelli d8f462f9ec Merge tag 'AddProjProgSyncro02' into develop
Update nuova gestione info progress del proj
2024-06-29 11:44:12 +02:00
Samuele Locatelli 99851c7fda Merge branch 'release/AddProjProgSyncro02' 2024-06-29 11:43:43 +02:00
Samuele Locatelli ae6b6a46db Merge branch 'develop' into SDK 2024-06-29 11:43:20 +02:00
Samuele Locatelli ad888921f8 Update metodi x prog refresh con val act/max 2024-06-29 11:41:42 +02:00
Samuele Locatelli bf284a6cc9 Rivisto modello dati proj + migrations relative 2024-06-29 11:41:14 +02:00
Samuele Locatelli 695ac9f747 Update struttura chiamata invio progresso proj 2024-06-29 11:20:35 +02:00
Samuele Locatelli 58c4ae1381 Merge tag 'AddProjProgSyncro01' into develop
Aggiunta metodi e logiche x syncro progetto
2024-06-29 10:13:58 +02:00
Samuele Locatelli bf958a0809 Merge branch 'release/AddProjProgSyncro01' 2024-06-29 10:13:43 +02:00
Samuele Locatelli 00fc2ec32e Merge branch 'develop' into SDK 2024-06-29 10:13:01 +02:00
Samuele Locatelli 348cf90833 Update metodi in controller MagMan x invio progresso proj 2024-06-29 10:12:45 +02:00
Samuele Locatelli 540f2a6fc6 Aggiunta metodi x syncro progresso progetto 2024-06-29 10:12:13 +02:00
Samuele Locatelli 2f6676d9ea Fix display progetto con percentuale 2024-06-29 09:50:31 +02:00
Samuele Locatelli 89e5de94b7 Fix context OnModelCreatingPartial (tolto private) 2024-06-29 09:50:22 +02:00
Samuele Locatelli b088d712ca Inizio modifica interfaccia x nuove info progetto 2024-06-29 09:32:24 +02:00
Samuele Locatelli 2684579b6c Aggiunta metodi x update percProg progetto 2024-06-29 09:32:08 +02:00
Samuele Locatelli c55fc7b214 Aggiunta campo progPerc progetto + migrations 2024-06-29 09:31:32 +02:00
Samuele Locatelli 4805a7916a Aggiunta DTO x update avanzamento progetto 2024-06-29 09:31:07 +02:00
Samuele Locatelli 07e10a3ca6 Merge tag 'RemoveMatCodeEditOnItemRaw02' into develop
Disabilitato editing delle dimensioni barre
2024-06-28 18:53:22 +02:00
Samuele Locatelli ec71b70421 Merge branch 'release/RemoveMatCodeEditOnItemRaw02' 2024-06-28 18:48:14 +02:00
Samuele Locatelli bfa94f4eee Disabilitato editing di tutto in Material (codice, dimensioni...) 2024-06-28 18:47:55 +02:00
Samuele Locatelli 448052028d Merge tag 'RemoveMatCodeEditOnItemRaw' into develop
Rimossa editabilità materiale in RawItem
2024-06-28 18:26:01 +02:00
Samuele Locatelli 1ad6abff63 Merge branch 'release/RemoveMatCodeEditOnItemRaw' 2024-06-28 18:25:29 +02:00
Samuele Locatelli 33dbca043f Disabilitato editing cod materiale in ItemRaw 2024-06-28 18:24:59 +02:00
Samuele Locatelli e73b0335e5 Merge branch 'develop' into SDK 2024-06-26 17:38:42 +02:00
Samuele Locatelli acc5c989a1 Merge tag 'UpdateDeployAndRestSharp02' into develop
Fix init timeout
2024-06-26 17:35:51 +02:00
Samuele Locatelli ba5541cbb9 Merge branch 'release/UpdateDeployAndRestSharp02' 2024-06-26 17:35:43 +02:00
Samuele Locatelli d11d91fcf1 Fix init timeout 2024-06-26 17:35:28 +02:00
Samuele Locatelli 3f85b48faa Merge tag 'UpdateDeployAndRestSharp01' into develop
Update componenti RestSharp + update procedura merge con parallelistmo a
8 x dati storici
2024-06-26 17:32:32 +02:00
Samuele Locatelli 85cd73b169 Merge branch 'release/UpdateDeployAndRestSharp01' 2024-06-26 17:32:17 +02:00
Samuele Locatelli 60d4102881 Update dipendenze restSharp 2024-06-26 17:31:45 +02:00
Samuele Locatelli 2f652d1f0a update processing dati con test parallelismo a 8 2024-06-08 12:57:07 +02:00
Samuele Locatelli 0fce9bbe04 Update con test vari x data syncro 2024-06-08 12:31:20 +02:00
Samuele Locatelli fd9fa52d36 Update x testing deploy dati Lovato 2024-05-31 16:56:02 +02:00
Samuele Locatelli 53972d0480 Merge tag 'FixRawItemDeleteAndReactiv01' into develop
Permesso riattivazione record articoli eliminati + gestione
cancellazione logica x record negativi (es barre non caricate a
magazzino tipo remnant)
2024-05-07 17:40:03 +02:00
Samuele Locatelli 3998ff02ea Merge branch 'release/FixRawItemDeleteAndReactiv01' 2024-05-07 17:39:36 +02:00
Samuele Locatelli 05a88733ff Gestione eliminazione/riattivazione record negativi articoli RawItem 2024-05-07 17:38:53 +02:00
Samuele Locatelli 6c0e54f761 Aggiunta migrazione x Eventi 2024-05-02 19:53:59 +02:00
Samuele Locatelli 9fa4e2da64 Fix posizione stored 2024-05-02 19:53:39 +02:00
Samuele Locatelli c575266766 Aggiunta migrazione stored 2024-05-02 19:52:28 +02:00
Samuele Locatelli d45892b279 Update conf:
- redis su cluster
- DB su cluster
- RIfatta migration x considerazione su cluster
2024-05-02 10:14:20 +02:00
Samuele Locatelli 03b34ff547 stored (wip) 2024-04-30 19:30:26 +02:00
Samuele Locatelli 3c5c823fcf Fix migrazioni struttura DB 2024-04-30 19:30:02 +02:00
Samuele Locatelli 741f9c7794 Merge tag 'MacLogPage02' into develop
Update condizione aggiornamento ALIAS + inizio gest statistiche prod
2024-04-30 15:44:17 +02:00
Samuele Locatelli 291de6a80a Merge branch 'release/MacLogPage02' 2024-04-30 15:43:57 +02:00
Samuele Locatelli bc9748ec8e Update display x proj e macStatus 2024-04-30 15:43:37 +02:00
Samuele Locatelli a09b5495d9 Aggiunta preliminare tab statistiche quotidiane + stored (bozza) 2024-04-30 15:43:17 +02:00
Samuele Locatelli f51abc2f68 Update condizione aggiornamento Alias (accetta cambio attivazione) 2024-04-30 15:42:52 +02:00
Samuele Locatelli 8a492e3c1b Merge tag 'MacLogPage01' into develop
Inizio aggiunte x MacLogPage
2024-04-30 10:52:31 +02:00
Samuele Locatelli b963c29ba3 Merge branch 'release/MacLogPage01' 2024-04-30 10:52:21 +02:00
Samuele Locatelli b35f90a878 Prima bozza log macchina 2024-04-30 10:51:43 +02:00
Samuele Locatelli ba5263b9f4 Merge tag 'FixUpsertLogMachine01' into develop
Fix procedure upsert x LogMachine
2024-04-30 09:13:15 +02:00
Samuele Locatelli c901e5f1e9 Merge branch 'release/FixUpsertLogMachine01' 2024-04-30 09:13:05 +02:00
Samuele Locatelli 53bdb75258 Fix console app test datalayer 2024-04-30 09:12:34 +02:00
Samuele Locatelli 6d61eb57ac Fix naming variabile SUpervId 2024-04-30 09:12:24 +02:00
Samuele Locatelli 725115010c Cambio modalità check machineID x upsert 2024-04-30 09:12:05 +02:00
Samuele Locatelli b38d0bfea8 MagMan.Data.Tenant:
- fix LogMachine con SupervId
- fix migrations
2024-04-30 09:11:45 +02:00
Samuele Locatelli dc699c6ba3 Fix x nuget e test sistemazione proj + upload 2024-04-30 08:29:10 +02:00
Samuele Locatelli e37a78392c Merge tag 'FixEgwProxyNuget03' into develop
Fix finale nuget
2024-04-29 13:59:09 +02:00
Samuele Locatelli be50a43890 Merge branch 'release/FixEgwProxyNuget03' 2024-04-29 13:58:42 +02:00
Samuele Locatelli d0e7afcd83 Merge branch 'develop' into SDK 2024-04-29 13:58:20 +02:00
Samuele Locatelli 89a84223ba Update UI x conversione DTO 2024-04-29 13:58:07 +02:00
Samuele Locatelli 80f4c706ae Merge branch 'develop' into SDK 2024-04-29 11:36:03 +02:00
Samuele Locatelli ecd693533e Merge tag 'FixEgwProxyNuget02' into develop
Fix DTO x nuget upload
2024-04-29 11:35:55 +02:00
Samuele Locatelli fc822a9d69 Merge branch 'release/FixEgwProxyNuget02' 2024-04-29 11:35:44 +02:00
Samuele Locatelli cd9640805b Update modello dati LogMachine + nuget da aggiornare 2024-04-29 11:35:07 +02:00
Samuele Locatelli c7790e3dfb Merge branch 'main' into SDK 2024-04-27 12:18:09 +02:00
Samuele Locatelli 05f7edfdc7 Merge tag 'FixEgwProxyNuget01' into develop
Fix gestione pacchetti nuget x proxy nuget
2024-04-27 12:17:58 +02:00
Samuele Locatelli d033910a9c Merge branch 'release/FixEgwProxyNuget01' 2024-04-27 12:17:49 +02:00
Samuele Locatelli 8c2e1c659a Fix procedure restore nexus list 2024-04-27 12:16:19 +02:00
Samuele Locatelli f8dbce0853 Fix nuget x DataLayer di test 2024-04-27 12:13:54 +02:00
Samuele Locatelli 73ca1cadbd Merge tag 'AddLogMachineSync' into develop
Aggiunto meccaniscmo SYNC + test da cnosole x record LogMachine
2024-04-27 11:59:27 +02:00
Samuele Locatelli 8e98a486a0 Merge branch 'release/AddLogMachineSync' 2024-04-27 11:59:11 +02:00
Samuele Locatelli 62c47e7b36 Merge branch 'develop' into SDK 2024-04-27 11:58:37 +02:00
Samuele Locatelli e38c80da47 COmpletata validazione SRV API UI + test da console 2024-04-27 11:58:27 +02:00
Samuele Locatelli 5eb34cef4e Update metodi x nuget (test letura DB + invio) 2024-04-27 11:42:12 +02:00
Samuele Locatelli df2e281744 Completo commit migrations 2024-04-27 11:41:59 +02:00
Samuele Locatelli 8a8018a8cc MagMan:
- aggiunta tab LogMachine + migrations
- aggiunto metodi sync
2024-04-27 11:41:44 +02:00
Samuele Locatelli 78aa06508e Bozza controller salvataggio log macchina 2024-04-26 18:05:22 +02:00
Samuele Locatelli 5951693058 Typo (minor) 2024-04-26 18:05:10 +02:00
Samuele Locatelli d0e7b5724e Update componente SDK x invio dati log eventi 2024-04-26 18:04:14 +02:00
Samuele Locatelli cc1f014587 Merge tag 'FixLoginPagesLayout02' into develop
Fix pagine management utente x layout
2024-04-26 12:33:08 +02:00
Samuele Locatelli 664f6fec06 Merge branch 'release/FixLoginPagesLayout02' 2024-04-26 12:32:58 +02:00
Samuele Locatelli 36678bd629 Fix grafica area manage account 2024-04-26 12:32:40 +02:00
Samuele Locatelli 49f8032bbe Merge tag 'FixLoginPagesLayout01' into develop
Fix pagine varie login x gestione grafica unitaria
2024-04-26 11:38:32 +02:00
Samuele Locatelli 5bed52e26e Merge branch 'release/FixLoginPagesLayout01' 2024-04-26 11:37:35 +02:00
Samuele Locatelli 996d4d87c3 Riscrittura template accesso/LOGIN 2024-04-26 11:36:59 +02:00
Samuele Locatelli 163cd16b6b Merge tag 'FixEditMateriali01' into develop
Fix gestione materiali in editing
2024-04-26 09:26:46 +02:00
Samuele Locatelli 948e777957 Merge branch 'release/FixEditMateriali01' 2024-04-26 09:26:36 +02:00
Samuele Locatelli 6739b18fd5 Fix edit materiali 2024-04-26 09:24:14 +02:00
Samuele Locatelli d9e26de7ac Merge tag 'UpdateNuget_240424_02' into develop
Completo rimozione pacchetti non encessari da nuget con fix
2024-04-24 19:04:56 +02:00
Samuele Locatelli 930d9d7292 Merge branch 'release/UpdateNuget_240424_02' 2024-04-24 19:04:45 +02:00
Samuele Locatelli 9f2e6c5151 rimozione componente + nuget packaging 2024-04-24 19:03:20 +02:00
Samuele Locatelli 3db5945b15 Rimozione SqlClient inutilizzato 2024-04-24 19:00:47 +02:00
Samuele Locatelli 4eacd656f8 Rimozione nuget non encessari 2024-04-24 18:59:38 +02:00
Samuele Locatelli 99a22f7f1e Merge tag 'UpdateNuget_240424' into develop
Update pacchetti nuget vari all'ultima release + fix pacchetti deprecati
di base
2024-04-24 18:56:39 +02:00
Samuele Locatelli bba2865f9f Merge branch 'release/UpdateNuget_240424' 2024-04-24 18:55:56 +02:00
Samuele Locatelli de748bd486 Update x rimozione blocco DatiMacchine da index page menu 2024-04-24 18:54:08 +02:00
Samuele Locatelli c480bb89d6 Update nuget pacchetti deprecati 2024-04-24 18:52:10 +02:00
Samuele Locatelli cca56c8f62 Gestione isDebug:
- menu DatiMacchine visibile solo in debug
- update akltre librerie nuget
2024-04-24 18:50:28 +02:00
Samuele Locatelli b29f96a233 Update nuget (EGW) 2024-04-24 18:35:09 +02:00
Samuele Locatelli f8aee63cee Merge tag 'FixChecks01' into develop
Fix vari x health checks
2024-04-24 09:18:00 +02:00
Samuele Locatelli 623d115d6c Merge branch 'release/FixChecks01' 2024-04-24 09:17:45 +02:00
Samuele Locatelli 8f2b190ad2 Update healtch check + UI 2024-04-24 09:17:23 +02:00
Samuele Locatelli bcb79ee551 Merge tag 'EditAliasBySelect01' into develop
Fix editing Alias: solo da SELECT
2024-04-24 07:34:08 +02:00
Samuele Locatelli b6c3fffe5b Merge branch 'release/EditAliasBySelect01' 2024-04-24 07:33:54 +02:00
Samuele Locatelli 9c026b0820 Update editing ALIAS 2024-04-24 07:33:26 +02:00
Samuele Locatelli 56bb1fcff1 update conf staging x provare in ufficio magman 2024-04-17 10:01:31 +02:00
Samuele Locatelli 134eb37a12 Merge tag 'AddCompBarre01' into develop
Aggiunta metodo comparazione barre (da testare)
2024-04-16 08:59:40 +02:00
Samuele Locatelli b301ada72e Merge branch 'release/AddCompBarre01' 2024-04-16 08:59:31 +02:00
Samuele Locatelli da3316f9cf Completato metodo dictComparer (da testare) 2024-04-16 08:58:57 +02:00
Samuele Locatelli d7ffd3111d Inizio modifiche controller API x check risorse 2024-04-15 20:22:51 +02:00
Samuele Locatelli 98cc38e338 Merge branch 'develop' into SDK 2024-04-15 20:22:30 +02:00
Samuele Locatelli 0918f7c58f update nuget comunicazione 2024-04-15 20:22:19 +02:00
Samuele Locatelli 4d24877c3e Merge branch 'develop' 2024-04-12 08:22:24 +02:00
Samuele Locatelli b0a61309ac Merge branch 'SDK' into develop 2024-04-12 08:22:11 +02:00
Samuele Locatelli ad3abbee06 Merge tag 'RemoveDbSetCountKeyless' into develop
Update db con rimozione DbSetCount Keyless
2024-04-12 08:21:54 +02:00
Samuele Locatelli 78dfc2b8eb Merge branch 'release/RemoveDbSetCountKeyless' 2024-04-12 08:21:34 +02:00
Samuele Locatelli 7555b89438 Rimozione tab DbSetCount keyless... 2024-04-12 08:21:05 +02:00
Samuele Locatelli c52438d0a4 Merge branch 'SDK' of https://gitlab.steamware.net/egalware-web/mes/wood/magman into SDK 2024-04-10 11:09:45 +02:00
Samuele Locatelli e8b0e75f2e Merge tag 'AddChechServerRetry' into develop
Aggiunto modalità "riprova e sarai + fortunato" per la gestione del test
server (ping)
2024-04-10 11:09:12 +02:00
Samuele Locatelli 703ffdb7a3 Merge branch 'release/AddChechServerRetry' 2024-04-10 11:08:45 +02:00
Samuele Locatelli a87494d6f0 Update metodo controllo server
- 5 tentativi (configurabili)
- tempo attesa 200ms tra prove (configurabile)
2024-04-10 11:08:09 +02:00
Samuele Locatelli bf12d27afb Merge tag 'AliasAddLogicalDelete02' into develop
Fix update aliast anche in lista
2024-04-04 12:35:16 +02:00
Samuele Locatelli 6b23b74917 Merge branch 'release/AliasAddLogicalDelete02' 2024-04-04 12:35:06 +02:00
Samuele Locatelli 752f902602 Fix update active alias anche x lista 2024-04-04 12:34:50 +02:00
Samuele Locatelli 5abaf08cf0 Merge tag 'AliasAddLogicalDelete' into develop
Gestione cancellazione logica da editing Alias su cloud
2024-04-04 12:19:03 +02:00
Samuele Locatelli f09c5f9d77 Merge branch 'release/AliasAddLogicalDelete' 2024-04-04 12:18:29 +02:00
Samuele Locatelli 4081b69aff Aggiunta gestione cancellazione logica 2024-04-04 12:18:19 +02:00
Samuele Locatelli bf5dd58364 Merge branch 'develop' into SDK 2024-04-04 11:54:34 +02:00
Samuele Locatelli 7bcb0a6c67 - Aggiunta migration x gestione nuovo campo alias
- update tracciati services x alias
2024-04-04 11:54:19 +02:00
Samuele Locatelli 129cb545e8 Modifica alias x bool gestione cancellazione logica 2024-04-04 11:53:53 +02:00
Samuele Locatelli 14f2be3725 Merge tag 'AddDtRifSyncroRes01' into develop
Aggiunto gestione DtRif x syncro invio risorse
2024-03-26 10:57:15 +01:00
Samuele Locatelli 0d49a4de41 Merge branch 'release/AddDtRifSyncroRes01' 2024-03-26 10:57:04 +01:00
Samuele Locatelli 5408f0995a Merge branch 'develop' into SDK 2024-03-26 10:56:32 +01:00
Samuele Locatelli dead2a06a3 Aggiunta dtRif in metodo invio sync 2024-03-26 10:56:21 +01:00
Samuele Locatelli 6bbe30e831 Merge branch 'SDK' into develop 2024-03-26 10:36:16 +01:00
Samuele Locatelli a920207ebe Update payload invio risorse:
- aggiunta dtReq x verifica se attivare o meno ultima richiesta
2024-03-26 10:33:28 +01:00
Samuele Locatelli 4512dace96 Merge branch 'develop' into SDK 2024-03-19 17:28:05 +01:00
Samuele Locatelli 687b736a50 Fix check server (ping a loopback di catch) 2024-03-19 17:27:48 +01:00
Samuele Locatelli ef54b8762b Merge tag 'FixMatItemEmptyDescr' into develop
Fix descrizioni vuote x progetti
2024-03-01 08:13:01 +01:00
Samuele Locatelli 954543feb4 Merge branch 'release/FixMatItemEmptyDescr' 2024-03-01 08:12:51 +01:00
Samuele Locatelli 495811fa26 Update controller RawItem + fix display proj 2024-03-01 08:12:20 +01:00
Samuele Locatelli c72756f25b Update metodi x calcolo descr materiale se mancante 2024-02-29 19:54:01 +01:00
Samuele Locatelli f0867272ec Fix gestione update risorse 2024-02-29 18:54:10 +01:00
Samuele Locatelli fd097d1472 Merge branch 'develop' into SDK 2024-02-29 12:51:34 +01:00
Samuele Locatelli 7848d7802b Update gestione ResourceTrack:
- update controller POST
- update lib SDK x syncro
2024-02-29 12:51:25 +01:00
Samuele Locatelli 749c4b4cc7 Merge branch 'develop' into SDK 2024-02-29 11:29:01 +01:00
Samuele Locatelli 95af7cc9b5 Update syncro x restituzione val INT 2024-02-29 11:28:55 +01:00
Samuele Locatelli b6d7b1e7b9 Merge tag 'Nuget_AddProjGetSingle' into develop
Aggiunta gestione nuget progetti x get single
2024-02-29 10:32:06 +01:00
Samuele Locatelli d59dea5c51 Merge branch 'release/Nuget_AddProjGetSingle' 2024-02-29 10:31:53 +01:00
Samuele Locatelli 6ea491284b Merge branch 'develop' into SDK 2024-02-29 10:30:47 +01:00
Samuele Locatelli 4eae0fa7ac Update SDK x nuget gestione syncro con single Proj get 2024-02-29 10:30:39 +01:00
Samuele Locatelli 3bd0806942 Aggiunta metodo x download singolo Proj da CloudId 2024-02-29 10:22:09 +01:00
Samuele Locatelli 35a6382f8a Merge branch 'main' into SDK 2024-02-29 08:49:23 +01:00
Samuele Locatelli 0f255e444b Merge tag 'UpgradeProjUpsert' into develop
Update x gestione Proj aggiornata in upsert e permettere nuovo SDK x
sync
2024-02-29 08:49:03 +01:00
Samuele Locatelli 62b14754cd Merge branch 'release/UpgradeProjUpsert' 2024-02-29 08:48:29 +01:00
Samuele Locatelli bd7a82d50f update metodi gestione Progetti:
- ritorno ID creato/aggiornato
- check funzioni insert/update
- REST refresh x testing
2024-02-29 08:47:58 +01:00
Samuele Locatelli 944ae6126c Merge tag 'AddAliasMan01' into develop
Gestione alias materiali online
2024-02-22 16:24:37 +01:00
Samuele Locatelli c276563d2f Merge branch 'release/AddAliasMan01' 2024-02-22 16:23:56 +01:00
Samuele Locatelli 3979d378b2 update index page 2024-02-22 16:23:36 +01:00
Samuele Locatelli 8959cb0751 Update gestione Alias 2024-02-22 16:20:51 +01:00
Samuele Locatelli 0785df95bf Merge branch 'develop' into SDK 2024-02-20 19:13:17 +01:00
Samuele Locatelli 438ade3a10 Update SDK methos AliasSendAsync name 2024-02-20 19:13:10 +01:00
Samuele Locatelli 13b904f61a Merge tag 'AddAliasSync' into develop
Completato update anche dell'SDK
2024-02-20 18:39:32 +01:00
Samuele Locatelli fcd7788a84 Merge branch 'release/AddAliasSync' 2024-02-20 18:39:21 +01:00
Samuele Locatelli 14e4b75b69 Update proxy con SDK 2024-02-20 18:39:10 +01:00
Samuele Locatelli a39a037aee Update x metodi gestione sync Alias 2024-02-20 18:19:09 +01:00
Samuele Locatelli c5f7a7d78e Merge tag 'AddForceReloadPage02' into develop
Fix reload page x blazor js
2024-02-19 19:57:00 +01:00
Samuele Locatelli b5fcf6cd4d Merge branch 'release/AddForceReloadPage02' 2024-02-19 19:56:51 +01:00
Samuele Locatelli bef5fdc203 Fix layout x reload blazor js 2024-02-19 19:56:36 +01:00
Samuele Locatelli f899ea5380 Merge tag 'AddForceReloadPage01' into develop
Update gestione force reload pagina per evitare reload waiting
2024-02-19 09:26:43 +01:00
Samuele Locatelli 87b5f37b5a Merge branch 'release/AddForceReloadPage01' 2024-02-19 09:26:28 +01:00
Samuele Locatelli 56de33cfc6 Fix force reload page 2024-02-19 09:24:34 +01:00
Samuele Locatelli 4aca1a465a Merge tag 'FixEditMaterials01' into develop
Fix editing materiali
2024-02-17 10:59:22 +01:00
Samuele Locatelli d5d28524bd Merge branch 'release/FixEditMaterials01' 2024-02-17 10:59:08 +01:00
Samuele Locatelli c67c37cd2c Fix catena selezione materiali 2024-02-17 10:58:31 +01:00
Samuele Locatelli 529179e581 Merge tag 'FixEditMaterialsOnCancel01' into develop
Fix gestone edit materiali su cancel
2024-02-16 18:50:23 +01:00
Samuele Locatelli 7635da616d Merge branch 'release/FixEditMaterialsOnCancel01' 2024-02-16 18:50:08 +01:00
Samuele Locatelli 7d9999b336 Update gestione exit edit Materiali 2024-02-16 18:49:18 +01:00
Samuele Locatelli 8918110dec Update gestione cancel edit materiali 2024-02-16 18:17:18 +01:00
Samuele Locatelli 287a9929b6 Merge tag 'InventoryFixUpdQtyOnlyCloud' into develop
Update gestione qty non aggiornata da EgtBW in sync
2024-02-14 15:09:50 +01:00
Samuele Locatelli dc0cb5fc69 Merge branch 'release/InventoryFixUpdQtyOnlyCloud' 2024-02-14 15:07:06 +01:00
Samuele Locatelli 147bd0dc9e Gestione opzionale set qty RawItem 2024-02-14 15:06:31 +01:00
Samuele Locatelli 75186f4628 Merge tag 'FixReloadSelCustomer' into develop
Fix refresh ceh eprde customer
2024-02-09 14:44:54 +01:00
Samuele Locatelli d9731433d1 Merge branch 'release/FixReloadSelCustomer' 2024-02-09 14:44:44 +01:00
Samuele Locatelli 1f75a0a39e Fix invio x merge itemRaw 2024-02-09 14:44:08 +01:00
Samuele Locatelli 9b32b9ae95 Merge tag 'fixAddDeleteRawItem' into develop
Aggiornamento insert/delete rawItem
2024-02-08 13:02:19 +01:00
Samuele Locatelli a58458b0e6 Merge branch 'release/fixAddDeleteRawItem' 2024-02-08 13:01:47 +01:00
Samuele Locatelli b466b3e8e5 Fix calcolo solo su attivi 2024-02-08 13:01:14 +01:00
Samuele Locatelli 86664908cb Fix display su cambio attivi (RawItem) 2024-02-08 12:43:51 +01:00
Samuele Locatelli f43acfd3ac Fix ItemRaw add 2024-02-08 11:24:34 +01:00
Samuele Locatelli 9bb42101ea Fix editing materiali 2024-02-08 10:23:06 +01:00
Samuele Locatelli 13dae1c425 Merge tag 'AddDeleteMatForAdmin' into develop
Aggiunta eliminazione materiali x admin
2024-02-08 09:09:13 +01:00
Samuele Locatelli 150916acbd Merge branch 'release/AddDeleteMatForAdmin' 2024-02-08 09:09:03 +01:00
Samuele Locatelli 08832c26f2 Update x gestione eliminazione record su MagMan 2024-02-08 09:08:42 +01:00
Samuele Locatelli f614d3df7f Merge branch 'SDK' into develop 2024-02-06 19:43:40 +01:00
Samuele Locatelli 786e850380 Update log invio in caso di problemi response 2024-02-06 19:43:31 +01:00
Samuele Locatelli ceadec4ae6 Merge branch 'develop' into SDK 2024-02-06 16:11:47 +01:00
Samuele Locatelli eb02173f67 Fix check bool fatto da statuscode 2024-02-06 16:11:42 +01:00
Samuele Locatelli 47bf84c5be Merge branch 'SDK' into develop 2024-02-06 15:54:54 +01:00
Samuele Locatelli acccb38a25 Update: ping con timeout pure lui 2024-02-06 15:54:46 +01:00
Samuele Locatelli abf8d30ecd Merge branch 'develop' into SDK 2024-02-06 15:48:32 +01:00
Samuele Locatelli ff066ddf1a Aggiunta override x timeout 2024-02-06 15:48:25 +01:00
Samuele Locatelli e51870a87b Merge tag 'SdkAddSyncroSyncAsync' into develop
Aggiunta metodi sync/async in SDK
2024-02-06 14:27:58 +01:00
Samuele Locatelli e1c3de8199 Merge branch 'release/SdkAddSyncroSyncAsync' 2024-02-06 14:27:48 +01:00
Samuele Locatelli 9a7e273fd5 Merge branch 'develop' into SDK 2024-02-06 14:27:13 +01:00
Samuele Locatelli 7d7bbf46c5 Update pacchetti DataSyncro x metodi Sync/Async 2024-02-06 14:27:06 +01:00
Samuele Locatelli 71ea0405d8 Merge tag 'FixuploadSdk' into develop
Fix tracciati upload SDK
2024-02-06 10:14:13 +01:00
Samuele Locatelli 4ce5157489 Merge branch 'release/FixuploadSdk' 2024-02-06 10:14:06 +01:00
Samuele Locatelli 162c6ff3a4 Merge branch 'develop' into SDK 2024-02-06 10:13:42 +01:00
Samuele Locatelli befbccc9a2 Fix chiamate REST di upload 2024-02-06 10:13:36 +01:00
Samuele Locatelli 6c84f84e53 Merge tag 'UpdMenuTopSpace01' into develop
Fix gestione spazio top menu
2024-02-06 08:45:47 +01:00
Samuele Locatelli 9a54256dbd Merge branch 'release/UpdMenuTopSpace01' 2024-02-06 08:45:38 +01:00
Samuele Locatelli c85f99bf10 Merge branch 'develop' into SDK 2024-02-06 08:44:56 +01:00
Samuele Locatelli 8d7d8d2f71 Fix header 2024-02-06 08:44:42 +01:00
Samuele Locatelli c01bf85968 Update SDK x gestione IP senza special port 2024-02-06 08:44:38 +01:00
Samuele Locatelli cec8aa22e4 Fix salvataggio pickup/deposit 2024-02-05 15:02:27 +01:00
Samuele Locatelli e6751ee3ba Fix display top, fix sel cliente 2024-02-05 15:02:19 +01:00
Samuele Locatelli 4055ce8426 Prima versione deposit/pickup da verificare 2024-02-02 19:38:42 +01:00
Samuele Locatelli e55610870c Merge tag 'AddSelNumKey' into develop
Aggiunta gestione NumKey via MessageService
2024-02-02 11:33:34 +01:00
Samuele Locatelli ddd7c1e98b Merge branch 'release/AddSelNumKey' 2024-02-02 11:31:51 +01:00
Samuele Locatelli f54e5702c2 Fix selezione key in cascata 2024-02-02 11:31:24 +01:00
Samuele Locatelli abd4f94279 Fix orientamento centrale QRCode JS 2024-02-02 09:13:21 +01:00
Samuele Locatelli d855a25b0e Merge tag 'AddMultiRoleClaim' into develop
Completato editing multi claim e multi role
2024-02-01 19:11:35 +01:00
Samuele Locatelli 4172a87982 Merge branch 'release/AddMultiRoleClaim' 2024-02-01 19:11:16 +01:00
Samuele Locatelli 4c820619ef Merge branch 'feature/FixMultiRoleClaim' into develop 2024-02-01 19:10:53 +01:00
Samuele Locatelli f80ff4d130 Completato editing claims! 2024-02-01 19:10:40 +01:00
Samuele Locatelli 35729ec1d5 OK, prima versione editing claims 2024-02-01 18:59:22 +01:00
Samuele Locatelli e8e7b804c5 Fix mono-role 2024-02-01 16:27:49 +01:00
Samuele Locatelli 698e168d4c Merge branch 'feature/FixMultiRoleClaim' into develop 2024-02-01 16:22:30 +01:00
Samuele Locatelli 30210b7b8b Gestione multirole deditabile (parametricamente gestita) 2024-02-01 16:22:24 +01:00
Samuele Locatelli 2175b1a559 Fix gestione autorize x tutto il sito 2024-02-01 15:06:50 +01:00
Samuele Locatelli 0a2b93134c Cambio naming obj QRCode display + ref 2024-02-01 15:06:42 +01:00
Samuele Locatelli a5262711b4 Merge tag 'FixQrcodeIcon01' into develop
Fix QRCode display x icona
2024-02-01 11:59:42 +01:00
Samuele Locatelli 130a8921fd Merge branch 'release/FixQrcodeIcon01' 2024-02-01 11:59:15 +01:00
Samuele Locatelli 0a18c07788 Fix display QrCode icon 2024-02-01 11:58:58 +01:00
Samuele Locatelli 00e96a1450 Merge tag 'FixQrcodeGenLinux' into develop
Fix QR x linux
2024-02-01 10:37:57 +01:00
Samuele Locatelli db30e98ee3 Merge branch 'release/FixQrcodeGenLinux' 2024-02-01 10:26:29 +01:00
Samuele Locatelli 850542fb7d Fix display QR x linux 2024-02-01 10:15:50 +01:00
Samuele Locatelli 9590087381 Merge tag 'AddUserManProd' into develop
Aggiunta gestione user in produzione
2024-02-01 09:48:21 +01:00
Samuele Locatelli 4698262742 Merge branch 'release/AddUserManProd' 2024-02-01 09:48:08 +01:00
Samuele Locatelli f5d490bd27 Merge branch 'feature/ConfUserAdminManProd' into develop 2024-02-01 09:47:49 +01:00
Samuele Locatelli 51b98c0896 Fix conf x prod (da testare) 2024-02-01 09:33:20 +01:00
Samuele Locatelli acf7be06fa Fix pagina jump da qrcode 2024-02-01 09:33:09 +01:00
Samuele Locatelli 3e3c5ede9c Merge branch 'feature/AddUserAdminMan' into develop 2024-01-31 19:41:35 +01:00
Samuele Locatelli 398295f602 Aggiunto layer auth x pagine specifiche 2024-01-31 19:41:25 +01:00
Samuele Locatelli 9e5f750444 Fix gestione user con deserializzazione claims sistemata 2024-01-31 19:11:05 +01:00
Samuele Locatelli 159602440a Ok search/display utenti con cache REDIS 2024-01-31 15:49:25 +01:00
Samuele Locatelli c00de7d839 Update gestione admin utenti 2024-01-31 13:02:39 +01:00
Samuele Locatelli 731e41b89c Gestione User: inizio inserimento servizi come GWMS 2024-01-31 12:57:14 +01:00
Samuele Locatelli 27beb82723 Merge tag 'UpdateAllDto01' into develop
Aggiornamentot raccaiti DTO x deploy in prod
2024-01-31 08:55:01 +01:00
Samuele Locatelli 6072e4bbf9 Merge branch 'release/UpdateAllDto01' 2024-01-31 08:54:50 +01:00
Samuele Locatelli 4b7097e941 Merge branch 'develop' into SDK 2024-01-31 08:53:28 +01:00
Samuele Locatelli 569bdac36d Merge branch 'feature/ReviewDto' into develop 2024-01-31 08:53:12 +01:00
Samuele Locatelli c13eb15ad0 Ancora fix DTO ResourcesExp 2024-01-31 08:53:02 +01:00
Samuele Locatelli 50b912c3f0 DTO Proxy:
- fix ResourceExp
2024-01-31 08:52:50 +01:00
Samuele Locatelli e41b7ac97e DTO proxy:
- fir resource (base)
2024-01-30 19:01:33 +01:00
Samuele Locatelli 77ac2c6d1b DTO Proxy:
- fix progetto
2024-01-30 19:00:12 +01:00
Samuele Locatelli ec1854844a DTO in Proxy:
- Fix Item
- Fix Material
2024-01-30 18:53:52 +01:00
Samuele Locatelli eb99ec5437 Fix ItemDTO 2024-01-30 18:41:59 +01:00
Samuele Locatelli f77e95c9b9 Merge branch 'feature/ReviewDto01' into develop 2024-01-30 18:26:57 +01:00
Samuele Locatelli b135a4ee3d Fix test consumo e stima risorse + REST file 2024-01-30 18:26:38 +01:00
Samuele Locatelli b4ec83e127 fix naming progetto locale/ext x invio risorse 2024-01-30 18:05:04 +01:00
Samuele Locatelli f12a85aea5 Modifica DTO risorse con indicazione Cloud 2024-01-30 17:59:50 +01:00
Samuele Locatelli 4efb48abe7 Update organizzazione gerarchia cache REDIS 2024-01-30 17:24:39 +01:00
Samuele Locatelli 848434fd00 Update modello DTO progetto 2024-01-30 17:19:32 +01:00
Samuele Locatelli 50d157005b Completato fix DTO x materiali ed inventario 2024-01-30 10:52:18 +01:00
Samuele Locatelli 5a0a543a87 Inizio modifiche x nuovi campi e review REST 2024-01-29 18:45:04 +01:00
Samuele Locatelli 8a339231db Merge branch 'SDK' into develop 2024-01-29 14:41:36 +01:00
Samuele Locatelli 15ae17a420 Fix SDK 2024-01-29 14:41:29 +01:00
Samuele Locatelli 2435e7d0fb Merge branch 'develop' into SDK 2024-01-29 14:39:23 +01:00
Samuele Locatelli 102249efe1 Ancora fix codice string x materiale 2024-01-29 14:39:17 +01:00
Samuele Locatelli ee32c8440e Merge branch 'develop' into SDK 2024-01-29 14:36:28 +01:00
Samuele Locatelli 09c719f42d Typo e correzione Tmm --> Hmm 2024-01-29 14:36:18 +01:00
Samuele Locatelli 1fe95c3fbf Merge branch 'SDK' into develop 2024-01-29 12:28:44 +01:00
Samuele Locatelli 4d3a0c74f9 Modifica naming metodi DataSyncro 2024-01-29 12:28:27 +01:00
Samuele Locatelli dc95214919 Merge branch 'main' into SDK 2024-01-29 09:59:10 +01:00
Samuele Locatelli 883635470f Merge tag 'FixResourceGetResp' into develop
Fix out risorse + update pacchetto nuget
2024-01-29 09:58:56 +01:00
Samuele Locatelli 736fb0d5a6 Merge branch 'release/FixResourceGetResp' 2024-01-29 09:58:46 +01:00
Samuele Locatelli 77798f0d60 Aggiunta metodi x gestione upload dati 2024-01-29 09:57:38 +01:00
Samuele Locatelli c0b51ef696 Merge tag 'ResourceService02' into develop
Fix servizi da gestire con SDK
2024-01-27 11:03:13 +01:00
Samuele Locatelli 07ab77782b Merge branch 'release/ResourceService02' 2024-01-27 11:03:03 +01:00
Samuele Locatelli e120f716d8 Aggiunta display QrCode 2024-01-26 09:21:44 +01:00
Samuele Locatelli b45837ec8d Merge branch 'feature/NugetSdk' into develop 2024-01-25 19:44:37 +01:00
Samuele Locatelli 32999677ea Aggiunta registrazione tipii comvimento in mag 2024-01-25 19:44:28 +01:00
Samuele Locatelli f4f2c9bfec Fix migrazioni 2024-01-25 19:44:20 +01:00
Samuele Locatelli 729727610e Aggiunta migrationx MovMag 2024-01-25 18:41:45 +01:00
Samuele Locatelli 7e5605aa7b Aggiunta modello dati MovMag 2024-01-25 18:41:39 +01:00
Samuele Locatelli cc879c073d Aggiunta display varianti 2024-01-25 17:10:23 +01:00
Samuele Locatelli 660f1f2407 Merge branch 'feature/NugetSdk' into develop 2024-01-25 16:15:54 +01:00
Samuele Locatelli 1547cbb0cb Fix filtraggio dati key/proj 2024-01-25 16:15:45 +01:00
Samuele Locatelli f4db03a154 Inizio porting su redis DIC KEY/auth 2024-01-25 15:45:16 +01:00
Samuele Locatelli 458c5e5c64 Merge branch 'feature/NugetSdk' into develop 2024-01-25 12:21:15 +01:00
Samuele Locatelli 6fe052addc Completato display consumo stimato/reale 2024-01-25 12:20:41 +01:00
Samuele Locatelli 94cb8101e1 Inserito dettaglio consumi 2024-01-25 12:09:37 +01:00
Samuele Locatelli 360d9d4332 Update giacenza su registro risorse 2024-01-25 09:34:07 +01:00
Samuele Locatelli c675e4a5f4 Merge tag 'ResourceService01' into develop
Aggiunta metodi upsert risorse e plan consumi
2024-01-24 18:55:22 +01:00
Samuele Locatelli 85638afb2c Merge branch 'release/ResourceService01' 2024-01-24 18:54:52 +01:00
Samuele Locatelli fd5df05ee9 Merge branch 'feature/NugetSdk' into develop 2024-01-24 18:54:14 +01:00
Samuele Locatelli 7dbc84fe45 Aggiunta post risorse (stima + consumo) - da testare 2024-01-24 18:34:16 +01:00
Samuele Locatelli db087b52e1 Aggiunto controllo export dati risorse (get) 2024-01-24 16:09:17 +01:00
Samuele Locatelli 437e23b30c OK display stato proj 2024-01-24 15:25:43 +01:00
Samuele Locatelli 6375ec8bd1 Bozza display progetti 2024-01-24 12:46:31 +01:00
Samuele Locatelli 8f2545aa29 Fix update selezione customer (stateHasChanged...) 2024-01-24 11:08:55 +01:00
Samuele Locatelli dbdce221e9 Fix gestione sel cliente 2024-01-24 10:08:54 +01:00
Samuele Locatelli 455ce65fcc Inizio mod clientID 2024-01-23 19:06:05 +01:00
Samuele Locatelli 9f53aa0c3f Riportato EA x clientID... da rifare implementazione 2024-01-23 18:53:33 +01:00
Samuele Locatelli 13242fffb1 spostamento grafico x sel clienti in CmpTop 2024-01-23 12:03:47 +01:00
Samuele Locatelli dafd2e6a0b Merge branch 'feature/NugetSdk' into develop 2024-01-23 09:28:23 +01:00
Samuele Locatelli 311da2987e Ancora fix deploy nuget stabile 2024-01-23 09:27:23 +01:00
Samuele Locatelli d34290bf63 Ancora typo CI/CD 2024-01-23 09:25:53 +01:00
Samuele Locatelli 7221b56c87 Fix sdk CI/CD 2024-01-23 09:23:34 +01:00
Samuele Locatelli 0aad827655 Update deploy SDK 2024-01-23 09:22:30 +01:00
Samuele Locatelli bf4f77e1f1 Merge tag 'AddMagManSdk02' into develop
Aggiunta nuova release con metodi x projects
2024-01-23 09:15:54 +01:00
Samuele Locatelli 2bf478529d Merge branch 'release/AddMagManSdk02' 2024-01-23 09:15:42 +01:00
Samuele Locatelli 37a911a150 Merge branch 'feature/NugetSdk' into develop 2024-01-23 09:15:22 +01:00
Samuele Locatelli 01c239fac1 refresh 2024-01-23 09:15:00 +01:00
Samuele Locatelli 3a7edacd53 Fix test lettura anche progetti 2024-01-23 09:14:14 +01:00
Samuele Locatelli 83c77905c9 Merge branch 'feature/NugetSdk' 2024-01-23 08:06:54 +01:00
Samuele Locatelli c0d59c09fd Fix dipendenze 2024-01-23 08:06:48 +01:00
Samuele Locatelli e9d13f2683 Merge tag 'AddMagManSdk01' into develop
Aggiunta preliminare sdk
2024-01-23 07:42:19 +01:00
Samuele Locatelli 8d65efaa92 Merge branch 'release/AddMagManSdk01' 2024-01-23 07:42:08 +01:00
Samuele Locatelli 466c0e48bb Merge branch 'feature/NugetSdk' into develop 2024-01-22 20:15:09 +01:00
Samuele Locatelli 39e1c367c7 Aggiiunta metodi controlli x projectDTO-->DB 2024-01-22 20:15:00 +01:00
Samuele Locatelli e5ea713813 Aggiunta metodi gestione Projects (controller, service) 2024-01-22 19:47:52 +01:00
Samuele Locatelli bcf2695cf8 Update controllers generali 2024-01-22 18:46:11 +01:00
Samuele Locatelli f7f5a97784 Fix migration 2024-01-22 18:46:05 +01:00
Samuele Locatelli c41ed6dfe8 modifiche modello dati 2024-01-22 18:45:58 +01:00
Samuele Locatelli 342cc73d7f Fix edit RawItems 2024-01-22 10:03:08 +01:00
Samuele Locatelli bbe2250c7b Update editing RawItem 2024-01-20 10:09:42 +01:00
Samuele Locatelli 9767e220ce Fix init active x RawItem 2024-01-20 09:57:26 +01:00
Samuele Locatelli 3bbdb2c25d Riordino display items... 2024-01-19 19:19:48 +01:00
Samuele Locatelli b9c5db56f5 Aggiunta preliminare RawItem con dimensioni mostrate dinamicamente 2024-01-19 19:18:13 +01:00
Samuele Locatelli d69bc8f18d OK fix ricerca 2024-01-19 17:02:18 +01:00
Samuele Locatelli 27522184e3 Conponente selCustomer estratto 2024-01-19 16:43:43 +01:00
Samuele Locatelli f818ebdda9 Merge branch 'feature/NugetSdk' into develop 2024-01-19 11:10:51 +01:00
Samuele Locatelli 8e1124a211 Update componente edit decimal da libreria 2024-01-19 11:10:41 +01:00
Samuele Locatelli 39abb4832c Fix edit materiali 2024-01-19 10:54:25 +01:00
Samuele Locatelli 249059e825 Update DTO x materiali + fix upsert RawItems 2024-01-18 19:24:09 +01:00
Samuele Locatelli 9fd274b166 Update chaimate REST via insomnia 2024-01-18 19:10:56 +01:00
Samuele Locatelli 81e36caaa3 Pulizia migration, update readme 2024-01-18 17:20:13 +01:00
Samuele Locatelli 5134f3b43f refresh readmeModifiche modello dati + migrations 2024-01-18 17:14:45 +01:00
Samuele Locatelli b2c4d76d78 Inizio aggiunta nuove classi x gestione richieste da Proj 2024-01-18 08:59:20 +01:00
Samuele Locatelli d4024058b4 Update demo VB 2024-01-17 19:52:21 +01:00
Samuele Locatelli d412e8e771 Merge branch 'feature/NugetSdk' into develop 2024-01-17 19:41:57 +01:00
Samuele Locatelli d70f271e1c Aggiunta in sync metodo recupero dati inventario oggetti 2024-01-17 19:40:53 +01:00
Samuele Locatelli 7181be9cb6 Aggiunto demo VB x lettura rest da nuget 2024-01-17 18:33:40 +01:00
Samuele Locatelli 627b29f06d Merge branch 'feature/NugetSdk' into develop 2024-01-17 18:19:55 +01:00
Samuele Locatelli a57b0ce611 Aggiunta demo app x test Nuget 2024-01-17 18:19:23 +01:00
Samuele Locatelli 41e2b869bd Fix naming pacchetti 2024-01-17 18:19:10 +01:00
Samuele Locatelli 86a0945ad7 Fix nuspec descript 2024-01-17 18:07:29 +01:00
Samuele Locatelli 7609cf3284 update dotnet --> Build 2024-01-17 18:05:39 +01:00
Samuele Locatelli 8057b52fc0 Merge branch 'feature/NugetSdk' into develop 2024-01-17 18:01:09 +01:00
Samuele Locatelli 74f7827742 fix nugetPath 2024-01-17 18:00:03 +01:00
Samuele Locatelli 7c3c475de2 Refresh nuget CI/CD 2024-01-17 17:58:40 +01:00
Samuele Locatelli e7c22e5703 fix yaml x build UI 2024-01-17 17:46:51 +01:00
Samuele Locatelli bbf7385f59 Merge branch 'feature/NugetSdk' into develop 2024-01-17 17:33:39 +01:00
Samuele Locatelli e808369929 Modifica CI/CD x pubblicazione 2024-01-17 17:22:32 +01:00
Samuele Locatelli 9849331b40 Aggiunta conf x generare nuget 2024-01-17 17:22:19 +01:00
Samuele Locatelli 257f52f9f8 Spostamento progetto test 2024-01-17 17:22:10 +01:00
Samuele Locatelli 9eaf5716bf Inizio sdk comunicazione con mAG 2024-01-17 16:56:21 +01:00
Samuele Locatelli ab005f72cb Fix ricerca matID zero 2024-01-17 15:31:25 +01:00
Samuele Locatelli f53b460ae8 Merge branch 'feature/TenantDb' into develop 2024-01-17 15:17:58 +01:00
Samuele Locatelli 4e50f4332e Completato fix gestione inventario magazzino 2024-01-17 15:17:32 +01:00
Samuele Locatelli 8762421407 Aggiunta metodi gestione HashSet in Redis 2024-01-16 14:37:03 +01:00
Samuele Locatelli 260e3557b3 Merge tag 'TenantDb01' into develop
test develop --> main x gestione dati tenant
2024-01-16 14:08:30 +01:00
Samuele Locatelli d89abe3aad Merge branch 'release/TenantDb01' 2024-01-16 14:08:18 +01:00
Samuele Locatelli fc8e533983 Bozza modifica gestione Items oltre a materiali, errore 470/000 2024-01-16 12:21:26 +01:00
Samuele Locatelli 42e9de7316 Merge branch 'feature/TenantDb' into develop 2024-01-16 10:56:14 +01:00
Samuele Locatelli f57a9d5360 Update rest file 2024-01-16 10:55:54 +01:00
Samuele Locatelli c2c179a826 Aggiunta metodo upsert materiale via REST 2024-01-16 10:55:24 +01:00
Samuele Locatelli 5726d6795c Fix loop gestione navigazione macchine 2024-01-16 09:38:16 +01:00
Samuele Locatelli e9e724fa7f Fix migrazone dati customer 2024-01-16 08:29:39 +01:00
Samuele Locatelli f43aeaf66c Aggiunta tracciato REST Insomnia 2024-01-15 19:54:06 +01:00
Samuele Locatelli 4e4280c829 Aggiunta primi servizi chiamate REST 2024-01-15 19:51:49 +01:00
Samuele Locatelli 81f8d316f9 bozza selezione dati da key 2024-01-15 17:58:48 +01:00
Samuele Locatelli e90c807a52 Inizio setup servizi/controller x tenantDB 2024-01-15 17:26:02 +01:00
Samuele Locatelli b0b8dda2c7 Merge branch 'feature/FixDbUserSetup' into develop 2024-01-15 14:47:43 +01:00
Samuele Locatelli 0cb19811c5 Aggiunta pagina reset + creazione DB (empty) 2024-01-15 14:47:21 +01:00
Samuele Locatelli 7a62ecbbd5 Fix migrazione dati key INT 2024-01-15 14:47:13 +01:00
Samuele Locatelli dc3bd557d2 Inizio gestione creazione DB 2024-01-15 11:44:22 +01:00
Samuele Locatelli d79120117e Aggiunto:
- gestione chiave main +  DB
- migrazione
2024-01-15 11:07:33 +01:00
Samuele Locatelli eed737ebb8 Rename service + controller MultiTenantAdmin 2024-01-15 10:25:07 +01:00
Samuele Locatelli 68992269f9 Fix selezione clienti in naviazione admin 2024-01-15 10:11:15 +01:00
Samuele Locatelli 211f52dee3 Merge tag 'TestDeploy02' into develop
Fix versione in prod da provare
2024-01-13 12:47:42 +01:00
Samuele Locatelli 064f79425d Merge branch 'release/TestDeploy02' 2024-01-13 12:46:31 +01:00
Samuele Locatelli 55474308c6 Merge branch 'feature/FixDbUserSetup' into develop 2024-01-13 12:46:02 +01:00
Samuele Locatelli 1971e2ed12 update grafico login/logout e index 2024-01-13 12:45:54 +01:00
Samuele Locatelli edd688c7e4 Update index page 2024-01-13 12:21:59 +01:00
Samuele Locatelli ec32cc75ab Update home page x deploy 2024-01-13 10:23:14 +01:00
Samuele Locatelli de3e0cf140 Ancora fix master x CI/CD 2024-01-12 19:23:40 +01:00
Samuele Locatelli e49be1b9f0 Fix branch main x deploy 2024-01-12 19:02:44 +01:00
Samuele Locatelli ee95c030f5 Merge tag 'TestDeploy01' into develop
Creazione prima release installabile x MagMan
2024-01-12 18:52:10 +01:00
Samuele Locatelli 34eaa29020 Merge branch 'release/TestDeploy01' 2024-01-12 18:51:53 +01:00
Samuele Locatelli bc90034d17 update x vers number 2024-01-12 16:53:03 +01:00
Samuele Locatelli fe1606dbbb Cleanup codice 2024-01-12 16:41:18 +01:00
Samuele Locatelli 3295482796 fix CI/CD stage installer 2024-01-12 16:06:19 +01:00
Samuele Locatelli ceacddd22c Merge branch 'feature/FixDbUserSetup' into develop 2024-01-12 16:04:02 +01:00
Samuele Locatelli 8a5cb4a7b5 Update x deploy 2024-01-12 16:03:50 +01:00
Samuele Locatelli 8868734b44 Test CI/CD x deploy + upload nexus 2024-01-12 16:03:41 +01:00
Samuele Locatelli e33bf8ef4a Merge branch 'feature/FixDbUserSetup' into develop 2024-01-12 15:20:16 +01:00
Samuele Locatelli 353dafe9c8 bozza migrazione x gestione keys 2024-01-12 15:19:39 +01:00
Samuele Locatelli 37a9238f73 Fix comportamento sel/edit company 2024-01-12 12:14:51 +01:00
Samuele Locatelli 84200fe515 Aggiunta metodig estione macchine (anagrafica) + controllo 2024-01-12 11:53:03 +01:00
Samuele Locatelli 9207b4350e Ok gestione add clienti 2024-01-11 19:34:15 +01:00
Samuele Locatelli 8917c5570a Merge branch 'feature/FixDbUserSetup' into develop 2024-01-11 17:27:01 +01:00
Samuele Locatelli bee30d98e3 Completata aggiunta primi elementi gestione area admin 2024-01-11 17:26:49 +01:00
Samuele Locatelli 41ffd471e2 Rename + pulizia metodi IdentContext 2024-01-11 14:59:48 +01:00
Samuele Locatelli 2e82c08fde pulizia vecchie metodologie aggiunta user/ruoli 2024-01-11 14:53:22 +01:00
Samuele Locatelli 7d08078681 Fix migration x ruoi e users 2024-01-11 14:51:02 +01:00
Samuele Locatelli 8e12957e77 Bozza nuova gestione user/ruoli (da rivederfe) 2024-01-11 12:18:36 +01:00
Samuele Locatelli 81ebf28c34 Ok login! 2024-01-11 10:39:57 +01:00
Samuele Locatelli c7f54277ea Aggiunta utenti admin 2024-01-10 20:14:21 +01:00
Samuele Locatelli cf2cef3c3f Merge branch 'feature/FixBaseDisplay' into develop 2024-01-10 19:54:07 +01:00
Samuele Locatelli 04dee711fc Continuo fix grafico di base 2024-01-10 19:53:38 +01:00
Samuele Locatelli 6fbdee5f2e primo rilascio yaml test 2024-01-10 19:33:52 +01:00
Samuele Locatelli d7ed564d3e Fix e test creazione DB ident OK 2024-01-10 19:29:38 +01:00
Samuele Locatelli 7b7c4095a9 update readme 2024-01-10 18:23:33 +01:00
Samuele Locatelli f31a671f1d Merge branch 'feature/SetupAuthGWMS' into develop 2024-01-10 18:12:37 +01:00
Samuele Locatelli 983586552b Completo riorganizzazione progetti:
- Core
- Data.Admin
2024-01-10 17:55:06 +01:00
Samuele Locatelli 53332b389f Inizio riortganizzazione classi 2024-01-10 17:54:47 +01:00
Samuele Locatelli 1acdde89e8 ancora setup progetto identity 2024-01-09 17:37:10 +01:00
Samuele Locatelli 1669413558 Separazione progetto identity da main DB (da testare!!!) 2024-01-09 17:36:58 +01:00
Samuele Locatelli eccd839236 Aggiunta progetto MagMan.User x spostare componente gestione identity... 2024-01-09 17:11:49 +01:00
Samuele Locatelli 96e4e09ba8 Update readme 2024-01-09 17:11:31 +01:00
Samuele E. Locatelli a0625bc77e Update note specifiche tecniche 2023-12-29 10:03:24 +01:00
Samuele E. Locatelli 009aba0cec update componenti layout pagina (da fixare) 2023-12-28 12:19:09 +01:00
Samuele E. Locatelli 88a4b0188e Update componenti wwwroot 2023-12-28 12:18:58 +01:00
Samuele E. Locatelli 008f288de2 Correzione procedure setup 2023-12-28 11:32:48 +01:00
Samuele Locatelli af24e2a01d Aggiunta conf x healthchecks-ui 2023-12-27 11:50:51 +01:00
Samuele Locatelli ca94cda9c7 Modifiche varie x setup iniziale user & ruoli + check 2023-12-27 11:47:45 +01:00
Samuele Locatelli 393e8b671f Ancora DB KO... da completare startup 2023-12-23 12:40:49 +01:00
Samuele Locatelli 82914f2f28 Aggiunta modifiche x gestione Auth, NON GIRA correttamente 2023-12-23 12:22:18 +01:00
Samuele Locatelli eca44a7fc5 COntinuo modifica pagine base 2023-12-23 11:17:27 +01:00
521 changed files with 143877 additions and 2382 deletions
+8 -3
View File
@@ -5,10 +5,9 @@
.vs/*
#--------------------------------
# area MP.Stats
# area .temp
#--------------------------------
/Mp.FileData/temp/*.csv
*.bak
.temp
#--------------------------------
# Area VersGen
@@ -163,12 +162,18 @@ publish/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
**/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 ignorable files
*.nuget.props
*.nuget.targets
# Windows Azure Build Output
csx/
+213
View File
@@ -0,0 +1,213 @@
variables:
VERS_MAIN: '1.0'
NEXUS_PATH: 'MagMan'
APP_NAME: 'MagMan.UI'
SOL_NAME: 'MagMan.UI'
NUGET_PATH: 'C:\Tools\nuget.exe'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
.nuget-fix: &nuget-fix
- |
echo "esecuzione Nuget FIX steps"
dotnet nuget list source
$hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus Proxy"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source "`"Steamware Nexus Proxy`""
}
$hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source "`"Steamware Nexus`""
}
$hasSource = dotnet nuget list source | Select-String -Pattern "nexus-proxy-v3"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source nexus-proxy-v3
}
dotnet nuget add source https://nexus.steamware.net/repository/nuget-group-3/index.json -n "Steamware Nexus" -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text
echo "Steamware Nexus Source added"
# helper creazione hash files
.hashBuild: &hashBuild
- |
$Target = $env:APP_NAME + "\bin\publish\" + $env:APP_NAME + ".zip"
$MD5 = Get-FileHash $Target -Algorithm MD5
$SHA1 = Get-FileHash $Target -Algorithm SHA1
New-Item $Target".md5"
New-Item $Target".sha1"
$MD5.Hash | Set-Content -Path $Target".md5"
$SHA1.Hash | Set-Content -Path $Target".sha1"
echo "Created HASH files for $Target"
# helper x send su NEXUS
.nexusUpload: &nexusUpload
- |
Set-Alias mCurl C:\Windows\system32\curl.exe
$currentDate = get-date -format yyMM;
$currentTime = get-date -format ddHH;
$VersNumb = Get-Content "Resources\VersNum.txt"
echo "Curr Version: $VersNumb"
if($CI_COMMIT_BRANCH -eq "main")
{
$version = "stable"
}
else
{
$version = "unstable"
}
$File2Send = Get-ChildItem($env:APP_NAME + "\bin\publish\*")
ForEach ($File in $File2Send) {
$FileName = Split-Path $File -leaf
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName
}
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html
# helper x fix version number
.version-fix: &version-fix
- |
$env:NEW_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format ddHH)
$env:NUM_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format dHH)
$env:NUM_DEB = $env:VERS_MAIN+"."+(get-date -format yyMM)+"-beta."+(get-date -format dHH)
$env:NEW_COPYRIGHT = "EgalWare @ 2021-" + (get-date -format yyyy)
# display versioni generate
$resoconto = "Effettuato fix file VersGen | release v: " + $env:NUM_REL + " | debug v: " + $env:NUM_DEB;
Write-Output $resoconto;
echo "Replace completati"
# helper x fix nuspec file
.nuspec-fix: &nuspec-fix
- |
echo "Modifica dati file nuspec Release"
$currRelease = $env:NUM_REL
$currDebug = $env:NUM_DEB
$find = "<version>(.|\n)*?</version>";
$fileNameRel = "$env:APP_NAME.Release.nuspec";
$replRel = "<version>" + $currRelease + "</version>";
$nuspDataRel = Get-Content $fileNameRel;
$nuspDataRelUpd = $nuspDataRel -replace $find, $replRel;
$nuspDataRelUpd = $nuspDataRelUpd -replace "#copyright#", $replCopy;
$nuspDataRelUpd = $nuspDataRelUpd -replace "#releaseNotes#", "Build $adesso";
Set-Content -Path $fileNameRel -Value $nuspDataRelUpd;
echo "Modifica dati file nuspec Debug"
$fileNameDeb = "$env:APP_NAME.Debug.nuspec";
$replDeb = "<version>" + $currDebug + "</version>";
$nuspDataDeb = Get-Content $fileNameDeb;
$nuspDataDebUpd = $nuspDataDeb -replace $find, $replDeb;
$nuspDataDebUpd = $nuspDataDebUpd -replace "#copyright#", $replCopy;
$nuspDataDebUpd = $nuspDataDebUpd -replace "#releaseNotes#", "Build $adesso";
Set-Content -Path $fileNameDeb -Value $nuspDataDebUpd;
echo "replace completati"
stages:
- build
- staging
- installer
- release
# --------------------------------
# BUILD
# --------------------------------
MagMan.UI:build:
stage: build
tags:
- win
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
script:
- echo $CI_COMMIT_BRANCH
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
EgwProxy.MagMan:build:
stage: build
tags:
- win
variables:
APP_NAME: EgwProxy.MagMan
SOL_NAME: EgwProxy.MagMan
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'
script:
- echo $CI_COMMIT_BRANCH
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# --------------------------------
# STAGING (nuget beta)
# --------------------------------
EgwProxy.MagMan:staging:
stage: staging
needs: ["EgwProxy.MagMan:build"]
tags:
- win
variables:
CONFIG: Debug
APP_NAME: EgwProxy.MagMan
SOL_NAME: EgwProxy.MagMan
only:
refs:
- develop
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet'
- *version-fix
- *nuspec-fix
script:
# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- dotnet build "$env:APP_NAME\$env:APP_NAME.csproj"
- '& Remove-Item *.nupkg'
- '& $env:NUGET_PATH pack "$env:APP_NAME.Debug.nuspec"'
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
# --------------------------------
# INSTALLER
# --------------------------------
installer:
stage: installer
tags:
- win
only:
- develop
- main
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
needs: ["MagMan.UI:build"]
script:
# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release MagMan.UI/MagMan.UI.csproj -o:publish
# pubblico solo installer Linux x64: https://docs.microsoft.com/en-us/dotnet/core/deploying/
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release MagMan.UI/MagMan.UI.csproj -o:publish -r linux-x64 --self-contained false
# qui il deploy su nexus...
- *hashBuild
- *nexusUpload
# --------------------------------
# RELEASE
# --------------------------------
EgwProxy.MagMan:release:
stage: release
needs: ["EgwProxy.MagMan:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: EgwProxy.MagMan
SOL_NAME: EgwProxy.MagMan
only:
refs:
- SDK
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet'
- *version-fix
- *nuspec-fix
script:
- dotnet build "$env:APP_NAME\$env:APP_NAME.csproj"
- '& Remove-Item *.nupkg'
- '& $env:NUGET_PATH pack "$env:APP_NAME.Release.nuspec"'
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
-108
View File
@@ -1,108 +0,0 @@
variables:
VERS_MAIN: '0.9'
NEXUS_PATH: 'GWMS'
APP_NAME: 'GWMS.UI'
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
.nuget-fix: &nuget-fix
- |
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
if ($hasSource -eq 0) {
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
} else {
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
}
echo $hasSource
# helper creazione hash files
.hashBuild: &hashBuild
- |
$Target = $env:APP_NAME + "\bin\publish\" + $env:APP_NAME + ".zip"
$MD5 = Get-FileHash $Target -Algorithm MD5
$SHA1 = Get-FileHash $Target -Algorithm SHA1
New-Item $Target".md5"
New-Item $Target".sha1"
$MD5.Hash | Set-Content -Path $Target".md5"
$SHA1.Hash | Set-Content -Path $Target".sha1"
echo "Created HASH files for $Target"
# helper x send su NEXUS
.nexusUpload: &nexusUpload
- |
Set-Alias mCurl C:\Windows\system32\curl.exe
$currentDate = get-date -format yyMM;
$currentTime = get-date -format ddHH;
$VersNumb = Get-Content "Resources\VersNum.txt"
echo "Curr Version: $VersNumb"
if($CI_COMMIT_BRANCH -eq "master")
{
$version = "stable"
}
else
{
$version = "unstable"
}
$File2Send = Get-ChildItem($env:APP_NAME + "\bin\publish\*")
ForEach ($File in $File2Send) {
$FileName = Split-Path $File -leaf
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName
}
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html
# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
stages:
- build
- installer
- release
build:
stage: build
tags:
- win
before_script:
- *nuget-fix
- dotnet restore GWMS.sln
script:
- dotnet build -p:Configuration=Release GWMS.UI/GWMS.UI.csproj
installer:
stage: installer
tags:
- win
only:
- develop
- master
needs: ["build"]
before_script:
# - *nuget-fix
# - dotnet restore
script:
# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release GWMS.UI/GWMS.UI.csproj -o:publish
# pubblico solo installer Linux x64: https://docs.microsoft.com/en-us/dotnet/core/deploying/
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release GWMS.UI/GWMS.UI.csproj -o:publish -r linux-x64 --self-contained false
# qui il deploy su nexus...
- *hashBuild
- *nexusUpload
release:
stage: release
tags:
- win
only:
#- feature/Deploy_CI_CD
# - master
- tags
except:
- branches
needs: ["build"]
artifacts:
paths:
- publish/
script:
- dotnet publish -c Release -o ./publish GWMS.UI/GWMS.UI.csproj
+79
View File
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />-->
<providers>
<!--<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />-->
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider>
</providers>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.6.0" newVersion="1.8.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.3" newVersion="7.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.26.1.0" newVersion="3.26.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.3.0.0" newVersion="8.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.8.0" newVersion="1.3.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.8.0" newVersion="1.3.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.3" newVersion="6.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ZstdSharp" publicKeyToken="8d151af33a4ad5cf" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.8.0.0" newVersion="0.8.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Renci.SshNet" publicKeyToken="1cee9f8bde3db106" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2020.0.2.0" newVersion="2020.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,144 @@
using EgwProxy.DataLayer.DbModel;
using EgwProxy.MagMan.DTO;
using NLog;
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Data.Entity.Infrastructure.Design.Executor;
namespace EgwProxy.DataLayer.Controllers
{
public class LogMachineController : IDisposable
{
#region Public Constructors
/// <summary>
/// Init classe
/// </summary>
/// <param name="connString"></param>
public LogMachineController()
{
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Helper conversione a LogMachineDTO
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public static LogMachineDTO ConvToItemDto(LogMachineModel currRec)
{
LogMachineDTO answ = new LogMachineDTO()
{
DtEvent = currRec.DtEvent,
EvType = (MagMan.MachLogTypes)currRec.EvType,
ProjCloudId = currRec.ProjCloudId,
SupervId = currRec.SupervId,
VarValue = currRec.VarValue
};
return answ;
}
public void Dispose()
{
}
/// <summary>
/// Recupero i dati in ordine crescente fino al num max indicato
/// </summary>
/// <param name="numMax"></param>
/// <returns></returns>
public List<LogMachineModel> GetUnsentAsc(int numMax)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
.DbSetLogMac
.Where(x => (x.DtSent == null || x.DtSent < x.DtEvent) && x.ProjCloudId > 0)
.OrderBy(x => x.DtEvent)
.Take(numMax)
.ToList();
}
}
/// <summary>
/// Aggiorna i record indicati inserendo dataora corrente x DtSent
/// </summary>
/// <param name="rec2upd"></param>
/// <returns></returns>
public bool SetDtSent(List<LogMachineModel> rec2upd)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
DateTime adesso = DateTime.Now;
foreach (var item in rec2upd)
{
var currRec = localDbCtx
.DbSetLogMac
.Where(x => (x.DtSent == null || x.DtSent < new DateTime(2000, 1, 1)) && x.LogDbId == item.LogDbId)
.FirstOrDefault();
if (currRec != null)
{
currRec.DtSent = adesso;
}
// indico modificato
localDbCtx.Entry(currRec).State = System.Data.Entity.EntityState.Modified;
}
// Salvataggio finale
localDbCtx.SaveChanges();
}
return done;
}
/// <summary>
/// Cerca di sistemare gli ID di Prod e ProjCloud mancanti
/// </summary>
/// <returns></returns>
public bool TryFixProjCloudId()
{
// init vars
bool fatto = false;
List<List<LogMachineModel>> listBatch = new List<List<LogMachineModel>>();
// vado sul DB
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
var list2proc = localDbCtx
.DbSetLogMac
.Where(x => x.ProjCloudId == 0 && ((int)x.EvType == 1 || (int)x.EvType == 2))
.OrderBy(x => x.DtEvent)
.ToList();
// se ci sono...
if (list2proc != null && list2proc.Count > 0)
{
// chiamo stored...
localDbCtx.Database.ExecuteSqlCommand("call stp_LogMachineFixPid");
}
}
// risultato
return fatto;
}
#endregion Public Methods
#region Private Fields
/// <summary>
/// Istanza logger
/// </summary>
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
@@ -0,0 +1,162 @@
using EgwProxy.DataLayer.DbModel;
using EgwProxy.MagMan.DTO;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.DataLayer.Controllers
{
public class ProdController : IDisposable
{
#region Public Methods
/// <summary>
/// Helper conversione a ProjectDTO
/// </summary>
/// <param name="currRec">record in formato ProdModel</param>
/// <returns></returns>
public static ProjectDTO ConvToDto(ProdModel currRec)
{
// ho valori mancanti che saranno calcolati dal cloud e valori messi a zero di default
ProjectDTO answ = new ProjectDTO()
{
ProjCloudId = currRec.ProjCloudId,
ProjLocalId = currRec.ProdDbId,
ProjExtId = currRec.ProdId,
// è calcolato sul cloud, da token --> machine ID
MachineCloudId = 0,
// è calcolato sul cloud, da token --> KeyNum
KeyNum = 0,
// disponibile solo su PROJ
BTLFileName = "",
PType = (EgwProxy.MagMan.BWType)currRec.PType,
Machine = currRec.Machine,
ProjDescription = currRec.Description,
DtCreated = currRec.DtCreated,
DtLastAction = DateTime.MinValue,
DtSchedule = DateTime.MinValue,
DtStartProd = DateTime.MinValue,
// disponibile solo su PROJ
ListName = "",
ProcTimeEst = 0,
ProcTimeReal = 0,
IsActive = currRec.IsActive,
IsArchived = currRec.IsArchived
};
return answ;
}
public void Dispose()
{
}
/// <summary>
/// Get record by ProdId
/// </summary>
/// <param name="ProdId"></param>
/// <returns></returns>
public ProdModel FindByProdId(int ProdId)
{
ProdModel answ;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = localDbCtx
.DbSetProd
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
}
return answ;
}
/// <summary>
/// Recupero i dati NON sincronizzati in ordine crescente fino al num max indicato
/// </summary>
/// <param name="dtStart"></param>
/// <param name="dtEnd"></param>
/// <returns></returns>
public List<ProdModel> GetUnsentAsc()
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
.DbSetProd
.Where(x => x.ProjCloudId == 0)
.OrderBy(x => x.ProdDbId)
.ToList();
}
}
/// <summary>
/// Update record su DB x ProjectCloudId
/// </summary>
/// <param name="ProdId"></param>
/// <param name="Description"></param>
/// <returns></returns>
public ProdModel UpdateCloudId(int ProdId, int ProjCloudId)
{
// cerco specifico Proj
ProdModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.DbSetProd
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
if (currData != null)
{
try
{
// aggiorno valore BTL
currData.ProjCloudId = ProjCloudId;
// salvo record PROD
localDbCtx.SaveChanges();
// cerco se ci siano projects collegati ed aggiorno pure loro...
var projList = localDbCtx
.DbSetProj
.Where(x => x.ProdDbId == currData.ProdDbId)
.ToList();
if (projList != null)
{
foreach (var item in projList)
{
item.ProjCloudId = ProjCloudId;
}
// salvo modifihce ai PROJ
localDbCtx.SaveChanges();
}
}
catch (Exception exc)
{
string errMessage = $"EXCEPTION on Prod.UpdateCloudId:{Environment.NewLine}{exc}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
else
{
string errMessage = $"ERROR on Prod.UpdateCloudId: req item was not found | ProdId {ProdId} | ProjCloudId {ProjCloudId}";
Console.WriteLine(errMessage);
Log.Error(errMessage);
}
}
return currData;
}
#endregion Public Methods
#region Private Fields
/// <summary>
/// Istanza logger
/// </summary>
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
+26
View File
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.DataLayer.Core
{
public class MachLog
{
public enum MachLogTypes
{
NULL = 0
, PART_STATUS = 1
, MACHGROUP_STATUS = 2
, MACHINE_MODE = 3
, MACHINE_STATUS = 4
, MACHINE_COMMAND = 5
, READ_VAR = 6
, WRITE_VAR = 7
, ALARM = 8
, OPERATOR_MSG = 9
, PROGRAM_SEND = 10
}
}
}
+44
View File
@@ -0,0 +1,44 @@
using EgwProxy.DataLayer.DbModel;
using MySql.Data.EntityFramework;
using NLog;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.DataLayer
{
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public partial class DatabaseContext : DbContext
{
#region Public Constructors
public DatabaseContext(string currConnString) : base(currConnString)
{
connString = currConnString;
}
#endregion Public Constructors
#region Public Properties
public virtual DbSet<LogMachineModel> DbSetLogMac { get; set; }
public DbSet<ProdModel> DbSetProd { get; set; }
public DbSet<ProjModel> DbSetProj { get; set; }
#endregion Public Properties
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private string connString = "";
#endregion Private Fields
}
}
+35
View File
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.DataLayer
{
public static class DbConfig
{
public static string DATABASE_NAME = "EgtBwDb";
public static int DATABASE_PROCESS_TIMEOUT = 5;
public static string DATABASE_PWD = "viacremasca";
// Database config
public static string DATABASE_SERV = "127.0.0.1";
public static string DATABASE_USER = "EgtUser";
/// <summary>
/// DB Connection string per azioni amministrative:
/// aggiunto parametro "allow user variables", da https://forums.mysql.com/read.php?38,609672,610320#msg-610320
/// </summary>
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
/// <summary>
/// DB Connection string, per effettuare migration riportare valore connessione admin cablato
/// DB Manu: server=localhost;port=3306;database=EgtBwDb_000102;uid=root;pwd=Egalware_24068!;
/// DB Sam: server=localhost;port=3306;database=EgtBwDb_000470;uid=root;pwd=Egalware_24068!;
/// DB Lovato: server=localhost;port=3306;database=EgtBwDb_000656;uid=root;pwd=Egalware_24068!;
/// </summary>
public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000656;uid=root;pwd=Egalware_24068!";
}
}
@@ -0,0 +1,68 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EgwProxy.DataLayer.DbModel
{
/// <summary>
/// Tabella dei LOG Macchina
/// </summary>
[Table("LogMachine")]
public class LogMachineModel
{
#region Public Properties
/// <summary>
/// Chiave primaria evento LOG
/// </summary>
[Key, Column("DbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int LogDbId { get; set; }
/// <summary>
/// Stato da enum Core
/// </summary>
[Column("EvType")]
public Core.MachLog.MachLogTypes EvType { get; set; } = Core.MachLog.MachLogTypes.NULL;
/// <summary>
/// Data Evento
/// </summary>
[Column("DtEvent")]
public DateTime DtEvent { get; set; } = DateTime.Now;
/// <summary>
/// Key prod attivo (DB locale)
/// </summary>
[Column("ProdId")]
public int ProdId { get; set; } = 0;
/// <summary>
/// Key progetto (cloud)
/// </summary>
[Column("ProjCloudId")]
public int ProjCloudId { get; set; } = 0;
/// <summary>
/// ID Supervisore (Indirizzo VAR)
/// </summary>
[Column("SupervId")]
public string SupervId { get; set; } = "";
/// <summary>
/// Valore VAR (oggetto del log da decodificare)
/// </summary>
[Column("VarValue")]
public string VarValue { get; set; } = "";
/// <summary>
/// Data di invio evento (su cloud)
/// </summary>
[Column("DtSent")]
public DateTime? DtSent { get; set; } = null;
#endregion Public Properties
}
}
+119
View File
@@ -0,0 +1,119 @@
using EgwProxy.MagMan;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.DataLayer.DbModel
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
/// <summary>
/// Tabella deiu raggruppamenti PROJ in forma di PROD
/// </summary>
[Table("ProdList")]
public class ProdModel
{
#region Public Properties
public ProdModel()
{
ProjListNav = new HashSet<ProjModel>();
}
/// <summary>
/// Chiave univoca DB
/// </summary>
[Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ProdDbId { get; set; }
[Column("Description")]
public string Description { get; set; } = "";
/// <summary>
/// Data Creazione
/// </summary>
[Index]
[Column("DtCreated")]
public DateTime DtCreated { get; set; }
/// <summary>
/// Stato NEW = creato ma NON salvato
/// </summary>
[Column("IsNew")]
public bool IsNew { get; set; } = true;
/// <summary>
/// Stato locked, quando aperto da un dispositivo in rete
/// </summary>
[Column("Lock")]
public bool Locked { get; set; } = false;
/// <summary>
/// Chiave univoca per EgtBM
/// </summary>
[Column("Id")]
[Index]
public int ProdId { get; set; }
/// <summary>
/// Codice Proj per sync info (Identificativo DB esterno del magazzino in sync)
/// </summary>
public int ProjCloudId { get; set; } = 0;
/// <summary>
/// Tipologia del progetto (Travi, Pareti, ...)
/// </summary>
public BWType PType { get; set; } = BWType.NULL;
/// <summary>
/// Macchina
/// </summary>
[Column("Machine")]
public string Machine { get; set; } = "";
/// <summary>
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
/// </summary>
[Column("LockedBy")]
public string LockedBy { get; set; } = "";
/// <summary>
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un dispositivo in rete
/// </summary>
[Column("LockDate")]
public DateTime LockDate { get; set; } = DateTime.MinValue;
/// <summary>
/// Record attivo (se false == cancellazione logica)
/// </summary>
[Index]
[Column("IsDeleted")]
public bool IsActive { get; set; } = true;
/// <summary>
/// Stato Prodotto = inviato ALMENO UNA VOLTA al supervisore --> NON eliminabile se non in modo logico
/// </summary>
[Index]
[Column("IsProduced")]
public bool IsProduced { get; set; } = false;
/// <summary>
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto
/// </summary>
[Index]
[Column("IsArchived")]
public bool IsArchived { get; set; } = false;
/// <summary>
/// Collezione oggetti Proj associati (almeno 1 by design)
/// </summary>
public virtual ICollection<ProjModel> ProjListNav { get; set; }
#endregion Public Properties
}
}
+125
View File
@@ -0,0 +1,125 @@
using EgwProxy.MagMan;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.DataLayer.DbModel
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
/// <summary>
/// Tabella dei PROJ caricati dal BTL
/// </summary>
[Table("ProjList")]
public class ProjModel
{
#region Public Properties
[Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ProjDbId { get; set; }
[Column("BTLFileName")]
public string BTLFileName { get; set; } = "";
/// <summary>
/// Data Creazione
/// </summary>
[Column("DtCreated")]
[Index]
public DateTime DtCreated { get; set; }
/// <summary>
/// Data Esportazione
/// </summary>
[Column("DtExported")]
[Index]
public DateTime DtExported { get; set; }
/// <summary>
/// Stato NEW = creato ma NON salvato
/// </summary>
[Index]
[Column("IsNew")]
public bool IsNew { get; set; } = true;
/// <summary>
/// ListName del BTL
/// </summary>
[Column("ListName")]
public string ListName { get; set; } = "";
/// <summary>
/// Stato locked (quando aperto da un dispositivo in rete)
/// </summary>
[Column("Lock")]
public bool Locked { get; set; } = false;
[Column("ProdDbId")]
public int? ProdDbId { get; set; }
/// <summary>
/// ID da modello ext
/// </summary>
[Column("Id")]
[Index]
public int ProjId { get; set; }
/// <summary>
/// Codice Proj per sync info (Identificativo DB esterno del magazzino in sync)
/// </summary>
public int ProjCloudId { get; set; } = 0;
/// <summary>
/// Tipologia del progetto (Travi, Pareti, ...)
/// </summary>
public BWType PType { get; set; } = BWType.NULL;
/// <summary>
/// Macchina
/// </summary>
[Column("Machine")]
public string Machine { get; set; } = "";
/// <summary>
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
/// </summary>
[Column("LockedBy")]
public string LockedBy { get; set; } = "";
/// <summary>
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un
/// dispositivo in rete
/// </summary>
[Column("LockDate")]
public DateTime LockDate { get; set; } = DateTime.MinValue;
/// <summary>
/// Record attivo (se false == cancellazione logica)
/// </summary>
[Index]
[Column("IsDeleted")]
public bool IsActive { get; set; } = true;
/// <summary>
/// Descrizione progetto (copiata da BTLFileName inizialmente)
/// </summary>
[Column("ProjDescription")]
public string ProjDescription { get; set; } = "";
/// <summary>
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto
/// </summary>
[Index]
[Column("IsArchived")]
public bool IsArchived { get; set; } = false;
[ForeignKey("ProdDbId")]
public virtual ProdModel Prod { get; set; }
#endregion Public Properties
}
}
@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{87935FC9-C1BC-4984-83CA-A9EDABBE2228}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EgwProxy.DataLayer</RootNamespace>
<AssemblyName>EgwProxy.DataLayer</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.3.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.26.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.26.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.8\lib\net462\K4os.Compression.LZ4.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.8\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
</Reference>
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.3.0\lib\net462\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.EntityFramework, Version=8.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.EntityFramework.8.3.0\lib\net462\MySql.Data.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.3.1\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet, Version=2020.0.2.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2020.0.2\lib\net40\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.ConfigurationManager, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Configuration.ConfigurationManager.4.4.1\lib\net461\System.Configuration.ConfigurationManager.dll</HintPath>
</Reference>
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.7.0.2\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Pipelines, Version=6.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.6.0.3\lib\net461\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="ZstdSharp, Version=0.8.0.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
<HintPath>..\packages\ZstdSharp.Port.0.8.0\lib\net462\ZstdSharp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\LogMachineController.cs" />
<Compile Include="Controllers\ProdController.cs" />
<Compile Include="Core\MachLog.cs" />
<Compile Include="DatabaseContext.cs" />
<Compile Include="DbConfig.cs" />
<Compile Include="DbModel\LogMachineModel.cs" />
<Compile Include="DbModel\ProdModel.cs" />
<Compile Include="DbModel\ProjModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EgwProxy.MagMan\EgwProxy.MagMan.csproj">
<Project>{1696d7a5-765a-4d25-8d29-ca7345023479}</Project>
<Name>EgwProxy.MagMan</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
</Target>
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
</Project>
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EgwProxy.DataLayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EgwProxy.DataLayer")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("87935fc9-c1bc-4984-83ca-a9edabbe2228")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle.Cryptography" version="2.3.0" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net472" />
<package id="Google.Protobuf" version="3.26.1" targetFramework="net472" />
<package id="K4os.Compression.LZ4" version="1.3.8" targetFramework="net472" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.8" targetFramework="net472" />
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.0" targetFramework="net472" />
<package id="MySql.Data" version="8.3.0" targetFramework="net472" />
<package id="MySql.Data.EntityFramework" version="8.3.0" targetFramework="net472" />
<package id="NLog" version="5.3.1" targetFramework="net472" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" />
<package id="SSH.NET" version="2020.0.2" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Configuration.ConfigurationManager" version="4.4.1" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="7.0.2" targetFramework="net472" />
<package id="System.IO.Pipelines" version="6.0.3" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="ZstdSharp.Port" version="0.8.0" targetFramework="net472" />
</packages>
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>EgwProxy.MagMan</id>
<version>#version#</version>
<title>EgwProxy.MagMan</title>
<authors>Samuele E. Locatelli, EgalWare</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<description>Libreria per comunicazione REST con server MagMan online/onsite per EgtBW - beta/unstable</description>
<releaseNotes>#releaseNotes#</releaseNotes>
<copyright>#copyright#</copyright>
<tags>EgwProxy.MagMan MagMan Rest</tags>
<dependencies>
<dependency id="RestSharp" version="110.2.0.0" />
<dependency id="Newtonsoft.Json" version="13.0.0.0" />
</dependencies>
</metadata>
<files>
<file src="EgwProxy.MagMan\bin\Debug\EgwProxy.MagMan*.dll" target="lib" />
<file src="EgwProxy.MagMan\bin\Debug\EgwProxy.MagMan*.config" target="lib" />
<file src="EgwProxy.MagMan\bin\Debug\EgwProxy.MagMan*.pdb" target="lib" />
</files>
</package>
+23
View File
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>EgwProxy.MagMan</id>
<version>#version#</version>
<title>EgwProxy.MagMan</title>
<authors>Samuele E. Locatelli, EgalWare</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<description>Libreria per comunicazione REST con server MagMan online/onsite per EgtBW</description>
<releaseNotes>#releaseNotes#</releaseNotes>
<copyright>#copyright#</copyright>
<tags>EgwProxy.MagMan MagMan Rest</tags>
<dependencies>
<dependency id="RestSharp" version="110.2.0.0" />
<dependency id="Newtonsoft.Json" version="13.0.0.0" />
</dependencies>
</metadata>
<files>
<file src="EgwProxy.MagMan\bin\Debug\EgwProxy.MagMan*.dll" target="lib" />
<file src="EgwProxy.MagMan\bin\Debug\EgwProxy.MagMan*.config" target="lib" />
</files>
</package>
+43
View File
@@ -0,0 +1,43 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34408.163
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestConsoleApp", "TestConsoleApp\TestConsoleApp.csproj", "{57626C9A-AAE0-4A43-A7E9-610320DD9D31}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwProxy.MagMan", "EgwProxy.MagMan\EgwProxy.MagMan.csproj", "{1696D7A5-765A-4D25-8D29-CA7345023479}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TestWinFormVB", "TestWinFormVB\TestWinFormVB.vbproj", "{665C94F5-27A6-4CD0-9487-036D199CDC47}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwProxy.DataLayer", "EgwProxy.DataLayer\EgwProxy.DataLayer.csproj", "{87935FC9-C1BC-4984-83CA-A9EDABBE2228}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{57626C9A-AAE0-4A43-A7E9-610320DD9D31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{57626C9A-AAE0-4A43-A7E9-610320DD9D31}.Debug|Any CPU.Build.0 = Debug|Any CPU
{57626C9A-AAE0-4A43-A7E9-610320DD9D31}.Release|Any CPU.ActiveCfg = Release|Any CPU
{57626C9A-AAE0-4A43-A7E9-610320DD9D31}.Release|Any CPU.Build.0 = Release|Any CPU
{1696D7A5-765A-4D25-8D29-CA7345023479}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1696D7A5-765A-4D25-8D29-CA7345023479}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1696D7A5-765A-4D25-8D29-CA7345023479}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1696D7A5-765A-4D25-8D29-CA7345023479}.Release|Any CPU.Build.0 = Release|Any CPU
{665C94F5-27A6-4CD0-9487-036D199CDC47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{665C94F5-27A6-4CD0-9487-036D199CDC47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{665C94F5-27A6-4CD0-9487-036D199CDC47}.Release|Any CPU.ActiveCfg = Release|Any CPU
{665C94F5-27A6-4CD0-9487-036D199CDC47}.Release|Any CPU.Build.0 = Release|Any CPU
{87935FC9-C1BC-4984-83CA-A9EDABBE2228}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87935FC9-C1BC-4984-83CA-A9EDABBE2228}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87935FC9-C1BC-4984-83CA-A9EDABBE2228}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87935FC9-C1BC-4984-83CA-A9EDABBE2228}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1A62D7FE-522B-4154-9525-DD9C529BF49B}
EndGlobalSection
EndGlobal
+26
View File
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.MagMan.DTO
{
public class AliasDTO
{
/// <summary>
/// Codice originale (da trasformare)
/// </summary>
public string ValOrig { get; set; } = "";
/// <summary>
/// Codice Alias in cui viene convertito
/// </summary>
public string ValAlias { get; set; } = "";
/// <summary>
/// Indica se il record sia attivo/valido (per cancellazione logica online e fisica in remoto)
/// </summary>
public bool IsActive { get; set; } = true;
}
}
+72
View File
@@ -0,0 +1,72 @@
namespace EgwProxy.MagMan.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ItemDTO
{
/// <summary>
/// Ext Ref Key Materiale (DB) / CLOUD
/// </summary>
public int MatCloudId { get; set; } = 0;
/// <summary>
/// Ext Ref Key Materiale (DB) / istanza locale
/// </summary>
public int MatLocalId { get; set; } = 0;
/// <summary>
/// Primary Key del RawItem (DB) / CLOUD
/// </summary>
public int RawItemCloudId { get; set; } = 0;
/// <summary>
/// Primary Key RawItem (DB) / istanza locale
/// </summary>
public int RawItemLocalId { get; set; } = 0;
/// <summary>
/// Boolean for logical delete
/// </summary>
public bool IsDeleted { get; set; } = false;
/// <summary>
/// Check if is a Remnant
/// </summary>
public bool IsRemn { get; set; } = false;
/// <summary>
/// Location
/// </summary>
public string Location { get; set; } = "";
/// <summary>
/// Qty available on wharehouse
/// </summary>
public int QtyAvail { get; set; } = 0;
/// <summary>
/// Item's Height/Thikness/Spessore
/// </summary>
public decimal HMm { get; set; } = 0;
/// <summary>
/// Item's Lenght
/// </summary>
public decimal LMm { get; set; } = 0;
/// <summary>
/// Item's Width
/// </summary>
public decimal WMm { get; set; } = 0;
/// <summary>
/// Note
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// Codice QR/Matrix Item
/// </summary>
public string ItemDtmx { get; set; } = "";
}
}
+37
View File
@@ -0,0 +1,37 @@
using System;
namespace EgwProxy.MagMan.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class LogMachineDTO
{
/// <summary>
/// Key progetto (DB) / CLOUD
/// </summary>
public int ProjCloudId { get; set; } = 0;
/// <summary>
/// Stato da enum
/// </summary>
public MachLogTypes EvType { get; set; } = MachLogTypes.NULL;
/// <summary>
/// Data Evento
/// </summary>
public DateTime DtEvent { get; set; } = DateTime.Now;
/// <summary>
/// ID Supervisore (Indirizzo VAR)
/// </summary>
public string SupervId { get; set; } = "";
/// <summary>
/// Valore VAR (oggetto del log da decodificare)
/// </summary>
public string VarValue { get; set; } = "";
}
}
+81
View File
@@ -0,0 +1,81 @@
using System.Collections.Generic;
namespace EgwProxy.MagMan.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class MaterialDTO
{
/// <summary>
/// Codice Univoco (DB) sul CLOUD
/// </summary>
public int MatCloudId { get; set; } = 0;
/// <summary>
/// Primary Key Materiale (DB) / istanza locale
/// </summary>
public int MatLocalId { get; set; } = 0;
/// <summary>
/// Codice materiale (esterno)
/// </summary>
public string MatCode { get; set; } = "";
/// <summary>
/// Descrizione materiale
/// </summary>
public string MatDesc { get; set; } = "";
/// <summary>
/// Height/Thikness/Spessore in mm
/// </summary>
public decimal HMm { get; set; } = 0;
/// <summary>
/// Lenght/Lunghezza in mm
/// </summary>
public decimal LMm { get; set; } = 0;
/// <summary>
/// Width/Larghezza in mm
/// </summary>
public decimal WMm { get; set; } = 0;
/// <summary>
/// Varianti dimensionali disponibili
/// </summary>
public int SizeNum { get; set; } = 0;
/// <summary>
/// Quantità totale in giacenza
/// </summary>
public decimal QtyTot { get; set; } = 0;
public string UM
{
get => IsBeam ? "m" : "m2";
}
/// <summary>
/// Codice QR/Matrix materiale
/// </summary>
public string MatDtmx { get; set; } = "";
/// <summary>
/// Verifica che sia Beam, quando L == 0
/// </summary>
public bool IsBeam { get; set; } = false;
/// <summary>
/// Verifica che sia Wall, quando W/L == 0
/// </summary>
public bool IsWall { get; set; } = false;
/// <summary>
/// Elenco item e giancenze
/// </summary>
public List<ItemDTO> ItemList { get; set; } = new List<ItemDTO>();
}
}
+102
View File
@@ -0,0 +1,102 @@
using System;
namespace EgwProxy.MagMan.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ProjectDTO
{
/// <summary>
/// Key progetto (DB) / CLOUD
/// </summary>
public int ProjCloudId { get; set; }
/// <summary>
/// ID del DB EgtBW, univoco con KeyNum, (DB) / istanza locale
/// </summary>
public int ProjLocalId { get; set; } = 0;
/// <summary>
/// ID esterno (da EgtBW)
/// </summary>
public int ProjExtId { get; set; } = 0;
/// <summary>
/// Descrizione progetto (copiata da BTLFileName inizialmente)
/// </summary>
public string ProjDescription { get; set; } = "";
/// <summary>
/// Nome file BTL originale
/// </summary>
public string BTLFileName { get; set; } = "";
/// <summary>
/// Data Creazione progetto
/// </summary>
public DateTime DtCreated { get; set; } = DateTime.Now;
/// <summary>
/// Data ora ultima operazione registrata
/// </summary>
public DateTime DtLastAction { get; set; } = DateTime.MinValue;
/// <summary>
/// Data di schedulazione (prevista)
/// </summary>
public DateTime DtSchedule { get; set; } = DateTime.Today.AddMonths(3);
/// <summary>
/// Data Inizio Produzione
/// </summary>
public DateTime DtStartProd { get; set; } = DateTime.MinValue;
/// <summary>
/// Record attivo (se false == cancellazione logica)
/// </summary>
public bool IsActive { get; set; } = true;
/// <summary>
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto/chiuso
/// </summary>
public bool IsArchived { get; set; } = false;
/// <summary>
/// Key di riferimento per il progetto
/// </summary>
public int KeyNum { get; set; } = 0;
/// <summary>
/// ListName del BTL
/// </summary>
public string ListName { get; set; } = "";
/// <summary>
/// Macchina (Costruttore/Modello)
/// </summary>
public string Machine { get; set; } = "";
/// <summary>
/// Id macchina (MagMan) DB / CLOUD
/// </summary>
public int MachineCloudId { get; set; } = 0;
/// <summary>
/// Tempo lavorazione previsto (stima) in minuti
/// </summary>
public double ProcTimeEst { get; set; } = 0;
/// <summary>
/// Tempo lavorazione reale in minuti (parziale o totale se chiuso/completato/archiviato)
/// </summary>
public double ProcTimeReal { get; set; } = 0;
/// <summary>
/// Tipologia del progetto (Travi, Pareti, ...)
/// </summary>
public BWType PType { get; set; } = BWType.NULL;
}
}
+36
View File
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.MagMan.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ProjectProgrDTO
{
/// <summary>
/// Key progetto (DB) / CLOUD
/// </summary>
public int ProjCloudId { get; set; }
/// <summary>
/// Avanzamento (tipicamente barre fatte)
/// </summary>
public double ValAct { get; set; } = 0;
/// <summary>
/// Valore finale atteso (tipicamente barre da fare)
/// </summary>
public double ValMax { get; set; } = 1;
/// <summary>
/// Tempo lavorazione reale in minuti (parziale o totale se chiuso/completato/archiviato)
/// </summary>
public double ProcTimeReal { get; set; } = 0;
}
}
+24
View File
@@ -0,0 +1,24 @@
namespace EgwProxy.MagMan.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ResourceDTO
{
/// <summary>
/// Primary Key RawItem (DB) / CLOUD
/// </summary>
public int RawItemCloudId { get; set; } = 0;
/// <summary>
/// Primary Key RawItem (DB) / istanza locale
/// </summary>
public int RawItemLocalId { get; set; } = 0;
/// <summary>
/// Qty, se > 0 rappresenta un IMPEGNO di qualsiasi tipo, se < 0 è un CONSUMO
/// </summary>
public int Qty { get; set; } = 0;
}
}
+75
View File
@@ -0,0 +1,75 @@
using System;
namespace EgwProxy.MagMan.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ResourceExpDTO
{
/// <summary>
/// ID risorsa (DB) / CLOUD
/// </summary>
public int ResourceCloudId { get; set; }
/// <summary>
/// Riferimento richiesta parent
/// </summary>
public int RequestId { get; set; } = 0;
/// <summary>
/// Ext ref for Material (DB) / CLOUD
/// </summary>
public int MatCloudId { get; set; } = 0;
/// <summary>
/// Ext ref for Material (DB) / CLOUD
/// </summary>
public int RawItemCloudId { get; set; } = 0;
/// <summary>
/// Primary Key RawItem (DB) / istanza locale
/// </summary>
public int RawItemLocalId { get; set; } = 0;
/// <summary>
/// Qty, se > 0 rappresenta un IMPEGNO di qualsiasi tipo, se < 0 è un CONSUMO
/// </summary>
public int Qty { get; set; } = 0;
/// <summary>
/// Check if is a Remnant
/// </summary>
public bool IsRemn { get; set; } = false;
/// <summary>
/// Item's Height (Thikness/Spessore) in mm
/// </summary>
public decimal HMm { get; set; } = 0;
/// <summary>
/// Item's Lenght
/// </summary>
public decimal LMm { get; set; } = 0;
/// <summary>
/// Item's Width
/// </summary>
public decimal WMm { get; set; } = 0;
/// <summary>
/// Note (optional)
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// Data richiesta
/// </summary>
public DateTime DtRequest { get; set; }
/// <summary>
/// record richiesto (me lo aspetto sempre a false se viene inviato/registrato...)
/// </summary>
public bool IsDeleted { get; set; } = false;
}
}
File diff suppressed because it is too large Load Diff
+102
View File
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1696D7A5-765A-4D25-8D29-CA7345023479}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EgwProxy.MagMan</RootNamespace>
<AssemblyName>EgwProxy.MagMan</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.1\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=111.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.111.2.0\lib\net471\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=8.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.8.0.3\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DataSyncro.cs" />
<Compile Include="DTO\AliasDTO.cs" />
<Compile Include="DTO\ItemDTO.cs" />
<Compile Include="DTO\MaterialDTO.cs" />
<Compile Include="DTO\ProjectDTO.cs" />
<Compile Include="DTO\LogMachineDTO.cs" />
<Compile Include="DTO\ProjectProgrDTO.cs" />
<Compile Include="DTO\ResourceDTO.cs" />
<Compile Include="DTO\ResourceExpDTO.cs" />
<Compile Include="Enums.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RestPayload.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+58
View File
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.MagMan
{
public enum BWType
{
NULL = 0,
BEAM = 1,
WALL = 2
}
public enum MachLogTypes
{
NULL = 0
, PART_STATUS = 1
, MACHGROUP_STATUS = 2
, MACHINE_MODE = 3
, MACHINE_STATUS = 4
, MACHINE_COMMAND = 5
, READ_VAR = 6
, WRITE_VAR = 7
, ALARM = 8
, OPERATOR_MSG = 9
, PROGRAM_SEND = 10
}
public enum ProjResState
{
/// <summary>
/// Registrazione consumo effettivo (update giacenza su tab RawItemList)
/// </summary>
Consumed = -1,
/// <summary>
/// Non definito
/// </summary>
ND = 0,
/// <summary>
/// Consumo stimato da nesting (solo simulazione)
/// </summary>
Estimated,
/// <summary>
/// Consumo confermato (da ordinare)
/// </summary>
Confirmed,
/// <summary>
/// Riservato (utile x calcolo quantità da ordinare)
/// </summary>
Reserved
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EgwProxy.MagMan")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EgwProxy.MagMan")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1696d7a5-765a-4d25-8d29-ca7345023479")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+128
View File
@@ -0,0 +1,128 @@
using EgwProxy.MagMan.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.MagMan
{
public class RestPayload
{
#region Public Classes
public class Alias
{
#region Public Properties
/// <summary>
/// Elenco decodifica Alias Materiali x invio POST
/// </summary>
public List<AliasDTO> AliasList { get; set; } = new List<AliasDTO>();
#endregion Public Properties
}
public class Items
{
#region Public Properties
/// <summary>
/// Elenco Items x invio POST
/// </summary>
public List<ItemDTO> ItemList { get; set; }
#endregion Public Properties
}
public class LogData
{
#region Public Properties
/// <summary>
/// Elenco record log x invio POST
/// </summary>
public List<LogMachineDTO> LogList { get; set; }
#endregion Public Properties
}
public class Materials
{
#region Public Properties
/// <summary>
/// Elenco materiali x invio POST
/// </summary>
public List<MaterialDTO> MatList { get; set; }
#endregion Public Properties
}
public class PeriodData
{
#region Public Properties
public DateTime DtEnd { get; set; } = DateTime.Now;
public DateTime DtStart { get; set; } = DateTime.Now;
#endregion Public Properties
}
public class ProdInfoData
{
#region Public Properties
public ProjectProgrDTO ProjectProgress { get; set; }
#endregion Public Properties
}
public class Projects
{
#region Public Properties
public ProjectDTO Project { get; set; }
#endregion Public Properties
}
public class ProjStatusData
{
#region Public Properties
public Dictionary<int, bool> ProjStatusList { get; set; }
#endregion Public Properties
}
public class Resources
{
#region Public Properties
/// <summary>
/// DataOra richiesta (data-ora del client)
/// </summary>
public DateTime DtReq { get; set; } = DateTime.Now;
/// <summary>
/// ID progetto univoco su Cloud
/// </summary>
public int ProjCloudId { get; set; } = 0;
/// <summary>
/// Tipo di registrazione dato inviata (previsione consumo, consumo effettivo...)
/// </summary>
public ProjResState ReqState { get; set; } = ProjResState.ND;
/// <summary>
/// Elenco Risorse x invio POST
/// </summary>
public List<ResourceDTO> ResourceList { get; set; }
#endregion Public Properties
}
#endregion Public Classes
}
}
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-110.1.0.0" newVersion="110.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.3" newVersion="7.0.0.3" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="NLog" version="5.0.1" targetFramework="net472" />
<package id="RestSharp" version="111.2.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="8.0.3" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>
+26
View File
@@ -0,0 +1,26 @@
# Note ed utility per GIT
Comandi utili x GIT.
Ad esempio per semplificare il processo di creazione del changelog (allegato al file readme del progetto e in versione ridotta nel sw)
```bash
git log --branches --remotes --full-history --date-order --format='%ai%d %an <%ae> | %h | %f' > .temp/CommitLogHistory.txt
```
Questo produrrà un file come il seguente
```csv
2024-07-30 15:02:15 +0200 (HEAD -> develop, origin/develop) Samuele Locatelli <samuele@steamware.net> | 0cebf0a | Merge-tag-FixRedisMasterFlush01-into-develop
2024-07-30 15:02:08 +0200 (tag: FixRedisMasterFlush01, origin/main, origin/HEAD, main) Samuele Locatelli <samuele@steamware.net> | 46a0c55 | Merge-branch-release-FixRedisMasterFlush01
2024-07-30 15:01:41 +0200 Samuele Locatelli <samuele@steamware.net> | e8b9770 | Completato-review-gestione-cache-redis-x-MagMan
2024-07-30 14:44:38 +0200 Samuele Locatelli <samuele@steamware.net> | 6bd3686 | Continuo-riscrittura-metodi-gestione-redis-cache-su-classi-separate
2024-07-29 09:41:05 +0200 Samuele Locatelli <samuele@steamware.net> | 83ed7d9 | Merge-tag-TestSentinelGalera01-into-develop
2024-07-29 09:40:00 +0200 (tag: TestSentinelGalera01) Samuele Locatelli <samuele@steamware.net> | 9054d42 | Merge-branch-release-TestSentinelGalera01
2024-07-29 09:39:26 +0200 Samuele Locatelli <samuele@steamware.net> | 08e54ff | Update-conf-x-usare-sentinel-localhost-e-db-locale-galera-cluster
```
Che poi si può usare x generare un chagnelog accurato
PS: il file è escluso da gitignore come tutti quelli in folder .temp
BIN
View File
Binary file not shown.
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Core
{
//// <Auto-Generated>
//// This is here so CodeMaid doesn't reorganize this document
//// </Auto-Generated>
public class Const
{
// dati conf REDIS Cache
public static readonly string BASE_PATH = Directory.GetCurrentDirectory();
public const string passPhrase = "9eb4660f-8753-46bc-b23b-08759ba03fe9";
// classi utilità x cache REDIS dati DB
public const string redisBaseAddr = "MagManUi";
public const string rKeyConfig = $"{redisBaseAddr}:Cache";
// REDIS Channels messaggi x QueueMan
public static readonly string Q_MMAN_GEN = $"MagManGeneral";
public static readonly string Q_MMAN_ALIAS_MAT = $"MagManAliasMaterial";
public static readonly string Q_MMAN_INVE = $"MagManInve";
public static readonly string Q_MMAN_LOG = $"MagManLog";
public static readonly string Q_MMAN_PROJ = $"MagManProj";
public static readonly string Q_MMAN_RES = $"MagManRes";
}
}
+26
View File
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Core.DTO
{
public class AliasDTO
{
/// <summary>
/// Codice originale (da trasformare)
/// </summary>
public string ValOrig { get; set; } = "";
/// <summary>
/// Codice Alias in cui viene convertito
/// </summary>
public string ValAlias { get; set; } = "";
/// <summary>
/// Indica se il record sia attivo/valido (per cancellazione logica online e fisica in remoto)
/// </summary>
public bool IsActive { get; set; } = true;
}
}
+80
View File
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ItemDTO
{
/// <summary>
/// Ext Ref Key Materiale (DB) / CLOUD
/// </summary>
public int MatCloudId { get; set; } = 0;
/// <summary>
/// Ext Ref Key Materiale (DB) / istanza locale
/// </summary>
public int MatLocalId { get; set; } = 0;
/// <summary>
/// Primary Key del RawItem di riferimento (se zero da verificare con quote) / CLOUD
/// </summary>
public int RawItemCloudId { get; set; } = 0;
/// <summary>
/// Primary Key RawItem (DB) / istanza locale
/// </summary>
public int RawItemLocalId { get; set; } = 0;
/// <summary>
/// Boolean for logical delete
/// </summary>
public bool IsDeleted { get; set; } = false;
/// <summary>
/// Check if is a Remnant
/// </summary>
public bool IsRemn { get; set; } = false;
/// <summary>
/// Location
/// </summary>
public string Location { get; set; } = "";
/// <summary>
/// Qty available on wharehouse
/// </summary>
public int QtyAvail { get; set; } = 0;
/// <summary>
/// Item's Thikness
/// </summary>
public decimal HMm { get; set; } = 0;
/// <summary>
/// Item's Lenght
/// </summary>
public decimal LMm { get; set; } = 0;
/// <summary>
/// Item's Width
/// </summary>
public decimal WMm { get; set; } = 0;
/// <summary>
/// Note (optional)
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// Codice QR/Matrix Item
/// </summary>
public string ItemDtmx { get; set; } = "";
}
}
+41
View File
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class LogMachineDTO
{
/// <summary>
/// Key progetto (DB) / CLOUD
/// </summary>
public int ProjCloudId { get; set; } = 0;
/// <summary>
/// Stato da enum
/// </summary>
public Enums.MachLogTypes EvType { get; set; } = Enums.MachLogTypes.NULL;
/// <summary>
/// Data Evento
/// </summary>
public DateTime DtEvent { get; set; } = DateTime.Now;
/// <summary>
/// ID Supervisore (Indirizzo VAR)
/// </summary>
public string SupervId { get; set; } = "";
/// <summary>
/// Valore VAR (oggetto del log) da decodificare
/// </summary>
public string VarValue { get; set; } = "";
}
}
+80
View File
@@ -0,0 +1,80 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace MagMan.Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class MaterialDTO
{
/// <summary>
/// Primary Key Materiale (DB) / CLOUD
/// </summary>
public int MatCloudId { get; set; } = 0;
/// <summary>
/// Primary Key Materiale (DB) / istanza locale
/// </summary>
public int MatLocalId { get; set; } = 0;
/// <summary>
/// Codice Materiale
/// </summary>
public string MatCode { get; set; } = "";
/// <summary>
/// Descrizione materiale
/// </summary>
public string MatDesc { get; set; } = "";
/// <summary>
/// Thikness/Spessore in mm
/// </summary>
public decimal HMm { get; set; } = 0;
/// <summary>
/// Lenght/Lunghezza in mm
/// </summary>
public decimal LMm { get; set; } = 0;
/// <summary>
/// Width/Larghezza in mm
/// </summary>
public decimal WMm { get; set; } = 0;
/// <summary>
/// Varianti dimensionali disponibili
/// </summary>
public int SizeNum { get; set; } = 0;
/// <summary>
/// Quantità totale in giacenza, come lunghezza (m) se barre o area (m2) se pareti
/// </summary>
public decimal QtyTot { get; set; } = 0;
public string UM
{
get => IsBeam ? "m" : "m2";
}
/// <summary>
/// Codice materiale x QR/Datamatrix
/// </summary>
public string MatDtmx { get; set; } = "";
/// <summary>
/// Verifica che sia Beam, quando L == 0
/// </summary>
public bool IsBeam { get; set; } = false;
/// <summary>
/// Verifica che sia Wall, quando W/L == 0
/// </summary>
public bool IsWall { get; set; } = false;
/// <summary>
/// Elenco item e giancenze
/// </summary>
public List<ItemDTO>? ItemList { get; set; } = new List<ItemDTO>();
}
}
+102
View File
@@ -0,0 +1,102 @@
using static MagMan.Core.Enums;
namespace MagMan.Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ProjectDTO
{
/// <summary>
/// Key progetto (DB) / CLOUD
/// </summary>
public int ProjCloudId { get; set; }
/// <summary>
/// ID del DB EgtBW, univoco con KeyNum, (DB) / istanza locale
/// </summary>
public int ProjLocalId { get; set; } = 0;
/// <summary>
/// ID esterno (da EgtBW)
/// </summary>
public int ProjExtId { get; set; } = 0;
/// <summary>
/// Descrizione progetto (copiata da BTLFileName inizialmente)
/// </summary>
public string ProjDescription { get; set; } = "";
/// <summary>
/// Nome file BTL originale
/// </summary>
public string BTLFileName { get; set; } = "";
/// <summary>
/// Data Creazione progetto
/// </summary>
public DateTime DtCreated { get; set; } = DateTime.Now;
/// <summary>
/// Data ora ultima operazione registrata
/// </summary>
public DateTime DtLastAction { get; set; } = DateTime.MinValue;
/// <summary>
/// Data di schedulazione (prevista)
/// </summary>
public DateTime DtSchedule { get; set; } = DateTime.MinValue;
/// <summary>
/// Data Inizio Produzione
/// </summary>
public DateTime DtStartProd { get; set; } = DateTime.MinValue;
/// <summary>
/// Record attivo (se false == cancellazione logica)
/// </summary>
public bool IsActive { get; set; } = true;
/// <summary>
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto/chiuso
/// </summary>
public bool IsArchived { get; set; } = false;
/// <summary>
/// Key di riferimento per il progetto
/// </summary>
public int KeyNum { get; set; } = 0;
/// <summary>
/// ListName del BTL
/// </summary>
public string ListName { get; set; } = "";
/// <summary>
/// Macchina (Costruttore/Modello)
/// </summary>
public string Machine { get; set; } = "";
/// <summary>
/// Id macchina (MagMan) DB / CLOUD
/// </summary>
public int MachineCloudId { get; set; } = 0;
/// <summary>
/// Tempo lavorazione previsto (stima) in minuti
/// </summary>
public double ProcTimeEst { get; set; } = 0;
/// <summary>
/// Tempo lavorazione reale in minuti (parziale o totale se chiuso/completato/archiviato)
/// </summary>
public double ProcTimeReal { get; set; } = 0;
/// <summary>
/// Tipologia del progetto (Travi, Pareti, ...)
/// </summary>
public BWType PType { get; set; } = BWType.NULL;
}
}
+32
View File
@@ -0,0 +1,32 @@
using static MagMan.Core.Enums;
namespace MagMan.Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ProjectProgrDTO
{
/// <summary>
/// Key progetto (DB) / CLOUD
/// </summary>
public int ProjCloudId { get; set; }
/// <summary>
/// Avanzamento (tipicamente barre fatte)
/// </summary>
public double ValAct { get; set; } = 0;
/// <summary>
/// Valore finale atteso (tipicamente barre da fare)
/// </summary>
public double ValMax { get; set; } = 1;
/// <summary>
/// Tempo lavorazione reale in minuti (parziale o totale se chiuso/completato/archiviato)
/// </summary>
public double ProcTimeReal { get; set; } = 0;
}
}
+24
View File
@@ -0,0 +1,24 @@
namespace MagMan.Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ResourceDTO
{
/// <summary>
/// Primary Key RawItem (DB) / CLOUD
/// </summary>
public int RawItemCloudId { get; set; } = 0;
/// <summary>
/// Primary Key RawItem (DB) / istanza locale
/// </summary>
public int RawItemLocalId { get; set; } = 0;
/// <summary>
/// Qty, se > 0 rappresenta un IMPEGNO di qualsiasi tipo, se < 0 è un CONSUMO
/// </summary>
public int Qty { get; set; } = 0;
}
}
+73
View File
@@ -0,0 +1,73 @@
namespace MagMan.Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ResourceExpDTO
{
/// <summary>
/// ID risorsa (DB) / CLOUD
/// </summary>
public int ResourceCloudId { get; set; }
/// <summary>
/// Riferimento richiesta parent
/// </summary>
public int RequestId { get; set; } = 0;
/// <summary>
/// Ext ref for Material (DB) / CLOUD
/// </summary>
public int MatCloudId { get; set; } = 0;
/// <summary>
/// Ext ref for Material (DB) / CLOUD
/// </summary>
public int RawItemCloudId { get; set; } = 0;
/// <summary>
/// Primary Key RawItem (DB) / istanza locale
/// </summary>
public int RawItemLocalId { get; set; } = 0;
/// <summary>
/// Qty, se > 0 rappresenta un IMPEGNO di qualsiasi tipo, se < 0 è un CONSUMO
/// </summary>
public int Qty { get; set; } = 0;
/// <summary>
/// Check if is a Remnant
/// </summary>
public bool IsRemn { get; set; } = false;
/// <summary>
/// Item's Height (Thikness/Spessore) in mm
/// </summary>
public decimal HMm { get; set; } = 0;
/// <summary>
/// Item's Lenght
/// </summary>
public decimal LMm { get; set; } = 0;
/// <summary>
/// Item's Width
/// </summary>
public decimal WMm { get; set; } = 0;
/// <summary>
/// Note (optional)
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// Data richiesta
/// </summary>
public DateTime DtRequest { get; set; }
/// <summary>
/// record richiesto (me lo aspetto sempre a false se viene inviato/registrato...)
/// </summary>
public bool IsDeleted { get; set; } = false;
}
}
+67 -2
View File
@@ -1,7 +1,18 @@
namespace MagMan.Core
using StackExchange.Redis;
namespace MagMan.Core
{
public class Enums
{
#region Public Enums
public enum BWType
{
NULL = 0,
BEAM = 1,
WALL = 2
}
public enum ItemState
{
None,
@@ -10,5 +21,59 @@
Request,
}
public enum MachLogTypes
{
NULL = 0
, PART_STATUS = 1
, MACHGROUP_STATUS = 2
, MACHINE_MODE = 3
, MACHINE_STATUS = 4
, MACHINE_COMMAND = 5
, READ_VAR = 6
, WRITE_VAR = 7
, ALARM = 8
, OPERATOR_MSG = 9
, PROGRAM_SEND = 10
}
public enum ProjResState
{
/// <summary>
/// Registrazione consumo effettivo (update giacenza su tab RawItemList)
/// </summary>
Consumed = -1,
/// <summary>
/// Non definito
/// </summary>
ND = 0,
/// <summary>
/// Consumo stimato da nesting (solo simulazione)
/// </summary>
Estimated,
/// <summary>
/// Consumo confermato (da ordinare)
/// </summary>
Confirmed,
/// <summary>
/// Riservato (utile x calcolo quantità da ordinare)
/// </summary>
Reserved
}
#if false
public enum ResultTypes
{
NULL = 0,
EXECUTED = 1,
RESULT = 2
}
#endif
#endregion Public Enums
}
}
}
+12 -1
View File
@@ -1,9 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
<PackageReference Include="MailKit" Version="4.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
<PackageReference Include="NLog" Version="5.2.8" />
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
</ItemGroup>
</Project>
+34
View File
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Core
{
public class MailKitMailData
{
// Receiver
public List<string> To { get; set; } = new List<string>();
public List<string> Bcc { get; set; } = new List<string>();
public List<string> Cc { get; set; } = new List<string>();
// Sender
public string? From { get; set; }
public string? DisplayName { get; set; }
public string? ReplyTo { get; set; }
public string? ReplyToName { get; set; }
// Content
public string Subject { get; set; } = "";
public string? Body { get; set; }
//// Attach (opzionale)
//public IFormFileCollection? Attachments { get; set; }
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Core
{
public class MailKitMailSettings
{
public string? DisplayName { get; set; }
public string? From { get; set; }
public string? UserName { get; set; }
public string? Password { get; set; }
public string? Host { get; set; }
public int Port { get; set; }
public bool UseSSL { get; set; }
public bool UseStartTls { get; set; }
}
}
+152
View File
@@ -0,0 +1,152 @@
using NLog;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Core
{
public class MessagePipe
{
#region Public Constructors
public MessagePipe(IConnectionMultiplexer redisConn, string channelName, bool enableLog = false)
{
_channel = new RedisChannel(channelName, RedisChannel.PatternMode.Literal); ;
redis = redisConn;
redisDb = redis.GetDatabase();
this.enableLog = enableLog;
// aggiungo sottoscrittore
setupSubscriber();
}
#endregion Public Constructors
#region Public Events
public event EventHandler EA_NewMessage = delegate { };
#endregion Public Events
#region Public Methods
/// <summary>
/// Invio messaggio sul canale + salvataggio in cache REDIS
/// </summary>
/// <param name="memKey">Chiave REDIS x salvare valore</param>
/// <param name="message"></param>
public bool saveAndSendMessage(string memKey, string message)
{
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
// invio notifica tramite il canale richiesto
answ = sendMessage(message);
if (redisDb != null)
{
redisDb.StringSetAsync(memKey, message);
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
if (numSent.ContainsKey(memKey))
{
numSent[memKey]++;
}
else
{
numSent.Add(memKey, 1);
}
if (enableLog || numSent[memKey] > 30)
{
Log.Info($"saveAndSendMessage| mKey {memKey} x {numSent[memKey]} | {message.Length} size | {ts.TotalMilliseconds} ms");
numSent[memKey] = 0;
}
return answ;
}
/// <summary>
/// Invio messaggio sul canale
/// </summary>
/// <param name="newMess"></param>
/// <returns></returns>
public bool sendMessage(string newMess)
{
bool answ = false;
ISubscriber sub = redis.GetSubscriber();
sub.Publish(_channel, newMess);
return answ;
}
#endregion Public Methods
#region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Protected Fields
#region Private Fields
private bool enableLog = false;
private Dictionary<string, int> numSent = new Dictionary<string, int>();
private IConnectionMultiplexer redis;
private IDatabase? redisDb;
#endregion Private Fields
#region Private Properties
/// <summary>
/// Canale associato al gestore pipeline messaggi
/// </summary>
private RedisChannel _channel { get; set; } = new RedisChannel("Default", RedisChannel.PatternMode.Literal);
#endregion Private Properties
#region Private Methods
private void setupSubscriber()
{
ISubscriber sub = redis.GetSubscriber();
//Subscribe to the channel named messages
sub.Subscribe(_channel, (channel, message) =>
{
Log.Trace($"ch {channel} | {message}");
// messaggio
PubSubEventArgs mea = new PubSubEventArgs($"{message}");
// se qualcuno ascolta sollevo evento nuovo valore...
if (EA_NewMessage != null)
{
EA_NewMessage(this, mea);
}
});
Log.Info($"Subscribed {_channel}");
}
#endregion Private Methods
}
public class PubSubEventArgs : EventArgs
{
#region Public Constructors
public PubSubEventArgs(string messaggio)
{
this.newMessage = messaggio;
}
#endregion Public Constructors
#region Public Properties
public string newMessage { get; set; } = "";
#endregion Public Properties
}
}
+129
View File
@@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MagMan.Core.DTO;
using static MagMan.Core.Enums;
namespace MagMan.Core
{
public class RestPayload
{
#region Public Classes
public class Alias
{
#region Public Properties
/// <summary>
/// Elenco decodifica Alias Materiali x invio POST
/// </summary>
public List<AliasDTO> AliasList { get; set; } = new List<AliasDTO>();
#endregion Public Properties
}
public class Items
{
#region Public Properties
/// <summary>
/// Elenco Items x invio POST
/// </summary>
public List<ItemDTO>? ItemList { get; set; }
#endregion Public Properties
}
public class LogData
{
#region Public Properties
/// <summary>
/// Elenco record log x invio POST
/// </summary>
public List<LogMachineDTO> LogList { get; set; } = new List<LogMachineDTO>();
#endregion Public Properties
}
public class Materials
{
#region Public Properties
/// <summary>
/// Elenco materiali x invio POST
/// </summary>
public List<MaterialDTO>? MatList { get; set; }
#endregion Public Properties
}
public class PeriodData
{
#region Public Properties
public DateTime DtEnd { get; set; } = DateTime.Now;
public DateTime DtStart { get; set; } = DateTime.Now;
#endregion Public Properties
}
public class ProdInfoData
{
#region Public Properties
public ProjectProgrDTO? ProjectProgress { get; set; }
#endregion Public Properties
}
public class Projects
{
#region Public Properties
public ProjectDTO? Project { get; set; }
#endregion Public Properties
}
public class ProjStatusData
{
#region Public Properties
public Dictionary<int, bool>? ProjStatusList { get; set; }
#endregion Public Properties
}
public class Resources
{
#region Public Properties
/// <summary>
/// DataOra richiesta (data-ora del client)
/// </summary>
public DateTime DtReq { get; set; } = DateTime.Now;
/// <summary>
/// ID progetto univoco su cloud
/// </summary>
public int ProjCloudId { get; set; } = 0;
/// <summary>
/// Tipo di registrazione dato inviata (previsione consumo, consumo effettivo...)
/// </summary>
public ProjResState ReqState { get; set; } = ProjResState.ND;
/// <summary>
/// Elenco Risorse x invio POST
/// </summary>
public List<ResourceDTO>? ResourceList { get; set; }
#endregion Public Properties
}
#endregion Public Classes
}
}
+173
View File
@@ -0,0 +1,173 @@
using NLog;
using StackExchange.Redis;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Core.Services
{
/// <summary>
/// Classe di partenza x costruzione servizi di accesso dati + cache
/// </summary>
public class BaseServ
{
#region Public Methods
/// <summary>
/// Refresh globale cache redis
/// </summary>
/// <returns></returns>
public async Task<bool> FlushRedisCache()
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
await Task.Delay(1);
RedisValue pattern = new RedisValue($"{Const.rKeyConfig}:*");
bool answ = await ExecFlushRedisPattern(pattern);
stopWatch.Stop();
Log.Debug($"FlushRedisCache in {stopWatch.Elapsed.TotalMilliseconds} ms");
return answ;
}
#endregion Public Methods
#region Protected Fields
protected static IConfiguration _configuration = null!;
protected static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Numero di operazioni parallele che si possono svolgere... (se 0 NON usa cicli paralleli)
/// </summary>
protected int numPar = 0;
/// <summary>
/// Oggetto per connessione a REDIS
/// </summary>
protected IConnectionMultiplexer redisConn = null!;
/// <summary>
/// Oggetto DB redis da impiegare x chiamate R/W
/// </summary>
protected IDatabase redisDb = null!;
#endregion Protected Fields
#region Protected Properties
protected string CodApp { get; set; } = "";
/// <summary>
/// Durata cache breve (1 min circa + perturbazione percentuale +/-10%)
/// </summary>
protected TimeSpan FastCache
{
get => TimeSpan.FromSeconds(cacheTtlShort * rnd.Next(900, 1100) / 1000);
}
/// <summary>
/// Durata cache lunga (+ perturbazione percentuale +/-10%)
/// </summary>
protected TimeSpan LongCache
{
get => TimeSpan.FromSeconds(cacheTtlLong * rnd.Next(900, 1100) / 1000);
}
/// <summary>
/// Durata cache MOLTO breve (10 sec circa + perturbazione percentuale +/-10%)
/// </summary>
protected TimeSpan UltraFastCache
{
get => TimeSpan.FromSeconds(cacheTtlShort / 6 * rnd.Next(900, 1100) / 1000);
}
/// <summary>
/// Durata cache MOLTO lunga (+ perturbazione percentuale +/-10%)
/// </summary>
protected TimeSpan UltraLongCache
{
get => TimeSpan.FromSeconds(cacheTtlLong * 10 * rnd.Next(900, 1100) / 1000);
}
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Esegue flush memoria redis dato pattern
/// </summary>
/// <param name="pattern"></param>
/// <returns></returns>
protected async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
{
bool answ = false;
/*******************************
* Recupero elenco dei server da cui cancellare le chaivi:
* - prendo solo i server connessi
* - prendo solo NON repliche (= master)
* - me ne aspetto 1 in uscita cmq
*******************************/
var connServ = redisConn.GetEndPoints()
.Select(endpoint =>
{
var server = redisConn.GetServer(endpoint);
return server;
})
.Where(x => x.IsConnected && !x.IsReplica)
.ToList();
// ciclo (anche se me ne aspetto 1 solo)
foreach (var mServer in connServ)
{
try
{
var keyList = mServer.Keys(redisDb.Database, pattern);
if (numPar > 0)
{
var options = new ParallelOptions { MaxDegreeOfParallelism = numPar };
await Parallel.ForEachAsync(keyList, async (item, token) =>
{
// cancello
await redisDb.KeyDeleteAsync(item);
});
}
else
{
foreach (var item in keyList)
{
await redisDb.KeyDeleteAsync(item);
}
}
answ = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ExecFlushRedisPattern | pattern: {pattern}{Environment.NewLine}{exc}");
}
}
return answ;
}
#endregion Protected Methods
#region Private Fields
/// <summary>
/// Durata cache lunga IN SECONDI
/// </summary>
private int cacheTtlLong = 60 * 5;
/// <summary>
/// Durata cache breve IN SECONDI
/// </summary>
private int cacheTtlShort = 60 * 1;
private Random rnd = new Random();
#endregion Private Fields
}
}
+13
View File
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Core.Services
{
public interface IMailService
{
Task<bool> SendAsync(MailKitMailData mailData, CancellationToken ct);
}
}
+137
View File
@@ -0,0 +1,137 @@
using MailKit.Net.Smtp;
using MailKit.Security;
using Microsoft.Extensions.Options;
using MimeKit;
using NLog;
using MagMan.Core;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MagMan.Core.Services
{
/// <summary>
/// Implementazione MailKit come descritto qui https://blog.christian-schou.dk/send-emails-with-asp-net-core-with-mailkit/
/// </summary>
public partial class MailService : IMailService
{
#region Public Constructors
public MailService(IOptions<MailKitMailSettings> settings)
{
_settings = settings.Value;
}
#endregion Public Constructors
#region Public Methods
public async Task<bool> SendAsync(MailKitMailData mailData, CancellationToken ct = default)
{
try
{
// Initialize a new instance of the MimeKit.MimeMessage class
var mail = new MimeMessage();
#region Sender / Receiver
// Sender
mail.From.Add(new MailboxAddress(_settings.DisplayName, mailData.From ?? _settings.From));
mail.Sender = new MailboxAddress(mailData.DisplayName ?? _settings.DisplayName, mailData.From ?? _settings.From);
// Receiver
foreach (string mailAddress in mailData.To)
mail.To.Add(MailboxAddress.Parse(mailAddress));
// Set Reply to if specified in mail data
if (!string.IsNullOrEmpty(mailData.ReplyTo))
mail.ReplyTo.Add(new MailboxAddress(mailData.ReplyToName, mailData.ReplyTo));
// BCC Check if a BCC was supplied in the request
if (mailData.Bcc != null)
{
// Get only addresses where value is not null or with whitespace. x = value of address
foreach (string mailAddress in mailData.Bcc.Where(x => !string.IsNullOrWhiteSpace(x)))
mail.Bcc.Add(MailboxAddress.Parse(mailAddress.Trim()));
}
// CC Check if a CC address was supplied in the request
if (mailData.Cc != null)
{
foreach (string mailAddress in mailData.Cc.Where(x => !string.IsNullOrWhiteSpace(x)))
mail.Cc.Add(MailboxAddress.Parse(mailAddress.Trim()));
}
#endregion Sender / Receiver
#region Content
// Add Content to Mime Message
var body = new BodyBuilder();
mail.Subject = mailData.Subject;
body.HtmlBody = mailData.Body;
mail.Body = body.ToMessageBody();
//// Check if we got any attachments and add the to the builder for our message
//if (mailData.Attachments != null)
//{
// byte[] attachmentFileByteArray;
// foreach (IFormFile attachment in mailData.Attachments)
// {
// // Check if length of the file in bytes is larger than 0
// if (attachment.Length > 0)
// {
// // Create a new memory stream and attach attachment to mail body
// using (MemoryStream memoryStream = new MemoryStream())
// {
// // Copy the attachment to the stream
// attachment.CopyTo(memoryStream);
// attachmentFileByteArray = memoryStream.ToArray();
// }
// // Add the attachment from the byte array
// body.Attachments.Add(attachment.FileName, attachmentFileByteArray, ContentType.Parse(attachment.ContentType));
// }
// }
//}
#endregion Content
#region Send Mail
using var smtp = new SmtpClient();
if (_settings.UseSSL)
{
await smtp.ConnectAsync(_settings.Host, _settings.Port, SecureSocketOptions.SslOnConnect, ct);
}
else if (_settings.UseStartTls)
{
await smtp.ConnectAsync(_settings.Host, _settings.Port, SecureSocketOptions.StartTls, ct);
}
await smtp.AuthenticateAsync(_settings.UserName, _settings.Password, ct);
await smtp.SendAsync(mail, ct);
await smtp.DisconnectAsync(true, ct);
#endregion Send Mail
return true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in SendAsync{Environment.NewLine}{exc}");
return false;
}
}
#endregion Public Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private readonly MailKitMailSettings _settings;
#endregion Private Fields
}
}
+737
View File
@@ -0,0 +1,737 @@
using Blazored.LocalStorage;
using Blazored.SessionStorage;
using Microsoft.AspNetCore.Components;
using Microsoft.VisualBasic;
using NLog;
using StackExchange.Redis;
using System.Diagnostics;
namespace MagMan.Core.Services
{
public class MessageService
{
#region Public Constructors
public MessageService(ILocalStorageService genLocalStorage, ISessionStorageService sessStore, IConnectionMultiplexer RedConn)
{
// gestione sessioni in browser
localStore = genLocalStorage;
sessionStore = sessStore;
// setup componenti REDIS
redisConn = RedConn;
redisDb = redisConn.GetDatabase();
// setup canali pub/sub
QueUpdGen = new MessagePipe(redisConn, Const.Q_MMAN_GEN);
QueUpdAliasMat = new MessagePipe(redisConn, Const.Q_MMAN_ALIAS_MAT);
QueUpdInve= new MessagePipe(redisConn, Const.Q_MMAN_LOG);
QueUpdLog = new MessagePipe(redisConn, Const.Q_MMAN_LOG);
QueUpdProj = new MessagePipe(redisConn, Const.Q_MMAN_PROJ);
QueUpdRes = new MessagePipe(redisConn, Const.Q_MMAN_RES);
}
#endregion Public Constructors
#region Public Events
public event Action EA_CustomerSel = null!;
public event Action EA_FilterUpdated = null!;
public event Action EA_HideSearch = null!;
public event Action EA_KeySel = null!;
public event Action EA_PageUpdated = null!;
public event Action EA_SearchUpdated = null!;
public event Action<bool> EA_ShowCustomers = null!;
public event Action EA_ShowSearch = null!;
#endregion Public Events
#region Public Properties
public int CustomerID
{
get => _customerID;
set
{
if (_customerID != value)
{
_customerID = value;
if (EA_CustomerSel != null)
{
EA_CustomerSel?.Invoke();
}
}
}
}
public int KeyNum
{
get => _keyNum;
set
{
if (_keyNum != value)
{
_keyNum = value;
if (EA_KeySel != null)
{
EA_KeySel?.Invoke();
}
}
}
}
public string PageIcon
{
get => _pageIcon;
set
{
if (_pageIcon != value)
{
_pageIcon = value;
ReportPageUpd();
}
}
}
public string PageName
{
get => _pageName;
set
{
if (_pageName != value)
{
_pageName = value;
ReportPageUpd();
}
}
}
public string SearchVal
{
get => _searchVal;
set
{
if (_searchVal != value)
{
_searchVal = value;
if (EA_SearchUpdated != null)
{
EA_SearchUpdated?.Invoke();
}
}
}
}
public string SelOrderCode { get; set; } = "";
public string SelPlantId { get; set; } = "0";
public bool ShowCustomers
{
get => _showCustomers;
set
{
_showCustomers = value;
if (EA_ShowCustomers != null)
{
EA_ShowCustomers?.Invoke(value);
}
}
}
public bool ShowSearch
{
get => _showSearch;
set
{
if (_showSearch != value)
{
_showSearch = value;
if (_showSearch)
{
if (EA_ShowSearch != null)
{
EA_ShowSearch?.Invoke();
}
}
else
{
if (EA_HideSearch != null)
{
EA_HideSearch?.Invoke();
}
}
}
}
}
/// <summary>
/// Message pipe ricezione dati da EgtBW relativi a info Alias/Materials
/// </summary>
public MessagePipe QueUpdAliasMat { get; set; } = null!;
/// <summary>
/// Message pipe ricezione dati da EgtBW (General/Generics)
/// </summary>
public MessagePipe QueUpdGen { get; set; } = null!;
/// <summary>
/// Message pipe ricezione dati da EgtBW relativi a info LogMachine
/// </summary>
public MessagePipe QueUpdLog { get; set; } = null!;
/// <summary>
/// Message pipe ricezione dati da EgtBW relativi a info Projects
/// </summary>
public MessagePipe QueUpdProj { get; set; } = null!;
/// <summary>
/// Message pipe ricezione dati da EgtBW relativi a info Resources
/// </summary>
public MessagePipe QueUpdRes { get; set; } = null!;
/// <summary>
/// Message pipe ricezione dati da EgtBW relativi a info Inventario (aggiunta/consumi)
/// </summary>
public MessagePipe QueUpdInve { get; set; } = null!;
public string UserName { get; set; } = "NA";
#endregion Public Properties
#region Public Methods
/// <summary>
/// Cliente selezionato (da browser data cache)
/// </summary>
public async Task<int> ClientIdGet()
{
var answ = await localStore.GetItemAsync<int>("ClientID");
return answ;
}
/// <summary>
/// Imposta Cliente selezionato (browser data cache)
/// </summary>
public async Task ClientIdSet(int newVal)
{
await localStore.SetItemAsync("ClientID", newVal);
}
/// <summary>
/// Num record x la pagina corrente
/// </summary>
public async Task<int> NumRowGridGet(string gridName)
{
var answ = await localStore.GetItemAsync<int>($"{gridName}_nRow");
answ = answ > 0 ? answ : 10;
return answ;
}
/// <summary>
/// Imposta num record x la pagina corrente
/// </summary>
public async Task NumRowGridSet(string gridName, int newVal)
{
await localStore.SetItemAsync($"{gridName}_nRow", newVal);
}
/// <summary>
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
/// </summary>
/// <param name="RestToken"></param>
/// <returns></returns>
public async Task<int> CustomerIdByToken(string RestToken)
{
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Token2CustID";
int answ = await RedisHashGetInt(currKey, RestToken);
return answ;
}
/// <summary>
/// salvataggio in dizionario Redis associativo Token / Customer
/// </summary>
/// <param name="RestToken"></param>
/// <param name="CustId"></param>
/// <returns></returns>
public bool CustomerIdByTokenSet(string RestToken, int CustId)
{
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Token2CustID";
bool fatto = RedisHashSet(currKey, RestToken, $"{CustId}");
return fatto;
}
/// <summary>
/// KeyNum da cliente selezionato (da browser data cache)
/// </summary>
public async Task<int> KeyNumGet()
{
var answ = await localStore.GetItemAsync<int>("KeyNum");
return answ;
}
/// <summary>
/// Imposta KeyNum da cliente selezionato (browser data cache)
/// </summary>
public async Task KeyNumSet(int newVal)
{
await localStore.SetItemAsync("KeyNum", newVal);
}
/// <summary>
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
/// </summary>
/// <param name="CustID"></param>
/// <returns></returns>
public async Task<int> MainKeyByCustomer(int CustID)
{
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Cust2MKey";
int answ = await RedisHashGetInt(currKey, $"{CustID}");
return answ;
}
/// <summary>
/// salvataggio in dizionario Redis associativo Token / Customer
/// </summary>
/// <param name="RestToken"></param>
/// <param name="CustId"></param>
/// <returns></returns>
public bool MainKeyByCustomerSet(int CustId, int MainKey)
{
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Cust2MKey";
bool fatto = RedisHashSet(currKey, $"{CustId}", $"{MainKey}");
return fatto;
}
/// <summary>
/// Recupera MainKey dal dizionario dei token noti o cercando sul DB
/// </summary>
/// <param name="RestToken"></param>
/// <returns></returns>
public async Task<int> MainKeyByToken(string RestToken)
{
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Token2MKey";
int answ = await RedisHashGetInt(currKey, RestToken);
return answ;
}
/// <summary>
/// salvataggio in dizionario Redis associativo Token / Customer
/// </summary>
/// <param name="RestToken"></param>
/// <param name="CustId"></param>
/// <returns></returns>
public bool MainKeyByTokenSet(string RestToken, int CustId)
{
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Token2MKey";
bool fatto = RedisHashSet(currKey, RestToken, $"{CustId}");
return fatto;
}
/// <summary>
/// Get single hash record
/// </summary>
/// <param name="currKey">Redis Key for Hashlist</param>
/// <param name="chiave">Requested key on list</param>
/// <returns>Value as Int</returns>
public async Task<int> RedisHashGetInt(RedisKey currKey, string chiave)
{
int result = 0;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
var hasVal = await redisDb.HashExistsAsync(currKey, chiave);
if (hasVal)
{
var rawRes = await redisDb.HashGetAsync(currKey, chiave);
if (rawRes.HasValue)
{
int.TryParse($"{rawRes}", out result);
}
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"RedisHashGetInt | {currKey} | in: {ts.TotalMilliseconds} ms");
return result;
}
/// <summary>
/// Get single hash record
/// </summary>
/// <param name="currKey">Redis Key for Hashlist</param>
/// <param name="chiave">Requested key on list</param>
/// <returns>Value as string</returns>
public async Task<string> RedisHashGetString(RedisKey currKey, string chiave)
{
string result = "";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
var hasVal = await redisDb.HashExistsAsync(currKey, chiave);
if (hasVal)
{
var rawRes = await redisDb.HashGetAsync(currKey, chiave);
if (rawRes.HasValue)
{
result = $"{rawRes}";
}
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"RedisHashGetString | {currKey} | in: {ts.TotalMilliseconds} ms");
return result;
}
/// <summary>
/// Remove for single hash record
/// </summary>
/// <param name="currKey">Chiave redis della Hashlist</param>
/// <param name="chiave">Chiave nella HashList</param>
/// <returns>Esito rimozione</returns>
public async Task<bool> RedisHashRemove(RedisKey currKey, string chiave)
{
bool fatto = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
fatto = await redisDb.HashDeleteAsync(currKey, chiave);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"RedisHashRemove | {currKey} | in: {ts.TotalMilliseconds} ms");
return fatto;
}
/// <summary>
/// Resetta 1:1 i dizionari Hash in Redis
/// </summary>
/// <returns></returns>
public bool ResetHashDict()
{
bool fatto = false;
string baseKey = $"{Const.rKeyConfig}:Mserv:Dict";
try
{
// salvo!
RedisHashDictSet($"{baseKey}:Token2CustID", new Dictionary<string, string>());
RedisHashDictSet($"{baseKey}:Token2MKey", new Dictionary<string, string>());
RedisHashDictSet($"{baseKey}:Cust2MKey", new Dictionary<string, string>());
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in ResetHashDict{Environment.NewLine}{exc}");
}
return fatto;
}
/// <summary>
/// Svuota localstorage (clear)
/// </summary>
/// <returns></returns>
public async Task<bool> StoreLocalClear()
{
bool answ = false;
try
{
await localStore.ClearAsync();
answ = true;
}
catch (Exception ex)
{
Log.Error($"Eccezione in StoreLocalClear{Environment.NewLine}{ex}");
}
return answ;
}
/// <summary>
/// Restituisce il valore richiesto da localstorage
/// </summary>
/// <param name="sKey">Chiave</param>
/// <returns></returns>
public async Task<string> StoreLocalGet(string sKey)
{
string answ = "";
var result = await localStore.GetItemAsync<string>(sKey);
if (result != null)
{
answ = result;
}
return answ;
}
/// <summary>
/// Scrive il valore nel localstorage
/// </summary>
/// <param name="sKey">Chiave</param>
/// <param name="sVal">Valore associato</param>
/// <returns></returns>
public async Task<bool> StoreLocalSet(string sKey, string sVal)
{
bool answ = false;
try
{
await localStore.SetItemAsStringAsync(sKey, sVal);
answ = true;
}
catch (Exception ex)
{
Log.Error($"Eccezione in StoreLocalSet{Environment.NewLine}{ex}");
}
return answ;
}
/// <summary>
/// Svuota sessionstorage (clear)
/// </summary>
/// <returns></returns>
public async Task<bool> StoreSessClear()
{
bool answ = false;
try
{
await sessionStore.ClearAsync();
answ = true;
}
catch (Exception ex)
{
Log.Error($"Eccezione in StoreLocalClear{Environment.NewLine}{ex}");
}
return answ;
}
/// <summary>
/// Restituisce il valore richiesto da sessionstorage
/// </summary>
/// <param name="sKey">Chiave</param>
/// <returns></returns>
public async Task<string> StoreSessGet(string sKey)
{
string answ = "";
var result = await sessionStore.GetItemAsync<string>(sKey);
if (result != null)
{
answ = result;
}
return answ;
}
/// <summary>
/// Scrive il valore nel sessionstorage (tab)
/// </summary>
/// <param name="sKey">Chiave</param>
/// <param name="sVal">Valore associato</param>
/// <returns></returns>
public async Task<bool> StoreSessSet(string sKey, string sVal)
{
bool answ = false;
try
{
await sessionStore.SetItemAsStringAsync(sKey, sVal);
answ = true;
}
catch (Exception ex)
{
Log.Error($"Eccezione in StoreSessSet{Environment.NewLine}{ex}");
}
return answ;
}
#endregion Public Methods
#region Protected Fields
/// <summary>
/// Oggetto per connessione a REDIS
/// </summary>
protected IConnectionMultiplexer redisConn = null!;
/// <summary>
/// Oggetto DB redis da impiegare x chiamate R/W
/// </summary>
protected IDatabase redisDb = null!;
#endregion Protected Fields
#region Protected Properties
protected ILocalStorageService localStore { get; set; } = null!;
protected ISessionStorageService sessionStore { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Effettua upsert in HasList redis
/// </summary>
/// <param name="currKey">Chiave redis della Hashlist</param>
/// <param name="chiave">Chiave nella HashList</param>
/// <param name="valore">Valore da salvare</param>
/// <returns>Num record nella HashList</returns>
protected async Task<long> RedisHashUpsert(RedisKey currKey, string chiave, string valore)
{
long numReq = 0;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
await redisDb.HashSetAsync(currKey, chiave, valore);
numReq = await redisDb.HashLengthAsync(currKey);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"RedisHashUpsert | {currKey} | in: {ts.TotalMilliseconds} ms");
return numReq;
}
#endregion Protected Methods
#if false
private SelectData _detailFilter = SelectData.Init(5, 15);
#endif
#region Private Fields
private int _customerID = -1;
private int _keyNum = -1;
private string _pageIcon = "";
private string _pageName = "";
private string _searchVal = "";
private bool _showCustomers = true;
private bool _showSearch = false;
private Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Methods
/// <summary>
/// Recupero HashSet redis come Dictionary
/// </summary>
/// <param name="currKey"></param>
/// <param name="dict"></param>
private Dictionary<string, string> RedisHashDictGet(RedisKey currKey)
{
Dictionary<string, string> answ = new Dictionary<string, string>();
try
{
answ = redisDb
.HashGetAll(currKey)
.ToDictionary(x => $"{x.Name}", x => $"{x.Value}");
}
catch (Exception exc)
{
Log.Info($"Errore RedisHashDictGet | currKey: {currKey}{Environment.NewLine}{exc}");
}
return answ;
}
/// <summary>
/// Salvataggio Dictionary come HashSet Redis
/// </summary>
/// <param name="currKey"></param>
/// <param name="dict"></param>
private bool RedisHashDictSet(RedisKey currKey, Dictionary<string, string> dict)
{
bool fatto = false;
try
{
HashEntry[] data2ins = new HashEntry[dict.Count];
int i = 0;
foreach (KeyValuePair<string, string> kvp in dict)
{
data2ins[i] = new HashEntry(kvp.Key, kvp.Value);
i++;
}
// salvo!
redisDb.HashSet(currKey, data2ins);
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in RedisHashDictSet | currKey: {currKey}{Environment.NewLine}{exc}");
}
return fatto;
}
/// <summary>
/// Salvataggio Dictionary come HashSet Redis
/// </summary>
/// <param name="currKey"></param>
/// <param name="dict"></param>
/// <param name="ttl"></param>
private bool RedisHashDictSet(RedisKey currKey, Dictionary<string, string> dict, TimeSpan ttl)
{
bool fatto = false;
try
{
HashEntry[] data2ins = new HashEntry[dict.Count];
int i = 0;
foreach (KeyValuePair<string, string> kvp in dict)
{
data2ins[i] = new HashEntry(kvp.Key, kvp.Value);
i++;
}
// salvo!
redisDb.HashSet(currKey, data2ins);
redisDb.KeyExpire(currKey, ttl);
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in RedisHashDictSet(+TTL) | currKey: {currKey} | ttl: {ttl}{Environment.NewLine}{exc}");
}
return fatto;
}
/// <summary>
/// Aggiunta KVP in HashSet Redis
/// </summary>
/// <param name="currKey"></param>
/// <param name="dict"></param>
private bool RedisHashSet(RedisKey currKey, string hashField, string value)
{
bool fatto = false;
try
{
// salvo!
redisDb.HashSet(currKey, hashField, value);
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in RedisHashSet | currKey: {currKey}{Environment.NewLine}{exc}");
}
return fatto;
}
private void ReportPageUpd()
{
if (EA_PageUpdated != null)
{
EA_PageUpdated?.Invoke();
}
}
private void ReportSearch()
{
if (EA_SearchUpdated != null)
{
EA_SearchUpdated?.Invoke();
}
}
#endregion Private Methods
#if false
/// <summary>
/// Dizionario totale preferenze utente
/// </summary>
public Dictionary<string, string> UsersPrefDict
{
get => RedisHashDictGet((RedisKey)$"{redisBaseKey}:{MatrOpr}");
set => RedisHashDictSet((RedisKey)$"{redisBaseKey}:{MatrOpr}", value);
}
#endif
}
}
@@ -0,0 +1,341 @@
using MagMan.Data.Admin.DbModels;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace MagMan.Data.Admin.Controllers
{
public class MTAdminController : IDisposable
{
#region Public Constructors
public MTAdminController(IConfiguration configuration)
{
_configuration = configuration;
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Elimina item AuthKey
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public bool AuthKeyDelete(AuthKeyModel updItem)
{
bool done = false;
using (MultiTenantContext dbCtx = new MultiTenantContext())
{
try
{
var currData = dbCtx
.DbSetAuthKey
.Where(x => x.AuthKeyID == updItem.AuthKeyID)
.FirstOrDefault();
if (currData != null)
{
dbCtx
.DbSetAuthKey
.Remove(currData);
dbCtx.SaveChanges();
done = true;
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in AuthKeyDelete{Environment.NewLine}{exc}");
}
}
return done;
}
/// <summary>
/// Elenco AuthKey dato Customer
/// </summary>
/// <param name="CustomerId">0 = tutti</param>
/// <returns></returns>
public List<AuthKeyModel> AuthKeyByCustId(int CustomerId)
{
List<AuthKeyModel> dbResult = new List<AuthKeyModel>();
using (MultiTenantContext dbCtx = new MultiTenantContext())
{
dbResult = dbCtx
.DbSetAuthKey
.Where(x => CustomerId == 0 || x.CustomerID == CustomerId)
.Include(c => c.CustomerNav)
.OrderBy(x => x.KeyNum)
.ToList();
}
return dbResult;
}
/// <summary>
/// Aggiunge/Modifica un item AuthKey
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public bool AuthKeyUpdate(AuthKeyModel updItem)
{
bool done = false;
using (MultiTenantContext dbCtx = new MultiTenantContext())
{
try
{
var currData = dbCtx
.DbSetAuthKey
.Where(x => x.AuthKeyID == updItem.AuthKeyID)
.FirstOrDefault();
if (currData != null)
{
currData.KeyNum = updItem.KeyNum;
currData.KeyValue = updItem.KeyValue;
currData.Note = updItem.Note;
currData.CustomerID = updItem.CustomerID;
currData.IsActive = updItem.IsActive;
currData.DtActivation = updItem.DtActivation;
dbCtx.Entry(currData).State = EntityState.Modified;
}
else
{
dbCtx
.DbSetAuthKey
.Add(updItem);
}
dbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in AuthKeyUpdate{Environment.NewLine}{exc}");
}
}
return done;
}
/// <summary>
/// Elimina item Customer
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public bool CustomerDelete(CustomerModel updItem)
{
bool done = false;
using (MultiTenantContext dbCtx = new MultiTenantContext())
{
try
{
var currData = dbCtx
.DbSetCustomers
.Where(x => x.CustomerID == updItem.CustomerID)
.FirstOrDefault();
if (currData != null)
{
dbCtx
.DbSetCustomers
.Remove(currData);
dbCtx.SaveChanges();
done = true;
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in CustomerDelete{Environment.NewLine}{exc}");
}
}
return done;
}
/// <summary>
/// Elenco clienti
/// </summary>
/// <returns></returns>
public List<CustomerModel> CustomerGetAll()
{
List<CustomerModel> dbResult = new List<CustomerModel>();
using (MultiTenantContext dbCtx = new MultiTenantContext())
{
dbResult = dbCtx
.DbSetCustomers
.Select(s => new CustomerModel
{
CustomerID = s.CustomerID,
DtActivation = s.DtActivation,
IsActive = s.IsActive,
RestToken = s.RestToken,
Name = s.Name,
Note = s.Note,
MainKey = s.MainKey,
HasDb = s.HasDb,
HasChildren = s.MachineNav.Any()
})
.OrderBy(x => x.Name)
.ToList();
}
return dbResult;
}
/// <summary>
/// Aggiunge/Modifica un item Customer
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public bool CustomerUpdate(CustomerModel updItem)
{
bool done = false;
using (MultiTenantContext dbCtx = new MultiTenantContext())
{
try
{
var currData = dbCtx
.DbSetCustomers
.Where(x => x.CustomerID == updItem.CustomerID)
.FirstOrDefault();
if (currData != null)
{
currData.Name = updItem.Name;
currData.Note = updItem.Note;
currData.IsActive = updItem.IsActive;
currData.DtActivation = updItem.DtActivation;
currData.RestToken = updItem.RestToken;
currData.MainKey = updItem.MainKey;
currData.HasDb = updItem.HasDb;
dbCtx.Entry(currData).State = EntityState.Modified;
}
else
{
dbCtx
.DbSetCustomers
.Add(updItem);
}
dbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in CustomerUpdate{Environment.NewLine}{exc}");
}
}
return done;
}
public void Dispose()
{
// Clear database context
Log.Info("Dispose di MultiTenantController");
}
/// <summary>
/// Elimina item Machine
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public bool MachineDelete(MachineModel updItem)
{
bool done = false;
using (MultiTenantContext dbCtx = new MultiTenantContext())
{
try
{
var currData = dbCtx
.DbSetMachines
.Where(x => x.MachineID == updItem.MachineID)
.FirstOrDefault();
if (currData != null)
{
dbCtx
.DbSetMachines
.Remove(currData);
dbCtx.SaveChanges();
done = true;
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in MachineDelete{Environment.NewLine}{exc}");
}
}
return done;
}
/// <summary>
/// Elenco Machine dato Customer
/// </summary>
/// <param name="CustomerId">0 = tutti</param>
/// <returns></returns>
public List<MachineModel> MachineGetByCustId(int CustomerId)
{
List<MachineModel> dbResult = new List<MachineModel>();
using (MultiTenantContext dbCtx = new MultiTenantContext())
{
dbResult = dbCtx
.DbSetMachines
.Where(x => CustomerId == 0 || x.CustomerID == CustomerId)
.OrderBy(x => x.Name)
.ToList();
}
return dbResult;
}
/// <summary>
/// Aggiunge/Modifica un item Machine
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public bool MachineUpdate(MachineModel updItem)
{
bool done = false;
using (MultiTenantContext dbCtx = new MultiTenantContext())
{
try
{
var currData = dbCtx
.DbSetMachines
.Where(x => x.MachineID == updItem.MachineID)
.FirstOrDefault();
if (currData != null)
{
currData.Name = updItem.Name;
currData.Note = updItem.Note;
currData.CustomerID = updItem.CustomerID;
currData.IsActive = updItem.IsActive;
currData.DtActivation = updItem.DtActivation;
currData.MainKey = updItem.MainKey;
dbCtx.Entry(currData).State = EntityState.Modified;
}
else
{
dbCtx
.DbSetMachines
.Add(updItem);
}
dbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in MachineUpdate{Environment.NewLine}{exc}");
}
}
return done;
}
#endregion Public Methods
#region Private Fields
private static IConfiguration _configuration = null!;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
+123
View File
@@ -0,0 +1,123 @@
using Microsoft.EntityFrameworkCore;
using NLog;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Admin
{
/// <summary>
/// Classe amministrazione Db principale:
/// - creazione utenti sul Server MySql
/// - gestione DB/Tabele x identity & gestione multi-tenant
/// </summary>
public class DbAdmin : IDisposable
{
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Public Constructors
public DbAdmin()
{
}
#endregion Public Constructors
#region Public Methods
public static bool CheckCreateUser(string username, string pwd, string dbName)
{
bool answ = false;
int numUser = 0;
using (ServerAdminContext adbCtx = new ServerAdminContext())
{
// ricerca utente...
numUser = adbCtx
.UserList
.Where(x => x.User == username)
.ToList()
.Count;
if (numUser > 0)
{
answ = true;
}
if (!answ)
{
// creo utente
string sqlCommand = "FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}';";
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
sqlCommand = $"GRANT ALL PRIVILEGES ON {dbName}.* TO '{username}'@'localhost';";
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
sqlCommand = "FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
}
}
return answ;
}
public static bool CheckCreateCustDb(int nKeyMain)
{
bool answ = false;
string dbName = $"MagMan_{nKeyMain:000000}";
using (ServerAdminContext adbCtx = new ServerAdminContext())
{
// ricerca DB...
string sqlCommand = $"SHOW DATABASES;";
var searchDb = adbCtx
.DbList
.FromSqlRaw(sqlCommand)
.ToList();
// se trovato qualcosa procedo
if (searchDb != null)
{
var rigaDb = searchDb.Where(x => x.Database.Contains(dbName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
answ = rigaDb != null;
}
// altrimenti crea
if (!answ)
{
// creo DB
sqlCommand = $"CREATE DATABASE IF NOT EXISTS {dbName};";
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
}
}
return answ;
}
public static async Task<bool> MigrateDbIdentity()
{
bool answ = false;
using (IdentityContext dbCtx = new IdentityContext())
{
await dbCtx.Database.MigrateAsync();
answ = true;
}
return answ;
}
public static async Task<bool> MigrateDbMultiTenant()
{
bool answ = false;
using (MultiTenantContext dbCtx = new MultiTenantContext())
{
await dbCtx.Database.MigrateAsync();
answ = true;
}
return answ;
}
public void Dispose()
{
}
#endregion Public Methods
}
}
+133
View File
@@ -0,0 +1,133 @@
using Microsoft.EntityFrameworkCore;
using MySqlConnector;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Admin
{
public static class DbConfig
{
#region Public Fields
public static string DATABASE_NAME = "MagMan_Admin";
public static int DATABASE_PROCESS_TIMEOUT = 5;
public static string DATABASE_PWD = "viad@nte16!";
public static string DATABASE_SERV = "127.0.0.1";
public static string DATABASE_USER = "MagMan_DbUser";
#endregion Public Fields
#region Public Properties
/// <summary>
/// DB Connection string per azioni amministrative
/// </summary>
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
/// <summary>
/// DB Connection string
/// </summary>
public static string CONNECTION_STRING { get; set; } = "";
#endregion Public Properties
#region Public Methods
public static bool CheckCustDb(int masterKey)
{
// esecuzione script di install locale
return DbAdmin.CheckCreateCustDb(masterKey);
}
public static bool CheckUser(string nKey, string sKey)
{
// esecuzione script di install locale
return DbAdmin.CheckCreateUser(DATABASE_USER, DATABASE_PWD, DATABASE_NAME);
}
public static ServerVersion CustomAutoDetect(string connectionString)
{
#if false
using var connection = new MySqlConnection(
new MySqlConnectionStringBuilder(connectionString)
{
Database = string.Empty,
// AutoEnlist = false, Pooling = false,
}.ConnectionString);
#endif
using var connection = new MySqlConnection(connectionString);
connection.Open();
ServerVersion currVers = ServerVersion.Parse(connection.ServerVersion);
return currVers;
}
public static bool ExecMigrationIdentity()
{
// esecuzione migrazione
var migrateTask = Task.Run(async () => await DbAdmin.MigrateDbIdentity());
migrateTask.Wait();
return migrateTask.Result;
}
public static bool ExecMigrationMultiTenant()
{
// esecuzione migrazione
var migrateTask = Task.Run(async () => await DbAdmin.MigrateDbMultiTenant());
migrateTask.Wait();
return migrateTask.Result;
}
public static void InitDb(string server)
{
DATABASE_SERV = server;
// tutto fisso x gestione utenti
CONNECTION_STRING = $"Server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;ConnectionIdleTimeout=30;ConnectionLifeTime=300;";
// stringa admin con utente admin dell'applicazione (già creato)...
ADMIN_CONNECTION_STRING = $"Server={DATABASE_SERV};port=3306;database=mysql;uid=egalware;pwd=Egalware_24068!;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;ConnectionIdleTimeout=30;ConnectionLifeTime=300;";
}
public static ServerVersion MysqlServerVersion(string connString)
{
// fix come da https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1859
//Log.Info($"MysqlServerVersion | {connString}");
//ServerVersion serverVersion = ServerVersion.Parse("10.11.13-MariaDB");
ServerVersion serverVersion = ServerVersion.Parse("10.5.25-mysql");
bool versOk = false;
try
{
serverVersion = ServerVersion.AutoDetect(connString);
versOk = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in verifica versione server ServerVersion.AutoDetect: {Environment.NewLine}{exc}");
}
if (!versOk)
{
try
{
serverVersion = CustomAutoDetect(connString);
versOk = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in verifica versione server CustomAutoDetect: {Environment.NewLine}{exc}");
}
}
return serverVersion;
}
#endregion Public Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Admin.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("AuthKeyList")]
public partial class AuthKeyModel
{
/// <summary>
/// Primary Key AUTO
/// </summary>
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int AuthKeyID { get; set; }
/// <summary>
/// Ext ref Customers
/// </summary>
public int CustomerID { get; set; } = 0;
/// <summary>
/// Numero chiave
/// </summary>
public int KeyNum { get; set; } = 0;
/// <summary>
/// Nome
/// </summary>
public string KeyValue { get; set; } = "";
/// <summary>
/// Note/Descrizione
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// Check attivo
/// </summary>
public bool IsActive { get; set; } = false;
/// <summary>
/// DateTime Attivazione
/// </summary>
public DateTime DtActivation { get; set; } = DateTime.Today;
/// <summary>
/// Navigation property to Customer
/// </summary>
[ForeignKey("CustomerID")]
public virtual CustomerModel CustomerNav { get; set; } = null!;
}
}
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Admin.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("CustomerList")]
public partial class CustomerModel
{
public CustomerModel()
{
MachineNav = new HashSet<MachineModel>();
}
/// <summary>
/// Primary Key AUTO
/// </summary>
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int CustomerID { get; set; }
/// <summary>
/// Nome
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// Note/Descrizione
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// Check attivo
/// </summary>
public bool IsActive { get; set; } = false;
/// <summary>
/// DateTime Attivazione
/// </summary>
public DateTime DtActivation { get; set; } = DateTime.Today;
/// <summary>
/// Token autorizzazione x comunicazione REST
/// </summary>
public string RestToken { get; set; } = "";
/// <summary>
/// Chiave principale (primo impianto) per creazione DB
/// </summary>
public int MainKey { get; set; } = 0;
/// <summary>
/// Boolean di creazione DB
/// </summary>
public bool HasDb { get; set; } = false;
[NotMapped]
public bool HasChildren { get; set; } = false;
[NotMapped]
public virtual ICollection<MachineModel> MachineNav { get; set; }
}
}
+24
View File
@@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Admin.DbModels
{
/// <summary>
/// Tabella dei Database di MySql
/// </summary>
[Table("Database"), Keyless]
public class DbModel
{
#region Public Properties
[Column("Database", Order = 1)]
public string Database { get; set; } = "";
#endregion Public Properties
}
}
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Admin.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("MachineList")]
public partial class MachineModel
{
/// <summary>
/// Primary Key AUTO
/// </summary>
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int MachineID { get; set; }
/// <summary>
/// Ext ref Customers
/// </summary>
public int CustomerID { get; set; } = 0;
/// <summary>
/// Nome
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// Note/Descrizione
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// Check attivo
/// </summary>
public bool IsActive { get; set; } = false;
/// <summary>
/// DateTime Attivazione
/// </summary>
public DateTime DtActivation { get; set; } = DateTime.Today;
/// <summary>
/// Chiave principale (impianto) associata
/// </summary>
public int MainKey { get; set; } = 0;
/// <summary>
/// Navigation property to Customer
/// </summary>
[ForeignKey("CustomerID")]
public virtual CustomerModel CustomerNav { get; set; } = null!;
}
}
+24
View File
@@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Admin.DbModels
{
/// <summary>
/// Classe fake x il conteggio tabelle e check preliminari
/// </summary>
[Keyless]
public class TableCount
{
#region Public Properties
public int Count { get; set; } = 0;
public string TableName { get; set; } = "";
#endregion Public Properties
}
}
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.DbModels
namespace MagMan.Data.Admin.DbModels
{
/// <summary>
/// Tabella dei USER di MySql
+60
View File
@@ -0,0 +1,60 @@
using MagMan.Data.Admin.DbModels;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Admin
{
public class IdentityContext : IdentityDbContext
{
#region Public Constructors
public IdentityContext()
{
}
public IdentityContext(DbContextOptions<IdentityContext> options) : base(options)
{
}
#endregion Public Constructors
#region Public Properties
public virtual DbSet<TableCount> DbSetCounts { get; set; } = null!;
#endregion Public Properties
#region Protected Methods
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
string connString = DbConfig.CONNECTION_STRING;
if (!optionsBuilder.IsConfigured)
{
var serverVersion = DbConfig.MysqlServerVersion(connString);
optionsBuilder.UseMySql(connString, serverVersion);
}
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
// Gestione in blocco user/permessi di base (salvata con migrazione AddUserAndRoles) come in GWMS + https://stackoverflow.com/questions/34343599/how-to-seed-users-and-roles-with-code-first-migration-using-identity-asp-net-cor
// disattivo riferimento view x avere oggetto davvero fittizio
builder.Entity<TableCount>().ToView(null);
builder.Seed();
base.OnModelCreating(builder);
}
#endregion Protected Methods
}
}
@@ -1,38 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
<ItemGroup>
<Folder Include="Controllers\" />
<Folder Include="DTO\" />
<Folder Include="Services\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MailKit" Version="4.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.25" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.25" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.25" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.25">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.25" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.25">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.2.7" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" />
<Compile Remove="Migrations\UserIdentityDb\20240110191326_AddAdminUsers.Designer.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MagMan.Core\MagMan.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
<PackageReference Include="MailKit" Version="4.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.28" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.28">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.28">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.2.8" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.3" />
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
</ItemGroup>
</Project>
@@ -0,0 +1,125 @@
// <auto-generated />
using System;
using MagMan.Data.Admin;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MagMan.Data.Admin.Migrations
{
[DbContext(typeof(MultiTenantContext))]
[Migration("20240111160917_MultiTenantInitDb")]
partial class MultiTenantInitDb
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.25")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.Property<int>("MachineID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<string>("KeyName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("KeyValue")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("MachineID");
b.HasIndex("CustomerID");
b.ToTable("AuthKeyList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.CustomerModel", b =>
{
b.Property<int>("CustomerID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("CustomerID");
b.ToTable("CustomerList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.Property<int>("MachineID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("MachineID");
b.HasIndex("CustomerID");
b.ToTable("MachineList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany()
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany()
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,108 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MagMan.Data.Admin.Migrations
{
public partial class MultiTenantInitDb : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "CustomerList",
columns: table => new
{
CustomerID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Note = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
DtActivation = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomerList", x => x.CustomerID);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "AuthKeyList",
columns: table => new
{
MachineID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CustomerID = table.Column<int>(type: "int", nullable: false),
KeyName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
KeyValue = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Note = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_AuthKeyList", x => x.MachineID);
table.ForeignKey(
name: "FK_AuthKeyList_CustomerList_CustomerID",
column: x => x.CustomerID,
principalTable: "CustomerList",
principalColumn: "CustomerID",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "MachineList",
columns: table => new
{
MachineID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CustomerID = table.Column<int>(type: "int", nullable: false),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Note = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_MachineList", x => x.MachineID);
table.ForeignKey(
name: "FK_MachineList_CustomerList_CustomerID",
column: x => x.CustomerID,
principalTable: "CustomerList",
principalColumn: "CustomerID",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_AuthKeyList_CustomerID",
table: "AuthKeyList",
column: "CustomerID");
migrationBuilder.CreateIndex(
name: "IX_MachineList_CustomerID",
table: "MachineList",
column: "CustomerID");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AuthKeyList");
migrationBuilder.DropTable(
name: "MachineList");
migrationBuilder.DropTable(
name: "CustomerList");
}
}
}
@@ -0,0 +1,131 @@
// <auto-generated />
using System;
using MagMan.Data.Admin;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MagMan.Data.Admin.Migrations
{
[DbContext(typeof(MultiTenantContext))]
[Migration("20240112104822_UpdateMachineModel")]
partial class UpdateMachineModel
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.25")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.Property<int>("MachineID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<string>("KeyName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("KeyValue")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("MachineID");
b.HasIndex("CustomerID");
b.ToTable("AuthKeyList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.CustomerModel", b =>
{
b.Property<int>("CustomerID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("CustomerID");
b.ToTable("CustomerList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.Property<int>("MachineID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("MachineID");
b.HasIndex("CustomerID");
b.ToTable("MachineList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany()
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany()
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,38 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MagMan.Data.Admin.Migrations
{
public partial class UpdateMachineModel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "DtActivation",
table: "MachineList",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "MachineList",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DtActivation",
table: "MachineList");
migrationBuilder.DropColumn(
name: "IsActive",
table: "MachineList");
}
}
}
@@ -0,0 +1,137 @@
// <auto-generated />
using System;
using MagMan.Data.Admin;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MagMan.Data.Admin.Migrations
{
[DbContext(typeof(MultiTenantContext))]
[Migration("20240112134116_UpdateKeyModel")]
partial class UpdateKeyModel
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.25")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.Property<int>("AuthKeyID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("KeyName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("KeyValue")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("AuthKeyID");
b.HasIndex("CustomerID");
b.ToTable("AuthKeyList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.CustomerModel", b =>
{
b.Property<int>("CustomerID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("CustomerID");
b.ToTable("CustomerList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.Property<int>("MachineID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("MachineID");
b.HasIndex("CustomerID");
b.ToTable("MachineList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany()
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany()
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MagMan.Data.Admin.Migrations
{
public partial class UpdateKeyModel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "MachineID",
table: "AuthKeyList",
newName: "AuthKeyID");
migrationBuilder.AddColumn<DateTime>(
name: "DtActivation",
table: "AuthKeyList",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "AuthKeyList",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DtActivation",
table: "AuthKeyList");
migrationBuilder.DropColumn(
name: "IsActive",
table: "AuthKeyList");
migrationBuilder.RenameColumn(
name: "AuthKeyID",
table: "AuthKeyList",
newName: "MachineID");
}
}
}
@@ -0,0 +1,147 @@
// <auto-generated />
using System;
using MagMan.Data.Admin;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MagMan.Data.Admin.Migrations
{
[DbContext(typeof(MultiTenantContext))]
[Migration("20240115132229_MachineKeyAndDb")]
partial class MachineKeyAndDb
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.25")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.Property<int>("AuthKeyID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<int>("KeyNum")
.HasColumnType("int");
b.Property<string>("KeyValue")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("AuthKeyID");
b.HasIndex("CustomerID");
b.ToTable("AuthKeyList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.CustomerModel", b =>
{
b.Property<int>("CustomerID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("CustomerID");
b.ToTable("CustomerList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.Property<int>("MachineID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("HasDb")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<int>("MainKey")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("MachineID");
b.HasIndex("CustomerID");
b.ToTable("MachineList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany()
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany("MachineNav")
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.CustomerModel", b =>
{
b.Navigation("MachineNav");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,59 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MagMan.Data.Admin.Migrations
{
public partial class MachineKeyAndDb : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "KeyName",
table: "AuthKeyList");
migrationBuilder.AddColumn<bool>(
name: "HasDb",
table: "MachineList",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "MainKey",
table: "MachineList",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "KeyNum",
table: "AuthKeyList",
type: "int",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HasDb",
table: "MachineList");
migrationBuilder.DropColumn(
name: "MainKey",
table: "MachineList");
migrationBuilder.DropColumn(
name: "KeyNum",
table: "AuthKeyList");
migrationBuilder.AddColumn<string>(
name: "KeyName",
table: "AuthKeyList",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
}
}
}
@@ -0,0 +1,154 @@
// <auto-generated />
using System;
using MagMan.Data.Admin;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MagMan.Data.Admin.Migrations
{
[DbContext(typeof(MultiTenantContext))]
[Migration("20240116072852_AddCustomerRestToken01")]
partial class AddCustomerRestToken01
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.25")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.Property<int>("AuthKeyID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<int>("KeyNum")
.HasColumnType("int");
b.Property<string>("KeyValue")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("AuthKeyID");
b.HasIndex("CustomerID");
b.ToTable("AuthKeyList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.CustomerModel", b =>
{
b.Property<int>("CustomerID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("HasDb")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<int>("MainKey")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("RestToken")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("CustomerID");
b.ToTable("CustomerList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.Property<int>("MachineID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<int>("MainKey")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("MachineID");
b.HasIndex("CustomerID");
b.ToTable("MachineList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany()
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany("MachineNav")
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.CustomerModel", b =>
{
b.Navigation("MachineNav");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,59 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MagMan.Data.Admin.Migrations
{
public partial class AddCustomerRestToken01 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HasDb",
table: "MachineList");
migrationBuilder.AddColumn<bool>(
name: "HasDb",
table: "CustomerList",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "MainKey",
table: "CustomerList",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "RestToken",
table: "CustomerList",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HasDb",
table: "CustomerList");
migrationBuilder.DropColumn(
name: "MainKey",
table: "CustomerList");
migrationBuilder.DropColumn(
name: "RestToken",
table: "CustomerList");
migrationBuilder.AddColumn<bool>(
name: "HasDb",
table: "MachineList",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
}
}
}
@@ -0,0 +1,152 @@
// <auto-generated />
using System;
using MagMan.Data.Admin;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MagMan.Data.Admin.Migrations
{
[DbContext(typeof(MultiTenantContext))]
partial class MultiTenantContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.25")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.Property<int>("AuthKeyID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<int>("KeyNum")
.HasColumnType("int");
b.Property<string>("KeyValue")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("AuthKeyID");
b.HasIndex("CustomerID");
b.ToTable("AuthKeyList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.CustomerModel", b =>
{
b.Property<int>("CustomerID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("HasDb")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<int>("MainKey")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("RestToken")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("CustomerID");
b.ToTable("CustomerList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.Property<int>("MachineID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("CustomerID")
.HasColumnType("int");
b.Property<DateTime>("DtActivation")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<int>("MainKey")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Note")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("MachineID");
b.HasIndex("CustomerID");
b.ToTable("MachineList");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.AuthKeyModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany()
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.MachineModel", b =>
{
b.HasOne("MagMan.Data.Admin.DbModels.CustomerModel", "CustomerNav")
.WithMany("MachineNav")
.HasForeignKey("CustomerID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomerNav");
});
modelBuilder.Entity("MagMan.Data.Admin.DbModels.CustomerModel", b =>
{
b.Navigation("MachineNav");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,6 +1,6 @@
// <auto-generated />
using System;
using MagMan.Data;
using MagMan.Data.Admin;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
@@ -8,9 +8,9 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MagMan.Data.Migrations.UserIdentityDb
namespace MagMan.Data.Admin.Migrations.UserIdentityDb
{
[DbContext(typeof(UserIdentityDbContext))]
[DbContext(typeof(IdentityContext))]
[Migration("20231222165912_CreateIdentitySchema")]
partial class CreateIdentitySchema
{
@@ -21,7 +21,7 @@ namespace MagMan.Data.Migrations.UserIdentityDb
.HasAnnotation("ProductVersion", "6.0.25")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("MagMan.Data.DbModels.TableCount", b =>
modelBuilder.Entity("MagMan.Data.Admin.DbModels.TableCount", b =>
{
b.Property<int>("Count")
.HasColumnType("int");
@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MagMan.Data.Migrations.UserIdentityDb
namespace MagMan.Data.Admin.Migrations.UserIdentityDb
{
public partial class CreateIdentitySchema : Migration
{
@@ -207,16 +207,16 @@ namespace MagMan.Data.Migrations.UserIdentityDb
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ "86a8f484-ca14-4e4d-a786-3eba35da6e06", "9dd579c3-bdfa-4c44-b6ca-6dd10d34debb", "Admin", "ADMIN" },
{ "ca44b425-5c7e-4812-a28a-047ec6aa2e68", "a1357889-6a23-49cb-9d33-6bc5ef6eb4e6", "User", "USER" },
{ "eebed9c1-7433-4716-a62f-df9829dc0f09", "4a1affe9-543f-4165-816a-2ed6d3f06c77", "Undef", "UNDEF" },
{ "f5bd74e5-df26-4c52-963e-2d87e858c4d6", "1d620875-05b0-490d-91d5-6f21a83844f1", "SuperAdmin", "SUPERADMIN" }
});
//migrationBuilder.InsertData(
// table: "AspNetRoles",
// columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
// values: new object[,]
// {
// { "86a8f484-ca14-4e4d-a786-3eba35da6e06", "9dd579c3-bdfa-4c44-b6ca-6dd10d34debb", "Admin", "ADMIN" },
// { "ca44b425-5c7e-4812-a28a-047ec6aa2e68", "a1357889-6a23-49cb-9d33-6bc5ef6eb4e6", "User", "USER" },
// { "eebed9c1-7433-4716-a62f-df9829dc0f09", "4a1affe9-543f-4165-816a-2ed6d3f06c77", "Undef", "UNDEF" },
// { "f5bd74e5-df26-4c52-963e-2d87e858c4d6", "1d620875-05b0-490d-91d5-6f21a83844f1", "SuperAdmin", "SUPERADMIN" }
// });
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
@@ -0,0 +1,438 @@
// <auto-generated />
using System;
using MagMan.Data.Admin;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MagMan.Data.Admin.Migrations.UserIdentityDb
{
[DbContext(typeof(IdentityContext))]
[Migration("20240111134425_AddUserAndRoles")]
partial class AddUserAndRoles
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.25")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("MagMan.Data.Admin.DbModels.TableCount", b =>
{
b.Property<int>("Count")
.HasColumnType("int");
b.Property<string>("TableName")
.IsRequired()
.HasColumnType("longtext");
b.ToTable("DbSetCounts");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("varchar(255)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
b.HasData(
new
{
Id = "82b54f2b-4da8-4e46-83bf-57ffc17cf8ed",
ConcurrencyStamp = "763dedf1-0868-424e-bc0a-1572a548c1d7",
Name = "Undef",
NormalizedName = "UNDEF"
},
new
{
Id = "34ae910e-acaf-46d1-aaa8-279a74c5bc61",
ConcurrencyStamp = "8b90b548-3d22-40c6-95ba-c3fb0ea032a7",
Name = "User",
NormalizedName = "USER"
},
new
{
Id = "8352aca0-c5e8-4a2d-be76-f6cde5f963a1",
ConcurrencyStamp = "63d84be1-17ac-4e8c-9bd7-35e0ed056533",
Name = "Admin",
NormalizedName = "ADMIN"
},
new
{
Id = "285df363-706d-498e-b1ad-4680e141ad01",
ConcurrencyStamp = "365f0dc5-81c1-4deb-945b-58dd8fc9d18a",
Name = "SuperAdmin",
NormalizedName = "SUPERADMIN"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("varchar(255)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
b.HasData(
new
{
Id = "3fac0523-697f-4b42-ac39-82026839ba2c",
AccessFailedCount = 0,
ConcurrencyStamp = "b23608ab-d50a-464d-8db2-8274f088b0ad",
Email = "samuele.locatelli@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "SAMUELE.LOCATELLI@EGALWARE.COM",
NormalizedUserName = "SAMUELE.LOCATELLI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEAQsxwpx5DzxcFhzIhUciCtBEHZo/GLlB4HtG49I3gTh/WtXSg9VVl0e5KBmopG9VQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "8f4ecdd7-9078-4345-82bc-7c1570e71387",
TwoFactorEnabled = false,
UserName = "samuele.locatelli@egalware.com"
},
new
{
Id = "238a34e8-7a80-4307-bfcc-41bdc4a39c1f",
AccessFailedCount = 0,
ConcurrencyStamp = "f62ab486-c4e0-450a-8fb4-6905d2e3da64",
Email = "emmanuele.sassi@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "EMMANUELE.SASSI@EGALWARE.COM",
NormalizedUserName = "EMMANUELE.SASSI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAECZ2BzJe3VOrXIgdmjBrD+JP/HqsV/eFwMO4DaGzAmFPvHG+xxkRFbwRkI2sYoWt8Q==",
PhoneNumberConfirmed = false,
SecurityStamp = "1be739d4-3aed-4a9a-a5c0-80c45a1474a6",
TwoFactorEnabled = false,
UserName = "emmanuele.sassi@egalware.com"
},
new
{
Id = "be261afb-580a-4cb6-a040-c4a335f9ff3a",
AccessFailedCount = 0,
ConcurrencyStamp = "9c306ce8-ec94-49b9-ad24-87b3d9937188",
Email = "luca.mazzoleni@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "LUCA.MAZZOLENI@EGALWARE.COM",
NormalizedUserName = "LUCA.MAZZOLENI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEHdDRZVkzBW4qlCF+vvpURb/4bj/b2/kl4+HSEjhbHRAekqX5WMnfJfWMPuyjKrgUg==",
PhoneNumberConfirmed = false,
SecurityStamp = "121bb662-adf9-4cba-bbc8-12bf1d2bc693",
TwoFactorEnabled = false,
UserName = "luca.mazzoleni@egalware.com"
},
new
{
Id = "3282b9f4-5240-4946-a8d0-5570df880642",
AccessFailedCount = 0,
ConcurrencyStamp = "20720e13-89b3-4660-8c6e-1f11e1e730b4",
Email = "info@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "INFO@EGALWARE.COM",
NormalizedUserName = "INFO@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEDEuPnbPPl/9vc6xg/mvOmyEfvirN5ZNDWu21im+PjvtNQcqvqfc9k3KQxtJKBs5EQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "3bd9e353-ab86-47b2-85da-d857e618f44e",
TwoFactorEnabled = false,
UserName = "info@egalware.com"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("varchar(255)");
b.Property<string>("RoleId")
.HasColumnType("varchar(255)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
b.HasData(
new
{
UserId = "3fac0523-697f-4b42-ac39-82026839ba2c",
RoleId = "34ae910e-acaf-46d1-aaa8-279a74c5bc61"
},
new
{
UserId = "3fac0523-697f-4b42-ac39-82026839ba2c",
RoleId = "8352aca0-c5e8-4a2d-be76-f6cde5f963a1"
},
new
{
UserId = "3fac0523-697f-4b42-ac39-82026839ba2c",
RoleId = "285df363-706d-498e-b1ad-4680e141ad01"
},
new
{
UserId = "238a34e8-7a80-4307-bfcc-41bdc4a39c1f",
RoleId = "34ae910e-acaf-46d1-aaa8-279a74c5bc61"
},
new
{
UserId = "238a34e8-7a80-4307-bfcc-41bdc4a39c1f",
RoleId = "8352aca0-c5e8-4a2d-be76-f6cde5f963a1"
},
new
{
UserId = "238a34e8-7a80-4307-bfcc-41bdc4a39c1f",
RoleId = "285df363-706d-498e-b1ad-4680e141ad01"
},
new
{
UserId = "be261afb-580a-4cb6-a040-c4a335f9ff3a",
RoleId = "34ae910e-acaf-46d1-aaa8-279a74c5bc61"
},
new
{
UserId = "be261afb-580a-4cb6-a040-c4a335f9ff3a",
RoleId = "8352aca0-c5e8-4a2d-be76-f6cde5f963a1"
},
new
{
UserId = "be261afb-580a-4cb6-a040-c4a335f9ff3a",
RoleId = "285df363-706d-498e-b1ad-4680e141ad01"
},
new
{
UserId = "3282b9f4-5240-4946-a8d0-5570df880642",
RoleId = "34ae910e-acaf-46d1-aaa8-279a74c5bc61"
},
new
{
UserId = "3282b9f4-5240-4946-a8d0-5570df880642",
RoleId = "8352aca0-c5e8-4a2d-be76-f6cde5f963a1"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("varchar(255)");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,238 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MagMan.Data.Admin.Migrations.UserIdentityDb
{
public partial class AddUserAndRoles : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "AspNetUserTokens",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(255)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "AspNetUserTokens",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(255)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ProviderKey",
table: "AspNetUserLogins",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(255)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "AspNetUserLogins",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(255)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ "285df363-706d-498e-b1ad-4680e141ad01", "365f0dc5-81c1-4deb-945b-58dd8fc9d18a", "SuperAdmin", "SUPERADMIN" },
{ "34ae910e-acaf-46d1-aaa8-279a74c5bc61", "8b90b548-3d22-40c6-95ba-c3fb0ea032a7", "User", "USER" },
{ "82b54f2b-4da8-4e46-83bf-57ffc17cf8ed", "763dedf1-0868-424e-bc0a-1572a548c1d7", "Undef", "UNDEF" },
{ "8352aca0-c5e8-4a2d-be76-f6cde5f963a1", "63d84be1-17ac-4e8c-9bd7-35e0ed056533", "Admin", "ADMIN" }
});
migrationBuilder.InsertData(
table: "AspNetUsers",
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" },
values: new object[,]
{
{ "238a34e8-7a80-4307-bfcc-41bdc4a39c1f", 0, "f62ab486-c4e0-450a-8fb4-6905d2e3da64", "emmanuele.sassi@egalware.com", true, false, null, "EMMANUELE.SASSI@EGALWARE.COM", "EMMANUELE.SASSI@EGALWARE.COM", "AQAAAAEAACcQAAAAECZ2BzJe3VOrXIgdmjBrD+JP/HqsV/eFwMO4DaGzAmFPvHG+xxkRFbwRkI2sYoWt8Q==", null, false, "1be739d4-3aed-4a9a-a5c0-80c45a1474a6", false, "emmanuele.sassi@egalware.com" },
{ "3282b9f4-5240-4946-a8d0-5570df880642", 0, "20720e13-89b3-4660-8c6e-1f11e1e730b4", "info@egalware.com", true, false, null, "INFO@EGALWARE.COM", "INFO@EGALWARE.COM", "AQAAAAEAACcQAAAAEDEuPnbPPl/9vc6xg/mvOmyEfvirN5ZNDWu21im+PjvtNQcqvqfc9k3KQxtJKBs5EQ==", null, false, "3bd9e353-ab86-47b2-85da-d857e618f44e", false, "info@egalware.com" },
{ "3fac0523-697f-4b42-ac39-82026839ba2c", 0, "b23608ab-d50a-464d-8db2-8274f088b0ad", "samuele.locatelli@egalware.com", true, false, null, "SAMUELE.LOCATELLI@EGALWARE.COM", "SAMUELE.LOCATELLI@EGALWARE.COM", "AQAAAAEAACcQAAAAEAQsxwpx5DzxcFhzIhUciCtBEHZo/GLlB4HtG49I3gTh/WtXSg9VVl0e5KBmopG9VQ==", null, false, "8f4ecdd7-9078-4345-82bc-7c1570e71387", false, "samuele.locatelli@egalware.com" },
{ "be261afb-580a-4cb6-a040-c4a335f9ff3a", 0, "9c306ce8-ec94-49b9-ad24-87b3d9937188", "luca.mazzoleni@egalware.com", true, false, null, "LUCA.MAZZOLENI@EGALWARE.COM", "LUCA.MAZZOLENI@EGALWARE.COM", "AQAAAAEAACcQAAAAEHdDRZVkzBW4qlCF+vvpURb/4bj/b2/kl4+HSEjhbHRAekqX5WMnfJfWMPuyjKrgUg==", null, false, "121bb662-adf9-4cba-bbc8-12bf1d2bc693", false, "luca.mazzoleni@egalware.com" }
});
migrationBuilder.InsertData(
table: "AspNetUserRoles",
columns: new[] { "RoleId", "UserId" },
values: new object[,]
{
{ "285df363-706d-498e-b1ad-4680e141ad01", "238a34e8-7a80-4307-bfcc-41bdc4a39c1f" },
{ "34ae910e-acaf-46d1-aaa8-279a74c5bc61", "238a34e8-7a80-4307-bfcc-41bdc4a39c1f" },
{ "8352aca0-c5e8-4a2d-be76-f6cde5f963a1", "238a34e8-7a80-4307-bfcc-41bdc4a39c1f" },
{ "34ae910e-acaf-46d1-aaa8-279a74c5bc61", "3282b9f4-5240-4946-a8d0-5570df880642" },
{ "8352aca0-c5e8-4a2d-be76-f6cde5f963a1", "3282b9f4-5240-4946-a8d0-5570df880642" },
{ "285df363-706d-498e-b1ad-4680e141ad01", "3fac0523-697f-4b42-ac39-82026839ba2c" },
{ "34ae910e-acaf-46d1-aaa8-279a74c5bc61", "3fac0523-697f-4b42-ac39-82026839ba2c" },
{ "8352aca0-c5e8-4a2d-be76-f6cde5f963a1", "3fac0523-697f-4b42-ac39-82026839ba2c" },
{ "285df363-706d-498e-b1ad-4680e141ad01", "be261afb-580a-4cb6-a040-c4a335f9ff3a" },
{ "34ae910e-acaf-46d1-aaa8-279a74c5bc61", "be261afb-580a-4cb6-a040-c4a335f9ff3a" },
{ "8352aca0-c5e8-4a2d-be76-f6cde5f963a1", "be261afb-580a-4cb6-a040-c4a335f9ff3a" }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "82b54f2b-4da8-4e46-83bf-57ffc17cf8ed");
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "285df363-706d-498e-b1ad-4680e141ad01", "238a34e8-7a80-4307-bfcc-41bdc4a39c1f" });
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "34ae910e-acaf-46d1-aaa8-279a74c5bc61", "238a34e8-7a80-4307-bfcc-41bdc4a39c1f" });
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "8352aca0-c5e8-4a2d-be76-f6cde5f963a1", "238a34e8-7a80-4307-bfcc-41bdc4a39c1f" });
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "34ae910e-acaf-46d1-aaa8-279a74c5bc61", "3282b9f4-5240-4946-a8d0-5570df880642" });
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "8352aca0-c5e8-4a2d-be76-f6cde5f963a1", "3282b9f4-5240-4946-a8d0-5570df880642" });
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "285df363-706d-498e-b1ad-4680e141ad01", "3fac0523-697f-4b42-ac39-82026839ba2c" });
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "34ae910e-acaf-46d1-aaa8-279a74c5bc61", "3fac0523-697f-4b42-ac39-82026839ba2c" });
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "8352aca0-c5e8-4a2d-be76-f6cde5f963a1", "3fac0523-697f-4b42-ac39-82026839ba2c" });
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "285df363-706d-498e-b1ad-4680e141ad01", "be261afb-580a-4cb6-a040-c4a335f9ff3a" });
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "34ae910e-acaf-46d1-aaa8-279a74c5bc61", "be261afb-580a-4cb6-a040-c4a335f9ff3a" });
migrationBuilder.DeleteData(
table: "AspNetUserRoles",
keyColumns: new[] { "RoleId", "UserId" },
keyValues: new object[] { "8352aca0-c5e8-4a2d-be76-f6cde5f963a1", "be261afb-580a-4cb6-a040-c4a335f9ff3a" });
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "285df363-706d-498e-b1ad-4680e141ad01");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "34ae910e-acaf-46d1-aaa8-279a74c5bc61");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "8352aca0-c5e8-4a2d-be76-f6cde5f963a1");
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "238a34e8-7a80-4307-bfcc-41bdc4a39c1f");
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "3282b9f4-5240-4946-a8d0-5570df880642");
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "3fac0523-697f-4b42-ac39-82026839ba2c");
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "be261afb-580a-4cb6-a040-c4a335f9ff3a");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "AspNetUserTokens",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "AspNetUserTokens",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ProviderKey",
table: "AspNetUserLogins",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "AspNetUserLogins",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}
@@ -1,36 +1,26 @@
// <auto-generated />
using System;
using MagMan.Data;
using MagMan.Data.Admin;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MagMan.Data.Migrations.UserIdentityDb
namespace MagMan.Data.Admin.Migrations.UserIdentityDb
{
[DbContext(typeof(UserIdentityDbContext))]
partial class UserIdentityDbContextModelSnapshot : ModelSnapshot
[DbContext(typeof(IdentityContext))]
[Migration("20240412061834_RemoveDbSetCounts")]
partial class RemoveDbSetCounts
{
protected override void BuildModel(ModelBuilder modelBuilder)
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.25")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("MagMan.Data.DbModels.TableCount", b =>
{
b.Property<int>("Count")
.HasColumnType("int");
b.Property<string>("TableName")
.IsRequired()
.HasColumnType("longtext");
b.ToTable("DbSetCounts");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
@@ -59,29 +49,29 @@ namespace MagMan.Data.Migrations.UserIdentityDb
b.HasData(
new
{
Id = "eebed9c1-7433-4716-a62f-df9829dc0f09",
ConcurrencyStamp = "4a1affe9-543f-4165-816a-2ed6d3f06c77",
Id = "e8456657-70cc-4d00-89e5-d7a8336451d5",
ConcurrencyStamp = "04a20b6f-64ae-40d7-81d8-4a52722193ec",
Name = "Undef",
NormalizedName = "UNDEF"
},
new
{
Id = "ca44b425-5c7e-4812-a28a-047ec6aa2e68",
ConcurrencyStamp = "a1357889-6a23-49cb-9d33-6bc5ef6eb4e6",
Id = "dcc6b28b-b0cb-4eb3-a8ce-2dd24ab95037",
ConcurrencyStamp = "5f90e86b-f714-4f88-a975-636d43863e08",
Name = "User",
NormalizedName = "USER"
},
new
{
Id = "86a8f484-ca14-4e4d-a786-3eba35da6e06",
ConcurrencyStamp = "9dd579c3-bdfa-4c44-b6ca-6dd10d34debb",
Id = "487f1bcc-1278-479a-a8bf-ca31e36be138",
ConcurrencyStamp = "36019e5f-e9ee-4451-bf13-c4f563e5bb99",
Name = "Admin",
NormalizedName = "ADMIN"
},
new
{
Id = "f5bd74e5-df26-4c52-963e-2d87e858c4d6",
ConcurrencyStamp = "1d620875-05b0-490d-91d5-6f21a83844f1",
Id = "c2a01f68-6720-48e9-87c2-433aa44d230e",
ConcurrencyStamp = "cbb91441-0a5b-4d7a-88f7-739b5339365c",
Name = "SuperAdmin",
NormalizedName = "SUPERADMIN"
});
@@ -172,6 +162,72 @@ namespace MagMan.Data.Migrations.UserIdentityDb
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
b.HasData(
new
{
Id = "655b49ee-4e4f-467e-b5b1-927d8cf4fd36",
AccessFailedCount = 0,
ConcurrencyStamp = "25f371d7-c9fc-4b7a-bedc-fc02fb9402b0",
Email = "samuele.locatelli@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "SAMUELE.LOCATELLI@EGALWARE.COM",
NormalizedUserName = "SAMUELE.LOCATELLI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEFTIbK5uhgIKXFvdYGv8QhefFh4kG9sHX1EPcpPrCmqf2xpfwm6qaUCHSKxvR8EfLw==",
PhoneNumberConfirmed = false,
SecurityStamp = "8200bcdd-2b13-4cd3-a81c-3c5598d6b5f6",
TwoFactorEnabled = false,
UserName = "samuele.locatelli@egalware.com"
},
new
{
Id = "75122e30-0933-4538-aee5-a4193b60fc91",
AccessFailedCount = 0,
ConcurrencyStamp = "1be7030f-bb4d-41ae-ae10-0fb3e8e11804",
Email = "emmanuele.sassi@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "EMMANUELE.SASSI@EGALWARE.COM",
NormalizedUserName = "EMMANUELE.SASSI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEANSSGEvLhSbYhJevBDO/Aoq0brwvn1KU5Sv/PJdNCE0+9ZyzGXXyQ+qTJR9gzWS1w==",
PhoneNumberConfirmed = false,
SecurityStamp = "62ed1518-5c7a-4d22-85e9-8bdd54a086ff",
TwoFactorEnabled = false,
UserName = "emmanuele.sassi@egalware.com"
},
new
{
Id = "5d532138-4470-466c-9d89-0c968e6bde1e",
AccessFailedCount = 0,
ConcurrencyStamp = "bf75f82a-4fc5-4bfd-8244-9e03f606387b",
Email = "luca.mazzoleni@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "LUCA.MAZZOLENI@EGALWARE.COM",
NormalizedUserName = "LUCA.MAZZOLENI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEMXSnNBKQhXsCw+CDzgYLKnYk6hsS/sHzOu0kk9C7buY/B9lIQf8dH7F8AXnOp25mA==",
PhoneNumberConfirmed = false,
SecurityStamp = "c974de3d-d0d5-45c4-b685-02b935ada41c",
TwoFactorEnabled = false,
UserName = "luca.mazzoleni@egalware.com"
},
new
{
Id = "ed350b67-b800-4800-9d4e-f2726d836eb5",
AccessFailedCount = 0,
ConcurrencyStamp = "bd182360-ce6a-400a-b295-f42bb5e5abf2",
Email = "info@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "INFO@EGALWARE.COM",
NormalizedUserName = "INFO@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEEqp3H7Tbc/HpqkAJuuZH85PLTWxx0x1vrZI9qpDRLSbSowBKlQqmrc1whRPledpbg==",
PhoneNumberConfirmed = false,
SecurityStamp = "7aa1ab48-a654-42ec-b7ba-8f34d90edde7",
TwoFactorEnabled = false,
UserName = "info@egalware.com"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
@@ -200,10 +256,12 @@ namespace MagMan.Data.Migrations.UserIdentityDb
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.HasColumnType("varchar(255)");
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
@@ -232,6 +290,28 @@ namespace MagMan.Data.Migrations.UserIdentityDb
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
b.HasData(
new
{
UserId = "655b49ee-4e4f-467e-b5b1-927d8cf4fd36",
RoleId = "c2a01f68-6720-48e9-87c2-433aa44d230e"
},
new
{
UserId = "75122e30-0933-4538-aee5-a4193b60fc91",
RoleId = "c2a01f68-6720-48e9-87c2-433aa44d230e"
},
new
{
UserId = "5d532138-4470-466c-9d89-0c968e6bde1e",
RoleId = "dcc6b28b-b0cb-4eb3-a8ce-2dd24ab95037"
},
new
{
UserId = "ed350b67-b800-4800-9d4e-f2726d836eb5",
RoleId = "dcc6b28b-b0cb-4eb3-a8ce-2dd24ab95037"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
@@ -240,10 +320,12 @@ namespace MagMan.Data.Migrations.UserIdentityDb
.HasColumnType("varchar(255)");
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Name")
.HasColumnType("varchar(255)");
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Value")
.HasColumnType("longtext");
@@ -0,0 +1,34 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MagMan.Data.Admin.Migrations.UserIdentityDb
{
public partial class RemoveDbSetCounts : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DbSetCounts");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DbSetCounts",
columns: table => new
{
Count = table.Column<int>(type: "int", nullable: false),
TableName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
})
.Annotation("MySql:CharSet", "utf8mb4");
}
}
}
@@ -0,0 +1,398 @@
// <auto-generated />
using System;
using MagMan.Data.Admin;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MagMan.Data.Admin.Migrations.UserIdentityDb
{
[DbContext(typeof(IdentityContext))]
[Migration("20240705134830_AddSuperUser")]
partial class AddSuperUser
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("varchar(255)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
b.HasData(
new
{
Id = "61898d91-a58c-4fcb-8da2-5078e32bb1eb",
ConcurrencyStamp = "f280c659-3676-4661-b66d-dcb5c6963fd1",
Name = "Undef",
NormalizedName = "UNDEF"
},
new
{
Id = "ef658f55-424b-4a45-a8bc-a2a6297e9e10",
ConcurrencyStamp = "9d095d39-178a-4471-a037-a13b3ab4f101",
Name = "User",
NormalizedName = "USER"
},
new
{
Id = "aa2e0987-62fd-4048-9deb-6e3c7f671865",
ConcurrencyStamp = "2609bd9d-b405-4a8c-bfa7-2bcab3ad38aa",
Name = "SuperUser",
NormalizedName = "SUPERUSER"
},
new
{
Id = "e63dae22-57dc-4dc6-bef5-be0928d98dd3",
ConcurrencyStamp = "3975cad2-c02b-4c93-86e2-86b29f596dd3",
Name = "Admin",
NormalizedName = "ADMIN"
},
new
{
Id = "9be32f20-0eee-4fac-97ab-00485b01b9d9",
ConcurrencyStamp = "2a080580-37cd-4b9e-8a99-ce9d99fe3b4f",
Name = "SuperAdmin",
NormalizedName = "SUPERADMIN"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("varchar(255)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
b.HasData(
new
{
Id = "0a01453d-17db-4c3a-87dd-33ce18974aac",
AccessFailedCount = 0,
ConcurrencyStamp = "775cec82-a98f-4575-bb6c-743b6c1fc79e",
Email = "samuele.locatelli@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "SAMUELE.LOCATELLI@EGALWARE.COM",
NormalizedUserName = "SAMUELE.LOCATELLI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEBLzPhI6ILF8fuQrEgkH8+rFWDFWviVTf+DnWoDutRb5LOt5LnuDmya/Wbmh/5FoBw==",
PhoneNumberConfirmed = false,
SecurityStamp = "7108c3f4-99b2-4901-b056-aba4a0cdb304",
TwoFactorEnabled = false,
UserName = "samuele.locatelli@egalware.com"
},
new
{
Id = "bba018ae-56c2-43d6-babd-50616c1fe826",
AccessFailedCount = 0,
ConcurrencyStamp = "f96737d1-b63d-4e98-a55d-b3205971df78",
Email = "emmanuele.sassi@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "EMMANUELE.SASSI@EGALWARE.COM",
NormalizedUserName = "EMMANUELE.SASSI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEOBoFtuiYZGMpUltyIepbFz9bI9LLoAEo8fnjPVsnShl73RHlLZNJjBG+Oh2GgGxFg==",
PhoneNumberConfirmed = false,
SecurityStamp = "74bc6030-02e8-4237-aac4-d0062277dfc8",
TwoFactorEnabled = false,
UserName = "emmanuele.sassi@egalware.com"
},
new
{
Id = "be99d5c7-f8c3-4429-b6de-ecb2032b0658",
AccessFailedCount = 0,
ConcurrencyStamp = "f7babbe0-0ab9-4428-bbb4-0cac6f4ee404",
Email = "luca.mazzoleni@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "LUCA.MAZZOLENI@EGALWARE.COM",
NormalizedUserName = "LUCA.MAZZOLENI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAENL3XhLx/+KxlDD3wJPCnj/BTJTNTP0hIuspu2Xlj/TLxDZ1yz6im0V9eqUwzjhJyw==",
PhoneNumberConfirmed = false,
SecurityStamp = "f7779584-e160-4c37-ba19-4d2702412da5",
TwoFactorEnabled = false,
UserName = "luca.mazzoleni@egalware.com"
},
new
{
Id = "aca6c684-1cb3-4cc8-ab59-ce27d6879a8c",
AccessFailedCount = 0,
ConcurrencyStamp = "e2eca078-1adf-45a2-ba6a-c39497107845",
Email = "info@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "INFO@EGALWARE.COM",
NormalizedUserName = "INFO@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAELj8C6+r2T6zDvEFiDcDkW78l0oeO8aE51Y3WFeEiXUeCoPO2WjBY3MW1VRwpmF8aQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "7e1ff0bc-c55c-413f-9721-56ce3aa6c687",
TwoFactorEnabled = false,
UserName = "info@egalware.com"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("varchar(255)");
b.Property<string>("RoleId")
.HasColumnType("varchar(255)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
b.HasData(
new
{
UserId = "0a01453d-17db-4c3a-87dd-33ce18974aac",
RoleId = "9be32f20-0eee-4fac-97ab-00485b01b9d9"
},
new
{
UserId = "bba018ae-56c2-43d6-babd-50616c1fe826",
RoleId = "9be32f20-0eee-4fac-97ab-00485b01b9d9"
},
new
{
UserId = "be99d5c7-f8c3-4429-b6de-ecb2032b0658",
RoleId = "ef658f55-424b-4a45-a8bc-a2a6297e9e10"
},
new
{
UserId = "aca6c684-1cb3-4cc8-ab59-ce27d6879a8c",
RoleId = "ef658f55-424b-4a45-a8bc-a2a6297e9e10"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("varchar(255)");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MagMan.Data.Admin.Migrations.UserIdentityDb
{
public partial class AddSuperUser : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ "aa2e0987-62fd-4048-9deb-6e3c7f671865", "2609bd9d-b405-4a8c-bfa7-2bcab3ad38aa", "SuperUser", "SUPERUSER" }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "aa2e0987-62fd-4048-9deb-6e3c7f671865");
}
}
}
@@ -0,0 +1,396 @@
// <auto-generated />
using System;
using MagMan.Data.Admin;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MagMan.Data.Admin.Migrations.UserIdentityDb
{
[DbContext(typeof(IdentityContext))]
partial class UserIdentityDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("varchar(255)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
b.HasData(
new
{
Id = "61898d91-a58c-4fcb-8da2-5078e32bb1eb",
ConcurrencyStamp = "f280c659-3676-4661-b66d-dcb5c6963fd1",
Name = "Undef",
NormalizedName = "UNDEF"
},
new
{
Id = "ef658f55-424b-4a45-a8bc-a2a6297e9e10",
ConcurrencyStamp = "9d095d39-178a-4471-a037-a13b3ab4f101",
Name = "User",
NormalizedName = "USER"
},
new
{
Id = "aa2e0987-62fd-4048-9deb-6e3c7f671865",
ConcurrencyStamp = "2609bd9d-b405-4a8c-bfa7-2bcab3ad38aa",
Name = "SuperUser",
NormalizedName = "SUPERUSER"
},
new
{
Id = "e63dae22-57dc-4dc6-bef5-be0928d98dd3",
ConcurrencyStamp = "3975cad2-c02b-4c93-86e2-86b29f596dd3",
Name = "Admin",
NormalizedName = "ADMIN"
},
new
{
Id = "9be32f20-0eee-4fac-97ab-00485b01b9d9",
ConcurrencyStamp = "2a080580-37cd-4b9e-8a99-ce9d99fe3b4f",
Name = "SuperAdmin",
NormalizedName = "SUPERADMIN"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("varchar(255)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
b.HasData(
new
{
Id = "0a01453d-17db-4c3a-87dd-33ce18974aac",
AccessFailedCount = 0,
ConcurrencyStamp = "775cec82-a98f-4575-bb6c-743b6c1fc79e",
Email = "samuele.locatelli@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "SAMUELE.LOCATELLI@EGALWARE.COM",
NormalizedUserName = "SAMUELE.LOCATELLI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEBLzPhI6ILF8fuQrEgkH8+rFWDFWviVTf+DnWoDutRb5LOt5LnuDmya/Wbmh/5FoBw==",
PhoneNumberConfirmed = false,
SecurityStamp = "7108c3f4-99b2-4901-b056-aba4a0cdb304",
TwoFactorEnabled = false,
UserName = "samuele.locatelli@egalware.com"
},
new
{
Id = "bba018ae-56c2-43d6-babd-50616c1fe826",
AccessFailedCount = 0,
ConcurrencyStamp = "f96737d1-b63d-4e98-a55d-b3205971df78",
Email = "emmanuele.sassi@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "EMMANUELE.SASSI@EGALWARE.COM",
NormalizedUserName = "EMMANUELE.SASSI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEOBoFtuiYZGMpUltyIepbFz9bI9LLoAEo8fnjPVsnShl73RHlLZNJjBG+Oh2GgGxFg==",
PhoneNumberConfirmed = false,
SecurityStamp = "74bc6030-02e8-4237-aac4-d0062277dfc8",
TwoFactorEnabled = false,
UserName = "emmanuele.sassi@egalware.com"
},
new
{
Id = "be99d5c7-f8c3-4429-b6de-ecb2032b0658",
AccessFailedCount = 0,
ConcurrencyStamp = "f7babbe0-0ab9-4428-bbb4-0cac6f4ee404",
Email = "luca.mazzoleni@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "LUCA.MAZZOLENI@EGALWARE.COM",
NormalizedUserName = "LUCA.MAZZOLENI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAENL3XhLx/+KxlDD3wJPCnj/BTJTNTP0hIuspu2Xlj/TLxDZ1yz6im0V9eqUwzjhJyw==",
PhoneNumberConfirmed = false,
SecurityStamp = "f7779584-e160-4c37-ba19-4d2702412da5",
TwoFactorEnabled = false,
UserName = "luca.mazzoleni@egalware.com"
},
new
{
Id = "aca6c684-1cb3-4cc8-ab59-ce27d6879a8c",
AccessFailedCount = 0,
ConcurrencyStamp = "e2eca078-1adf-45a2-ba6a-c39497107845",
Email = "info@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "INFO@EGALWARE.COM",
NormalizedUserName = "INFO@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAELj8C6+r2T6zDvEFiDcDkW78l0oeO8aE51Y3WFeEiXUeCoPO2WjBY3MW1VRwpmF8aQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "7e1ff0bc-c55c-413f-9721-56ce3aa6c687",
TwoFactorEnabled = false,
UserName = "info@egalware.com"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("varchar(255)");
b.Property<string>("RoleId")
.HasColumnType("varchar(255)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
b.HasData(
new
{
UserId = "0a01453d-17db-4c3a-87dd-33ce18974aac",
RoleId = "9be32f20-0eee-4fac-97ab-00485b01b9d9"
},
new
{
UserId = "bba018ae-56c2-43d6-babd-50616c1fe826",
RoleId = "9be32f20-0eee-4fac-97ab-00485b01b9d9"
},
new
{
UserId = "be99d5c7-f8c3-4429-b6de-ecb2032b0658",
RoleId = "ef658f55-424b-4a45-a8bc-a2a6297e9e10"
},
new
{
UserId = "aca6c684-1cb3-4cc8-ab59-ce27d6879a8c",
RoleId = "ef658f55-424b-4a45-a8bc-a2a6297e9e10"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("varchar(255)");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,91 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static StackExchange.Redis.Role;
namespace MagMan.Data.Admin
{
public static class ModelBuilderExtensions
{
#region Public Methods
/// <summary>
/// Estensione per seed iniziale dei dati nel DB (auth)
/// </summary>
/// <param name="modelBuilder"></param>
public static void Seed(this ModelBuilder modelBuilder)
{
// seed ruoli
List<IdentityRole> roles = new List<IdentityRole>()
{
new IdentityRole { Name = "Undef", NormalizedName = "UNDEF" },
new IdentityRole { Name = "User", NormalizedName = "USER" },
new IdentityRole { Name = "SuperUser", NormalizedName = "SUPERUSER" },
new IdentityRole { Name = "Admin", NormalizedName = "ADMIN" },
new IdentityRole { Name = "SuperAdmin", NormalizedName = "SUPERADMIN" }
};
modelBuilder.Entity<IdentityRole>().HasData(roles);
// seed utenti
List<IdentityUser> users = new List<IdentityUser>()
{
// SuperAdmins
getNewUser("samuele.locatelli@egalware.com", "th1sIsTh3R1vrOfThNgt202401"),
getNewUser("emmanuele.sassi@egalware.com", "th1sIsTh3R1vrOfThNgt202402"),
getNewUser("luca.mazzoleni@egalware.com", "th1sIsTh3R1vrOfThNgt202403"),
// Admin egalware base
getNewUser("info@egalware.com", "th1sIsTh3R1vrOfThNgt202404")
};
modelBuilder.Entity<IdentityUser>().HasData(users);
List<IdentityUserRole<string>> userRoles = new List<IdentityUserRole<string>>();
for (int i = 0; i < users.Count; i++)
{
// nei primi 3 rendo SuperAdmin
if (i < 2)
{
userRoles.Add(new IdentityUserRole<string>
{
UserId = users[i].Id,
RoleId = roles.First(q => q.Name == "SuperAdmin").Id
});
}
else
{
// aggiungo ruoli User x altri
userRoles.Add(new IdentityUserRole<string>
{
UserId = users[i].Id,
RoleId = roles.First(q => q.Name == "User").Id
});
}
}
modelBuilder.Entity<IdentityUserRole<string>>().HasData(userRoles);
}
private static IdentityUser getNewUser(string email, string passwd)
{
var newRec = new IdentityUser
{
UserName = email,
NormalizedUserName = email.ToUpper(),
Email = email,
NormalizedEmail = email.ToUpper(),
EmailConfirmed = true,
PasswordHash = hasher.HashPassword(null!, passwd),
};
return newRec;
}
private static PasswordHasher<IdentityUser> hasher = new PasswordHasher<IdentityUser>();
#endregion Public Methods
}
}
+101
View File
@@ -0,0 +1,101 @@
using MagMan.Data.Admin.DbModels;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Admin
{
public partial class MultiTenantContext : DbContext
{
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Public Constructors
public MultiTenantContext()
{
}
public MultiTenantContext(DbContextOptions<MultiTenantContext> options) : base(options)
{
}
#endregion Public Constructors
#region Public Properties
public virtual DbSet<CustomerModel> DbSetCustomers { get; set; } = null!;
public virtual DbSet<MachineModel> DbSetMachines { get; set; } = null!;
public virtual DbSet<AuthKeyModel> DbSetAuthKey { get; set; } = null!;
#endregion Public Properties
#region Protected Methods
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
// default
string connString = DbConfig.CONNECTION_STRING;
if (!optionsBuilder.IsConfigured)
{
// commentato x test su cluster in ufficio
#if DEBUG
//connString = "Server=localhost;port=3306;database=MagMan_Admin;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;";
//connString = "Server=mdb03.ufficio;port=3306;database=MagMan_Admin;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;";
connString = "Server=mdb.ufficio;port=3306;database=MagMan_Admin;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;ConnectionIdleTimeout=30;ConnectionLifeTime=300;";
#endif
var serverVersion = DbConfig.MysqlServerVersion(connString);
optionsBuilder.UseMySql(connString, serverVersion);
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
foreach (var relationship in modelBuilder.Model.GetEntityTypes().SelectMany(e => e.GetForeignKeys()))
{
relationship.DeleteBehavior = DeleteBehavior.Restrict;
}
OnModelCreatingPartial(modelBuilder);
}
#endregion Protected Methods
#region Public Methods
public void DbForceMigrate()
{
try
{
// se non ci fosse... crea o migra!
Database.Migrate();
Log.Info("MultiTenantContext DbForceMigrate: done!");
}
catch (Exception exc)
{
Log.Error(exc, "MultiTenantContext DbForceMigrate: Exception during context initialization 01");
}
}
#endregion Public Methods
#region Private Methods
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
#endregion Private Methods
}
}
+114
View File
@@ -0,0 +1,114 @@
using MagMan.Data.Admin.DbModels;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MySqlConnector;
using NLog;
namespace MagMan.Data.Admin
{
/// <summary>
/// Classe gestione Server MySql:
/// - creazione utenti su DB principale
/// - aggiunta permessi lettura/scrittura
/// </summary>
public partial class ServerAdminContext : DbContext
{
#region Private Fields
#endregion Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
#region Public Constructors
public ServerAdminContext()
{
Log.Info("Calling ServerAdminContext()");
}
public ServerAdminContext(IConfiguration configuration)
{
Log.Info("Calling ServerAdminContext(IConfiguration configuration)");
}
public ServerAdminContext(DbContextOptions<ServerAdminContext> options) : base(options)
{
Log.Info("Calling ServerAdminContext(DbContextOptions<ServerAdminContext> options)");
}
#endregion Public Constructors
#region Public Properties
/// <summary>
/// User management
/// </summary>
public virtual DbSet<UserPriv> UserList { get; set; } = null!;
/// <summary>
/// User management
/// </summary>
public virtual DbSet<DbModel> DbList { get; set; } = null!;
#endregion Public Properties
#region Protected Methods
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
Log.Info("Calling OnConfiguring");
string connString = DbConfig.ADMIN_CONNECTION_STRING;
if (!optionsBuilder.IsConfigured)
{
// chiave cablata x gestione Server se fosse vuota...
if (string.IsNullOrEmpty(connString))
{
connString = "Server=localhost;port=3306;database=mysql;user=egalware;pwd=Egalware_24068!;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;";
}
ServerVersion serverVersion = DbConfig.MysqlServerVersion(connString);
optionsBuilder.UseMySql(connString, serverVersion);
Log.Info("NOT Configured | connString forced to default!");
}
else
{
Log.Info("optionsBuilder.IsConfigured");
}
}
public static ServerVersion CustomAutoDetect(string connectionString)
{
#if false
using var connection = new MySqlConnection(
new MySqlConnectionStringBuilder(connectionString)
{
Database = string.Empty,
// AutoEnlist = false,
// Pooling = false,
}.ConnectionString);
#endif
using var connection = new MySqlConnection(connectionString);
connection.Open();
ServerVersion currVers = ServerVersion.Parse(connection.ServerVersion);
return currVers;
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<UserPriv>().HasKey(c => new { c.Host, c.User });
OnModelCreatingPartial(modelBuilder);
}
#endregion Protected Methods
#region Private Methods
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
#endregion Private Methods
}
}
@@ -0,0 +1,702 @@
using MagMan.Core;
using MagMan.Core.Services;
using MagMan.Data.Admin.Controllers;
using MagMan.Data.Admin.DbModels;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using StackExchange.Redis;
using System.Diagnostics;
namespace MagMan.Data.Admin.Services
{
public class MTAdminService : BaseServ, IDisposable
{
#region Public Constructors
public MTAdminService(IConfiguration configuration, IConnectionMultiplexer redisConnMult, IEmailSender emailSender, UserManager<IdentityUser> userManager)
{
Log.Info("MTAdminService starting...");
_configuration = configuration;
_emailSender = emailSender;
_userManager = userManager;
// Conf cache
redisConn = redisConnMult;
redisDb = this.redisConn.GetDatabase();
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
JSSettings = new JsonSerializerSettings()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
};
// cod app
CodApp = _configuration.GetValue<string>("OptConf:CodApp");
// gestione parallelismo...
numPar = _configuration.GetValue<int>("OptConf:NumPar");
// DB
dbController = new MTAdminController(configuration);
// chiudo log
Log.Info("MTAdminService started!");
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Lista AuthKey
/// </summary>
/// <param name="CustomerId">0 = tutti</param>
/// <returns></returns>
public async Task<List<AuthKeyModel>> AuthKeyByCustId(int CustomerId)
{
string source = "DB";
List<AuthKeyModel>? dbResult = new List<AuthKeyModel>();
try
{
string currKey = $"{Const.rKeyConfig}:Admin:AuthKeyList:{CustomerId}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData) && rawData.Length > 2)
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<AuthKeyModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<AuthKeyModel>();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.AuthKeyByCustId(CustomerId);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (dbResult == null)
{
dbResult = new List<AuthKeyModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"AuthKeyByCustId | {source} in: {ts.TotalMilliseconds} ms");
}
catch (Exception exc)
{
Log.Error($"Error during AuthKeyByCustId:{Environment.NewLine}{exc}");
}
return dbResult;
}
/// <summary>
/// Delete record AuthKey + refresh cache
/// </summary>
/// <param name="currItem"></param>
/// <returns></returns>
public async Task<bool> AuthKeyDelete(AuthKeyModel currItem)
{
bool fatto = false;
try
{
fatto = dbController.AuthKeyDelete(currItem);
if (fatto)
{
await FlushRedisCache();
}
}
catch (Exception exc)
{
Log.Error($"Error during AuthKeyDelete:{Environment.NewLine}{exc}");
}
return fatto;
}
/// <summary>
/// Lista AuthKey da Rest Token
/// </summary>
/// <param name="RestToken">token di auth del cliente</param>
/// <returns></returns>
public async Task<List<AuthKeyModel>> AuthKeyGetByToken(string RestToken)
{
List<AuthKeyModel>? dbResult = new List<AuthKeyModel>();
// cerco in primis customer ID...
int CustomerId = await CustomerIdByToken(RestToken);
if (CustomerId >= 0)
{
dbResult = await AuthKeyByCustId(CustomerId);
}
return dbResult;
}
/// <summary>
/// Update record AuthKey + refresh cache
/// </summary>
/// <param name="currItem"></param>
/// <returns></returns>
public async Task<bool> AuthKeyUpdate(AuthKeyModel currItem)
{
bool fatto = false;
try
{
fatto = dbController.AuthKeyUpdate(currItem);
if (fatto)
{
await FlushRedisCache();
}
}
catch (Exception exc)
{
Log.Error($"Error during AuthKeyUpdate:{Environment.NewLine}{exc}");
}
return fatto;
}
/// <summary>
/// Delete record customer + refresh cache
/// </summary>
/// <param name="currItem"></param>
/// <returns></returns>
public async Task<bool> CustomerDelete(CustomerModel currItem)
{
bool fatto = false;
try
{
fatto = dbController.CustomerDelete(currItem);
if (fatto)
{
await FlushRedisCache();
}
}
catch (Exception exc)
{
Log.Error($"Error during CustomerDelete:{Environment.NewLine}{exc}");
}
return fatto;
}
/// <summary>
/// Lista Customers
/// </summary>
/// <returns></returns>
public async Task<List<CustomerModel>> CustomerGetAll()
{
string source = "DB";
List<CustomerModel>? dbResult = new List<CustomerModel>();
try
{
string currKey = $"{Const.rKeyConfig}:Admin:CustomersList";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<CustomerModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<CustomerModel>();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.CustomerGetAll();
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (dbResult == null)
{
dbResult = new List<CustomerModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"CustomerGetAll | {source} in: {ts.TotalMilliseconds} ms");
}
catch (Exception exc)
{
Log.Error($"Error during CustomerGetAll:{Environment.NewLine}{exc}");
}
return dbResult;
}
/// <summary>
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
/// </summary>
/// <param name="RestToken"></param>
/// <returns></returns>
public async Task<int> CustomerIdByToken(string RestToken)
{
int answ = -1;
string currKey = $"{Const.rKeyConfig}:Admin:Dict:Token2CustID";
answ = RedisHashGetInt(currKey, RestToken);
if (answ <= 0)
{
// cerco nel DB
var custList = await CustomerGetAll();
var custRow = custList.FirstOrDefault(x => x.RestToken == RestToken);
// se trovato salvo
if (custRow != null)
{
answ = custRow.CustomerID;
RedisHashSet(currKey, RestToken, $"{answ}");
Log.Info($"Token2CustID: added {RestToken} --> {answ}");
}
}
return answ;
}
/// <summary>
/// Update record customer + refresh cache
/// </summary>
/// <param name="currItem"></param>
/// <returns></returns>
public async Task<bool> CustomerUpdate(CustomerModel currItem)
{
bool fatto = false;
try
{
fatto = dbController.CustomerUpdate(currItem);
if (fatto)
{
await FlushRedisCache();
}
}
catch (Exception exc)
{
Log.Error($"Error during CustomerUpdate:{Environment.NewLine}{exc}");
}
return fatto;
}
public void Dispose()
{
dbController.Dispose();
}
/// <summary>
/// Delete record Machine + refresh cache
/// </summary>
/// <param name="currItem"></param>
/// <returns></returns>
public async Task<bool> MachineDelete(MachineModel currItem)
{
bool fatto = false;
try
{
fatto = dbController.MachineDelete(currItem);
if (fatto)
{
await FlushRedisCache();
}
}
catch (Exception exc)
{
Log.Error($"Error during MachineDelete:{Environment.NewLine}{exc}");
}
return fatto;
}
/// <summary>
/// Lista Macchine
/// </summary>
/// <param name="CustomerId">0 = tutti</param>
/// <returns></returns>
public async Task<List<MachineModel>> MachineGetByCustId(int CustomerId)
{
string source = "DB";
List<MachineModel>? dbResult = new List<MachineModel>();
try
{
string currKey = $"{Const.rKeyConfig}:Admin:MachineList:{CustomerId}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<MachineModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<MachineModel>();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.MachineGetByCustId(CustomerId);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
// per evitare loopback uso deserialize...
var tempResult = JsonConvert.DeserializeObject<List<MachineModel>>(rawData);
if (tempResult != null)
{
dbResult = tempResult;
}
}
if (dbResult == null)
{
dbResult = new List<MachineModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"MachineGetByCustId | {source} in: {ts.TotalMilliseconds} ms");
}
catch (Exception exc)
{
Log.Error($"Error during MachineGetByCustId:{Environment.NewLine}{exc}");
}
return dbResult;
}
/// <summary>
/// Lista Macchine da Rest Token
/// </summary>
/// <param name="RestToken">token di auth del cliente</param>
/// <returns></returns>
public async Task<List<MachineModel>> MachineGetByToken(string RestToken)
{
List<MachineModel>? dbResult = new List<MachineModel>();
// cerco in primis customer ID...
int CustomerId = await CustomerIdByToken(RestToken);
if (CustomerId >= 0)
{
dbResult = await MachineGetByCustId(CustomerId);
}
return dbResult;
}
/// <summary>
/// Update record Machine + refresh cache
/// </summary>
/// <param name="currItem"></param>
/// <returns></returns>
public async Task<bool> MachineUpdate(MachineModel currItem)
{
bool fatto = false;
try
{
fatto = dbController.MachineUpdate(currItem);
if (fatto)
{
await FlushRedisCache();
}
}
catch (Exception exc)
{
Log.Error($"Error during MachineUpdate:{Environment.NewLine}{exc}");
}
return fatto;
}
/// <summary>
/// Recupera CustomerID dal dizionario dei token noti o cercando sul DB
/// </summary>
/// <param name="CustID"></param>
/// <returns></returns>
public async Task<int> MainKeyByCustomer(int CustID)
{
int answ = -1;
string currKey = $"{Const.rKeyConfig}:Admin:Dict:Cust2MKey";
answ = RedisHashGetInt(currKey, $"{CustID}");
if (answ <= 0)
{
// cerco nel DB
var custList = await CustomerGetAll();
var custRow = custList.FirstOrDefault(x => x.CustomerID == CustID);
// se trovato salvo
if (custRow != null)
{
answ = custRow.MainKey;
RedisHashSet(currKey, $"{CustID}", $"{answ}");
Log.Info($"Cust2MKey: added {CustID} --> {answ}");
}
}
return answ;
}
/// <summary>
/// Recupera MainKey dal dizionario dei token noti o cercando sul DB
/// </summary>
/// <param name="RestToken"></param>
/// <returns></returns>
public async Task<int> MainKeyByToken(string RestToken)
{
int answ = -1;
string currKey = $"{Const.rKeyConfig}:Admin:Dict:Token2MKey";
answ = RedisHashGetInt(currKey, RestToken);
if (answ <= 0)
{
// cerco nel DB
var custList = await CustomerGetAll();
var custRow = custList.FirstOrDefault(x => x.RestToken == RestToken);
// se trovato salvo
if (custRow != null)
{
answ = custRow.MainKey;
RedisHashSet(currKey, RestToken, $"{answ}");
Log.Info($"TokenMKey: added {RestToken} --> {answ}");
}
}
return answ;
}
/// <summary>
/// Reset dati cache redis
/// </summary>
/// <returns></returns>
public async Task ResetUserDataCache()
{
string currKey = $"{Const.rKeyConfig}:Admin:UserData:*";
await ExecFlushRedisPattern((RedisValue)currKey);
}
public async Task<List<UserData>> UserDataGetFilt(string searchVal)
{
// Collezione utenti
List<IdentityUser> RawList = new List<IdentityUser>();
List<UserData> dbResult = new List<UserData>();
string source = "DB";
try
{
string typeSearch = string.IsNullOrEmpty(searchVal) ? "ALL" : searchVal;
string currKey = $"{Const.rKeyConfig}:Admin:UserData:{typeSearch}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData) && rawData.Length > 2)
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<UserData>>(rawData);
if (tempResult == null)
{
dbResult = new List<UserData>();
}
else
{
dbResult = tempResult;
}
}
else
{
// recupero utenti da obj _userManager
var allData = _userManager.Users.ToList();
if (!string.IsNullOrEmpty(searchVal))
{
RawList = allData.Where(x => x.NormalizedEmail.Contains(searchVal.ToUpper()) || x.NormalizedUserName.Contains(searchVal.ToUpper())).ToList();
}
else
{
RawList = allData;
}
var user = RawList.Select(x => new IdentityUser
{
Id = x.Id,
UserName = x.UserName,
Email = x.Email,
PhoneNumber = x.PhoneNumber,
PasswordHash = "*****",
EmailConfirmed = x.EmailConfirmed
}).ToList();
foreach (var item in user)
{
var UserRoles = await _userManager.GetRolesAsync(item);
var UserClaims = await _userManager.GetClaimsAsync(item);
var newItem = new UserData()
{
Identity = item,
Roles = UserRoles.ToList(),
Claims = UserClaims.ToList()
};
dbResult.Add(newItem);
}
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (dbResult == null)
{
dbResult = new List<UserData>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"UserDataGetFilt | {source} in: {ts.TotalMilliseconds} ms");
}
catch (Exception exc)
{
Log.Error($"Error during UserDataGetFilt:{Environment.NewLine}{exc}");
}
return dbResult;
}
#endregion Public Methods
#region Protected Fields
protected static MTAdminController dbController = null!;
#endregion Protected Fields
#region Private Fields
private static JsonSerializerSettings? JSSettings;
private readonly IEmailSender _emailSender;
private readonly UserManager<IdentityUser> _userManager;
#endregion Private Fields
#region Private Methods
/// <summary>
/// Recupera UN SINGOLO VALORE dalla hash per un dato field
/// </summary>
/// <param name="hashKey"></param>
/// <param name="hashField"></param>
/// <returns></returns>
private string RedisHashGet(RedisKey hashKey, string hashField)
{
string answ = "";
var hasVal = redisDb.HashExists(hashKey, hashField);
if (hasVal)
{
answ = redisDb.HashGet(hashKey, hashField).ToString();
}
return answ;
}
/// <summary>
/// Recupero HashSet redis come Dictionary
/// </summary>
/// <param name="hashKey"></param>
private Dictionary<string, string> RedisHashGetDict(RedisKey hashKey)
{
Dictionary<string, string> answ = new Dictionary<string, string>();
try
{
answ = redisDb
.HashGetAll(hashKey)
.ToDictionary(x => $"{x.Name}", x => $"{x.Value}");
}
catch (Exception exc)
{
Log.Info($"Errore RedisHashGetDict | hashKey: {hashKey}{Environment.NewLine}{exc}");
}
return answ;
}
/// <summary>
/// Recupera UN SINGOLO VALORE dalla hash per un dato field come INT
/// </summary>
/// <param name="hashKey">Redis Key for Hashlist</param>
/// <param name="hashField">Requested key on list</param>
/// <returns>Value as Int</returns>
private int RedisHashGetInt(RedisKey hashKey, string hashField)
{
int result = 0;
var rawRes = RedisHashGet(hashKey, hashField);
if (!string.IsNullOrEmpty(rawRes))
{
int.TryParse($"{rawRes}", out result);
}
return result;
}
/// <summary>
/// Aggiunta KVP in HashSet Redis
/// </summary>
/// <param name="currKey"></param>
/// <param name="dict"></param>
private bool RedisHashSet(RedisKey currKey, string hashField, string value)
{
bool fatto = false;
try
{
// salvo!
redisDb.HashSet(currKey, hashField, value);
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in RedisHashSet | currKey: {currKey}{Environment.NewLine}{exc}");
}
return fatto;
}
/// <summary>
/// Salvataggio Dictionary come HashSet Redis
/// </summary>
/// <param name="hashKey"></param>
/// <param name="dict"></param>
private bool RedisHashSetDict(RedisKey hashKey, Dictionary<string, string> dict)
{
bool fatto = false;
try
{
HashEntry[] data2ins = new HashEntry[dict.Count];
int i = 0;
foreach (KeyValuePair<string, string> kvp in dict)
{
data2ins[i] = new HashEntry(kvp.Key, kvp.Value);
i++;
}
// salvo!
redisDb.HashSet(hashKey, data2ins);
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in RedisHashSet | hashKey: {hashKey}{Environment.NewLine}{exc}");
}
return fatto;
}
/// <summary>
/// Salvataggio Dictionary come HashSet Redis
/// </summary>
/// <param name="hashKey"></param>
/// <param name="dict"></param>
/// <param name="ttl"></param>
private bool RedisHashSetDict(RedisKey hashKey, Dictionary<string, string> dict, TimeSpan ttl)
{
bool fatto = false;
try
{
HashEntry[] data2ins = new HashEntry[dict.Count];
int i = 0;
foreach (KeyValuePair<string, string> kvp in dict)
{
data2ins[i] = new HashEntry(kvp.Key, kvp.Value);
i++;
}
// salvo!
redisDb.HashSet(hashKey, data2ins);
redisDb.KeyExpire(hashKey, ttl);
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in RedisHashSet | hashKey: {hashKey}{Environment.NewLine}{exc}");
}
return fatto;
}
#endregion Private Methods
}
}
+79
View File
@@ -0,0 +1,79 @@
using Microsoft.AspNetCore.Identity;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Security.Claims;
namespace MagMan.Data.Admin
{
/// <summary>
/// Classe generalizzaizone identity (user + roles + claims) x gestione semplificata in editing
///
/// per deserializzare i claims vedere questi link:
/// - https://stackoverflow.com/questions/63634652/c-sharp-newtonsoft-deserialize-custom-object-with-claims
/// - https://stackoverflow.com/questions/28155169/how-to-programmatically-choose-a-constructor-during-deserialization/28155770#28155770
/// </summary>
public class UserData
{
#region Public Properties
[JsonProperty(ItemConverterType = typeof(ClaimConverter))]
public List<Claim> Claims { get; set; } = new List<Claim>();
public IdentityUser Identity { get; set; } = new IdentityUser();
public List<string> Roles { get; set; } = new List<string>();
#endregion Public Properties
}
class ClaimConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return (objectType == typeof(System.Security.Claims.Claim));
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
JObject jo = JObject.Load(reader);
string type = (string)jo["Type"];
string value = (string)jo["Value"];
string valueType = (string)jo["ValueType"];
string issuer = (string)jo["Issuer"];
string originalIssuer = (string)jo["OriginalIssuer"];
return new Claim(type, value, valueType, issuer, originalIssuer);
}
public override bool CanWrite
{
get { return false; }
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
/// <summary>
/// Classe x gestione dei claim come record editabile
/// </summary>
public class ClaimRec
{
public int Id { get; set; } = 0;
public string Type { get; set; } = "";
public string Value { get; set; } = "";
public ClaimRec(Claim currItem, int nId)
{
this.Id = nId;
this.Type = currItem.Type;
this.Value = currItem.Value;
}
public ClaimRec(string newType, string newValue, int nId)
{
this.Id = nId;
this.Type = newType;
this.Value = newValue;
}
}
}
File diff suppressed because it is too large Load Diff
+56
View File
@@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore;
using NLog;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace MagMan.Data.Tenant
{
public class DbAdmin : IDisposable
{
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Public Constructors
public DbAdmin()
{
}
#endregion Public Constructors
#region Public Methods
public static async Task<bool> migrateDbMain(string connString)
{
bool answ = false;
using (MagManContext dbCtx = new MagManContext(connString))
{
await dbCtx.Database.MigrateAsync();
answ = true;
}
return answ;
}
public static bool resetPlantLogTable()
{
bool answ = false;
using (MagManContext dbCtx = new MagManContext())
{
string sqlCommand = "TRUNCATE TABLE PlantLog;";
dbCtx.Database.ExecuteSqlRaw(sqlCommand);
answ = true;
}
return answ;
}
public void Dispose()
{
}
#endregion Public Methods
}
}
+113
View File
@@ -0,0 +1,113 @@
using Microsoft.EntityFrameworkCore;
using MySqlConnector;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Tenant
{
public static class DbConfig
{
#region Public Fields
public static string DATABASE_NAME = "MagMan_000000";
public static int DATABASE_PROCESS_TIMEOUT = 5;
public static string DATABASE_PWD = "viad@nte16!";
public static string DATABASE_SERV = "127.0.0.1";
public static string DATABASE_USER = "MagMan_DbUser";
#endregion Public Fields
#region Public Properties
/// <summary>
/// DB Connection string
/// </summary>
public static string CONNECTION_STRING { get; set; } = "";
#endregion Public Properties
#region Public Methods
public static ServerVersion CustomAutoDetect(string connectionString)
{
#if false
using var connection = new MySqlConnection(
new MySqlConnectionStringBuilder(connectionString)
{
Database = string.Empty,
// AutoEnlist = false, Pooling = false,
}.ConnectionString);
#endif
using var connection = new MySqlConnection(connectionString);
connection.Open();
ServerVersion currVers = ServerVersion.Parse(connection.ServerVersion);
return currVers;
}
public static string CustomerConnString(string server, int nKey)
{
string dbName = $"MagMan_{nKey:000000}";
return $"server={server};port=3306;database={dbName};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;ConnectionIdleTimeout=30;ConnectionLifeTime=300;";
//LoadBalance=RoundRobin;Pooling=true;
}
public static bool ExecMigrationMain(string connString)
{
// esecuzione migrazione
var migrateTask = Task.Run(async () => await DbAdmin.migrateDbMain(connString));
migrateTask.Wait();
return migrateTask.Result;
}
public static void InitDb(string server, int nKey)
{
DATABASE_SERV = server;
DATABASE_NAME = $"MagMan_{nKey:000000}";
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;ConnectionIdleTimeout=30;ConnectionLifeTime=300;";
//LoadBalance=RoundRobin;Pooling=true;
}
public static ServerVersion MysqlServerVersion(string connString)
{
// fix come da https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1859
//Log.Info($"MysqlServerVersion | {connString}");
//ServerVersion serverVersion = ServerVersion.Parse("10.11.13-MariaDB");
ServerVersion serverVersion = ServerVersion.Parse("10.5.25-mysql");
bool versOk = false;
try
{
serverVersion = ServerVersion.AutoDetect(connString);
versOk = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in verifica versione server ServerVersion.AutoDetect: {Environment.NewLine}{exc}");
}
if (!versOk)
{
try
{
serverVersion = CustomAutoDetect(connString);
versOk = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in verifica versione server CustomAutoDetect: {Environment.NewLine}{exc}");
}
}
return serverVersion;
}
#endregion Public Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
+62
View File
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MagMan.Data.Tenant.Services;
namespace MagMan.Data.Tenant.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("AliasList")]
public class AliasModel
{
/// <summary>
/// Famiglia di sinonimi
/// </summary>
public string Family { get; set; } = "";
/// <summary>
/// Codice originale (da trasformare)
/// </summary>
public string ValueOriginal { get; set; } = "";
/// <summary>
/// Codice Alias in cui viene convertito
/// </summary>
public string ValueAlias { get; set; } = "";
/// <summary>
/// Indica se il record sia attivo/valido (per cancellazione logica online e fisica in remoto)
/// </summary>
public bool IsActive { get; set; } = true;
public override bool Equals(object? obj)
{
if (obj == null)
return false;
if (!(obj is AliasModel item))
return false;
if (Family != item.Family)
return false;
if (ValueOriginal != item.ValueOriginal)
return false;
if (ValueAlias != item.ValueAlias)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MagMan.Data.DbModels
namespace MagMan.Data.Tenant.DbModels
{
/// <summary>
/// Tabella Config
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Tenant.DbModels
{
[Table("DayStat")]
public class DayStatModel
{
[Key, Column("DayId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int DayId { get; set; }
/// <summary>
/// Id macchina (diMagMan)
/// </summary>
public int MachineID { get; set; } = 0;
/// <summary>
/// Data di riferimento
/// </summary>
public DateTime DtRif { get; set; } = DateTime.MinValue;
/// <summary>
/// Ope apertura disponibili
/// </summary>
public double OreDis { get; set; } = 0;
/// <summary>
/// Ore lavorate effettive
/// </summary>
public double OreLav { get; set; } = 0;
[NotMapped]
public double OEE
{
get
{
double denom = OreDis > 0 ? OreDis : 1;
return OreLav / denom;
}
}
}
}
+26
View File
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Tenant.DbModels
{
[Table("AnagEventi")]
public class EventModel
{
[Key]
public int IdxEv { get; set; } = 0;
public string Nome { get; set; } = "";
public string TabAzione { get; set; } = "";
public string Azione { get; set; } = "";
public string KeyEvento { get; set; } = "";
public bool EventoTablet { get; set; } = false;
public string NoteEvento { get; set; } = "";
public string CssClass { get; set; } = "";
public string Icon { get; set; } = "";
}
}
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using static MagMan.Core.Enums;
namespace MagMan.Data.Tenant.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
/// <summary>
/// Tabella dei LOG Macchina (per macchina)
/// </summary>
[Table("LogMachine")]
[Index(nameof(MachineID))]
[Index(nameof(KeyNum))]
public class LogMachineModel
{
[Key, Column("DbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int LogDbId { get; set; }
/// <summary>
/// Key di riferimento per il progetto
/// </summary>
public int KeyNum { get; set; } = 0;
/// <summary>
/// Id macchina (diMagMan)
/// </summary>
public int MachineID { get; set; } = 0;
/// <summary>
/// Progetto di riferimento (CloudId)
/// </summary>
public int ProjDbId { get; set; }
/// <summary>
/// Data Registrazione
/// </summary>
[Column("DtEvent")]
public DateTime DtEvent { get; set; } = DateTime.Now;
/// <summary>
/// Stato da enum Core
/// </summary>
[Column("EvType")]
public MachLogTypes EvType { get; set; } = MachLogTypes.NULL;
/// <summary>
/// Indirizzo VAR
/// </summary>
[Column("SupervId")]
public string SupervId { get; set; } = "";
/// <summary>
/// Valore VAR
/// </summary>
[Column("VarValue")]
public string VarValue { get; set; } = "";
}
}
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Tenant.DbModels
{
/// <summary>
/// Tabella dei grezzi
/// </summary>
[Table("MachGroupList")]
public class MachGroupModel
{
[Key, Column("DbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int MachGroupDbId { get; set; }
/// <summary>
/// Id geometrico Grezzo (barra intera)
/// </summary>
[Column("MachGroupId")]
public int MachGroupId { get; set; }
/// <summary>
/// Proj di appartenenza
/// </summary>
public int ProjDbId { get; set; }
/// <summary>
/// Data Start
/// </summary>
[Column("DtStart")]
public DateTime DtStart { get; set; }
/// <summary>
/// Data End
/// </summary>
[Column("DtEnd")]
public DateTime DtEnd { get; set; }
}
}
@@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Tenant.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("MaterialsList")]
public partial class MaterialModel
{
/// <summary>
/// Init classe
/// </summary>
public MaterialModel()
{
RawItemList = new HashSet<RawItemModel>();
}
/// <summary>
/// Primary Key AUTO
/// </summary>
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int MatId { get; set; }
/// <summary>
/// Codice Materiale
/// </summary>
public string MatCode { get; set; } = "";
/// <summary>
/// Descrizione materiale
/// </summary>
public string MatDesc { get; set; } = "";
/// <summary>
/// Height (Thikness/Spessore) in mm
/// </summary>
public decimal HMm { get; set; } = 0;
/// <summary>
/// Lenght/Lunghezza in mm
/// </summary>
public decimal LMm { get; set; } = 0;
/// <summary>
/// Width/Larghezza in mm
/// </summary>
public decimal WMm { get; set; } = 0;
/// <summary>
/// Codice materiale x QR/Datamatrix
/// </summary>
[NotMapped]
public string MatDtmx
{
get => $"MT{MatId:00000000}";
}
/// <summary>
/// Verifica che sia Beam, quando L == 0
/// </summary>
[NotMapped]
public bool IsBeam
{
get => (LMm == 0 && (HMm > 0 && WMm > 0));
}
/// <summary>
/// Verifica che sia Wall, quando W/L == 0
/// </summary>
[NotMapped]
public bool IsWall
{
get => (HMm > 0 && (LMm == 0 && WMm == 0));
}
/// <summary>
/// Navigazione ad oggetti child
/// </summary>
public virtual ICollection<RawItemModel>? RawItemList { get; set; }
}
}

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