diff --git a/StockManMVC/App_Start/MVCGridConfig.cs b/StockManMVC/App_Start/MVCGridConfig.cs
index 86078dc..d6eab36 100644
--- a/StockManMVC/App_Start/MVCGridConfig.cs
+++ b/StockManMVC/App_Start/MVCGridConfig.cs
@@ -59,6 +59,14 @@ namespace StockManMVC
.WithHtmlEncoding(false)
.WithValueExpression((i, c) => c.UrlHelper.Action("Details", "Items", new { id = i.ID, StockItemID = i.ID, FluxItemID = i.ID }))
.WithValueTemplate("");
+ cols.Add("Clona").WithColumnName("Clona")
+ .WithSorting(false)
+ .WithVisibility(true, false)
+ .WithAllowChangeVisibility(false)
+ .WithHeaderText("")
+ .WithHtmlEncoding(false)
+ .WithValueExpression((i, c) => c.UrlHelper.Action("Duplicate", "Items", new { id = i.ID }))
+ .WithValueTemplate("");
cols.Add("Family").WithColumnName("Family")
.WithVisibility(true, false)
.WithAllowChangeVisibility(false)
diff --git a/StockManMVC/Controllers/ItemsController.cs b/StockManMVC/Controllers/ItemsController.cs
index f5dee92..6d7d5c9 100644
--- a/StockManMVC/Controllers/ItemsController.cs
+++ b/StockManMVC/Controllers/ItemsController.cs
@@ -153,7 +153,7 @@ namespace StockManMVC.Controllers
using (var ctx = new StockManEntities())
{
// esegue stored procedure come function, SE id == 0 processa TUTTI...
- int rowMod = ctx.stp_consolidateItem(id);
+ int rowMod = ctx.stp_ItemConsolidate(id);
}
// se non specificati rimando a /Items/Details
@@ -237,6 +237,26 @@ namespace StockManMVC.Controllers
return View(item);
}
+
+ // GET: Items/Duplicate/5
+ public ActionResult Duplicate(int? id)
+ {
+ if (id == null)
+ {
+ return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+ }
+ int newId = 0;
+ // ora chiamo stored e recupero nuovo ID del record duplicato
+ using (var ctx = new StockManEntities())
+ {
+ // esegue stored procedure come function, recuperando nuovo ID creato...
+ newId = ctx.stp_ItemDuplicate(id);
+ }
+
+ // rimando in editing!
+ return RedirectToAction("Edit", "Items", new { ID = newId });
+ }
+
// GET: Items/Edit/5
public ActionResult Edit(int? id)
{
diff --git a/StockManMVC/Models/Item.cs b/StockManMVC/Models/Item.cs
index dd5f2a3..ff9ad3a 100644
--- a/StockManMVC/Models/Item.cs
+++ b/StockManMVC/Models/Item.cs
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//
-// This code was generated from a template.
+// Codice generato da un modello.
//
-// Manual changes to this file may cause unexpected behavior in your application.
-// Manual changes to this file will be overwritten if the code is regenerated.
+// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
+// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
//
//------------------------------------------------------------------------------
diff --git a/StockManMVC/Models/ItemFamily.cs b/StockManMVC/Models/ItemFamily.cs
index 0eab266..9d7a97c 100644
--- a/StockManMVC/Models/ItemFamily.cs
+++ b/StockManMVC/Models/ItemFamily.cs
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//
-// This code was generated from a template.
+// Codice generato da un modello.
//
-// Manual changes to this file may cause unexpected behavior in your application.
-// Manual changes to this file will be overwritten if the code is regenerated.
+// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
+// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
//
//------------------------------------------------------------------------------
diff --git a/StockManMVC/Models/ItemFlux.cs b/StockManMVC/Models/ItemFlux.cs
index 2117df5..e7f4051 100644
--- a/StockManMVC/Models/ItemFlux.cs
+++ b/StockManMVC/Models/ItemFlux.cs
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//
-// This code was generated from a template.
+// Codice generato da un modello.
//
-// Manual changes to this file may cause unexpected behavior in your application.
-// Manual changes to this file will be overwritten if the code is regenerated.
+// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
+// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
//
//------------------------------------------------------------------------------
@@ -26,6 +26,8 @@ namespace StockManMVC.Models
public string Note { get; set; }
public Nullable dtExport { get; set; }
public string OperatorID { get; set; }
+ public string CodDoc { get; set; }
+ public Nullable dtDoc { get; set; }
public virtual Location Location { get; set; }
public virtual MovType MovType { get; set; }
diff --git a/StockManMVC/Models/ItemStock.cs b/StockManMVC/Models/ItemStock.cs
index 086c56e..3fc7222 100644
--- a/StockManMVC/Models/ItemStock.cs
+++ b/StockManMVC/Models/ItemStock.cs
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//
-// This code was generated from a template.
+// Codice generato da un modello.
//
-// Manual changes to this file may cause unexpected behavior in your application.
-// Manual changes to this file will be overwritten if the code is regenerated.
+// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
+// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
//
//------------------------------------------------------------------------------
diff --git a/StockManMVC/Models/LocType.cs b/StockManMVC/Models/LocType.cs
index e2c13d7..52c076e 100644
--- a/StockManMVC/Models/LocType.cs
+++ b/StockManMVC/Models/LocType.cs
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//
-// This code was generated from a template.
+// Codice generato da un modello.
//
-// Manual changes to this file may cause unexpected behavior in your application.
-// Manual changes to this file will be overwritten if the code is regenerated.
+// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
+// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
//
//------------------------------------------------------------------------------
diff --git a/StockManMVC/Models/Location.cs b/StockManMVC/Models/Location.cs
index 033eb5c..d7c30b1 100644
--- a/StockManMVC/Models/Location.cs
+++ b/StockManMVC/Models/Location.cs
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//
-// This code was generated from a template.
+// Codice generato da un modello.
//
-// Manual changes to this file may cause unexpected behavior in your application.
-// Manual changes to this file will be overwritten if the code is regenerated.
+// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
+// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
//
//------------------------------------------------------------------------------
diff --git a/StockManMVC/Models/MovType.cs b/StockManMVC/Models/MovType.cs
index 47f4e71..c7d2b08 100644
--- a/StockManMVC/Models/MovType.cs
+++ b/StockManMVC/Models/MovType.cs
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//
-// This code was generated from a template.
+// Codice generato da un modello.
//
-// Manual changes to this file may cause unexpected behavior in your application.
-// Manual changes to this file will be overwritten if the code is regenerated.
+// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
+// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
//
//------------------------------------------------------------------------------
diff --git a/StockManMVC/Models/Operator.cs b/StockManMVC/Models/Operator.cs
index 89bafd0..228454e 100644
--- a/StockManMVC/Models/Operator.cs
+++ b/StockManMVC/Models/Operator.cs
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//
-// This code was generated from a template.
+// Codice generato da un modello.
//
-// Manual changes to this file may cause unexpected behavior in your application.
-// Manual changes to this file will be overwritten if the code is regenerated.
+// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
+// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
//
//------------------------------------------------------------------------------
diff --git a/StockManMVC/Models/SMModel.Context.cs b/StockManMVC/Models/SMModel.Context.cs
index 093d02f..3df623c 100644
--- a/StockManMVC/Models/SMModel.Context.cs
+++ b/StockManMVC/Models/SMModel.Context.cs
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//
-// This code was generated from a template.
+// Codice generato da un modello.
//
-// Manual changes to this file may cause unexpected behavior in your application.
-// Manual changes to this file will be overwritten if the code is regenerated.
+// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
+// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
//
//------------------------------------------------------------------------------
@@ -45,5 +45,23 @@ namespace StockManMVC.Models
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("stp_consolidateItem", itemIDParameter);
}
+
+ public virtual int stp_ItemConsolidate(Nullable itemID)
+ {
+ var itemIDParameter = itemID.HasValue ?
+ new ObjectParameter("ItemID", itemID) :
+ new ObjectParameter("ItemID", typeof(int));
+
+ return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("stp_ItemConsolidate", itemIDParameter);
+ }
+
+ public virtual int stp_ItemDuplicate(Nullable original_ID)
+ {
+ var original_IDParameter = original_ID.HasValue ?
+ new ObjectParameter("Original_ID", original_ID) :
+ new ObjectParameter("Original_ID", typeof(int));
+
+ return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("stp_ItemDuplicate", original_IDParameter);
+ }
}
}
diff --git a/StockManMVC/Models/SMModel.Designer.cs b/StockManMVC/Models/SMModel.Designer.cs
index 61b7291..55e23f2 100644
--- a/StockManMVC/Models/SMModel.Designer.cs
+++ b/StockManMVC/Models/SMModel.Designer.cs
@@ -1,10 +1,10 @@
-// T4 code generation is enabled for model 'C:\Users\samuele\Documents\Visual Studio 2015\Projects\StockMan\StockManMVC\Models\SMModel.edmx'.
-// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
-// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
-// is open in the designer.
+// Generazione del codice predefinita abilitata per il modello 'C:\Users\samuele.STEAMWAREWIN\Documents\VisualStudioProjects\StockMan\StockManMVC\Models\SMModel.edmx'.
+// Per abilitare la generazione del codice legacy, modificare il valore della proprietà della finestra di progettazione 'Strategia di generazione del codice
+// su 'Legacy ObjectContext'. Questa proprietà è disponibile nella finestra Proprietà quando il modello è
+// aperto nella finestra di progettazione.
-// If no context and entity classes have been generated, it may be because you created an empty model but
-// have not yet chosen which version of Entity Framework to use. To generate a context class and entity
-// classes for your model, open the model in the designer, right-click on the designer surface, and
-// select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation
-// Item...'.
\ No newline at end of file
+// La mancata generazione di classi contesto ed entità può essere dovuta al fatto che è stato creato un modello vuoto, ma
+// non è ancora stata scelta la versione di Entity Framework da utilizzare. Per generare una classe contesto e classi entità
+// per il modello, aprire il modello nella finestra di progettazione, fare clic con il pulsante destro del mouse nell'area di progettazione e
+// selezionare 'Aggiorna modello da database...', 'Genera database da modello...' o 'Aggiungi elemento di generazione
+// codice...'.
\ No newline at end of file
diff --git a/StockManMVC/Models/SMModel.cs b/StockManMVC/Models/SMModel.cs
index 7cc0662..d6f4df2 100644
--- a/StockManMVC/Models/SMModel.cs
+++ b/StockManMVC/Models/SMModel.cs
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//
-// This code was generated from a template.
+// Codice generato da un modello.
//
-// Manual changes to this file may cause unexpected behavior in your application.
-// Manual changes to this file will be overwritten if the code is regenerated.
+// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
+// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
//
//------------------------------------------------------------------------------
diff --git a/StockManMVC/Models/SMModel.edmx b/StockManMVC/Models/SMModel.edmx
index de562d8..eb678f8 100644
--- a/StockManMVC/Models/SMModel.edmx
+++ b/StockManMVC/Models/SMModel.edmx
@@ -43,6 +43,8 @@
+
+
@@ -91,8 +93,8 @@
-
+
@@ -211,9 +213,12 @@ warning 6002: The table/view 'StockMan.dbo.vItemFlux2Save' does not have a prima
-
+
+
+
+
@@ -294,6 +299,8 @@ warning 6002: The table/view 'StockMan.dbo.vItemFlux2Save' does not have a prima
+
+
@@ -441,6 +448,12 @@ warning 6002: The table/view 'StockMan.dbo.vItemFlux2Save' does not have a prima
+
+
+
+
+
+
@@ -572,6 +585,8 @@ warning 6002: The table/view 'StockMan.dbo.vItemFlux2Save' does not have a prima
+
+
@@ -628,7 +643,6 @@ warning 6002: The table/view 'StockMan.dbo.vItemFlux2Save' does not have a prima
-
@@ -675,6 +689,8 @@ warning 6002: The table/view 'StockMan.dbo.vItemFlux2Save' does not have a prima
+
+
diff --git a/StockManMVC/Models/vItemFlux2Save.cs b/StockManMVC/Models/vItemFlux2Save.cs
index d9c6c63..a8e3436 100644
--- a/StockManMVC/Models/vItemFlux2Save.cs
+++ b/StockManMVC/Models/vItemFlux2Save.cs
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//
-// This code was generated from a template.
+// Codice generato da un modello.
//
-// Manual changes to this file may cause unexpected behavior in your application.
-// Manual changes to this file will be overwritten if the code is regenerated.
+// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
+// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
//
//------------------------------------------------------------------------------
diff --git a/StockManMVC/Views/Shared/_Layout.cshtml b/StockManMVC/Views/Shared/_Layout.cshtml
index 3c5b8ee..ec12d48 100644
--- a/StockManMVC/Views/Shared/_Layout.cshtml
+++ b/StockManMVC/Views/Shared/_Layout.cshtml
@@ -23,7 +23,7 @@