Aggiunto View e metodo nel controller per Disabilita utente
This commit is contained in:
parent
749d21dd70
commit
fdab186e20
@ -491,9 +491,8 @@ namespace VirtualTask.Controllers
|
|||||||
|
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
string data = response.Content.ReadAsStringAsync().Result;
|
//string data = response.Content.ReadAsStringAsync().Result;
|
||||||
string e = JsonConvert.DeserializeObject<string>(data);
|
//string e = JsonConvert.DeserializeObject<string>(data);
|
||||||
|
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@ -510,12 +509,92 @@ namespace VirtualTask.Controllers
|
|||||||
helper.SetStringValue("errMsg", "Utente non abilitato per la funzione");
|
helper.SetStringValue("errMsg", "Utente non abilitato per la funzione");
|
||||||
return RedirectToAction("Error");
|
return RedirectToAction("Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DISATTIVA
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Disattiva(int id)
|
||||||
|
{
|
||||||
|
SessionHelper helper = new SessionHelper(this);
|
||||||
|
|
||||||
|
//token = helper.GetStringValue("tok");
|
||||||
|
|
||||||
|
apiUrl = helper.GetStringValue("apiUrl");
|
||||||
|
urlBase = apiUrl + "RegistrazioniList";
|
||||||
|
//urlBase = "http://10.0.0.187:8000/api/Polo/RegistrazioniList";
|
||||||
|
//urlBase = urlBase + "?token=" + token;
|
||||||
|
Uri baseAddress = new Uri(urlBase);
|
||||||
|
client = new HttpClient();
|
||||||
|
client.BaseAddress = baseAddress;
|
||||||
|
|
||||||
|
admin = helper.GetStringValue("admin");
|
||||||
|
ViewBag.Admin = admin;
|
||||||
|
|
||||||
|
Registrazione reg = new Registrazione();
|
||||||
|
List<Registrazione> modelList = new List<Registrazione>();
|
||||||
|
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
string data = response.Content.ReadAsStringAsync().Result;
|
||||||
|
modelList = JsonConvert.DeserializeObject<List<Registrazione>>(data);
|
||||||
|
reg = modelList.Where(x => x.id.Equals(id)).First();
|
||||||
|
return View(reg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errMes = response.Content.ReadAsStringAsync().Result;
|
||||||
|
helper.SetStringValue("errMsg", errMes);
|
||||||
|
return RedirectToAction("Error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Disattiva(Registrazione model)
|
||||||
|
{
|
||||||
|
SessionHelper helper = new SessionHelper(this);
|
||||||
|
apiUrl = helper.GetStringValue("apiUrl");
|
||||||
|
token = helper.GetStringValue("tok");
|
||||||
|
string errore = string.Empty;
|
||||||
|
admin = helper.GetStringValue("admin");
|
||||||
|
// prima verifico che l'utente connesso sia SA
|
||||||
|
if (!string.IsNullOrEmpty(admin) && admin.Equals("S"))
|
||||||
|
{
|
||||||
|
urlBase = apiUrl + "DisattivazioneStored";
|
||||||
|
urlBase = urlBase + "?token=" + token;
|
||||||
|
urlBase = urlBase + "&id=" + model.id;
|
||||||
|
Uri baseAddress = new Uri(urlBase);
|
||||||
|
client = new HttpClient();
|
||||||
|
client.BaseAddress = baseAddress;
|
||||||
|
|
||||||
|
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
//string data = response.Content.ReadAsStringAsync().Result;
|
||||||
|
//string e = JsonConvert.DeserializeObject<string>(data);
|
||||||
|
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errMes = response.Content.ReadAsStringAsync().Result;
|
||||||
|
helper.SetStringValue("errMsg", "Errore in attivazione");
|
||||||
|
return RedirectToAction("Error");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
helper.SetStringValue("errMsg", "Utente non abilitato per la funzione");
|
||||||
|
return RedirectToAction("Error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
|
|||||||
244
Views/Registrazioni/Disattiva.cshtml
Normal file
244
Views/Registrazioni/Disattiva.cshtml
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
@model VirtualTask.Models.Registrazione
|
||||||
|
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Disattiva";
|
||||||
|
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="Disattiva">
|
||||||
|
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.id)</b> @Html.DisplayFor(model => model.id)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.nome)</b> @Html.DisplayFor(model => model.nome)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.cognome)</b> @Html.DisplayFor(model => model.cognome)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.RagioneSociale)</b> @Html.DisplayFor(model => model.RagioneSociale)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.telefono)</b> @Html.DisplayFor(model => model.telefono)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.cellulare)</b> @Html.DisplayFor(model => model.cellulare)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.email)</b> @Html.DisplayFor(model => model.email)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.emailConf)</b> @Html.DisplayFor(model => model.emailConf)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.azienda)</b> @Html.DisplayFor(model => model.azienda)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.username)</b> @Html.DisplayFor(model => model.username)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.passwd)</b> @Html.DisplayFor(model => model.passwd)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.citta)</b> @Html.DisplayFor(model => model.citta)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.provincia)</b> @Html.DisplayFor(model => model.provincia)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.nazione)</b> @Html.DisplayFor(model => model.nazione)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<b>@Html.DisplayNameFor(model => model.attivato)</b> @Html.DisplayFor(model => model.attivato)
|
||||||
|
</div>
|
||||||
|
@Html.HiddenFor(model => model.id)
|
||||||
|
@Html.HiddenFor(model => model.nome)
|
||||||
|
@Html.HiddenFor(model => model.cognome)
|
||||||
|
@Html.HiddenFor(model => model.telefono)
|
||||||
|
@Html.HiddenFor(model => model.cellulare)
|
||||||
|
@Html.HiddenFor(model => model.email)
|
||||||
|
@Html.HiddenFor(model => model.emailConf)
|
||||||
|
@Html.HiddenFor(model => model.azienda)
|
||||||
|
@Html.HiddenFor(model => model.username)
|
||||||
|
@Html.HiddenFor(model => model.passwd)
|
||||||
|
@Html.HiddenFor(model => model.citta)
|
||||||
|
@Html.HiddenFor(model => model.provincia)
|
||||||
|
@Html.HiddenFor(model => model.nazione)
|
||||||
|
@Html.HiddenFor(model => model.attivato)
|
||||||
|
@Html.HiddenFor(model => model.token)
|
||||||
|
@Html.HiddenFor(model => model.privacy1)
|
||||||
|
@Html.HiddenFor(model => model.privacy2)
|
||||||
|
@Html.HiddenFor(model => model.privacy3)
|
||||||
|
@Html.HiddenFor(model => model.privacy4)
|
||||||
|
@Html.HiddenFor(model => model.ModuloTimesheet)
|
||||||
|
@Html.HiddenFor(model => model.ModuloRapportini)
|
||||||
|
@Html.HiddenFor(model => model.RagioneSociale)
|
||||||
|
|
||||||
|
<input type="submit" value="Disabilita" class="agy-btn submitForm" />
|
||||||
|
</form>
|
||||||
|
<div>
|
||||||
|
<a asp-action="Index" value="Torna alla lista" class="agy-btn submitForm">Torna alla lista</a>
|
||||||
|
@* <input type="submit" value="Torna alla lista" class="agy-btn submitForm" /> *@
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@* <div>
|
||||||
|
<h4>Registrazione</h4>
|
||||||
|
<hr />
|
||||||
|
<dl class="row">
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.id)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.id)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.nome)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.nome)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.cognome)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.cognome)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.telefono)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.telefono)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.cellulare)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.cellulare)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.email)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.email)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.emailConf)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.emailConf)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.azienda)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.azienda)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.username)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.username)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.passwd)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.passwd)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.citta)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.citta)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.provincia)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.provincia)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.nazione)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.nazione)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.attivato)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.attivato)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.token)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.token)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.privacy1)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.privacy1)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.privacy2)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.privacy2)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.privacy3)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.privacy3)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.privacy4)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.privacy4)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.ModuloTimesheet)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.ModuloTimesheet)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.ModuloRapportini)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.ModuloRapportini)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.RagioneSociale)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.RagioneSociale)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.numtec)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.numtec)
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) |
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</div> *@
|
||||||
@ -92,10 +92,12 @@
|
|||||||
<a href="@Url.Action("Delete", "Registrazioni", new { id=item.id })" title="Elimina" class="links">
|
<a href="@Url.Action("Delete", "Registrazioni", new { id=item.id })" title="Elimina" class="links">
|
||||||
<img alt="Elimina" src="@Url.Content("~/assets/images/icons8-elimina-50.png")" style="width:30px;height:30px;">
|
<img alt="Elimina" src="@Url.Content("~/assets/images/icons8-elimina-50.png")" style="width:30px;height:30px;">
|
||||||
</a>
|
</a>
|
||||||
<a href="@Url.Action("Attiva", "Registrazioni", new { id=item.id })" title="Attiva" class="links">
|
<a href="@Url.Action("Attiva", "Registrazioni", new { id=item.id })" title="Attiva utente" class="links">
|
||||||
<img alt="Attiva" src="@Url.Content("~/assets/images/icons8-pulsante-di-spegnimento-50.png")" style="width:30px;height:30px;">
|
<img alt="Attiva" src="@Url.Content("~/assets/images/icons8-pulsante-di-spegnimento-50.png")" style="width:30px;height:30px;">
|
||||||
</a>
|
</a>
|
||||||
|
<a href="@Url.Action("Disattiva", "Registrazioni", new { id=item.id })" title="Disattiva utente" class="links">
|
||||||
|
<img alt="Disattiva" src="@Url.Content("~/assets/images/icons8-rimuovere-l'utente-uomo-50.png")" style="width:30px;height:30px;">
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
wwwroot/assets/images/icons8-rimuovere-l'utente-uomo-50.png
Normal file
BIN
wwwroot/assets/images/icons8-rimuovere-l'utente-uomo-50.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
Loading…
Reference in New Issue
Block a user