refactor codice

This commit is contained in:
Samuele Locatelli
2022-02-09 10:17:53 +01:00
parent 29d5e7cef4
commit d1b38418cb
@@ -98,6 +98,30 @@ namespace GPW_Admin.WebUserControls
}
}
protected int idxCliSel
{
get
{
return memLayer.ML.IntSessionObj("idxCli_sel");
}
set
{
memLayer.ML.setSessionVal("idxCli_sel", $"{value}");
}
}
protected int idxProjSel
{
get
{
return memLayer.ML.IntSessionObj("idxProgetto_sel");
}
set
{
memLayer.ML.setSessionVal("idxProgetto_sel", $"{value}");
}
}
#endregion Protected Properties
#region Public Properties
@@ -370,65 +394,6 @@ namespace GPW_Admin.WebUserControls
}
}
protected int idxProjSel
{
get
{
return memLayer.ML.IntSessionObj("idxProgetto_sel");
}
set
{
memLayer.ML.setSessionVal("idxProgetto_sel", $"{value}");
}
}
protected int idxCliSel
{
get
{
return memLayer.ML.IntSessionObj("idxCli_sel");
}
set
{
memLayer.ML.setSessionVal("idxCli_sel", $"{value}");
}
}
/// <summary>
/// Effettua salvataggio dati x progetto selezionato in sessione (cliente + progetto)
/// </summary>
/// <param name="idxProj"></param>
/// <returns></returns>
protected bool saveProjSel(object idxProj)
{
bool fatto = false;
if (idxProj != null)
{
int idxProgetto = 0;
int.TryParse($"{idxProj}", out idxProgetto);
if (idxProgetto > 0)
{
try
{
// salvo progetto sel
idxProjSel = idxProgetto;
// salvo idxCli...
int idxCli = 0;
try
{
idxCli = DataProxy.DP.taAP.getByIdxPrj(idxProgetto)[0].idxCliente;
idxCliSel = idxCli;
}
catch
{ }
fatto = true;
}
catch
{ }
}
}
return fatto;
}
/// <summary>
/// intercetto eventuale update fittizio x rimandare a pagina dett fasi
/// </summary>
@@ -451,22 +416,6 @@ namespace GPW_Admin.WebUserControls
switch (_comando)
{
case "dettFasi":
#if false
// salvo idxCli...
int idxCli = 0;
try
{
idxCli = DataProxy.DP.taAP.getByIdxPrj(memLayer.ML.IntSessionObj("idxProgetto_sel"))[0].idxCliente;
}
catch
{ }
memLayer.ML.setSessionVal("idxCli_sel", idxCli);
// preseleziono filtro cliente...
var tempFilt = currFiltProj;
tempFilt.filtCli = true;
currFiltProj = tempFilt;
filtroCli.valore = $"{idxCli}";
#endif
// blocco update!
e.Cancel = true;
Response.Redirect("fasi");
@@ -486,10 +435,6 @@ namespace GPW_Admin.WebUserControls
/// <param name="e"></param>
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
#if false
saveProjSel(grView.SelectedDataKey["idxProgetto"]);
memLayer.ML.setSessionVal("idxProgetto_sel", grView.SelectedDataKey["idxProgetto"]);
#endif
int idxProj = 0;
int.TryParse($"{grView.SelectedDataKey["idxProgetto"]}", out idxProj);
mod_dettaglioProgetto1.IdxProgetto = idxProj;
@@ -641,6 +586,42 @@ namespace GPW_Admin.WebUserControls
}
}
/// <summary>
/// Effettua salvataggio dati x progetto selezionato in sessione (cliente + progetto)
/// </summary>
/// <param name="idxProj"></param>
/// <returns></returns>
protected bool saveProjSel(object idxProj)
{
bool fatto = false;
if (idxProj != null)
{
int idxProgetto = 0;
int.TryParse($"{idxProj}", out idxProgetto);
if (idxProgetto > 0)
{
try
{
// salvo progetto sel
idxProjSel = idxProgetto;
// salvo idxCli...
int idxCli = 0;
try
{
idxCli = DataProxy.DP.taAP.getByIdxPrj(idxProgetto)[0].idxCliente;
idxCliSel = idxCli;
}
catch
{ }
fatto = true;
}
catch
{ }
}
}
return fatto;
}
#endregion Protected Methods
#region Public Methods