diff --git a/Controllers/AnagController.cs b/Controllers/AnagController.cs index 3aa7d6d..4c836ee 100644 --- a/Controllers/AnagController.cs +++ b/Controllers/AnagController.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using NuGet.Common; using System.Diagnostics; +using System.Reflection; using System.Runtime.Intrinsics.Arm; using System.Text; using VirtualTask.Models; @@ -15,15 +16,13 @@ namespace VirtualTask.Controllers string apiUrl = string.Empty; string urlBase=string.Empty; string token=string.Empty; + string tenant = 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; public AnagController() - { - + { + client = new HttpClient(); } #region INDEX @@ -39,7 +38,6 @@ namespace VirtualTask.Controllers urlBase = apiUrl+"anagraficheList"; urlBase = urlBase + "?token=" + token; Uri baseAddress = new Uri(urlBase); - client = new HttpClient(); client.BaseAddress = baseAddress; List modelList = new List(); @@ -49,7 +47,6 @@ namespace VirtualTask.Controllers { string data = response.Content.ReadAsStringAsync().Result; modelList = JsonConvert.DeserializeObject>(data); - if (!string.IsNullOrEmpty(searchString)) { modelList = modelList.Where(s => s.andescri.ToUpper().Contains(searchString.ToUpper())).ToList(); @@ -80,6 +77,8 @@ namespace VirtualTask.Controllers helper.SetStringValue("errMsg", errMes); return RedirectToAction("Error"); } + + } #endregion INDEX @@ -97,7 +96,8 @@ namespace VirtualTask.Controllers SessionHelper helper = new SessionHelper(this); token = helper.GetStringValue("tok"); - + tenant = helper.GetStringValue("tenant"); + model.ancodazi=tenant; apiUrl = helper.GetStringValue("apiUrl"); urlBase = apiUrl + "anagrafiche/add"; urlBase = urlBase + "?token=" + token; @@ -108,7 +108,6 @@ 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"); @@ -120,7 +119,6 @@ namespace VirtualTask.Controllers return RedirectToAction("Error"); } - return View(); } #endregion CREATE @@ -190,7 +188,7 @@ namespace VirtualTask.Controllers string data = response.Content.ReadAsStringAsync().Result; modelList = JsonConvert.DeserializeObject>(data); anag = modelList.Where(x => x.ancodice.Equals(id)).First(); - + } else { @@ -208,7 +206,8 @@ namespace VirtualTask.Controllers SessionHelper helper = new SessionHelper(this); token = helper.GetStringValue("tok"); - + tenant = helper.GetStringValue("tenant"); + model.ancodazi = tenant; apiUrl = helper.GetStringValue("apiUrl"); urlBase = apiUrl + "anagrafiche/mod"; urlBase = urlBase + "?token=" + token; @@ -226,8 +225,13 @@ namespace VirtualTask.Controllers { return RedirectToAction("Index"); } + else + { + errMes = response.Content.ReadAsStringAsync().Result; + helper.SetStringValue("errMsg", errMes); + return RedirectToAction("Error"); + } - return View(model); } #endregion EDIT @@ -260,32 +264,28 @@ namespace VirtualTask.Controllers modelList = JsonConvert.DeserializeObject>(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); } //DA MODIFICARE PERCHE' NON E' UNA DELETE MA UN UPDATE DELLA DATA OBSOLESCENZA [HttpPost, ActionName("DeleteConfirmed")] - public IActionResult DeleteConfirmed(string id) + public IActionResult DeleteConfirmed(Anag model) { SessionHelper helper = new SessionHelper(this); token = helper.GetStringValue("tok"); - + tenant = helper.GetStringValue("tenant"); + model.ancodazi = tenant; + model.andtobso=DateTime.Now; apiUrl = helper.GetStringValue("apiUrl"); - urlBase = apiUrl + "anagrafiche/del?" + "codice=" + id + "&"; - urlBase = urlBase + "token=" + token; + urlBase = apiUrl + "anagrafiche/del"; + urlBase = urlBase + "?token=" + token; Uri baseAddress = new Uri(urlBase); client = new HttpClient(); client.BaseAddress = baseAddress; - string data = JsonConvert.SerializeObject(id); + string data = JsonConvert.SerializeObject(model); StringContent content = new StringContent(data, Encoding.UTF8, "application/json"); @@ -302,7 +302,6 @@ namespace VirtualTask.Controllers return RedirectToAction("Error"); } - return View(); } #endregion DELETE diff --git a/Controllers/ImpiantiController.cs b/Controllers/ImpiantiController.cs index e014e04..6975cc5 100644 --- a/Controllers/ImpiantiController.cs +++ b/Controllers/ImpiantiController.cs @@ -193,6 +193,7 @@ namespace VirtualTask.Controllers return RedirectToAction("Error"); } + ViewBag.AllStockList = LoadStockitems(); return View(impianto); } diff --git a/Models/Anag.cs b/Models/Anag.cs index d00f11b..15c7a0a 100644 --- a/Models/Anag.cs +++ b/Models/Anag.cs @@ -5,14 +5,18 @@ namespace VirtualTask.Models { public class Anag { - [Display(Name = "TIPO"), Required(ErrorMessage = "Inserire tipo cliente")] - /// tipo + [Display(Name = "TIPO")] + /// tipo (chiave) public string? antipcon { get; set; } - [Display(Name = "CODICE"), Required(ErrorMessage = "Inserire codice cliente")] - /// codice + [Display(Name = "CODICE")] + /// codice (chiave) public string? ancodice { get; set; } + [Display(Name = "AZIENDA")] + /// aziewnda (chiave) + public string? ancodazi { get; set; } + [Display(Name = "EMAIL")] /// email public string? an_email { get; set; } @@ -41,7 +45,7 @@ namespace VirtualTask.Models /// pec public string? an_empec { get; set; } - [Display(Name = "RAGIONE SOCIALE"), Required(ErrorMessage = "Inserire ragione sociale")] + [Display(Name = "RAGIONE SOCIALE")] /// descrizione public string? andescri { get; set; } diff --git a/Views/Anag/Create.cshtml b/Views/Anag/Create.cshtml index b8e3e01..9d34116 100644 --- a/Views/Anag/Create.cshtml +++ b/Views/Anag/Create.cshtml @@ -12,21 +12,21 @@
-
- - - -
+ + @Html.HiddenFor(x => x.andtobso) + @Html.HiddenFor(x => x.annumlis) +
- - - + + +
+
@@ -52,26 +52,18 @@
+
+ + + +
-
- - - -
-
- - - -
-
- - - -
+ +
diff --git a/Views/Anag/Delete.cshtml b/Views/Anag/Delete.cshtml index e0c13a5..3ca0ed6 100644 --- a/Views/Anag/Delete.cshtml +++ b/Views/Anag/Delete.cshtml @@ -16,51 +16,61 @@
@Html.DisplayFor(model => model.antipcon) +
@Html.DisplayNameFor(model => model.ancodice)
@Html.DisplayFor(model => model.ancodice) +
@Html.DisplayNameFor(model => model.an_email) +
@Html.DisplayFor(model => model.an_email) +
@Html.DisplayNameFor(model => model.ancodfis)
@Html.DisplayFor(model => model.ancodfis) +
@Html.DisplayNameFor(model => model.anpariva)
@Html.DisplayFor(model => model.anpariva) +
@Html.DisplayNameFor(model => model.anindiri)
@Html.DisplayFor(model => model.anindiri) +
@Html.DisplayNameFor(model => model.antelefo)
@Html.DisplayFor(model => model.antelefo) +
@Html.DisplayNameFor(model => model.annumcel)
@Html.DisplayFor(model => model.annumcel) +
@Html.DisplayNameFor(model => model.an_empec) +
@Html.DisplayFor(model => model.an_empec) @@ -70,24 +80,25 @@
@Html.DisplayFor(model => model.andescri) +
-
- @Html.DisplayNameFor(model => model.annumlis) -
-
- @Html.DisplayFor(model => model.annumlis) -
-
- @Html.DisplayNameFor(model => model.andtobso) -
-
- @Html.DisplayFor(model => model.andtobso) -
+ + + @Html.HiddenFor(x => x.annumlis) + @Html.HiddenFor(x => x.andescri) + @Html.HiddenFor(x => x.an_empec) + @Html.HiddenFor(x => x.annumcel) + @Html.HiddenFor(x => x.antelefo) + @Html.HiddenFor(x => x.anindiri) + @Html.HiddenFor(x => x.anpariva) + @Html.HiddenFor(x => x.ancodfis) + @Html.HiddenFor(x => x.an_email) + @Html.HiddenFor(x => x.ancodice) + @Html.HiddenFor(x => x.antipcon) | - model.ancodice) name="id" /> Back to List
diff --git a/Views/Anag/Details.cshtml b/Views/Anag/Details.cshtml index dfe0fa3..7ef36a4 100644 --- a/Views/Anag/Details.cshtml +++ b/Views/Anag/Details.cshtml @@ -10,24 +10,20 @@

Anag


-
- @Html.DisplayNameFor(model => model.antipcon) -
-
- @Html.DisplayFor(model => model.antipcon) -
+
@Html.DisplayNameFor(model => model.ancodice)
@Html.DisplayFor(model => model.ancodice)
-
- @Html.DisplayNameFor(model => model.an_email) +
+ @Html.DisplayNameFor(model => model.andescri)
-
- @Html.DisplayFor(model => model.an_email) +
+ @Html.DisplayFor(model => model.andescri)
+
@Html.DisplayNameFor(model => model.ancodfis)
@@ -58,30 +54,20 @@
@Html.DisplayFor(model => model.annumcel)
+
+ @Html.DisplayNameFor(model => model.an_email) +
+
+ @Html.DisplayFor(model => model.an_email) +
@Html.DisplayNameFor(model => model.an_empec)
@Html.DisplayFor(model => model.an_empec)
-
- @Html.DisplayNameFor(model => model.andescri) -
-
- @Html.DisplayFor(model => model.andescri) -
-
- @Html.DisplayNameFor(model => model.annumlis) -
-
- @Html.DisplayFor(model => model.annumlis) -
-
- @Html.DisplayNameFor(model => model.andtobso) -
-
- @Html.DisplayFor(model => model.andtobso) -
+ +
diff --git a/Views/Anag/Edit.cshtml b/Views/Anag/Edit.cshtml index ab7e7bd..ec4aef0 100644 --- a/Views/Anag/Edit.cshtml +++ b/Views/Anag/Edit.cshtml @@ -12,21 +12,21 @@
-
- - - -
+ + @Html.HiddenFor(x => x.antipcon) + @Html.HiddenFor(x => x.andtobso) + @Html.HiddenFor(x => x.annumlis)
- - - + + +
+
@@ -52,26 +52,19 @@
+
+ + + +
-
- - - -
-
- - - -
-
- - - -
+ + +
diff --git a/Views/Impianti/Create.cshtml b/Views/Impianti/Create.cshtml index 0170b14..1e873ef 100644 --- a/Views/Impianti/Create.cshtml +++ b/Views/Impianti/Create.cshtml @@ -17,11 +17,7 @@
-@*
- - - -
*@ + @Html.HiddenFor(m => m.imcodazi)
@@ -87,15 +83,6 @@
- - - - - - - - - + + + + + + + + @section Scripts { @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} } diff --git a/Views/Impianti/Index.cshtml b/Views/Impianti/Index.cshtml index c17630b..37a35f4 100644 --- a/Views/Impianti/Index.cshtml +++ b/Views/Impianti/Index.cshtml @@ -22,106 +22,27 @@ - - - + + + -@* - - - - - - - - *@ - + @foreach (var item in Model) { - string message = string.Empty; - if (!string.IsNullOrEmpty(item.imindiri1)) - message = message + item.imindiri1; - if (!string.IsNullOrEmpty(item.imindiri2)) - message = " "+message + item.imindiri2; - if (item.imindiri3!=null) - message = "," + message + Convert.ToString( item.imindiri3); + - - - - -@* - - - - - - - - *@ - - + + + + +
- Cod. Impianto - - Azienda - - Descrizione - Cod. ImpiantoAziendaDescrizione Indirizzo - @Html.DisplayNameFor(model => model.imindiri1) - - @Html.DisplayNameFor(model => model.imindiri2) - - @Html.DisplayNameFor(model => model.imindiri3) - - @Html.DisplayNameFor(model => model.imindiri4) - - @Html.DisplayNameFor(model => model.imindiri5) - - @Html.DisplayNameFor(model => model.imlocali) - - @Html.DisplayNameFor(model => model.imcodcap) - - @Html.DisplayNameFor(model => model.imcomune) - - @Html.DisplayNameFor(model => model.improvin) - - Cod. Cliente - Cod. Clienterr
- @Html.DisplayFor(modelItem => item.imcodimp) - - @Html.DisplayFor(modelItem => item.imcodazi) - - @Html.DisplayFor(modelItem => item.imdescri) - - @Html.DisplayFor(modelItem => item.indirizzo) - - @Html.DisplayFor(modelItem => item.imindiri1) - - @Html.DisplayFor(modelItem => item.imindiri2) - - @Html.DisplayFor(modelItem => item.imindiri3) - - @Html.DisplayFor(modelItem => item.imindiri4) - - @Html.DisplayFor(modelItem => item.imindiri5) - - @Html.DisplayFor(modelItem => item.imlocali) - - @Html.DisplayFor(modelItem => item.imcodcap) - - @Html.DisplayFor(modelItem => item.imcomune) - - @Html.DisplayFor(modelItem => item.improvin) - - @Html.DisplayFor(modelItem => item.imultcli) - @Html.DisplayFor(modelItem => item.imcodimp)@Html.DisplayFor(modelItem => item.imcodazi)@Html.DisplayFor(modelItem => item.imdescri)@Html.DisplayFor(modelItem => item.indirizzo)@Html.DisplayFor(modelItem => item.imultcli)pppp @Html.ActionLink("Edit", "Edit", new { id=item.imcodimp }) | @Html.ActionLink("Details", "Details", new { id=item.imcodimp }) |