From 8dfbad66abd7600bc1f31f7198088cf930249b24 Mon Sep 17 00:00:00 2001 From: michele Date: Tue, 21 Nov 2023 10:28:06 +0100 Subject: [PATCH] MICHELE: progresivi + models vincoli lunghezza --- Controllers/ChiamateController.cs | 6 +++--- Models/Anag.cs | 8 ++++++++ Models/AziendaRif.cs | 6 +++++- Models/Chiamate.cs | 1 + Models/Chiusure.cs | 3 +++ Models/Impianto.cs | 12 ++++++++++++ Models/Progressivo.cs | 6 +++++- Models/Rapp_New.cs | 9 +++++++++ Models/Registrazione.cs | 15 +++++++++++++++ Models/Tecnici.cs | 5 +++++ Views/AziendaRif/Create.cshtml | 6 ------ 11 files changed, 66 insertions(+), 11 deletions(-) diff --git a/Controllers/ChiamateController.cs b/Controllers/ChiamateController.cs index 5b641b6..0713ee4 100644 --- a/Controllers/ChiamateController.cs +++ b/Controllers/ChiamateController.cs @@ -370,6 +370,7 @@ namespace VirtualTask.Controllers #endregion DELETE #region metodi interni + private List getImpianti() { SessionHelper helper = new SessionHelper(this); @@ -574,9 +575,6 @@ namespace VirtualTask.Controllers return numero; } - #endregion - - [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { @@ -584,5 +582,7 @@ namespace VirtualTask.Controllers string e = helper.GetStringValue("errMsg"); return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier, ErrMsg = e }); } + + #endregion } } diff --git a/Models/Anag.cs b/Models/Anag.cs index 5e0323e..a97087c 100644 --- a/Models/Anag.cs +++ b/Models/Anag.cs @@ -18,34 +18,42 @@ namespace VirtualTask.Models public string? ancodazi { get; set; } [Display(Name = "EMAIL")] + [StringLength(254)] /// email public string? an_email { get; set; } [Display(Name = "CODICE FISCALE")] + [StringLength(16)] /// codice fiscale public string? ancodfis { get; set; } [Display(Name = "PARTITA IVA")] + [StringLength(12)] /// partita iva public string? anpariva { get; set; } [Display(Name = "INDIRIZZO")] + [StringLength(35)] /// indirizzo public string? anindiri { get; set; } [Display(Name = "TELEFONO")] + [StringLength(36)] /// telefono public string? antelefo { get; set; } [Display(Name = "CELLULARE")] + [StringLength(36)] /// cellulare public string? annumcel { get; set; } [Display(Name = "PEC")] + [StringLength(254)] /// pec public string? an_empec { get; set; } [Display(Name = "RAGIONE SOCIALE"), Required(ErrorMessage = "Ragione sociale obbligatoria")] + [StringLength(60)] /// descrizione public string? andescri { get; set; } diff --git a/Models/AziendaRif.cs b/Models/AziendaRif.cs index 27fc152..f54a420 100644 --- a/Models/AziendaRif.cs +++ b/Models/AziendaRif.cs @@ -1,4 +1,6 @@ -namespace VirtualTask.Models +using System.ComponentModel.DataAnnotations; + +namespace VirtualTask.Models { public class AziendaRif { @@ -11,9 +13,11 @@ /// tecnico public string? pirifazi { get; set; } + [StringLength(50)] /// Nome azienda collegata public string? pinomede { get; set; } + [StringLength(254)] /// url logo public string? pilogurl { get; set; } diff --git a/Models/Chiamate.cs b/Models/Chiamate.cs index 46d543e..c0f6ba9 100644 --- a/Models/Chiamate.cs +++ b/Models/Chiamate.cs @@ -35,6 +35,7 @@ namespace VirtualTask.Models public string? chrifer { get; set; } [Display(Name = "TELEFONO")] + [StringLength(18)] public string? chtelef { get; set; } [Display(Name = "COD. SEGNALAZIONE")] diff --git a/Models/Chiusure.cs b/Models/Chiusure.cs index f93825f..b5bae20 100644 --- a/Models/Chiusure.cs +++ b/Models/Chiusure.cs @@ -9,9 +9,12 @@ namespace VirtualTask.Models [Display(Name = "AZIENDA")] public string? cccodazi { get; set; } + [StringLength(15)] [Display(Name = "CODICE"), Required(ErrorMessage = "Inserire codice chiamata")] + public string? cccodice { get; set; } + [StringLength(50)] [Display(Name = "DESCRIZIONE"), Required(ErrorMessage = "Inserire descrizione")] public string? ccdescr { get; set; } diff --git a/Models/Impianto.cs b/Models/Impianto.cs index 1ba6941..e4f6007 100644 --- a/Models/Impianto.cs +++ b/Models/Impianto.cs @@ -5,7 +5,9 @@ namespace VirtualTask.Models { public class Impianto { + [Display(Name = "Codice Impianto"), Required(ErrorMessage = "Inserire codice impianto")] + [StringLength(10)] /// Codice Impianto public string? imcodimp { get; set; } @@ -14,15 +16,18 @@ namespace VirtualTask.Models public string? imcodazi { get; set; } [Display(Name = "Descrizione"), Required(ErrorMessage = "Inserire descrizione")] + [StringLength(40)] /// Descrizione Impianto public string? imdescri { get; set; } /// Tipo indirizzo (Via, piazza..) [Display(Name = "Via,piazza,..")] + [StringLength(10)] public string? imindiri1 { get; set; } /// indirizzo [Display(Name = "Indirizzo")] + [StringLength(30)] public string? imindiri2 { get; set; } /// numero civico @@ -31,26 +36,33 @@ namespace VirtualTask.Models /// sottonumero [Display(Name = "Interno")] + [StringLength(4)] public string? imindiri4 { get; set; } /// scala [Display(Name = "Scala")] + [StringLength(3)] public string? imindiri5 { get; set; } /// localita [Display(Name = "Località")] + [StringLength(30)] public string? imlocali { get; set; } /// Cap [Display(Name = "Cap")] + [StringLength(5)] public string? imcodcap { get; set; } /// Comune [Display(Name = "Comune")] + [StringLength(20)] public string? imcomune { get; set; } /// Provincia [Display(Name = "Provincia")] + [StringLength(2)] + public string? improvin { get; set; } [Display(Name = "Cliente")] diff --git a/Models/Progressivo.cs b/Models/Progressivo.cs index 263f11e..c387f96 100644 --- a/Models/Progressivo.cs +++ b/Models/Progressivo.cs @@ -1,10 +1,14 @@ -namespace VirtualTask.Models +using System.ComponentModel.DataAnnotations; + +namespace VirtualTask.Models { public class Progressivo { + [StringLength(5)] /// Azienda public string? azienda { get; set; } + [StringLength(10)] /// stringa definisce il tipo di progressivo da gestire public string? tipo_prog { get; set; } diff --git a/Models/Rapp_New.cs b/Models/Rapp_New.cs index 4f04445..edd62f5 100644 --- a/Models/Rapp_New.cs +++ b/Models/Rapp_New.cs @@ -17,6 +17,7 @@ namespace VirtualTask.Models public string? azienda_impianto { get; set; } [Display(Name = "CODICE IMPIANTO"), Required(ErrorMessage = "Inserisci codice impianto")] + [StringLength(10)] public string? codice_impianto { get; set; } [Display(Name = "AZ. CHIAMATA")] @@ -32,15 +33,19 @@ namespace VirtualTask.Models public DateTime data_rapportino { get; set; } [Display(Name = "ORA INIZIO")] + [StringLength(2)] public string? ora_ini_rapportino { get; set; } + [StringLength(2)] [Display(Name = "MINUTO INIZIO")] public string? min_ini_rapportino { get; set; } [Display(Name = "ORA FINE")] + [StringLength(2)] public string? ora_fin_rapportino { get; set; } [Display(Name = "MINUTO FINE")] + [StringLength(2)] public string? min_fin_rapportino { get; set; } [Display(Name = "CODICE CHIUSURA 1")] @@ -119,18 +124,21 @@ namespace VirtualTask.Models public string? lavoro_eseguito { get; set; } [Display(Name = "ESITO")] + [StringLength(1)] public string? esito_intervento { get; set; } [Display(Name = "NOTE")] public string? note_intervento { get; set; } [Display(Name = "NUOVO CONTRATTO")] + [StringLength(2)] public string? nuovo_contratto { get; set; } [Display(Name = "ORE LAVORO")] public double? ore_lavoro { get; set; } [Display(Name = "CAUSALE")] + [StringLength(5)] public string? causale { get; set; } [Display(Name = "MATERIALE")] @@ -146,6 +154,7 @@ namespace VirtualTask.Models public double? spese_viaggio { get; set; } [Display(Name = "PAGAMENTO")] + [StringLength(20)] public string? pagamento { get; set; } [Display(Name = "ANTICIPO")] diff --git a/Models/Registrazione.cs b/Models/Registrazione.cs index 2a51925..4cf3fed 100644 --- a/Models/Registrazione.cs +++ b/Models/Registrazione.cs @@ -8,18 +8,23 @@ namespace VirtualTask.Models public int id { get; set; } [Display(Name = "Nome"), Required(ErrorMessage = "Nome obbligatorio")] + [StringLength(50)] public string? nome { get; set; } [Display(Name = "Cognome"), Required(ErrorMessage = "Cognome obbligatorio")] + [StringLength(50)] public string? cognome { get; set; } [Display(Name = "Telefono"), Required(ErrorMessage = "Telefono obbligatorio")] + [StringLength(50)] public string? telefono { get; set;} [Display(Name = "Cellulare"), Required(ErrorMessage = "Cellulare obbligatorio")] + [StringLength(50)] public string? cellulare { get; set;} [RegularExpression("^[a-zA-Z0-9_\\.-]+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$", ErrorMessage = "formato campo Email non valido")] + [StringLength(100)] [Display(Name = "Email"), Required(ErrorMessage = "Email obbligatorio")] public string? email { get; set;} @@ -28,17 +33,27 @@ namespace VirtualTask.Models public string? emailConf { get; set;} [Display(Name = "Azienda"), Required(ErrorMessage = "Azienda obbligatorio")] + [StringLength(5)] public string? azienda { get; set; } [Display(Name = "Username"), Required(ErrorMessage = "Username obbligatorio")] + [StringLength(20)] public string? username { get; set; } [Display(Name = "Password"), Required(ErrorMessage = "Password obbligatorio")] + [StringLength(20)] public string? passwd { get; set;} + [StringLength(50)] public string? citta { get; set;} + + [StringLength(2)] public string? provincia { get; set;} + + [StringLength(2)] public string? nazione { get; set;} + + [StringLength(1)] public string? attivato { get; set;} } } diff --git a/Models/Tecnici.cs b/Models/Tecnici.cs index fc5166d..646850c 100644 --- a/Models/Tecnici.cs +++ b/Models/Tecnici.cs @@ -10,18 +10,23 @@ namespace VirtualTask.Models public string? tccodazi { get; set; } [Display(Name = "CODICE"), Required(ErrorMessage = "Inserire codice tecnico")] + [StringLength(15)] public string? tccodice { get; set; } [Display(Name = "DESCRIZIONE"), Required(ErrorMessage = "Inserire descrizione")] + [StringLength(40)] public string? tcdescri { get; set;} [Display(Name = "TELEFONO")] + [StringLength(18)] public string? tctelef1 { get; set;} [Display(Name = "UTENTE"), Required(ErrorMessage = "Inserire Utente")] + [StringLength(20)] public string? tcuser { get; set;} [Display(Name = "PASSWORD")] + [StringLength(20)] public string? tcpwd { get; set;} [Display(Name = "COSTO ORDINARIO")] diff --git a/Views/AziendaRif/Create.cshtml b/Views/AziendaRif/Create.cshtml index e9a2adf..8c5ec16 100644 --- a/Views/AziendaRif/Create.cshtml +++ b/Views/AziendaRif/Create.cshtml @@ -26,12 +26,6 @@
 
-
- @* *@ - - -
-
 
@* *@