MICHELE: Chiamate

This commit is contained in:
Michele Ferri 2023-10-02 09:24:10 +02:00
parent e1af0b9c7f
commit de9982af8d
4 changed files with 536 additions and 0 deletions

View File

@ -0,0 +1,70 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using VirtualTask.Models;
using X.PagedList;
namespace VirtualTask.Controllers
{
public class ChiamateController : Controller
{
string apiUrl = string.Empty;
string urlBase = string.Empty;
string token = string.Empty;
HttpClient client;
public ChiamateController()
{
client = new HttpClient();
}
#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("Index", "Login");
apiUrl = helper.GetStringValue("apiUrl");
urlBase = apiUrl + "chiamateList";
urlBase = urlBase + "?token=" + token;
Uri baseAddress = new Uri(urlBase);
client = new HttpClient();
client.BaseAddress = baseAddress;
List<Chiamate> modelList = new List<Chiamate>();
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
if (response.IsSuccessStatusCode)
{
string data = response.Content.ReadAsStringAsync().Result;
modelList = JsonConvert.DeserializeObject<List<Chiamate>>(data);
}
if (!string.IsNullOrEmpty(searchString))
{
modelList = modelList.Where(s => s.chcodimp.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.chcodimp)
.ToPagedList(page ?? 1, pageSize);
return View(shortLinks);
}
#endregion INDEX
}
}

75
Models/Chiamate.cs Normal file
View File

@ -0,0 +1,75 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Linq;
namespace VirtualTask.Models
{
public class Chiamate
{
[Display (Name= "AZIENDA")]
public string? chcodazi { get; set; }
[Display(Name = "SERIALE")]
public string? chserial { get; set; }
[Display(Name = "CODICE ESERCIZIO")]
public string? chcodese { get; set; }
[Display(Name = "TIPO")]
public string? chtipo { get; set; }
[Display(Name = "NUMERO")]
public double? chnumero { get; set; }
[Display(Name = "DATA")]
public DateTime? chdata { get; set; }
public int? chora { get; set; }
public int? chmin { get; set; }
public int? chopins { get; set; }
public int? chopass { get; set; }
public int? chopchi { get; set; }
public string? chcodimp { get; set; }
public string? chaziimp { get; set; }
public string? chtchiam { get; set; }
public string? chtmanut { get; set; }
public string? chstato { get; set; }
public string? chdtapp { get; set; }
public string? choraapi { get; set; }
public int? chminapi { get; set; }
public int? choraapf { get; set; }
public int? chminapf { get; set; }
public string? chrifer { get; set; }
public string? chtelef { get; set; }
public string? chcodseg { get; set; }
public string? chstopi { get; set; }
public string? chnote { get; set; }
public string? chdtass { get; set; }
public int? chorass { get; set; }
public int? chminass { get; set; }
public string? chdtchi { get; set; }
public int? chorachi { get; set; }
public int? chminchi { get; set; }
public string? chdtlin { get; set; }
public int? chorali { get; set; }
public int? chminli { get; set; }
public string? chdtlfi { get; set; }
public int? choralf { get; set; }
public int? chminlf { get; set; }
public string? chvalfat { get; set; }
public string? cpccchk { get; set; }
public int? chnrap1 { get; set; }
public string? chsrap1 { get; set; }
public int? chnrap2 { get; set; }
public string? chsrap2 { get; set; }
public string? chmodrac { get; set; }
public int? chprgann { get; set; }
public string? chserchi { get; set; }
public string? chdesfat { get; set; }
public string? chdessup { get; set; }
public double? chimpofa { get; set; }
public string? chserdoc { get; set; }
public double? chimpmat { get; set; }
public double? chimpman { get; set; }
public double? chperman { get; set; }
public string? chflstim { get; set; }
public string? chfleste { get; set; }
public string? chserext { get; set; }
public string? chrifiutata { get; set; }
}
}

388
Views/Chiamate/Index.cshtml Normal file
View File

@ -0,0 +1,388 @@
@model IPagedList<VirtualTask.Models.Chiamate>
@using X.PagedList.Mvc.Core;
@using X.PagedList.Web.Common;
@using X.PagedList;
@{
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.chcodazi) *@
AZIENDA
</th>
<th>
@* @Html.DisplayNameFor(model => model.chserial) *@
SERIALE
</th>
<th>
@* @Html.DisplayNameFor(model => model.chcodese) *@
ESERCIZIO
</th>
<th>
@* @Html.DisplayNameFor(model => model.chtipo) *@
TIPO
</th>
<th>
@* @Html.DisplayNameFor(model => model.chnumero) *@
NUMERO
</th>
<th>
@* @Html.DisplayNameFor(model => model.chdata) *@
DATA
</th>
<th>
@* @Html.DisplayNameFor(model => model.chora) *@
ORA
</th>
<th>
@* @Html.DisplayNameFor(model => model.chmin) *@
MINUTI
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chopins) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chopass) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chopchi) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chcodimp) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chaziimp) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chtchiam) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chtmanut) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chstato) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chdtapp) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.choraapi) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chminapi) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.choraapf) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chminapf) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chrifer) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chtelef) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chcodseg) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chstopi) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chnote) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chdtass) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chorass) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chminass) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chdtchi) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chorachi) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chminchi) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chdtlin) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chorali) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chminli) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chdtlfi) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.choralf) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chminlf) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chvalfat) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.cpccchk) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chnrap1) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chsrap1) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chnrap2) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chsrap2) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chmodrac) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chprgann) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chserchi) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chdesfat) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chdessup) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chimpofa) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chserdoc) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chimpmat) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chimpman) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chperman) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chflstim) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chfleste) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chserext) *@
</th>
<th hidden>
@* @Html.DisplayNameFor(model => model.chrifiutata) *@
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.chcodazi)
</td>
<td>
@Html.DisplayFor(modelItem => item.chserial)
</td>
<td>
@Html.DisplayFor(modelItem => item.chcodese)
</td>
<td>
@Html.DisplayFor(modelItem => item.chtipo)
</td>
<td>
@Html.DisplayFor(modelItem => item.chnumero)
</td>
<td>
@Html.DisplayFor(modelItem => item.chdata)
</td>
<td>
@Html.DisplayFor(modelItem => item.chora)
</td>
<td>
@Html.DisplayFor(modelItem => item.chmin)
</td>
<td>
@Html.DisplayFor(modelItem => item.chopins)
</td>
<td>
@Html.DisplayFor(modelItem => item.chopass)
</td>
<td>
@Html.DisplayFor(modelItem => item.chopchi)
</td>
<td>
@Html.DisplayFor(modelItem => item.chcodimp)
</td>
<td>
@Html.DisplayFor(modelItem => item.chaziimp)
</td>
<td>
@Html.DisplayFor(modelItem => item.chtchiam)
</td>
<td>
@Html.DisplayFor(modelItem => item.chtmanut)
</td>
<td>
@Html.DisplayFor(modelItem => item.chstato)
</td>
<td>
@Html.DisplayFor(modelItem => item.chdtapp)
</td>
<td>
@Html.DisplayFor(modelItem => item.choraapi)
</td>
<td>
@Html.DisplayFor(modelItem => item.chminapi)
</td>
<td>
@Html.DisplayFor(modelItem => item.choraapf)
</td>
<td>
@Html.DisplayFor(modelItem => item.chminapf)
</td>
<td>
@Html.DisplayFor(modelItem => item.chrifer)
</td>
<td>
@Html.DisplayFor(modelItem => item.chtelef)
</td>
<td>
@Html.DisplayFor(modelItem => item.chcodseg)
</td>
<td>
@Html.DisplayFor(modelItem => item.chstopi)
</td>
<td>
@Html.DisplayFor(modelItem => item.chnote)
</td>
<td>
@Html.DisplayFor(modelItem => item.chdtass)
</td>
<td>
@Html.DisplayFor(modelItem => item.chorass)
</td>
<td>
@Html.DisplayFor(modelItem => item.chminass)
</td>
<td>
@Html.DisplayFor(modelItem => item.chdtchi)
</td>
<td>
@Html.DisplayFor(modelItem => item.chorachi)
</td>
<td>
@Html.DisplayFor(modelItem => item.chminchi)
</td>
<td>
@Html.DisplayFor(modelItem => item.chdtlin)
</td>
<td>
@Html.DisplayFor(modelItem => item.chorali)
</td>
<td>
@Html.DisplayFor(modelItem => item.chminli)
</td>
<td>
@Html.DisplayFor(modelItem => item.chdtlfi)
</td>
<td>
@Html.DisplayFor(modelItem => item.choralf)
</td>
<td>
@Html.DisplayFor(modelItem => item.chminlf)
</td>
<td>
@Html.DisplayFor(modelItem => item.chvalfat)
</td>
<td>
@Html.DisplayFor(modelItem => item.cpccchk)
</td>
<td>
@Html.DisplayFor(modelItem => item.chnrap1)
</td>
<td>
@Html.DisplayFor(modelItem => item.chsrap1)
</td>
<td>
@Html.DisplayFor(modelItem => item.chnrap2)
</td>
<td>
@Html.DisplayFor(modelItem => item.chsrap2)
</td>
<td>
@Html.DisplayFor(modelItem => item.chmodrac)
</td>
<td>
@Html.DisplayFor(modelItem => item.chprgann)
</td>
<td>
@Html.DisplayFor(modelItem => item.chserchi)
</td>
<td>
@Html.DisplayFor(modelItem => item.chdesfat)
</td>
<td>
@Html.DisplayFor(modelItem => item.chdessup)
</td>
<td>
@Html.DisplayFor(modelItem => item.chimpofa)
</td>
<td>
@Html.DisplayFor(modelItem => item.chserdoc)
</td>
<td>
@Html.DisplayFor(modelItem => item.chimpmat)
</td>
<td>
@Html.DisplayFor(modelItem => item.chimpman)
</td>
<td>
@Html.DisplayFor(modelItem => item.chperman)
</td>
<td>
@Html.DisplayFor(modelItem => item.chflstim)
</td>
<td>
@Html.DisplayFor(modelItem => item.chfleste)
</td>
<td>
@Html.DisplayFor(modelItem => item.chserext)
</td>
<td>
@Html.DisplayFor(modelItem => item.chrifiutata)
</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>

View File

@ -34,6 +34,9 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Rapp_New" asp-action="Index">RAPP NEW</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Chiamate" asp-action="Index">CHIAMATE</a>
</li>
</ul>
</div>
</div>