diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs
index 77989a0d..2a73213c 100644
--- a/MP.Data/Controllers/MpSpecController.cs
+++ b/MP.Data/Controllers/MpSpecController.cs
@@ -28,7 +28,7 @@ namespace MP.Data.Controllers
/// Elenco Gruppi tipo Azienda
///
///
- public List AnagGruppiAziende()
+ public List AnagGruppiAziende()
{
return AnagGruppiGetTipo("AZIENDA");
}
@@ -37,7 +37,7 @@ namespace MP.Data.Controllers
/// Elenco Gruppi tipo Fasi
///
///
- public List AnagGruppiFase()
+ public List AnagGruppiFase()
{
return AnagGruppiGetTipo("FASE");
}
@@ -46,9 +46,9 @@ namespace MP.Data.Controllers
/// Elenco Gruppi
///
///
- public List AnagGruppiGetAll()
+ public List AnagGruppiGetAll()
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -65,9 +65,9 @@ namespace MP.Data.Controllers
///
///
///
- public List AnagGruppiGetTipo(string tipoGruppo)
+ public List AnagGruppiGetTipo(string tipoGruppo)
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -84,7 +84,7 @@ namespace MP.Data.Controllers
/// Elenco valori ammessi x Stati commessa (es Yacht Baglietto)
///
///
- public List AnagStatiComm()
+ public List AnagStatiComm()
{
return ListValuesFilt("PODL", "StatoComm");
}
@@ -93,7 +93,7 @@ namespace MP.Data.Controllers
/// Elenco valori ammessi x Tipo articoli
///
///
- public List AnagTipoArtLV()
+ public List AnagTipoArtLV()
{
return ListValuesFilt("AnagArticoli", "Tipo");
}
@@ -103,7 +103,7 @@ namespace MP.Data.Controllers
///
///
///
- public async Task ArticoliDeleteRecord(DatabaseModels.AnagArticoli currRec)
+ public async Task ArticoliDeleteRecord(AnagArticoli currRec)
{
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
@@ -134,9 +134,9 @@ namespace MP.Data.Controllers
///
///
///
- public List ArticoliGetSearch(int numRecord, string searchVal = "")
+ public List ArticoliGetSearch(int numRecord, string searchVal = "")
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -157,9 +157,9 @@ namespace MP.Data.Controllers
///
///
///
- public List ArticoliGetSearch(int numRecord, string azienda = "*", string searchVal = "")
+ public List ArticoliGetSearch(int numRecord, string azienda = "*", string searchVal = "")
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -177,9 +177,9 @@ namespace MP.Data.Controllers
/// Elenco tabella Articoli IMPIEGATI (da stored stp_ART_getUsed)
///
///
- public List ArticoliGetUsed()
+ public List ArticoliGetUsed()
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -196,7 +196,7 @@ namespace MP.Data.Controllers
///
///
///
- public async Task ArticoliUpdateRecord(DatabaseModels.AnagArticoli editRec)
+ public async Task ArticoliUpdateRecord(AnagArticoli editRec)
{
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
@@ -236,9 +236,9 @@ namespace MP.Data.Controllers
/// Elenco da tabella Config
///
///
- public List ConfigGetAll()
+ public List ConfigGetAll()
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -254,10 +254,10 @@ namespace MP.Data.Controllers
/// Update record config
///
///
- public bool ConfigUpdate(DatabaseModels.ConfigModel updRec)
+ public bool ConfigUpdate(ConfigModel updRec)
{
bool fatto = false;
- DatabaseModels.ConfigModel dbResult = new DatabaseModels.ConfigModel();
+ ConfigModel dbResult = new ConfigModel();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -281,21 +281,29 @@ namespace MP.Data.Controllers
///
/// Eliminazione di un dossier
///
- /// record dossier da eliminare
+ /// record dossier da eliminare
///
- public bool DossiersDelete(Dossiers selRecord)
+ public async Task DossiersDeleteRecord(Dossiers currRec)
{
bool answ = false;
using (var dbCtx = new MoonProContext(_configuration))
{
- var pIdxMacchina = new SqlParameter("@Original_IdxMacchina", selRecord.IdxMacchina);
- var pIdxODL = new SqlParameter("@Original_IdxODL", selRecord.IdxODL);
- var pDtRif = new SqlParameter("@Original_DtRif ", selRecord.DtRif);
-
- var dbResult = dbCtx
- .Database
- .ExecuteSqlRaw("EXEC stp_DOSS_deleteQuery @Original_IdxMacchina,@Original_IdxODL,@Original_DtRif", pIdxMacchina, pIdxODL, pDtRif);
- answ = true;
+ try
+ {
+ var currVal = dbCtx
+ .DbSetDossiers
+ .Where(x => x.IdxDossier == currRec.IdxDossier)
+ .FirstOrDefault();
+ dbCtx
+ .DbSetDossiers
+ .Remove(currVal);
+ await dbCtx.SaveChangesAsync();
+ answ = true;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante DossiersDeleteRecord{Environment.NewLine}{exc}");
+ }
}
return answ;
}
@@ -308,9 +316,9 @@ namespace MP.Data.Controllers
/// Data di riferimento (Massima) per estrazioen records
/// numero massimo record da restituire
///
- public List DossiersGetLastFilt(string IdxMacchina, DateTime DtRef, int MaxRec)
+ public List DossiersGetLastFilt(string IdxMacchina, DateTime DtRef, int MaxRec)
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -351,7 +359,7 @@ namespace MP.Data.Controllers
/// Elenco valori link (x home e navMenu laterale)
///
///
- public List ElencoLink()
+ public List ElencoLink()
{
return ListLinkFilt("SpecLink");
}
@@ -363,9 +371,9 @@ namespace MP.Data.Controllers
/// *=tutti, altrimenti solo selezionato
/// numero massimo record da restituire
///
- public List FluxLogGetLastFilt(string IdxMacchina, string CodFlux, int MaxRec)
+ public List FluxLogGetLastFilt(string IdxMacchina, string CodFlux, int MaxRec)
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -379,9 +387,9 @@ namespace MP.Data.Controllers
return dbResult;
}
- public List ListLinkFilt(string tipoLink)
+ public List ListLinkFilt(string tipoLink)
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -401,9 +409,9 @@ namespace MP.Data.Controllers
/// Cod articolo
/// KeyRich (parziale) da cercare (es cod stato x yacht)
///
- public List ListODLFilt(bool inCorso, string codArt, string keyRichPart)
+ public List ListODLFilt(bool inCorso, string codArt, string keyRichPart)
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -422,9 +430,9 @@ namespace MP.Data.Controllers
/// Cod articolo
/// KeyRich (parziale) da cercare (es cod stato x yacht)
///
- public List ListPODLFilt(string codArt, string keyRichPart)
+ public List ListPODLFilt(string codArt, string keyRichPart)
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -443,9 +451,9 @@ namespace MP.Data.Controllers
///
///
///
- public List ListValuesFilt(string tabName, string fieldName)
+ public List ListValuesFilt(string tabName, string fieldName)
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -462,9 +470,9 @@ namespace MP.Data.Controllers
/// Elenco da tabella Macchine
///
///
- public List MacchineGetAll()
+ public List MacchineGetAll()
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -499,9 +507,9 @@ namespace MP.Data.Controllers
/// Elenco da tabella MappaStatoExpl
///
///
- public List MseGetAll(int maxAge = 2000)
+ public List MseGetAll(int maxAge = 2000)
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
var maxAgeSec = new SqlParameter("@maxAgeSec", maxAge);
@@ -541,7 +549,7 @@ namespace MP.Data.Controllers
///
///
///
- public async Task PODLDeleteRecord(DatabaseModels.PODLModel currRec)
+ public async Task PODLDeleteRecord(PODLModel currRec)
{
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
@@ -571,7 +579,7 @@ namespace MP.Data.Controllers
///
///
///
- public async Task PODLUpdateRecord(DatabaseModels.PODLModel editRec)
+ public async Task PODLUpdateRecord(PODLModel editRec)
{
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
diff --git a/MP.Data/DatabaseModels/Dossiers.cs b/MP.Data/DatabaseModels/Dossiers.cs
index a44a47bf..46c294a1 100644
--- a/MP.Data/DatabaseModels/Dossiers.cs
+++ b/MP.Data/DatabaseModels/Dossiers.cs
@@ -14,6 +14,9 @@ namespace MP.Data.DatabaseModels
{
#region Public Properties
+ [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int IdxDossier { get; set; }
+
[MaxLength(50)]
public string DataType { get; set; }
diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs
index 221d765b..9d62d4f3 100644
--- a/MP.Data/MoonProContext.cs
+++ b/MP.Data/MoonProContext.cs
@@ -296,11 +296,6 @@ namespace MP.Data
{
entity.HasKey(e => new { e.IdxMacchina, e.dtEvento, e.CodFlux });
- });
- modelBuilder.Entity(entity =>
- {
- entity.HasKey(e => new { e.IdxMacchina, e.DtRif });
-
});
OnModelCreatingPartial(modelBuilder);
diff --git a/MP.SPEC/Components/ListDossiers.razor b/MP.SPEC/Components/ListDossiers.razor
index 16e5bcf8..afe8d0a6 100644
--- a/MP.SPEC/Components/ListDossiers.razor
+++ b/MP.SPEC/Components/ListDossiers.razor
@@ -23,6 +23,7 @@ else