This commit is contained in:
Michele Ferri 2023-10-09 16:08:25 +02:00
parent 40c14060e7
commit 6c51d9bd07
13 changed files with 371 additions and 118 deletions

View File

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NuGet.Common;
using System.Diagnostics;
using System.Runtime.Intrinsics.Arm;
using System.Text;
using VirtualTask.Models;
@ -14,6 +15,8 @@ namespace VirtualTask.Controllers
string apiUrl = string.Empty;
string urlBase=string.Empty;
string token=string.Empty;
string errMes = string.Empty;
//Uri baseAddress = new Uri("http://10.0.0.187:8000/api/Polo/anagraficheList?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiVEVTVCIsImp0aSI6IjA2MzA5MzlmLTBhZDgtNDhkMi04ZTI5LWI3Mjk3N2IyOWM1YiIsInRlbmFudCI6Ik1BUlJPIiwidGNjb2RpY2UiOiJaWlogICAgICAgICAgICAiLCJleHAiOjE3MDE3Njk0NTUsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NjE5NTUiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.CDt3wR6ube4zzNscVG9Qv6bzOnNF6A9-bIZxxjbKmKI");
//Uri baseAddress = new Uri("http://10.0.0.187:8000/api/Polo/anagraficheList?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiVEVTVCIsImp0aSI6IjA2MzA5MzlmLTBhZDgtNDhkMi04ZTI5LWI3Mjk3N2IyOWM1YiIsInRlbmFudCI6Ik1BUlJPIiwidGNjb2RpY2UiOiJaWlogICAgICAgICAgICAiLCJleHAiOjE3MDE3Njk0NTUsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NjE5NTUiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.CDt3wR6ube4zzNscVG9Qv6bzOnNF6A9-bIZxxjbKmKI");
HttpClient client;
@ -46,31 +49,37 @@ namespace VirtualTask.Controllers
{
string data = response.Content.ReadAsStringAsync().Result;
modelList = JsonConvert.DeserializeObject<List<Anag>>(data);
}
if (!string.IsNullOrEmpty(searchString))
{
modelList = modelList.Where(s => s.andescri.ToUpper().Contains(searchString.ToUpper())).ToList();
ViewData["CurrentFilter"] = searchString;
if (!string.IsNullOrEmpty(searchString))
{
modelList = modelList.Where(s => s.andescri.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.ancodice)
.ToPagedList(page ?? 1, pageSize);
return View(shortLinks);
}
else
{
ViewData["CurrentFilter"] = null;
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
if (page != null && page < 1)
{
page = 1;
}
var pageSize = 10;
var shortLinks = modelList
.OrderByDescending(s => s.ancodice)
.ToPagedList(page ?? 1, pageSize);
return View(shortLinks);
}
#endregion INDEX
@ -99,10 +108,17 @@ namespace VirtualTask.Controllers
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");
}
return View();
}
@ -136,6 +152,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Anag>>(data);
anag = modelList.Where(x => x.ancodice.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(anag);
}
@ -170,6 +192,12 @@ namespace VirtualTask.Controllers
anag = modelList.Where(x => x.ancodice.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(anag);
}
@ -232,6 +260,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Anag>>(data);
anag = modelList.Where(x => x.ancodice.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(anag);
}
@ -261,10 +295,24 @@ namespace VirtualTask.Controllers
{
return RedirectToAction("Index");
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View();
}
#endregion DELETE
[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 });
}
}
}

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System.Diagnostics;
using System.Text;
using VirtualTask.Models;
using X.PagedList;
@ -12,6 +13,7 @@ namespace VirtualTask.Controllers
string urlBase = string.Empty;
string token = string.Empty;
string tenant = string.Empty;
string errMes = string.Empty;
HttpClient client;
@ -43,28 +45,35 @@ namespace VirtualTask.Controllers
{
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();
if (!string.IsNullOrEmpty(searchString))
{
modelList = modelList.Where(s => s.chcodimp.ToUpper().Contains(searchString.ToUpper())).ToList();
ViewData["CurrentFilter"] = searchString;
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);
}
else
ViewData["CurrentFilter"] = null;
if (page != null && page < 1)
{
page = 1;
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
var pageSize = 10;
var shortLinks = modelList
.OrderByDescending(s => s.chcodimp)
.ToPagedList(page ?? 1, pageSize);
return View(shortLinks);
}
#endregion INDEX
@ -99,6 +108,12 @@ namespace VirtualTask.Controllers
{
return RedirectToAction("Index");
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View();
}
@ -132,6 +147,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Chiamate>>(data);
chiamata = modelList.Where(x => x.chserial.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(chiamata);
}
@ -165,6 +186,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Chiamate>>(data);
chiamata = modelList.Where(t => t.chserial.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(chiamata);
}
@ -191,10 +218,17 @@ namespace VirtualTask.Controllers
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");
}
return View(model);
}
@ -226,6 +260,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Chiamate>>(data);
chiamata = modelList.Where(x => x.chserial.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(chiamata);
}
@ -251,9 +291,23 @@ namespace VirtualTask.Controllers
{
return RedirectToAction("Index");
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View();
}
#endregion DELETE
[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 });
}
}
}

View File

@ -78,7 +78,6 @@ namespace VirtualTask.Controllers
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
}
#endregion INDEX
@ -125,8 +124,6 @@ namespace VirtualTask.Controllers
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
}
#endregion CREATE

View File

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Newtonsoft.Json;
using System.Diagnostics;
using System.Drawing.Printing;
using System.Text;
using VirtualTask.Models;
@ -15,6 +16,7 @@ namespace VirtualTask.Controllers
string urlBase = string.Empty;
string token = string.Empty;
string tenant = string.Empty;
string errMes = string.Empty;
HttpClient client;
public ImpiantiController()
@ -46,28 +48,34 @@ namespace VirtualTask.Controllers
string data = response.Content.ReadAsStringAsync().Result;
modelList = JsonConvert.DeserializeObject<List<Impianto>>(data);
modelList = modelList.Where(s => !string.IsNullOrEmpty(s.imcodimp)).ToList();
}
if (!string.IsNullOrEmpty(searchString))
{
modelList = modelList.Where(s => s.indirizzo.ToUpper().Contains(searchString.ToUpper())).ToList();
ViewData["CurrentFilter"] = searchString;
if (!string.IsNullOrEmpty(searchString))
{
modelList = modelList.Where(s => s.indirizzo.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.imcodimp)
.ToPagedList(page ?? 1, pageSize);
return View(shortLinks);
}
else
ViewData["CurrentFilter"] = null;
if (page != null && page < 1)
{
page = 1;
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
var pageSize = 10;
var shortLinks = modelList
.OrderByDescending(s => s.imcodimp)
.ToPagedList(page ?? 1, pageSize);
return View(shortLinks);
}
#endregion INDEX
@ -98,12 +106,17 @@ namespace VirtualTask.Controllers
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");
}
return View();
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
}
#endregion CREATE
@ -133,6 +146,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Impianto>>(data);
impianto = modelList.Where(x => x.imcodimp.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(impianto);
@ -167,6 +186,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Impianto>>(data);
impianto = modelList.Where(x => x.imcodimp.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(impianto);
}
@ -197,7 +222,14 @@ namespace VirtualTask.Controllers
{
return RedirectToAction("Index");
}
return View(model);
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
//return View(model);
}
#endregion EDIT
@ -226,6 +258,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Impianto>>(data);
impianto = modelList.Where(t => t.imcodimp.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(impianto);
@ -251,8 +289,14 @@ namespace VirtualTask.Controllers
{
return RedirectToAction("Index");
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View();
//return View();
}
@ -285,5 +329,13 @@ namespace VirtualTask.Controllers
}
return selectItems;
}
[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 });
}
}
}

View File

@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Newtonsoft.Json;
using System.Diagnostics;
using System.Text;
using VirtualTask.Models;
using X.PagedList;
@ -12,6 +13,7 @@ namespace VirtualTask.Controllers
string apiUrl = string.Empty;
string urlBase = string.Empty;
string token = string.Empty;
string errMes = string.Empty;
HttpClient client;
@ -43,28 +45,35 @@ namespace VirtualTask.Controllers
{
string data = response.Content.ReadAsStringAsync().Result;
modelList = JsonConvert.DeserializeObject<List<Rapp_New>>(data);
}
if (!string.IsNullOrEmpty(searchString))
{
modelList = modelList.Where(s => s.descrizione_intervento.ToUpper().Contains(searchString.ToUpper())).ToList();
ViewData["CurrentFilter"] = searchString;
if (!string.IsNullOrEmpty(searchString))
{
modelList = modelList.Where(s => s.descrizione_intervento.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.seriale_rapportino)
.ToPagedList(page ?? 1, pageSize);
return View(shortLinks);
}
else
ViewData["CurrentFilter"] = null;
if (page != null && page < 1)
{
page = 1;
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
var pageSize = 10;
var shortLinks = modelList
.OrderByDescending(s => s.seriale_rapportino)
.ToPagedList(page ?? 1, pageSize);
return View(shortLinks);
}
#endregion INDEX
@ -98,6 +107,12 @@ namespace VirtualTask.Controllers
{
return RedirectToAction("Index");
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View();
}
@ -131,6 +146,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Rapp_New>>(data);
rapp = modelList.Where(x => x.seriale_rapportino.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(rapp);
}
@ -163,7 +184,12 @@ namespace VirtualTask.Controllers
string data = response.Content.ReadAsStringAsync().Result;
modelList = JsonConvert.DeserializeObject<List<Rapp_New>>(data);
rapp = modelList.Where(x => x.seriale_rapportino.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(rapp);
@ -193,6 +219,12 @@ namespace VirtualTask.Controllers
{
return RedirectToAction("Index");
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(rapp);
}
@ -227,6 +259,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Rapp_New>>(data);
rapp = modelList.Where(x => x.seriale_rapportino.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(rapp);
}
@ -255,6 +293,12 @@ namespace VirtualTask.Controllers
{
return RedirectToAction("Index");
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View();
}
@ -290,5 +334,13 @@ namespace VirtualTask.Controllers
return selectItems;
}
[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 });
}
}
}

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System.Diagnostics;
using System.Text;
using VirtualTask.Models;
using X.PagedList;
@ -14,6 +15,7 @@ namespace VirtualTask.Controllers
string urlBase = string.Empty;
string token = string.Empty;
string tenant = string.Empty;
string errMes = string.Empty;
//MF commentati perchè L'Uri viene costruito
//Uri baseAddress = new Uri("http://10.0.0.187:8000/api/Polo/tecniciList?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiVEVTVCIsImp0aSI6IjA2MzA5MzlmLTBhZDgtNDhkMi04ZTI5LWI3Mjk3N2IyOWM1YiIsInRlbmFudCI6Ik1BUlJPIiwidGNjb2RpY2UiOiJaWlogICAgICAgICAgICAiLCJleHAiOjE3MDE3Njk0NTUsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NjE5NTUiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.CDt3wR6ube4zzNscVG9Qv6bzOnNF6A9-bIZxxjbKmKI");
@ -56,28 +58,35 @@ namespace VirtualTask.Controllers
{
string data = response.Content.ReadAsStringAsync().Result;
modelList = JsonConvert.DeserializeObject<List<Tecnici>>(data);
}
if (!string.IsNullOrEmpty(searchString))
{
modelList = modelList.Where(s => s.tcdescri.ToUpper().Contains(searchString.ToUpper())).ToList();
ViewData["CurrentFilter"] = searchString;
if (!string.IsNullOrEmpty(searchString))
{
modelList = modelList.Where(s => s.tcdescri.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.tccodice)
.ToPagedList(page ?? 1, pageSize);
return View(shortLinks);
}
else
ViewData["CurrentFilter"] = null;
if (page != null && page < 1)
{
page = 1;
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
var pageSize = 10;
var shortLinks = modelList
.OrderByDescending(s => s.tccodice)
.ToPagedList(page ?? 1, pageSize);
return View(shortLinks);
}
#endregion INDEX
@ -86,7 +95,6 @@ namespace VirtualTask.Controllers
public IActionResult Create()
{
return View();
}
@ -113,12 +121,17 @@ namespace VirtualTask.Controllers
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");
}
return View();
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("ErrMsg", errMes);
return RedirectToAction("Index");
}
}
#endregion CREATE
@ -150,6 +163,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Tecnici>>(data);
tecnico = modelList.Where(x => x.tccodice.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(tecnico);
}
@ -184,6 +203,12 @@ namespace VirtualTask.Controllers
tecnico = modelList.Where(x => x.tccodice.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(tecnico);
}
@ -252,6 +277,12 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Tecnici>>(data);
tecnico = modelList.Where(x => x.tccodice.Equals(id)).First();
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
return View(tecnico);
}
@ -280,10 +311,22 @@ namespace VirtualTask.Controllers
{
return RedirectToAction("Index");
}
return View();
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
}
#endregion DELETE
[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 });
}
}
}

View File

@ -5,11 +5,11 @@ namespace VirtualTask.Models
{
public class Anag
{
[Display(Name = "TIPO")]
[Display(Name = "TIPO"), Required(ErrorMessage = "Inserire tipo cliente")]
/// <summary>tipo </summary>
public string? antipcon { get; set; }
[Display(Name = "CODICE")]
[Display(Name = "CODICE"), Required(ErrorMessage = "Inserire codice cliente")]
/// <summary>codice</summary>
public string? ancodice { get; set; }
@ -41,7 +41,7 @@ namespace VirtualTask.Models
/// <summary>pec</summary>
public string? an_empec { get; set; }
[Display(Name = "RAGIONE SOCIALE")]
[Display(Name = "RAGIONE SOCIALE"), Required(ErrorMessage = "Inserire ragione sociale")]
/// <summary>descrizione </summary>
public string? andescri { get; set; }

View File

@ -9,16 +9,22 @@ namespace VirtualTask.Models
{
[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; }

View File

@ -9,12 +9,13 @@ namespace VirtualTask.Models
[Display(Name = "AZIENDA")]
public string? cccodazi { get; set; }
[Display(Name = "CODICE")]
[Display(Name = "CODICE"), Required(ErrorMessage = "Inserire codice chiamata")]
public string? cccodice { get; set; }
[Display(Name = "DESCRIZIONE")]
[Display(Name = "DESCRIZIONE"), Required(ErrorMessage = "Inserire descrizione")]
public string? ccdescr { get; set; }
[Display(Name = "DESC. SUPPLEMENTARE")]
[Display(Name = "DESC. SUPPLEMENTARE"), Required(ErrorMessage = "Inserire Desc. Supplementare")]
public string? ccdessup { get; set; }

View File

@ -5,7 +5,7 @@ namespace VirtualTask.Models
{
public class Impianto
{
[Display(Name = "Codice Impianto")]
[Display(Name = "Codice Impianto"), Required(ErrorMessage = "Inserire codice impianto")]
/// <summary>Codice Impianto</summary>
public string? imcodimp { get; set; }
@ -13,7 +13,7 @@ namespace VirtualTask.Models
/// <summary> Azienda </summary>
public string? imcodazi { get; set; }
[Display(Name = "Descrizione")]
[Display(Name = "Descrizione"), Required(ErrorMessage = "Inserire descrizione")]
/// <summary>Descrizione Impianto</summary>
public string? imdescri { get; set; }

View File

@ -7,7 +7,7 @@ namespace VirtualTask.Models
{
public class Rapp_New
{
[Display(Name = "SERIALE RAPPORTINO")]
[Display(Name = "SERIALE RAPPORTINO"), Required(ErrorMessage = "Inserisci il seriale rapportino")]
public string? seriale_rapportino { get; set; }
[Display(Name = "TIPO RAPPORTINI")]
@ -16,7 +16,7 @@ namespace VirtualTask.Models
[Display(Name = "AZIENDA")]
public string? azienda_impianto { get; set; }
[Display(Name = "CODICE IMPIANTO")]
[Display(Name = "CODICE IMPIANTO"), Required(ErrorMessage = "Inserisci codice impianto")]
public string? codice_impianto { get; set; }
[Display(Name = "AZ. CHIAMATA")]

View File

@ -9,16 +9,16 @@ namespace VirtualTask.Models
[Display(Name = "AZIENDA")]
public string? tccodazi { get; set; }
[Display(Name = "CODICE")]
[Display(Name = "CODICE"), Required(ErrorMessage = "Inserire codice tecnico")]
public string? tccodice { get; set; }
[Display(Name = "DESCRIZIONE")]
[Display(Name = "DESCRIZIONE"), Required(ErrorMessage = "Inserire descrizione")]
public string? tcdescri { get; set;}
[Display(Name = "TELEFONO")]
public string? tctelef1 { get; set;}
[Display(Name = "UTENTE")]
[Display(Name = "UTENTE"), Required(ErrorMessage = "Inserire Utente")]
public string? tcuser { get; set;}
[Display(Name = "PASSWORD")]

View File

@ -21,12 +21,12 @@
</div>
<div class="form-group">
<label asp-for="ccdescr" class="control-label"></label>
<input asp-for="ccdescr" class="form-control" />
<input asp-for="ccdescr" class="form-control" />
<span asp-validation-for="ccdescr" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="ccdessup" class="control-label"></label>
<input asp-for="ccdessup" class="form-control" />
<div class="form-group">
<input asp-for="ccdessup" class="form-control" />
<span asp-validation-for="ccdessup" class="text-danger"></span>
</div>