176 lines
4.7 KiB
C#
176 lines
4.7 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace NKC_WF.WebUserControls
|
|
{
|
|
public partial class cmp_errorDetail : BaseUserControl
|
|
{
|
|
#region Protected Properties
|
|
|
|
protected int countDown
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(lblCounter.Text, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
lblCounter.Text = value.ToString();
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Public Properties
|
|
|
|
public string ErrorExpl
|
|
{
|
|
get
|
|
{
|
|
return lblErrorExpl.Text;
|
|
}
|
|
set
|
|
{
|
|
lblErrorExpl.Text = value;
|
|
}
|
|
}
|
|
|
|
public string ErrorTitle
|
|
{
|
|
get
|
|
{
|
|
return lblErrorTitle.Text;
|
|
}
|
|
set
|
|
{
|
|
lblErrorTitle.Text = value;
|
|
}
|
|
}
|
|
|
|
public string LastError
|
|
{
|
|
get
|
|
{
|
|
string answ = "N.A.";
|
|
if (!string.IsNullOrEmpty(memLayer.ML.QSS("aspxerrorpath")))
|
|
{
|
|
answ = traduci(memLayer.ML.QSS("aspxerrorpath"));
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
public string LastErrorCode
|
|
{
|
|
get
|
|
{
|
|
string answ = "N.A.";
|
|
if (!string.IsNullOrEmpty(memLayer.ML.QSS("aspxerrorpath")))
|
|
{
|
|
answ = memLayer.ML.QSS("aspxerrorpath");
|
|
}
|
|
// se opzione bonifica doppio codice --> toglie doppio inizio
|
|
if (memLayer.ML.CRB("dedupBasePath"))
|
|
{
|
|
string dedupBasePathVal = memLayer.ML.CRS("dedupBasePathVal");
|
|
answ = answ.Replace($"{dedupBasePathVal}/{dedupBasePathVal}", $"{dedupBasePathVal}");
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
public string timeAdv
|
|
{
|
|
get
|
|
{
|
|
return $"width: {(countDown) * 100 / 10}%";
|
|
}
|
|
}
|
|
|
|
public string UserName
|
|
{
|
|
get
|
|
{
|
|
return lblUserName.Text;
|
|
}
|
|
set
|
|
{
|
|
lblUserName.Text = value;
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void doRedirect()
|
|
{
|
|
// loggo!
|
|
lgError($"ERROR PAGE --> REDIRECT to default{Environment.NewLine}Curr Url: {Request.Url.AbsoluteUri}{Environment.NewLine}UserName: {UserName}{Environment.NewLine}Error Origin: {LastErrorCode}{Environment.NewLine}ErrorExpl: {ErrorExpl}");
|
|
// svuoto session e cache per rileggere i dati da Db
|
|
Session.RemoveAll();
|
|
try
|
|
{
|
|
// aggiorno vocabolario
|
|
DataWrap.DW.resetVocabolario();
|
|
// reset dati in cache x DbConfig...
|
|
memLayer.ML.resetAppConf();
|
|
}
|
|
catch
|
|
{ }
|
|
// ulteriore reset sessione
|
|
Session.Clear();
|
|
// attendo...
|
|
Thread.Sleep(500);
|
|
// cerco in sessione SE non ci fosse un redirect appena fatto... se non c'è tento di tornare alla pagina, altrimenti alla default...
|
|
string reloadKey = "NKC:SERV:ERRORS:RELOADPAGE";
|
|
string rawData = memLayer.ML.getRSV(reloadKey);
|
|
string nextPage = "default";
|
|
if (string.IsNullOrEmpty(rawData))
|
|
{
|
|
// imposto pagina
|
|
nextPage = LastErrorCode;
|
|
lgInfo($"Tentativo redirect a ultima pagina: {nextPage}");
|
|
//imposto in redis x 20 sec...
|
|
memLayer.ML.setRSV(reloadKey, nextPage, 20);
|
|
}
|
|
|
|
// reload!
|
|
memLayer.ML.setSessionVal("nextPage", nextPage);
|
|
Response.Redirect($"~/{nextPage}");
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
protected void lbtTryReset_Click(object sender, EventArgs e)
|
|
{
|
|
doRedirect();
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
protected void timerRedirect_Tick(object sender, EventArgs e)
|
|
{
|
|
// decremento contatore
|
|
if (countDown <= 0)
|
|
{
|
|
doRedirect();
|
|
}
|
|
countDown--;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |