From c28dae0c8d10040eb2a23fffaa5f230d3f318674 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 8 Oct 2022 17:47:47 +0200 Subject: [PATCH] SPEC, statistiche ODL: -aggiunta model e controllo x recupero stat da stored --- MP.Data/Controllers/MpSpecController.cs | 22 +++++++++++++++++++++- MP.Data/DatabaseModels/StatODLModel.cs | 25 +++++++++++++++++++++++++ MP.Data/MoonProContext.cs | 1 + 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 MP.Data/DatabaseModels/StatODLModel.cs diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index f31a1c6a..c9e62483 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -184,7 +184,7 @@ namespace MP.Data.Controllers using (var dbCtx = new MoonProContext(_configuration)) { dbResult = dbCtx - .DbSetArticoli + .DbSetArticoli .FromSqlRaw("EXEC stp_ART_getUsed") .AsNoTracking() .ToList(); @@ -192,6 +192,26 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Statistiche ODL calcolate (da stored stp_STAT_ODL) + /// + /// + public List StatOdl(int IdxOdl) + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + var IdxODL = new SqlParameter("@IdxODL", IdxOdl); + + dbResult = dbCtx + .DbSetStatOdl + .FromSqlRaw("EXEC stp_STAT_ODL @IdxODL", IdxODL) + .AsNoTracking() + .ToList(); + } + return dbResult; + } + /// /// Update Record /// diff --git a/MP.Data/DatabaseModels/StatODLModel.cs b/MP.Data/DatabaseModels/StatODLModel.cs new file mode 100644 index 00000000..88dc6ca7 --- /dev/null +++ b/MP.Data/DatabaseModels/StatODLModel.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + + +#nullable disable +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.Data.DatabaseModels +{ + public partial class StatODLModel + { + #region Public Properties + + public int IdxStato { get; set; } + public string DescrizioneCodArticolo { get; set; } = ""; + public string Semaforo { get; set; } + public string Css { get; set; } + public decimal TotDurata { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs index 9d62d4f3..e35a351e 100644 --- a/MP.Data/MoonProContext.cs +++ b/MP.Data/MoonProContext.cs @@ -48,6 +48,7 @@ namespace MP.Data public virtual DbSet DbSetPODL { get; set; } public virtual DbSet DbSetFluxLog { get; set; } public virtual DbSet DbSetDossiers { get; set; } + public virtual DbSet DbSetStatOdl { get; set; } #endregion Public Properties