Michele: Magazzini. model, controller con crud, pagine web
This commit is contained in:
parent
a4126806a4
commit
b0ddd70db6
@ -161,7 +161,7 @@ namespace VirtualTask.Controllers
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
Articoli chiusura = new Articoli();
|
||||
Articoli articolo = new Articoli();
|
||||
|
||||
List<Articoli> modelList = new List<Articoli>();
|
||||
|
||||
@ -171,7 +171,7 @@ namespace VirtualTask.Controllers
|
||||
{
|
||||
string data = response.Content.ReadAsStringAsync().Result;
|
||||
modelList = JsonConvert.DeserializeObject<List<Articoli>>(data);
|
||||
chiusura = modelList.Where(x => x.SlCodice.Equals(id)).First();
|
||||
articolo = modelList.Where(x => x.SlCodice.Equals(id)).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -180,7 +180,7 @@ namespace VirtualTask.Controllers
|
||||
return RedirectToAction("Error");
|
||||
}
|
||||
|
||||
return View(chiusura);
|
||||
return View(articolo);
|
||||
}
|
||||
|
||||
#endregion DETAIL
|
||||
|
||||
338
Controllers/MagazziniVTController.cs
Normal file
338
Controllers/MagazziniVTController.cs
Normal file
@ -0,0 +1,338 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using VirtualTask.Models;
|
||||
using X.PagedList;
|
||||
|
||||
namespace VirtualTask.Controllers
|
||||
{
|
||||
public class MagazziniVTController : Controller
|
||||
{
|
||||
string apiUrl = string.Empty;
|
||||
string urlBase = string.Empty;
|
||||
string token = string.Empty;
|
||||
string tenant = string.Empty;
|
||||
string errMes = string.Empty;
|
||||
string admin = string.Empty;
|
||||
string time_sheet = string.Empty;
|
||||
HttpClient client;
|
||||
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public MagazziniVTController(IConfiguration configuration)
|
||||
{
|
||||
client = new HttpClient();
|
||||
_configuration = configuration;
|
||||
var key = _configuration["ApplicationInsights:rootUrlApi"];
|
||||
apiUrl = key;
|
||||
}
|
||||
|
||||
#region INDEX
|
||||
|
||||
public IActionResult Index(string searchString, int? page = 1)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
return RedirectToAction("Login2", "Login");
|
||||
}
|
||||
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
admin = helper.GetStringValue("admin");
|
||||
ViewBag.Admin = admin;
|
||||
|
||||
urlBase = apiUrl + "MagazziniVTList";
|
||||
urlBase = urlBase + "?token=" + token;
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
List<MagazziniVT> modelList = new List<MagazziniVT>();
|
||||
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string data = response.Content.ReadAsStringAsync().Result;
|
||||
modelList = JsonConvert.DeserializeObject<List<MagazziniVT>>(data);
|
||||
modelList = modelList.Where(x => x.DataObso == null).ToList();
|
||||
|
||||
if (!string.IsNullOrEmpty(searchString))
|
||||
{
|
||||
modelList = modelList.Where(s => s.Mgdesmag.ToUpper().Contains(searchString.ToUpper())).ToList();
|
||||
|
||||
ViewData["CurrentFilter"] = searchString;
|
||||
}
|
||||
else
|
||||
ViewData["CurrentFilter"] = null;
|
||||
|
||||
if (page != null && page < 1)
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
|
||||
var pageSize = 10;
|
||||
|
||||
var shortLinks = modelList
|
||||
.OrderByDescending(s => s.Mgcodmag)
|
||||
.ToPagedList(page ?? 1, pageSize);
|
||||
|
||||
return View(shortLinks);
|
||||
}
|
||||
else
|
||||
{
|
||||
errMes = response.Content.ReadAsStringAsync().Result;
|
||||
helper.SetStringValue("errMsg", errMes);
|
||||
return RedirectToAction("Error");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CREATE
|
||||
|
||||
public IActionResult Create()
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
admin = helper.GetStringValue("admin");
|
||||
ViewBag.Admin = admin;
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Create(MagazziniVT model)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
tenant = helper.GetStringValue("tenant");
|
||||
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
return RedirectToAction("Login2", "Login");
|
||||
}
|
||||
|
||||
model.Azienda = tenant;
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
admin = helper.GetStringValue("admin");
|
||||
ViewBag.Admin = admin;
|
||||
urlBase = apiUrl + "magazziniVT/add";
|
||||
urlBase = urlBase + "?token=" + token;
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
string data = JsonConvert.SerializeObject(model);
|
||||
StringContent content = new StringContent(data, Encoding.UTF8, "application/json");
|
||||
HttpResponseMessage response = client.PostAsync(baseAddress, content).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
else
|
||||
{
|
||||
errMes = response.Content.ReadAsStringAsync().Result;
|
||||
helper.SetStringValue("errMsg", errMes);
|
||||
return RedirectToAction("Error");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DETAILS
|
||||
public IActionResult Details(string id)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
admin = helper.GetStringValue("admin");
|
||||
ViewBag.Admin = admin;
|
||||
urlBase = apiUrl + "magazziniVTList";
|
||||
urlBase = urlBase + "?token=" + token;
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
MagazziniVT magazzino = new MagazziniVT();
|
||||
|
||||
List<MagazziniVT> modelList = new List<MagazziniVT>();
|
||||
|
||||
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string data = response.Content.ReadAsStringAsync().Result;
|
||||
modelList = JsonConvert.DeserializeObject<List<MagazziniVT>>(data);
|
||||
magazzino = modelList.Where(x => x.Mgcodmag.Equals(id)).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
errMes = response.Content.ReadAsStringAsync().Result;
|
||||
helper.SetStringValue("errMsg", errMes);
|
||||
return RedirectToAction("Error");
|
||||
}
|
||||
|
||||
return View(magazzino);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EDIT
|
||||
public IActionResult Edit(string id)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
admin = helper.GetStringValue("admin");
|
||||
ViewBag.Admin = admin;
|
||||
urlBase = apiUrl + "magazziniVTList";
|
||||
urlBase = urlBase + "?token=" + token;
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
MagazziniVT ele = new MagazziniVT();
|
||||
|
||||
List<MagazziniVT> modelList = new List<MagazziniVT>();
|
||||
|
||||
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string data = response.Content.ReadAsStringAsync().Result;
|
||||
modelList = JsonConvert.DeserializeObject<List<MagazziniVT>>(data);
|
||||
var el = modelList.Where(t => t.Mgcodmag.Equals(id)).First();
|
||||
ele = el;
|
||||
}
|
||||
else
|
||||
{
|
||||
errMes = response.Content.ReadAsStringAsync().Result;
|
||||
helper.SetStringValue("errMsg", errMes);
|
||||
return RedirectToAction("Error");
|
||||
}
|
||||
|
||||
return View(ele);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Edit(MagazziniVT model)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
tenant = helper.GetStringValue("tenant");
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
return RedirectToAction("Index", "Login");
|
||||
}
|
||||
model.Azienda = tenant;
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
urlBase = apiUrl + "magazziniVT/mod";
|
||||
urlBase = urlBase + "?token=" + token;
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
string data = JsonConvert.SerializeObject(model);
|
||||
StringContent content = new StringContent(data, Encoding.UTF8, "application/json");
|
||||
HttpResponseMessage response = client.PostAsync(baseAddress, content).Result;
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
else
|
||||
{
|
||||
errMes = response.Content.ReadAsStringAsync().Result;
|
||||
helper.SetStringValue("errMsg", errMes);
|
||||
return RedirectToAction("Error");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DELETE
|
||||
[HttpGet]
|
||||
public IActionResult Delete(string id)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
admin = helper.GetStringValue("admin");
|
||||
ViewBag.Admin = admin;
|
||||
urlBase = apiUrl + "magazziniVTList";
|
||||
urlBase = urlBase + "?token=" + token;
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
MagazziniVT elem = new MagazziniVT();
|
||||
List<MagazziniVT> modelList = new List<MagazziniVT>();
|
||||
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string data = response.Content.ReadAsStringAsync().Result;
|
||||
modelList = JsonConvert.DeserializeObject<List<MagazziniVT>>(data);
|
||||
elem = modelList.Where(t => t.Mgcodmag.Equals(id)).First();
|
||||
return View(elem);
|
||||
}
|
||||
else
|
||||
{
|
||||
errMes = response.Content.ReadAsStringAsync().Result;
|
||||
helper.SetStringValue("errMsg", errMes);
|
||||
return RedirectToAction("Error");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("DeleteConfirmed")]
|
||||
public IActionResult DeleteConfirmed(string id)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
|
||||
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
admin = helper.GetStringValue("admin");
|
||||
ViewBag.Admin = admin;
|
||||
urlBase = apiUrl + "magazziniVT/del?" + "magCodice=" + id + "&";
|
||||
urlBase = urlBase + "token=" + token;
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
string data = JsonConvert.SerializeObject(id);
|
||||
StringContent content = new StringContent(data, Encoding.UTF8, "application/json");
|
||||
|
||||
HttpResponseMessage response = client.PostAsync(baseAddress, content).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
else
|
||||
{
|
||||
errMes = response.Content.ReadAsStringAsync().Result;
|
||||
helper.SetStringValue("errMsg", errMes);
|
||||
return RedirectToAction("Error");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
string e = helper.GetStringValue("errMsg");
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier, ErrMsg = e });
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Models/MagazziniVT.cs
Normal file
15
Models/MagazziniVT.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace VirtualTask.Models
|
||||
{
|
||||
public class MagazziniVT
|
||||
{
|
||||
[Display(Name = "Azienda")]
|
||||
public string? Azienda { get; set; }
|
||||
[Display(Name = "Cod. Magazzino")]
|
||||
public string? Mgcodmag { get; set; }
|
||||
[Display(Name = "Descrizone")]
|
||||
public string? Mgdesmag { get; set; }
|
||||
public DateTime? DataObso { get; set; }
|
||||
}
|
||||
}
|
||||
@ -55,55 +55,54 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.SlCodice)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ArDesArt)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.SlCodMag)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.SlQtAper)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LiPrezzo)
|
||||
</td>
|
||||
@Html.HiddenFor(modelItem => item.Azienda)
|
||||
@Html.HiddenFor(modelItem => item.AmCodice)
|
||||
@Html.HiddenFor(modelItem => item.LoCodice)
|
||||
@Html.HiddenFor(modelItem => item.LiCodLis)
|
||||
@Html.HiddenFor(modelItem => item.LiCodArt)
|
||||
@Html.HiddenFor(modelItem => item.LiDatAtt)
|
||||
@Html.HiddenFor(modelItem => item.LiQuanti)
|
||||
@Html.HiddenFor(modelItem => item.LiScont1)
|
||||
@Html.HiddenFor(modelItem => item.LiScont2)
|
||||
@Html.HiddenFor(modelItem => item.LiScont3)
|
||||
@Html.HiddenFor(modelItem => item.LiScont4)
|
||||
@Html.HiddenFor(modelItem => item.Gest_Matr)
|
||||
@Html.HiddenFor(modelItem => item.Gest_Lotti)
|
||||
@Html.HiddenFor(modelItem => item.Desc_sup)
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.SlCodice)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ArDesArt)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.SlCodMag)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.SlQtAper)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LiPrezzo)
|
||||
</td>
|
||||
@Html.HiddenFor(modelItem => item.Azienda)
|
||||
@Html.HiddenFor(modelItem => item.AmCodice)
|
||||
@Html.HiddenFor(modelItem => item.LoCodice)
|
||||
@Html.HiddenFor(modelItem => item.LiCodLis)
|
||||
@Html.HiddenFor(modelItem => item.LiCodArt)
|
||||
@Html.HiddenFor(modelItem => item.LiDatAtt)
|
||||
@Html.HiddenFor(modelItem => item.LiQuanti)
|
||||
@Html.HiddenFor(modelItem => item.LiScont1)
|
||||
@Html.HiddenFor(modelItem => item.LiScont2)
|
||||
@Html.HiddenFor(modelItem => item.LiScont3)
|
||||
@Html.HiddenFor(modelItem => item.LiScont4)
|
||||
@Html.HiddenFor(modelItem => item.Gest_Matr)
|
||||
@Html.HiddenFor(modelItem => item.Gest_Lotti)
|
||||
@Html.HiddenFor(modelItem => item.Desc_sup)
|
||||
|
||||
<td>
|
||||
<a href="@Url.Action("Edit", "Articoli", new { id=item.SlCodice })" title="Modifica" class="links">
|
||||
<img alt="Modifica" src="@Url.Content("~/assets/images/icons8-modificare-64.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
|
|
||||
<a href="@Url.Action("Details", "Articoli", new { id=item.SlCodice })" title="Dettaglio" class="links">
|
||||
<img alt="Dettaglio" src="@Url.Content("~/assets/images/icons8-visualizza-file-64.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
|
|
||||
<a href="@Url.Action("Delete", "Articoli", new { id=item.SlCodice })" title="Elimina" class="links">
|
||||
<img alt="Elimina" src="@Url.Content("~/assets/images/icons8-elimina-50.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
}
|
||||
<td>
|
||||
<a href="@Url.Action("Edit", "Articoli", new { id=item.SlCodice })" title="Modifica" class="links">
|
||||
<img alt="Modifica" src="@Url.Content("~/assets/images/icons8-modificare-64.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
|
|
||||
<a href="@Url.Action("Details", "Articoli", new { id=item.SlCodice })" title="Dettaglio" class="links">
|
||||
<img alt="Dettaglio" src="@Url.Content("~/assets/images/icons8-visualizza-file-64.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
|
|
||||
<a href="@Url.Action("Delete", "Articoli", new { id=item.SlCodice })" title="Elimina" class="links">
|
||||
<img alt="Elimina" src="@Url.Content("~/assets/images/icons8-elimina-50.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -112,162 +111,18 @@
|
||||
<br />
|
||||
<nav>
|
||||
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page, searchString = @ViewData["CurrentFilter"] }), new PagedListRenderOptions()
|
||||
{
|
||||
ActiveLiElementClass = "active",
|
||||
PageClasses = new[] { "page-link" },
|
||||
LiElementClasses = new[] { "page-item" },
|
||||
UlElementClasses = new[] { "pagination", "justify-content-center", "mt-3" },
|
||||
LinkToNextPageFormat = "Successiva",
|
||||
LinkToPreviousPageFormat = "Precedente",
|
||||
MaximumPageNumbersToDisplay = 5,
|
||||
DisplayLinkToPreviousPage = PagedListDisplayMode.Always,
|
||||
DisplayLinkToNextPage = PagedListDisplayMode.Always
|
||||
})
|
||||
{
|
||||
ActiveLiElementClass = "active",
|
||||
PageClasses = new[] { "page-link" },
|
||||
LiElementClasses = new[] { "page-item" },
|
||||
UlElementClasses = new[] { "pagination", "justify-content-center", "mt-3" },
|
||||
LinkToNextPageFormat = "Successiva",
|
||||
LinkToPreviousPageFormat = "Precedente",
|
||||
MaximumPageNumbersToDisplay = 5,
|
||||
DisplayLinkToPreviousPage = PagedListDisplayMode.Always,
|
||||
DisplayLinkToNextPage = PagedListDisplayMode.Always
|
||||
})
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* @model IEnumerable<VirtualTask.Models.Articoli>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Index";
|
||||
}
|
||||
|
||||
<h1>Index</h1>
|
||||
|
||||
<p>
|
||||
<a asp-action="Create">Create New</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Azienda)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.SlCodice)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.ArDesArt)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.SlCodMag)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.SlQtAper)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.AmCodice)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LoCodice)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LiCodLis)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LiCodArt)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LiDatAtt)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LiQuanti)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LiPrezzo)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LiScont1)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LiScont2)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LiScont3)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LiScont4)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Gest_Matr)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Gest_Lotti)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Desc_sup)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Azienda)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.SlCodice)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ArDesArt)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.SlCodMag)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.SlQtAper)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.AmCodice)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LoCodice)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LiCodLis)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LiCodArt)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LiDatAtt)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LiQuanti)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LiPrezzo)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LiScont1)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LiScont2)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LiScont3)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LiScont4)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Gest_Matr)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Gest_Lotti)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Desc_sup)
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
|
||||
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
*@
|
||||
</div>
|
||||
95
Views/MagazziniVT/Create.cshtml
Normal file
95
Views/MagazziniVT/Create.cshtml
Normal file
@ -0,0 +1,95 @@
|
||||
@model VirtualTask.Models.MagazziniVT
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Nuovo magazzino";
|
||||
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
|
||||
}
|
||||
|
||||
<div class="agy-project-wrapper agy-project-page-wrapper">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Create">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||
<div class="form-group">
|
||||
<h5><label asp-for="Mgcodmag" class="control-label"></label></h5>
|
||||
<input asp-for="Mgcodmag" class="form-control" />
|
||||
<span asp-validation-for="Mgcodmag" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||
<div class="form-group">
|
||||
<h5><label asp-for="Mgdesmag" class="control-label"></label></h5>
|
||||
<input asp-for="Mgdesmag" class="form-control" />
|
||||
<span asp-validation-for="Mgdesmag" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Salva" class="agy-btn submitForm" />
|
||||
<a asp-action="Index" value="Torna alla lista" class="agy-btn submitForm">Torna alla lista</a>
|
||||
</div>
|
||||
@Html.HiddenFor(x => x.Azienda)
|
||||
@Html.HiddenFor(x => x.DataObso)
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@section Scripts {
|
||||
@{
|
||||
await Html.RenderPartialAsync("_ValidationScriptsPartial");
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* @model VirtualTask.Models.MagazziniVT
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Create";
|
||||
}
|
||||
|
||||
<h1>Create</h1>
|
||||
|
||||
<h4>MagazziniVT</h4>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Create">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Azienda" class="control-label"></label>
|
||||
<input asp-for="Azienda" class="form-control" />
|
||||
<span asp-validation-for="Azienda" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Mgcodmag" class="control-label"></label>
|
||||
<input asp-for="Mgcodmag" class="form-control" />
|
||||
<span asp-validation-for="Mgcodmag" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Mgdesmag" class="control-label"></label>
|
||||
<input asp-for="Mgdesmag" class="form-control" />
|
||||
<span asp-validation-for="Mgdesmag" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="DataObso" class="control-label"></label>
|
||||
<input asp-for="DataObso" class="form-control" />
|
||||
<span asp-validation-for="DataObso" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Create" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||
}
|
||||
*@
|
||||
33
Views/MagazziniVT/Delete.cshtml
Normal file
33
Views/MagazziniVT/Delete.cshtml
Normal file
@ -0,0 +1,33 @@
|
||||
@model VirtualTask.Models.MagazziniVT
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Elimina";
|
||||
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
|
||||
}
|
||||
|
||||
<div class="agy-project-wrapper agy-project-page-wrapper">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-10">
|
||||
<b>@Html.DisplayNameFor(model => model.Mgcodmag)</b> @Html.DisplayFor(model => model.Mgcodmag)
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<b>@Html.DisplayNameFor(model => model.Mgdesmag)</b> @Html.DisplayFor(model => model.Mgdesmag)
|
||||
</div>
|
||||
@Html.HiddenFor(x => x.Azienda)
|
||||
@Html.HiddenFor(model => model.DataObso)
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||
<form asp-action="DeleteConfirmed">
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Elimina" class="agy-btn submitForm" />
|
||||
<input type="hidden" id="id" value=@Html.DisplayFor(model => model.Mgcodmag) name="id" />
|
||||
<a asp-action="Index" value="Torna alla lista" class="agy-btn submitForm">Torna alla lista</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
34
Views/MagazziniVT/Details.cshtml
Normal file
34
Views/MagazziniVT/Details.cshtml
Normal file
@ -0,0 +1,34 @@
|
||||
@model VirtualTask.Models.MagazziniVT
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Dettaglio";
|
||||
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
|
||||
}
|
||||
|
||||
<div class="agy-project-wrapper agy-project-page-wrapper">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-10">
|
||||
<b>@Html.DisplayNameFor(model => model.Mgcodmag)</b> @Html.DisplayFor(model => model.Mgcodmag)
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<b>@Html.DisplayNameFor(model => model.Mgdesmag)</b> @Html.DisplayFor(model => model.Mgdesmag)
|
||||
</div>
|
||||
@Html.HiddenFor(x => x.Azienda)
|
||||
@Html.HiddenFor(model => model.DataObso)
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||
<form asp-action="DeleteConfirmed">
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Elimina" class="agy-btn submitForm" />
|
||||
<input type="hidden" id="id" value=@Html.DisplayFor(model => model.Mgcodmag) name="id" />
|
||||
<a asp-action="Index" value="Torna alla lista" class="agy-btn submitForm">Torna alla lista</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
37
Views/MagazziniVT/Edit.cshtml
Normal file
37
Views/MagazziniVT/Edit.cshtml
Normal file
@ -0,0 +1,37 @@
|
||||
@model VirtualTask.Models.MagazziniVT
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Modifica magazzino";
|
||||
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
|
||||
}
|
||||
|
||||
<div class="agy-project-wrapper agy-project-page-wrapper">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Edit">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||
<div class="form-group">
|
||||
<h5><label asp-for="Mgcodmag" class="agy-client-quote"></label></h5>
|
||||
<input asp-for="Mgcodmag" class="agy-form-field require" class="form-control" />
|
||||
<span asp-validation-for="Mgcodmag" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||
<div class="form-group">
|
||||
<h5><label asp-for="Mgdesmag" class="agy-client-quote"></label></h5>
|
||||
<input asp-for="Mgdesmag" class="agy-form-field require" class="form-control" />
|
||||
<span asp-validation-for="Mgdesmag" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Salva" class="agy-btn submitForm" />
|
||||
<a asp-action="Index" value="Torna alla lista" class="agy-btn submitForm">Torna alla lista</a>
|
||||
</div>
|
||||
@Html.HiddenFor(x => x.Azienda)
|
||||
@Html.HiddenFor(model => model.DataObso)
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
103
Views/MagazziniVT/Index.cshtml
Normal file
103
Views/MagazziniVT/Index.cshtml
Normal file
@ -0,0 +1,103 @@
|
||||
@using X.PagedList.Mvc.Core;
|
||||
@using X.PagedList.Web.Common;
|
||||
@using X.PagedList;
|
||||
@model IPagedList<VirtualTask.Models.MagazziniVT>
|
||||
|
||||
<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
|
||||
@{
|
||||
ViewData["Title"] = "Magazzini";
|
||||
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
|
||||
}
|
||||
|
||||
<div class="agy-project-wrapper agy-project-page-wrapper">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<p>
|
||||
<a asp-action="Create" class="info-data"><img src="~/assets/images/icons8-nuovo-50.png" alt="Crea un nuovo elemento" /></a>
|
||||
</p>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
<div class="card">
|
||||
<h5 class="card-header">Ricerca</h5>
|
||||
<table class="table">
|
||||
<tbody class="table-border-bottom-0">
|
||||
<tr>
|
||||
<td>
|
||||
<span class="fw-medium">@Html.TextBox("SearchString", null, new { placeholder = "Cerca per descrizione", @class = "agy-form-field require" })</span>
|
||||
</td>
|
||||
<td>
|
||||
<i class="bx bxl-angular bx-sm text-black me-3"> </i>
|
||||
<span class="fw-medium"><input type="submit" value="Cerca" class="agy-btn submitForm" /></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div style="width:100%;height:30px;">
|
||||
|
||||
</div>
|
||||
<div class="card">
|
||||
<h5 class="card-header">Articoli</h5>
|
||||
<div class="table-responsive text-nowrap">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cod. Magazzino</th>
|
||||
<th>Descrizione</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Mgcodmag)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Mgdesmag)
|
||||
</td>
|
||||
@Html.HiddenFor(modelItem => item.Azienda)
|
||||
@Html.HiddenFor(modelItem => item.DataObso)
|
||||
|
||||
<td>
|
||||
<a href="@Url.Action("Edit", "MagazziniVT", new { id=item.Mgcodmag })" title="Modifica" class="links">
|
||||
<img alt="Modifica" src="@Url.Content("~/assets/images/icons8-modificare-64.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
|
|
||||
<a href="@Url.Action("Details", "MagazziniVT", new { id=item.Mgcodmag})" title="Dettaglio" class="links">
|
||||
<img alt="Dettaglio" src="@Url.Content("~/assets/images/icons8-visualizza-file-64.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
|
|
||||
<a href="@Url.Action("Delete", "MagazziniVT", new { id=item.Mgcodmag})" title="Elimina" class="links">
|
||||
<img alt="Elimina" src="@Url.Content("~/assets/images/icons8-elimina-50.png")" style="width:30px;height:30px;">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<nav>
|
||||
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page, searchString = @ViewData["CurrentFilter"] }), new PagedListRenderOptions()
|
||||
{
|
||||
ActiveLiElementClass = "active",
|
||||
PageClasses = new[] { "page-link" },
|
||||
LiElementClasses = new[] { "page-item" },
|
||||
UlElementClasses = new[] { "pagination", "justify-content-center", "mt-3" },
|
||||
LinkToNextPageFormat = "Successiva",
|
||||
LinkToPreviousPageFormat = "Precedente",
|
||||
MaximumPageNumbersToDisplay = 5,
|
||||
DisplayLinkToPreviousPage = PagedListDisplayMode.Always,
|
||||
DisplayLinkToNextPage = PagedListDisplayMode.Always
|
||||
})
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -172,6 +172,7 @@ Purchase:
|
||||
<li><a asp-area="" asp-controller="Anag" asp-action="Index">Clienti</a></li>
|
||||
<li><a asp-area="" asp-controller="Impianti" asp-action="Index">Impianti</a></li>
|
||||
<li><a asp-area="" asp-controller="Articoli" asp-action="Index">Articoli</a></li>
|
||||
<li><a asp-area="" asp-controller="MagazziniVT" asp-action="Index">Magazzini</a></li>
|
||||
<li><a asp-area="" asp-controller="Rapp_New" asp-action="Index">Buono intervento</a></li>
|
||||
<li><a asp-area="" asp-controller="Chiamate" asp-action="Index">Chiamate</a></li>
|
||||
<li><a asp-area="" asp-controller="Progressivi" asp-action="Index">Progressivi</a></li>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user