inserito hard coded parametro ItemID di test a 1 nell'URL..., da esporre x usare MVC Grid...
This commit is contained in:
@@ -54,10 +54,10 @@ namespace StockManMVC
|
||||
cols.Add("ViewLink").WithColumnName("ViewLink")
|
||||
.WithSorting(false)
|
||||
.WithVisibility(true, false)
|
||||
.WithHeaderText("")
|
||||
.WithHeaderText("<a href='/Items' title='reset'><i class='glyphicon glyphicon-refresh' aria-hidden='true'></i></a>")
|
||||
.WithHtmlEncoding(false)
|
||||
.WithValueExpression((i, c) => c.UrlHelper.Action("Details", "Items", new { id = i.ID }))
|
||||
.WithValueTemplate("<a href='{Value}' title='Vedi Dettagli'><i class='glyphicon glyphicon-search' aria-hidden='true'></i></a>");
|
||||
.WithValueTemplate("<a href='{Value}?ItemID=1' title='Vedi Dettagli'><i class='glyphicon glyphicon-search' aria-hidden='true'></i></a>");
|
||||
cols.Add("Family").WithColumnName("Family")
|
||||
.WithVisibility(true, false)
|
||||
.WithHeaderText("Famiglia")
|
||||
@@ -119,6 +119,40 @@ namespace StockManMVC
|
||||
})
|
||||
);
|
||||
|
||||
MVCGridDefinitionTable.Add("StockGrid", new MVCGridBuilder<Models.ItemStock>(gridDefaults, colDefaults) // aggiungo valori di default...
|
||||
.WithSorting(sorting: true, defaultSortColumn: "LocationID") //, defaultSortDirection: SortDirection.Dsc
|
||||
.WithAdditionalQueryOptionNames("ID")
|
||||
//.WithRowCssClassExpression(p => p.QtaCurr == 0 ? "warning" : "") // commentata x ora, poi potrebbe servire...
|
||||
.WithQueryStringPrefix("Item")
|
||||
.WithPaging(false)
|
||||
.AddColumns(cols =>
|
||||
{
|
||||
cols.Add("LocationID").WithColumnName("LocationID")
|
||||
.WithVisibility(true, false)
|
||||
.WithHeaderText("Posizione")
|
||||
.WithValueExpression(i => i.Location.Descr);
|
||||
cols.Add("QtyConf").WithColumnName("QtyConf")
|
||||
.WithVisibility(true, false)
|
||||
.WithHeaderText("Giacenza")
|
||||
.WithValueExpression(i => i.QtyConf.ToString());
|
||||
})
|
||||
.WithRetrieveDataMethod((context) =>
|
||||
{
|
||||
|
||||
var options = context.QueryOptions;
|
||||
string sItemID = options.GetAdditionalQueryOptionString("ID");
|
||||
if (String.IsNullOrEmpty(sItemID)) sItemID = "0";
|
||||
int ItemID = Convert.ToInt32(sItemID);
|
||||
|
||||
return new QueryResult<Models.ItemStock>()
|
||||
{
|
||||
Items = ItemStocksController.Select(ItemID).ToList(),
|
||||
TotalRecords = ItemStocksController.SelectCount(ItemID)
|
||||
};
|
||||
|
||||
})
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,32 @@ namespace StockManMVC.Controllers
|
||||
{
|
||||
private StockManEntities db = new StockManEntities();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Selezione
|
||||
/// </summary>
|
||||
/// <param name="ItemID"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<ItemStock> Select(int? ItemID)
|
||||
{
|
||||
StockManEntities db = new StockManEntities();
|
||||
if (ItemID == null)
|
||||
{
|
||||
ItemID = 0;
|
||||
}
|
||||
var answ = db.ItemStock.Where(s => s.ItemID == ItemID);
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// calcolo num risultati
|
||||
/// </summary>
|
||||
/// <param name="ItemID"></param>
|
||||
/// <returns></returns>
|
||||
public static int SelectCount(int? ItemID)
|
||||
{
|
||||
return Select(ItemID).Count();
|
||||
}
|
||||
|
||||
// GET: ItemStocks
|
||||
public ActionResult Index()
|
||||
{
|
||||
|
||||
@@ -123,12 +123,14 @@ namespace StockManMVC.Controllers
|
||||
}
|
||||
|
||||
// GET: Items
|
||||
public ActionResult Index()
|
||||
public ActionResult Index(int? id)
|
||||
{
|
||||
var item = db.Item.Include(i => i.ItemFamily);
|
||||
if (id == null) id = 0;
|
||||
ViewBag.ItemID = (int)id;
|
||||
return View(item.ToList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ActionResult Grid()
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>
|
||||
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
|
||||
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
|
||||
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
|
||||
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>False</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
|
||||
<WebStackScaffolding_LayoutPageFile />
|
||||
<WebStackScaffolding_DbContextTypeFullName>StockManMVC.Models.StockManEntities</WebStackScaffolding_DbContextTypeFullName>
|
||||
<WebStackScaffolding_IsViewGenerationSelected>True</WebStackScaffolding_IsViewGenerationSelected>
|
||||
|
||||
@@ -4,79 +4,113 @@
|
||||
ViewBag.Title = "Details";
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
@using MVCGrid.Web
|
||||
|
||||
<div>
|
||||
<h4>Item</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Descr)
|
||||
</dt>
|
||||
<div class="row" style="margin-top: 0.5em;">
|
||||
<div class="col-sm-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Dettaglio Articolo</strong>
|
||||
</div>
|
||||
<div class="panel-body small">
|
||||
<div>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Descr)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Descr)
|
||||
</dd>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Descr)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.CodInt)
|
||||
</dt>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.CodInt)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.CodInt)
|
||||
</dd>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.CodInt)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.CodExt)
|
||||
</dt>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.CodExt)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.CodExt)
|
||||
</dd>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.CodExt)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.DescrExt)
|
||||
</dt>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.DescrExt)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.DescrExt)
|
||||
</dd>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.DescrExt)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.QtaMin)
|
||||
</dt>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.QtaMin)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.QtaMin)
|
||||
</dd>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.QtaMin)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.QtaBatch)
|
||||
</dt>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.QtaBatch)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.QtaBatch)
|
||||
</dd>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.QtaBatch)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.CurrValue)
|
||||
</dt>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.CurrValue)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.CurrValue)
|
||||
</dd>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.CurrValue)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ItemFamily.Descr)
|
||||
</dt>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ItemFamily.Descr)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ItemFamily.Descr)
|
||||
</dd>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ItemFamily.Descr)
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.ID }) |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Stock Giacenze</strong>
|
||||
</div>
|
||||
<div class="panel-body small">
|
||||
@Html.MVCGrid("StockGrid")
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Movimenti</strong>
|
||||
</div>
|
||||
<div class="panel-body small">
|
||||
@Html.MVCGrid("StockGrid")
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.ID }) |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,28 @@
|
||||
@model IEnumerable<StockManMVC.Models.Item>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
ViewBag.Title = "Articoli";
|
||||
string mainCss = "col-sm-12";
|
||||
//bool hasDetail = false;
|
||||
//if (ViewBag.ItemID != 0)
|
||||
//{
|
||||
// hasDetail = true;
|
||||
// mainCss = "col-sm-8";
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@using MVCGrid.Web
|
||||
<div class="row" style="margin-top: 0.5em;">
|
||||
<div class="col-lg-10 col-lg-offset-1 col-sm-12">
|
||||
@*@if (hasDetail)
|
||||
{
|
||||
<div class="col-sm-4">
|
||||
Dettagli
|
||||
<hr />
|
||||
stock attuale
|
||||
</div>
|
||||
}*@
|
||||
|
||||
<div class="@(mainCss)">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
@@ -37,72 +52,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@*<table class="table table-condensed table-hover table-striped">
|
||||
<tr>
|
||||
<th data-column-id="Descr" data-order="asc">
|
||||
@Html.DisplayNameFor(model => model.Descr)
|
||||
</th>
|
||||
<th data-column-id="CodInt">
|
||||
@Html.DisplayNameFor(model => model.CodInt)
|
||||
</th>
|
||||
<th data-column-id="CodExt">
|
||||
@Html.DisplayNameFor(model => model.CodExt)
|
||||
</th>
|
||||
<th data-column-id="DescrExt">
|
||||
@Html.DisplayNameFor(model => model.DescrExt)
|
||||
</th>
|
||||
<th data-column-id="QtaMin">
|
||||
@Html.DisplayNameFor(model => model.QtaMin)
|
||||
</th>
|
||||
<th data-column-id="QtaBatch">
|
||||
@Html.DisplayNameFor(model => model.QtaBatch)
|
||||
</th>
|
||||
<th data-column-id="CurrValue">
|
||||
@Html.DisplayNameFor(model => model.CurrValue)
|
||||
</th>
|
||||
<th data-column-id="Family">
|
||||
@Html.DisplayNameFor(model => model.ItemFamily.Descr)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Descr)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CodInt)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CodExt)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.DescrExt)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.QtaMin)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.QtaBatch)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CurrValue)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ItemFamily.Descr)
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
|
||||
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</table>*@
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
<appSettings>
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
<add key="MVCGridShowErrorDetail" value="true" />
|
||||
</appSettings>
|
||||
|
||||
<system.webServer>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user