modificata gestione locations:

- esplicitata visualizzazione ID
- protetti record che iniziano con "#" come riservati x editing/delete
- inserito TRIM spazi alla creazione nuovo (x Location, ItemFamily...)
This commit is contained in:
Samuele E. Locatelli
2016-10-31 16:29:33 +01:00
parent 7064269d19
commit 2bc5fbb51c
13 changed files with 34 additions and 5 deletions
Binary file not shown.
@@ -45,6 +45,8 @@ namespace StockManMVC.Controllers
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "ID,Descr")] ItemFamily itemFamily)
{
// verifico ID: nel caso trimmo spazi...
itemFamily.ID = itemFamily.ID.Trim().Replace(" ", " ").Replace(" ", " ").Replace(" ", " ").Replace(" ","_").ToUpper();
if (ModelState.IsValid)
{
db.ItemFamily.Add(itemFamily);
@@ -292,7 +292,7 @@ namespace StockManMVC.Controllers
{
case "CAR":
// per partire scelgo la posizione di default ric ordini
string stdLocationId = "RIC-ORD";
string stdLocationId = "#RIC-ORD";
// cerco se ci sia una posizione occupata dall'item in stock..
if (db.ItemStock.Where(s => s.ItemID == ItemID).Count() > 0)
{
@@ -317,7 +317,7 @@ namespace StockManMVC.Controllers
CurrStyle = "bg-primary";
break;
case "OFOR":
ViewBag.LocationID = new SelectList(db.Location.Where(o => o.LocType.IsStock), "ID", "Descr", "RIC-ORD");
ViewBag.LocationID = new SelectList(db.Location.Where(o => o.LocType.IsStock), "ID", "Descr", "#RIC-ORD");
ViewBag.ExtLocationID = new SelectList(db.Location.Where(o => o.LocType.IsFor), "ID", "Descr");
CurrStyle = "bg-info";
break;
@@ -44,6 +44,8 @@ namespace StockManMVC.Controllers
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "ID,Descr,IsStock,IsCli,IsFor")] LocType locType)
{
// verifico ID: nel caso trimmo spazi...
locType.ID = locType.ID.Trim().Replace(" ", " ").Replace(" ", " ").Replace(" ", " ").Replace(" ", "_").ToUpper();
if (ModelState.IsValid)
{
db.LocType.Add(locType);
@@ -111,6 +111,8 @@ namespace StockManMVC.Controllers
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "ID,Descr,LocTypeID")] Location location)
{
// verifico ID: nel caso trimmo spazi...
location.ID = location.ID.Trim().Replace(" ", " ").Replace(" ", " ").Replace(" ", " ").Replace(" ", "_").ToUpper();
if (ModelState.IsValid)
{
db.Location.Add(location);
@@ -44,6 +44,8 @@ namespace StockManMVC.Controllers
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "ID,Descr,CssClass")] MovType movType)
{
// verifico ID: nel caso trimmo spazi...
movType.ID = movType.ID.Trim().Replace(" ", " ").Replace(" ", " ").Replace(" ", " ").Replace(" ", "_").ToUpper();
if (ModelState.IsValid)
{
db.MovType.Add(movType);
+6
View File
@@ -21,6 +21,9 @@
<div id="mainDiv" class="col-xs-12">
<table class="table table-condensed table-responsive table-striped table-hover table-bordered">
<tr>
<th>
@Html.DisplayNameFor(model => model.ID)
</th>
<th>
@Html.DisplayNameFor(model => model.Descr)
</th>
@@ -41,6 +44,9 @@
var delStyle = "";
if (item.Location.Count > 0 || item.ID == "ND") { delStyle = "disabled invisible"; }
<tr>
<td>
@Html.DisplayFor(modelItem => item.ID)
</td>
<td>
@Html.DisplayFor(modelItem => item.Descr)
</td>
+12 -3
View File
@@ -6,6 +6,9 @@
<div class="col-sm-12">
<table class="table table-condensed table-responsive table-striped table-hover table-bordered">
<tr>
<th>
@Html.DisplayNameFor(model => model.ID)
</th>
<th>
@Html.ActionLink(Html.DisplayNameFor(model => model.Descr).ToString(), "Index", new { LocTypeID = ViewBag.LocTypeID, SearchVal = ViewBag.SearchVal, SortOrd = ViewBag.DescrSortParm, page = 1, pageSize = ViewBag.pageSize })
</th>
@@ -18,8 +21,14 @@
@foreach (var item in Model)
{
var delStyle = "";
var edtStyle = "";
if (item.ItemFlux.Count + item.ItemFlux1.Count > 0) { delStyle = "disabled invisible"; }
// anche i codici "#QUALCOSA#" NON sono modificabili...
if(item.ID.StartsWith("#")) { delStyle = "disabled invisible"; edtStyle = "disabled invisible"; }
<tr>
<td>
@Html.DisplayFor(modelItem => item.ID)
</td>
<td>
@Html.DisplayFor(modelItem => item.Descr)
</td>
@@ -27,7 +36,7 @@
@Html.DisplayFor(modelItem => item.LocType.Descr)
</td>
<td class="text-right" style="width: 7em;">
<button class="btn btn-xs btn-primary" title="Modifica" onclick="LoadCurrEdit('@item.ID');"><i class="glyphicon glyphicon-edit"></i></button>
<button class="btn btn-xs btn-primary @edtStyle" title="Modifica" onclick="LoadCurrEdit('@item.ID');"><i class="glyphicon glyphicon-edit"></i></button>
<button class="btn btn-xs btn-danger @delStyle" title="Elimina" onclick="LoadCurrDelete('@item.ID');"><i class="glyphicon glyphicon-trash"></i></button>
</td>
</tr>
@@ -37,13 +46,13 @@
</div>
<div class="row">
<div class="col-sm-1">
<div class="col-sm-2">
@Html.DropDownList("PageSizeDD", null, htmlAttributes: new { @class = "form-control pageSelDD" })
</div>
<div class="col-sm-2 pagination">
@(((IPagedList)Model).FirstItemOnPage) - @(((IPagedList)Model).LastItemOnPage) (@(((IPagedList)Model).TotalItemCount) tot)
</div>
<div class="col-sm-9 text-right">
<div class="col-sm-8 text-right">
@Html.PagedListPager((IPagedList)Model, page => Url.Action("Index", new { LocTypeID = ViewBag.LocTypeID, SearchVal = ViewBag.SearchVal, SortOrd = ViewBag.SortOrd, pageSize = ViewBag.pageSize, page }), PagedListRenderOptions.ClassicPlusFirstAndLast)
</div>
</div>
+6
View File
@@ -22,6 +22,9 @@
<div id="mainDiv" class="col-xs-12">
<table class="table table-condensed table-responsive table-striped table-hover table-bordered">
<tr>
<th>
@Html.DisplayNameFor(model => model.ID)
</th>
<th>
@Html.DisplayNameFor(model => model.Descr)
</th>
@@ -36,6 +39,9 @@
var delStyle = "";
if (item.ItemFlux.Count > 0 || item.ID == "ND") { delStyle = "disabled invisible"; }
<tr>
<td>
@Html.DisplayFor(modelItem => item.ID)
</td>
<td>
@Html.DisplayFor(modelItem => item.Descr)
</td>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.