From 1d4a41101b57ac82ef376ca08a50192943f727f4 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 19 Feb 2018 15:35:06 +0100 Subject: [PATCH] Fix BUG eliminazione set misure come collaudatori --- CMS_SC/Collaudi.aspx.cs | 51 ++- CMS_SC/Web.config | 1 + .../WebUserControls/mod_StatoCollaudi.ascx.cs | 306 +++++++++--------- CMS_SC/bin/CMS_SC.dll.config | 1 + 4 files changed, 204 insertions(+), 155 deletions(-) diff --git a/CMS_SC/Collaudi.aspx.cs b/CMS_SC/Collaudi.aspx.cs index 1441a13..a1d68cb 100644 --- a/CMS_SC/Collaudi.aspx.cs +++ b/CMS_SC/Collaudi.aspx.cs @@ -223,9 +223,9 @@ namespace CMS_SC { btnShowHideHist.DataBind(); btnAddNewSetMis.DataBind(); - btnAddNewSetMis.Visible = addNewVisible; + btnAddNewSetMis.Visible = addNewVisible && canEditMis; btnRemSetMis.DataBind(); - btnRemSetMis.Visible = !addNewVisible && remMisVisible; // non devo inserire nulla e non ho nessuna misura inserita... + btnRemSetMis.Visible = (!addNewVisible && remMisVisible) && canEditMis; // non devo inserire nulla e non ho nessuna misura inserita... // aggiorno modulo stato.. mod_StatoCollaudi.Fase = Fase; @@ -347,6 +347,8 @@ namespace CMS_SC // fix visualizzazione fixControls(); fixControlsPrev(); + // tolgo selezione... + mod_StatoCollaudi.resetSelezione(); } protected void ddlFase_SelectedIndexChanged(object sender, EventArgs e) { @@ -357,6 +359,8 @@ namespace CMS_SC fixControls(); // salvo anche dossier! savePar("ddlDossier", ddlDossier.SelectedValue); + // tolgo selezione... + mod_StatoCollaudi.resetSelezione(); } protected void ddlFasePrev_SelectedIndexChanged(object sender, EventArgs e) @@ -383,6 +387,8 @@ namespace CMS_SC DtProxy.man.taMis.insMissing(idxDossier, CodSchedaVers, ddlFase.SelectedValue); mod_collaudi.doUpdate(); fixControls(); + // tolgo selezione... + mod_StatoCollaudi.resetSelezione(); } /// /// elimina set misure poiché VUOTE @@ -395,6 +401,8 @@ namespace CMS_SC DtProxy.man.taMis.remSetMis(idxDossier, CodSchedaVers, ddlFase.SelectedValue); mod_collaudi.doUpdate(); fixControls(); + // tolgo selezione... + mod_StatoCollaudi.resetSelezione(); } /// /// verifico se sia possibile aggiungere records (= mancano misure x lo stato indicato...) @@ -443,6 +451,45 @@ namespace CMS_SC return answ; } } + /// + /// Verifica se editing misure concesso (utente livello > collaudatore) + /// + public bool canEditMis + { + get + { + bool answ = false; + // se ha solo 1 diritto.. ed è "User" allora NON BASTA... + if (devicesAuthProxy.stObj.diritti.Rows.Count == 1) + { + if (!devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("CollaudatoreRole"))) + { + answ = true; + } + } + else + { + if (devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("SuperAdminRole"))) + { + answ = true; + } + else if (devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("CapoOfficinaRole"))) + { + answ = true; + } + else if (devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("CapoGruppo"))) + { + answ = true; + } + else if (devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("AnagAdminRole"))) + { + answ = true; + } + } + return answ; + } + } + protected void ddlFase_DataBound(object sender, EventArgs e) { diff --git a/CMS_SC/Web.config b/CMS_SC/Web.config index ffaadfe..c0128a8 100644 --- a/CMS_SC/Web.config +++ b/CMS_SC/Web.config @@ -40,6 +40,7 @@ + diff --git a/CMS_SC/WebUserControls/mod_StatoCollaudi.ascx.cs b/CMS_SC/WebUserControls/mod_StatoCollaudi.ascx.cs index 91f89a2..9accb63 100644 --- a/CMS_SC/WebUserControls/mod_StatoCollaudi.ascx.cs +++ b/CMS_SC/WebUserControls/mod_StatoCollaudi.ascx.cs @@ -5,159 +5,159 @@ using System.Web.UI; namespace CMS_SC.WebUserControls { - public partial class mod_StatoCollaudi : SteamWare.UserControl + public partial class mod_StatoCollaudi : SteamWare.UserControl + { + + protected void Page_Load(object sender, EventArgs e) { - - protected void Page_Load(object sender, EventArgs e) - { - if(!Page.IsPostBack) - { - showDescrColl = true; - grView.DataBind(); - } - } - /// - /// dimensione pagina grid view - /// - public int pageSize - { - get - { - return grView.PageSize; - } - set - { - grView.PageSize = value; - } - } - /// - /// dossier selezionato - /// - public string idxDossier - { - get - { - return hfIdxDossier.Value; - } - set - { - hfIdxDossier.Value = value; - grView.DataBind(); - } - } - /// - /// dossier selezionato - /// - public string Fase - { - get - { - return hfFase.Value; - } - set - { - hfFase.Value = value; - grView.DataBind(); - } - } - - public string CodSchedaVersNum - { - get - { - string answ = ""; - if (grView.SelectedIndex >= 0) - { - try - { - answ = string.Format("{0}.{1}.{2}", grView.SelectedDataKey["CodScheda"], grView.SelectedDataKey["Vers"], grView.SelectedDataKey["NumScheda"]); - } - catch (Exception exc) - { - logger.lg.scriviLog(exc.ToString(), tipoLog.EXCEPTION); - } - } - return answ; - } - set - { - //grView.SelectedIndex = 0; - } - } - - public void doUpdate() - { - grView.DataBind(); - } - /// - /// selezione scheda... - /// - /// - /// - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - if (CodSchedaVersNum != "") - { - // indico di dover NASCONDERE dettaglio... - showDescrColl = false; - // salvo parametro - savePar("ddlSelScheda", CodSchedaVersNum); - // fix visualizzazione... - grView.DataBind(); - // sollevo evento... - raiseEvent(ucEvType.Selected); - } - } - /// - /// salva su DB il parametro scelto dall'utente - /// - /// - /// - protected void savePar(string paramName, string paramValue) - { - DtProxy.man.taUsrPar.upsert(OpAuth.currAuth.email, paramName, paramValue); - } - protected void btnReset_Click(object sender, EventArgs e) - { - resetSelezione(); - } - protected void lbtShowAll_Click(object sender, EventArgs e) - { - // indico di dover NASCONDERE dettaglio... - showDescrColl = false; - grView.SelectedIndex = -1; - grView.DataBind(); - // salvo parametro - savePar("ddlSelScheda", ""); - raiseEvent(ucEvType.ReqUpdateParent); - } - protected void lbtHideAll_Click(object sender, EventArgs e) - { - resetSelezione(); - } - /// - /// resetto selezione - /// - private void resetSelezione() - { - showDescrColl = true; - grView.SelectedIndex = -1; - grView.DataBind(); - // salvo parametro - savePar("ddlSelScheda", ""); - raiseEvent(ucEvType.Reset); - } - - public bool showDescrColl - { - get - { - return memLayer.ML.BoolSessionObj("showDescrColl"); - } - set - { - memLayer.ML.setSessionVal("showDescrColl", value); - } - } + if (!Page.IsPostBack) + { + showDescrColl = true; + grView.DataBind(); + } } + /// + /// dimensione pagina grid view + /// + public int pageSize + { + get + { + return grView.PageSize; + } + set + { + grView.PageSize = value; + } + } + /// + /// dossier selezionato + /// + public string idxDossier + { + get + { + return hfIdxDossier.Value; + } + set + { + hfIdxDossier.Value = value; + grView.DataBind(); + } + } + /// + /// dossier selezionato + /// + public string Fase + { + get + { + return hfFase.Value; + } + set + { + hfFase.Value = value; + grView.DataBind(); + } + } + + public string CodSchedaVersNum + { + get + { + string answ = ""; + if (grView.SelectedIndex >= 0) + { + try + { + answ = string.Format("{0}.{1}.{2}", grView.SelectedDataKey["CodScheda"], grView.SelectedDataKey["Vers"], grView.SelectedDataKey["NumScheda"]); + } + catch (Exception exc) + { + logger.lg.scriviLog(exc.ToString(), tipoLog.EXCEPTION); + } + } + return answ; + } + set + { + //grView.SelectedIndex = 0; + } + } + + public void doUpdate() + { + grView.DataBind(); + } + /// + /// selezione scheda... + /// + /// + /// + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + if (CodSchedaVersNum != "") + { + // indico di dover NASCONDERE dettaglio... + showDescrColl = false; + // salvo parametro + savePar("ddlSelScheda", CodSchedaVersNum); + // fix visualizzazione... + grView.DataBind(); + // sollevo evento... + raiseEvent(ucEvType.Selected); + } + } + /// + /// salva su DB il parametro scelto dall'utente + /// + /// + /// + protected void savePar(string paramName, string paramValue) + { + DtProxy.man.taUsrPar.upsert(OpAuth.currAuth.email, paramName, paramValue); + } + protected void btnReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + protected void lbtShowAll_Click(object sender, EventArgs e) + { + // indico di dover NASCONDERE dettaglio... + showDescrColl = false; + grView.SelectedIndex = -1; + grView.DataBind(); + // salvo parametro + savePar("ddlSelScheda", ""); + raiseEvent(ucEvType.ReqUpdateParent); + } + protected void lbtHideAll_Click(object sender, EventArgs e) + { + resetSelezione(); + } + /// + /// resetto selezione + /// + public void resetSelezione() + { + showDescrColl = true; + grView.SelectedIndex = -1; + grView.DataBind(); + // salvo parametro + savePar("ddlSelScheda", ""); + raiseEvent(ucEvType.Reset); + } + + public bool showDescrColl + { + get + { + return memLayer.ML.BoolSessionObj("showDescrColl"); + } + set + { + memLayer.ML.setSessionVal("showDescrColl", value); + } + } + } } \ No newline at end of file diff --git a/CMS_SC/bin/CMS_SC.dll.config b/CMS_SC/bin/CMS_SC.dll.config index ffaadfe..c0128a8 100644 --- a/CMS_SC/bin/CMS_SC.dll.config +++ b/CMS_SC/bin/CMS_SC.dll.config @@ -40,6 +40,7 @@ +