764 lines
25 KiB
C#
764 lines
25 KiB
C#
using GPW_data;
|
|
using Newtonsoft.Json;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace GPW_Admin.WebUserControls
|
|
{
|
|
public class filtroProj
|
|
{
|
|
#region Public Constructors
|
|
|
|
/// <summary>
|
|
/// Init con valori specifici
|
|
/// </summary>
|
|
/// <param name="fGrp"></param>
|
|
/// <param name="fCli"></param>
|
|
/// <param name="interv"></param>
|
|
/// <param name="onlStar"></param>
|
|
/// <param name="showA"></param>
|
|
/// <param name="showE"></param>
|
|
public filtroProj(bool fGrp, bool fCli, intervalloDate interv, bool onlStar, bool showA, bool showE)
|
|
{
|
|
this.filtGrp = fGrp;
|
|
this.filtCli = fCli;
|
|
this.intAnalys = interv;
|
|
this.onlyStarred = onlStar;
|
|
this.showArch = showA;
|
|
this.showEmpty = showE;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Init con valori default
|
|
/// </summary>
|
|
public filtroProj()
|
|
{
|
|
filtGrp = false;
|
|
filtCli = false;
|
|
// imposto intervallo dal 2000.01.01...
|
|
intervalloDate date = new intervalloDate();
|
|
date.fine = DateTime.Now.Date.AddDays(1);
|
|
date.inizio = new DateTime(2000, 1, 1);
|
|
onlyStarred = false;
|
|
intAnalys = date;
|
|
showArch = false;
|
|
showEmpty = true;
|
|
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
public bool filtCli { get; set; }
|
|
public bool filtGrp { get; set; }
|
|
public intervalloDate intAnalys { get; set; }
|
|
public bool onlyStarred { get; set; }
|
|
public bool showArch { get; set; }
|
|
public bool showEmpty { get; set; }
|
|
|
|
#endregion Public Properties
|
|
}
|
|
|
|
public partial class mod_adminProgetti : BaseUserControl
|
|
{
|
|
#region Protected Properties
|
|
|
|
/// <summary>
|
|
/// Filtro attivo (formato OBJ) salvato in redis x utente
|
|
/// </summary>
|
|
protected filtroProj currFiltProj
|
|
{
|
|
get
|
|
{
|
|
string redKey = memLayer.ML.redHash($"currFiltProj:{user_std.UtSn.userNameAD.Replace("\\", ":")}");
|
|
filtroProj answ = new filtroProj();
|
|
string rawData = memLayer.ML.getRSV(redKey);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
try
|
|
{
|
|
answ = JsonConvert.DeserializeObject<filtroProj>(rawData);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
else
|
|
{
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
string redKey = memLayer.ML.redHash($"currFiltProj:{user_std.UtSn.userNameAD.Replace("\\", ":")}");
|
|
string rawData = JsonConvert.SerializeObject(value);
|
|
memLayer.ML.setRSV(redKey, rawData);
|
|
}
|
|
}
|
|
|
|
protected int idxProjSel
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.IntSessionObj("idxProgetto_sel");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("idxProgetto_sel", $"{value}");
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// determina se siano da visualizzare i progetti già chiusi
|
|
/// </summary>
|
|
public bool showArchiviati
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.BoolSessionObj("showPrjArch");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("showPrjArch", value);
|
|
chkShowChiusi.Checked = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// determina se siano visibili SOLO progetti "Starred"
|
|
/// </summary>
|
|
public bool showOnlyStarred
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.BoolSessionObj("showPrjStar");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("showPrjStar", value);
|
|
chkShowOnlyStarred.Checked = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// determina se siano visibili progetti "vuoti" con zero ore caricate quindi
|
|
/// </summary>
|
|
public bool showVuoti
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.BoolSessionObj("showPrjZeroH");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("showPrjZeroH", value);
|
|
chkShowVuoti.Checked = value;
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// verifica vetodi ricalcolo in REDIS, se non ci fosse --> ricalcola!
|
|
/// </summary>
|
|
private void checkRefresh()
|
|
{
|
|
string vetoHash = memLayer.ML.redHash($"VetoProjRefresh");
|
|
string vetoRefresh = memLayer.ML.getRSV(vetoHash);
|
|
if (string.IsNullOrEmpty(vetoRefresh))
|
|
{
|
|
// effettua refresh SOLO ATTIVI
|
|
DataProxy.DP.taAP.doSummary_Update(0, "", 0, false);
|
|
// imposto veto 120 min
|
|
int vetoRicalcProj = memLayer.ML.CRI("vetoRicalcProj") > 0 ? memLayer.ML.CRI("vetoRicalcProj") : 60;
|
|
memLayer.ML.setRSV(vetoHash, $"Last Update {DateTime.Now:yyyy.MM.dd HH:mm:ss}", vetoRicalcProj * 60);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// selezionato valore, filtro!
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void filtroCli_eh_selValore(object sender, EventArgs e)
|
|
{
|
|
if (filtroCli.isChecked)
|
|
{
|
|
memLayer.ML.setSessionVal("idxCli_sel", filtroCli.valore);
|
|
}
|
|
else
|
|
{
|
|
memLayer.ML.setSessionVal("idxCli_sel", "");
|
|
}
|
|
// salvo!
|
|
var tempFilt = currFiltProj;
|
|
tempFilt.filtCli = filtroCli.isChecked;
|
|
currFiltProj = tempFilt;
|
|
grView.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// selezionato valore, filtro!
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void filtroGrp_eh_selValore(object sender, EventArgs e)
|
|
{
|
|
if (filtroGrp.isChecked)
|
|
{
|
|
memLayer.ML.setSessionVal("gruppo_sel", filtroGrp.valore);
|
|
}
|
|
else
|
|
{
|
|
memLayer.ML.setSessionVal("gruppo_sel", "");
|
|
}
|
|
// salvo!
|
|
var tempFilt = currFiltProj;
|
|
tempFilt.filtGrp = filtroGrp.isChecked;
|
|
currFiltProj = tempFilt;
|
|
grView.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// cambiati dati dettaglio (attivo/inattivo)
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void mod_dettaglioProgetto1_eh_nuovoValore(object sender, EventArgs e)
|
|
{
|
|
doUpdate();
|
|
}
|
|
|
|
/// <summary>
|
|
/// resetta filtraggio
|
|
/// </summary>
|
|
private void resetFilter()
|
|
{
|
|
// svuoto variabili sessione
|
|
memLayer.ML.emptySessionVal("gruppo_sel");
|
|
memLayer.ML.emptySessionVal("idxProgetto_sel");
|
|
memLayer.ML.emptySessionVal("idxCli_sel");
|
|
// genero un nuovo oggetto di default
|
|
currFiltProj = new filtroProj();
|
|
setupFilter(currFiltProj);
|
|
}
|
|
|
|
private void setupFilter(filtroProj currFilt)
|
|
{
|
|
// imposto
|
|
showArchiviati = currFilt.showArch;
|
|
showVuoti = currFilt.showEmpty;
|
|
showOnlyStarred = currFilt.onlyStarred;
|
|
filtroCli.isChecked = currFilt.filtCli;
|
|
filtroGrp.isChecked = currFilt.filtGrp;
|
|
// se ho valori filtro validi --> seleziono...
|
|
if (!string.IsNullOrEmpty(memLayer.ML.StringSessionObj("idxCli_sel")))
|
|
{
|
|
currFilt.filtCli = true;
|
|
}
|
|
if (!string.IsNullOrEmpty(memLayer.ML.StringSessionObj("gruppo_sel")))
|
|
{
|
|
currFilt.filtGrp = true;
|
|
}
|
|
// se deselezionato --> svuoto
|
|
if (!currFilt.filtGrp)
|
|
{
|
|
filtroGrp.valore = "";
|
|
}
|
|
if (!currFilt.filtCli)
|
|
{
|
|
filtroCli.valore = "";
|
|
}
|
|
// salvo ulteriori valori
|
|
filtroGrp.ods = odsGruppi;
|
|
filtroCli.ods = odsClienti;
|
|
currFiltProj = currFilt;
|
|
grView.DataBind();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// gestione evento richiesta nuovo valore (mostra footer, ...)
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnNew_Click(object sender, EventArgs e)
|
|
{
|
|
// reset selezione...
|
|
resetSelezione();
|
|
// mostro il footer oppure la riga dei dettagli x nuovo...
|
|
if (grView.FooterRow != null)
|
|
{
|
|
grView.FooterRow.Visible = true;
|
|
}
|
|
// sollevo evento nuovo valore...
|
|
raiseAddNew();
|
|
}
|
|
|
|
/// <summary>
|
|
/// reset della selezione
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnReset_Click(object sender, EventArgs e)
|
|
{
|
|
resetSelezione();
|
|
}
|
|
|
|
/// <summary>
|
|
/// determina se mostrare i progetti archiviati
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void chkShowChiusi_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
showArchiviati = chkShowChiusi.Checked;
|
|
var tempFilt = currFiltProj;
|
|
tempFilt.showArch = chkShowChiusi.Checked;
|
|
currFiltProj = tempFilt;
|
|
grView.DataBind();
|
|
filtroCli.ods = odsClienti;
|
|
}
|
|
|
|
protected void chkShowOnlyStarred_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
showOnlyStarred = chkShowOnlyStarred.Checked;
|
|
var tempFilt = currFiltProj;
|
|
tempFilt.onlyStarred = chkShowOnlyStarred.Checked;
|
|
currFiltProj = tempFilt;
|
|
grView.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// cambia impsotazione show/hide progetti con ore a zero...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void chkShowVuoti_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
showVuoti = chkShowVuoti.Checked;
|
|
var tempFilt = currFiltProj;
|
|
tempFilt.showEmpty = chkShowVuoti.Checked;
|
|
currFiltProj = tempFilt;
|
|
grView.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// elenco colonne del datagrid
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected DataColumnCollection colonneObj()
|
|
{
|
|
DataColumnCollection colonne = null;
|
|
using (DS_Applicazione.AnagProgettiDataTable tabella = new DS_Applicazione.AnagProgettiDataTable())
|
|
{
|
|
colonne = tabella.Columns;
|
|
}
|
|
return colonne;
|
|
}
|
|
|
|
/// <summary>
|
|
/// traduce gli header delle colonne
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_DataBound(object sender, EventArgs e)
|
|
{
|
|
if (grView.Rows.Count > 0)
|
|
{
|
|
LinkButton lb;
|
|
// aggiorno gli headers
|
|
foreach (TableCell cella in grView.HeaderRow.Cells)
|
|
{
|
|
try
|
|
{
|
|
lb = (LinkButton)cella.Controls[0];
|
|
lb.Text = traduci(lb.Text);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1);
|
|
lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord);
|
|
}
|
|
else
|
|
{
|
|
lblNumRec.Text = "";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// intercetto eventuale update fittizio x rimandare a pagina dett fasi
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_RowUpdating(object sender, GridViewUpdateEventArgs e)
|
|
{
|
|
if (e != null)
|
|
{
|
|
// salvo progetto sel
|
|
saveProjSel(e.Keys["idxProgetto"]);
|
|
// quale comando?
|
|
string _comando = "";
|
|
if (memLayer.ML.isInSessionObject("nextObjCommand"))
|
|
{
|
|
_comando = memLayer.ML.StringSessionObj("nextObjCommand");
|
|
memLayer.ML.emptySessionVal("nextObjCommand");
|
|
}
|
|
// verifico il tipo di richiesta (clona o update normale)
|
|
switch (_comando)
|
|
{
|
|
case "dettFasi":
|
|
// blocco update!
|
|
e.Cancel = true;
|
|
Response.Redirect("fasi");
|
|
break;
|
|
|
|
default:
|
|
// faccio update!
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// evento selezione!
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
int idxProj = 0;
|
|
int.TryParse($"{grView.SelectedDataKey["idxProgetto"]}", out idxProj);
|
|
mod_dettaglioProgetto1.IdxProgetto = idxProj;
|
|
mod_dettaglioProgetto1.Visible = true;
|
|
raiseEvent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// annulla inserimento nuovo valore da footer
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lblCanc_click(object sender, EventArgs e)
|
|
{
|
|
// annullo inserimento: nascondo footer, bind controlli...
|
|
grView.FooterRow.Visible = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// inserisce nuovo valore da footer
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lblIns_click(object sender, EventArgs e)
|
|
{
|
|
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
|
|
ods.Insert();
|
|
// tolgo veto x refresh...
|
|
string vetoHash = memLayer.ML.redHash($"VetoProjRefresh");
|
|
memLayer.ML.setRSV(vetoHash,"");
|
|
checkRefresh();
|
|
}
|
|
|
|
/// <summary>
|
|
/// salvo in session che il prox comando è andare a dettaglio...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtDettFasi_Click(object sender, EventArgs e)
|
|
{
|
|
memLayer.ML.setSessionVal("nextObjCommand", "dettFasi");
|
|
}
|
|
|
|
protected void lbtForceUpdate_Click(object sender, EventArgs e)
|
|
{
|
|
// effettua refresh DI TUTTI (anche archiviati)
|
|
DataProxy.DP.taAP.doSummary_Update(0, "", 0, true);
|
|
}
|
|
|
|
protected void lbtResetFilt_Click(object sender, EventArgs e)
|
|
{
|
|
resetFilter();
|
|
}
|
|
|
|
/// <summary>
|
|
/// check licenze in fase di update...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
|
{
|
|
if (e != null)
|
|
{
|
|
if (!licenzeGPW.checkLicenze)
|
|
{
|
|
// annullo insert se licenze sforate...
|
|
e.Cancel = true;
|
|
grView.EditIndex = -1;
|
|
grView.DataBind();
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// caricamento
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
grView.PageSize = utils.pageSize;
|
|
if (!Page.IsPostBack)
|
|
{
|
|
// imposto filtro (precedente o da zero)
|
|
setupFilter(currFiltProj);
|
|
mod_dettaglioProgetto1.Visible = false;
|
|
}
|
|
filtroGrp.eh_selValore += new EventHandler(filtroGrp_eh_selValore);
|
|
filtroCli.eh_selValore += new EventHandler(filtroCli_eh_selValore);
|
|
mod_dettaglioProgetto1.eh_nuovoValore += new EventHandler(mod_dettaglioProgetto1_eh_nuovoValore);
|
|
checkRefresh();
|
|
}
|
|
|
|
/// <summary>
|
|
/// recupera i dati di un nuovo record contenuti nel footer di un gridView;
|
|
/// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e)
|
|
{
|
|
if (e != null)
|
|
{
|
|
if (chkLicOk)
|
|
{
|
|
//recupero la riga footer...
|
|
DataColumnCollection colonne = colonneObj();
|
|
string nomeCol;
|
|
string tipoColonna = "";
|
|
foreach (DataColumn colonna in colonne)
|
|
{
|
|
nomeCol = colonna.ColumnName;
|
|
// cerco un textbox o quello che sia...
|
|
if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null)
|
|
{
|
|
tipoColonna = "textBox";
|
|
}
|
|
else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null)
|
|
{
|
|
tipoColonna = "dropDownList";
|
|
}
|
|
else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null)
|
|
{
|
|
tipoColonna = "checkBox";
|
|
}
|
|
// in base al tipo salvo negli inputparameters dell'ODS
|
|
switch (tipoColonna)
|
|
{
|
|
case "textBox":
|
|
e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text;
|
|
break;
|
|
|
|
case "dropDownList":
|
|
e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue;
|
|
break;
|
|
|
|
case "checkBox":
|
|
e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked;
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
tipoColonna = "";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// annullo insert se licenze sforate...
|
|
e.Cancel = true;
|
|
grView.DataBind();
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <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;
|
|
memLayer.ML.setSessionVal("idxCli_sel", $"{idxCli}");
|
|
}
|
|
catch
|
|
{ }
|
|
fatto = true;
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
}
|
|
return fatto;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// restituisce una classe css a seconda dei valori passati:
|
|
/// green: bdgt > real
|
|
/// orange: real > bdgt*warning
|
|
/// red: real > bdgt
|
|
/// std: errore...
|
|
/// </summary>
|
|
/// <param name="real"></param>
|
|
/// <param name="bdgt"></param>
|
|
/// <returns></returns>
|
|
public string colorByVal(object real, object bdgt)
|
|
{
|
|
string specClass = "default";
|
|
try
|
|
{
|
|
double valoreReal = Convert.ToDouble(real);
|
|
double valoreBdget = Convert.ToDouble(bdgt);
|
|
double valoreWarn = Convert.ToDouble(bdgt) * Convert.ToDouble(memLayer.ML.confReadString("warningRatioPerc")) / 100;
|
|
if (valoreReal >= valoreBdget)
|
|
{
|
|
specClass = "danger";
|
|
}
|
|
else if (valoreReal >= valoreWarn)
|
|
{
|
|
specClass = "warning";
|
|
}
|
|
else
|
|
{
|
|
specClass = "success";
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
return $"textNormal table-{specClass} border border-{specClass} rounded";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Determina se sia eliminabile il record (=non ha ore caricate ne fasi)
|
|
/// </summary>
|
|
/// <param name="totOre"></param>
|
|
/// <returns></returns>
|
|
public bool delEnabled(object totOre, object idxProj)
|
|
{
|
|
bool answ = isWritable();
|
|
// solo se ha diritti scrittura controllo
|
|
if (answ && totOre != null && idxProj != null)
|
|
{
|
|
double numOre = 0;
|
|
_ = Double.TryParse($"{totOre}", out numOre);
|
|
answ = (numOre == 0);
|
|
// se fosse true --> procedo con controllo fasi
|
|
if (answ)
|
|
{
|
|
int idxProgetto = 0;
|
|
_ = int.TryParse($"{idxProj}", out idxProgetto);
|
|
answ = !hasChildObj(idxProgetto);
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettua update controllo
|
|
/// </summary>
|
|
public void doUpdate()
|
|
{
|
|
grView.PageSize = utils.pageSize;
|
|
resetSelezione();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Determina se abbia child obj --> NON eliminabile
|
|
/// </summary>
|
|
/// <param name="idxMaker"></param>
|
|
/// <returns></returns>
|
|
public bool hasChildObj(int idxProj)
|
|
{
|
|
bool answ = false;
|
|
string redKey = memLayer.ML.redHash($"projHasChildObj:{idxProj}");
|
|
// cerco inc ache redis...
|
|
string rawData = memLayer.ML.getRSV(redKey);
|
|
if (rawData == null)
|
|
{
|
|
int trovati = DataProxy.DP.taAF.getByIdxProgetto(idxProj).Count;
|
|
answ = (trovati > 0);
|
|
memLayer.ML.setRSV(redKey, $"{answ}", 60 * 5);
|
|
}
|
|
else
|
|
{
|
|
bool.TryParse(rawData, out answ);
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// inverte valore booleano
|
|
/// </summary>
|
|
/// <param name="isEnt"></param>
|
|
/// <returns></returns>
|
|
public bool invBool(object valore)
|
|
{
|
|
bool answ = true;
|
|
try
|
|
{
|
|
answ = !Convert.ToBoolean(valore);
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
|
/// </summary>
|
|
public void resetSelezione()
|
|
{
|
|
grView.SelectedIndex = -1;
|
|
grView.DataBind();
|
|
mod_dettaglioProgetto1.Visible = false;
|
|
raiseReset();
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |