fix sino a collaudi

This commit is contained in:
Samuele E. Locatelli
2018-02-15 15:31:22 +01:00
parent e0b81e1ebd
commit 6654545e50
8 changed files with 1119 additions and 1103 deletions
+84 -85
View File
@@ -9,92 +9,91 @@
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<div class="container-flow">
<div class="row" style="margin: 0 5px;">
<div runat="server" id="divStato" class="col-md-6 col-lg-4" style="font-size: 0.8em;">
<div class="row card">
<div class="card-header">
<div class="row">
<div class="col-12">
<h4 class="card-title"><%: traduci("StatoCollaudi") %></h4>
</div>
<div class="col-6">
<asp:DropDownList runat="server" ID="ddlFase" DataSourceID="odsFase" DataTextField="label" DataValueField="value" AutoPostBack="True" OnSelectedIndexChanged="ddlFase_SelectedIndexChanged" OnDataBound="ddlFase_DataBound">
</asp:DropDownList>
<asp:ObjectDataSource ID="odsFase" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="CMS_SC_Data.DS_UtilityTableAdapters.v_selFasiTableAdapter"></asp:ObjectDataSource>
</div>
<div class="col-6">
<asp:DropDownList runat="server" ID="ddlDossier" DataSourceID="odsDossier" DataTextField="label" DataValueField="value" AutoPostBack="True" OnSelectedIndexChanged="ddlDossier_SelectedIndexChanged"></asp:DropDownList>
<asp:ObjectDataSource ID="odsDossier" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByConditio" TypeName="CMS_SC_Data.DS_UtilityTableAdapters.v_selElencoDossierTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="ddlFase" Name="conditio" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</div>
</div>
</div>
<div class="col-12 panel-body">
<uc1:mod_StatoCollaudi runat="server" ID="mod_StatoCollaudi" />
</div>
<div class="col-12 card-footer">
<uc1:mod_righePag runat="server" ID="mod_righePagStato" />
</div>
</div>
</div>
<div runat="server" id="divMain" class="col-md-3 col-lg-4" style="font-size: 0.9em;">
<div class="row panel panel-info">
<div class="card-header">
<div class="row">
<div class="col-6">
<h3 class="card-title"><%: traduci("CollaudiAttivi") %></h3>
<asp:Button runat="server" ID="btnEmpty" Text="Empty" CssClass="hiddenBtn" />
</div>
<div class="col-3">
<asp:Button runat="server" ID="btnAddNewSetMis" CssClass="btn btn-success" Text='<%# traduci("btnAddNewSetMis") %>' OnClick="btnAddNewSetMis_click" Font-Size="0.9em" Width="100%" />
<asp:Button runat="server" ID="btnRemSetMis" CssClass="btn btn-danger" Text='<%# traduci("btnRemSetMis") %>' OnClick="btnRemSetMis_click" Font-Size="0.9em" Width="100%" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' />
</div>
<div class="col-3">
<asp:Button runat="server" ID="btnShowHideHist" CssClass="btn btn-warning" Text='<%# traduci("btnShowHist") %>' Font-Size="0.8em" Width="100%" OnClick="btnShowHideHist_Click" />
</div>
</div>
</div>
<div class="col-12 panel-body">
<uc1:mod_collaudi runat="server" ID="mod_collaudi" editEnabled="true" />
</div>
<div class="col-12 card-footer bg-info">
<uc1:mod_righePag runat="server" ID="mod_righePag" />
</div>
</div>
</div>
<div runat="server" id="divHist" class="col-md-3 col-lg-4" style="font-size: 0.8em;">
<div class="row panel panel-warning">
<div class="card-header">
<div class="row">
<div class="col-12">
<h3 class="card-title"><%: traduci("CollaudiPrev") %></h3>
</div>
</div>
<div class="row" style="font-size: 0.8em;">
<div class="col-6">
<asp:DropDownList runat="server" ID="ddlFasePrev" DataSourceID="odsFasePrev" DataTextField="label" DataValueField="value" AutoPostBack="True" OnSelectedIndexChanged="ddlFasePrev_SelectedIndexChanged" OnDataBound="ddlFase_DataBound">
</asp:DropDownList>
<asp:ObjectDataSource ID="odsFasePrev" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getPrev" TypeName="CMS_SC_Data.DS_UtilityTableAdapters.v_selFasiTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="ddlFase" DefaultValue="0" Name="value" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</div>
</div>
</div>
<div class="col-12 panel-body">
<uc1:mod_collaudi runat="server" ID="mod_collaudiPrev" editEnabled="false" />
</div>
<div class="col-12 card-footer">
<uc1:mod_righePag runat="server" ID="mod_righePagPrev" />
</div>
</div>
<div class="container-fluid">
<div class="row p-0">
<div runat="server" id="divStato" class="col-md-6 col-lg-4 fontSmall pr-0">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-12">
<h6 class="card-title text-uppercase"><%: traduci("StatoCollaudi") %></h6>
</div>
<div class="col-4">
<asp:DropDownList runat="server" ID="ddlFase" DataSourceID="odsFase" DataTextField="label" DataValueField="value" AutoPostBack="True" CssClass="form-control form-control-sm" OnSelectedIndexChanged="ddlFase_SelectedIndexChanged" OnDataBound="ddlFase_DataBound">
</asp:DropDownList>
<asp:ObjectDataSource ID="odsFase" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="CMS_SC_Data.DS_UtilityTableAdapters.v_selFasiTableAdapter"></asp:ObjectDataSource>
</div>
<div class="col-8">
<asp:DropDownList runat="server" ID="ddlDossier" DataSourceID="odsDossier" DataTextField="label" DataValueField="value" CssClass="form-control form-control-sm" AutoPostBack="True" OnSelectedIndexChanged="ddlDossier_SelectedIndexChanged"></asp:DropDownList>
<asp:ObjectDataSource ID="odsDossier" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByConditio" TypeName="CMS_SC_Data.DS_UtilityTableAdapters.v_selElencoDossierTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="ddlFase" Name="conditio" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</div>
</div>
</div>
<div class="card-body p-0">
<uc1:mod_StatoCollaudi runat="server" ID="mod_StatoCollaudi" />
</div>
<div class="card-footer">
<uc1:mod_righePag runat="server" ID="mod_righePagStato" />
</div>
</div>
</div>
<div runat="server" id="divMain" class="col-md-3 col-lg-4 fontSmall pl-0">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-4">
<h6 class="card-title text-uppercase"><%: traduci("CollaudiAttivi") %></h6>
<asp:Button runat="server" ID="btnEmpty" Text="Empty" CssClass="hiddenBtn" />
</div>
<div class="col-4 fontSmall">
<asp:Button runat="server" ID="btnAddNewSetMis" CssClass="btn btn-block btn-success" Text='<%# traduci("btnAddNewSetMis") %>' OnClick="btnAddNewSetMis_click" />
<asp:Button runat="server" ID="btnRemSetMis" CssClass="btn btn-block btn-danger" Text='<%# traduci("btnRemSetMis") %>' OnClick="btnRemSetMis_click" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' />
</div>
<div class="col-4 fontSmall">
<asp:Button runat="server" ID="btnShowHideHist" CssClass="btn btn-block btn-warning" Text='<%# traduci("btnShowHist") %>' OnClick="btnShowHideHist_Click" />
</div>
</div>
</div>
<div class="card-body p-0">
<uc1:mod_collaudi runat="server" ID="mod_collaudi" editEnabled="true" />
</div>
<div class="card-footer bg-info">
<uc1:mod_righePag runat="server" ID="mod_righePag" />
</div>
</div>
</div>
<div runat="server" id="divHist" class="col-md-3 col-lg-4" style="font-size: 0.8em;">
<div class="row panel panel-warning">
<div class="card-header">
<div class="row">
<div class="col-12">
<h3 class="card-title"><%: traduci("CollaudiPrev") %></h3>
</div>
</div>
<div class="row" style="font-size: 0.8em;">
<div class="col-6">
<asp:DropDownList runat="server" ID="ddlFasePrev" DataSourceID="odsFasePrev" DataTextField="label" DataValueField="value" AutoPostBack="True" OnSelectedIndexChanged="ddlFasePrev_SelectedIndexChanged" OnDataBound="ddlFase_DataBound">
</asp:DropDownList>
<asp:ObjectDataSource ID="odsFasePrev" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getPrev" TypeName="CMS_SC_Data.DS_UtilityTableAdapters.v_selFasiTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="ddlFase" DefaultValue="0" Name="value" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</div>
</div>
</div>
<div class="col-12 panel-body">
<uc1:mod_collaudi runat="server" ID="mod_collaudiPrev" editEnabled="false" />
</div>
<div class="col-12 card-footer">
<uc1:mod_righePag runat="server" ID="mod_righePagPrev" />
</div>
</div>
</div>
</div>
</div>
</asp:Content>
+477 -459
View File
@@ -5,465 +5,483 @@ using System.Web.UI;
namespace CMS_SC
{
public partial class Collaudi : System.Web.UI.Page
public partial class Collaudi : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
((Bootstrap)this.Master).showSearch = true;
// default: nascondo dettagli e storico!
showDetail = false;
showHist = false;
fixPaginazione();
tryGetParam();
fixPanels();
fixControls();
fixControlsPrev();
}
mod_righePagStato.eh_newNum += mod_righePagStato_eh_newNum;
mod_righePag.eh_newNum += mod_righePag_eh_newNum;
mod_righePagPrev.eh_newNum += mod_righePagPrev_eh_newNum;
mod_StatoCollaudi.eh_ucev += Mod_StatoCollaudi_eh_ucev;
}
/// <summary>
/// gestione eventi selezione panel stato collaudi
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Mod_StatoCollaudi_eh_ucev(object sender, EventArgs e)
{
// verifico se devo fare un cambio di visibilità dettagli...
ucEvent evento = (ucEvent)e;
switch (evento.tipoEvento)
{
case ucEvType.ReqUpdateParent:
case ucEvType.Selected:
showDetail = true;
break;
case ucEvType.Reset:
default:
showDetail = false;
break;
}
// fix pannelli
fixPanels();
if (showDetail)
{
fixControls();
fixControlsPrev();
}
}
/// <summary>
/// sistemazione controlli paginazione
/// </summary>
private void fixPaginazione()
{
// pannello stato schede
mod_righePagStato.numRowPag = 10;
if (getPar("numRowPagColl_Stato") != "")
{
try
{
mod_righePagStato.numRowPag = Convert.ToInt32(getPar("numRowPagColl_Stato"));
}
catch
{ }
}
mod_StatoCollaudi.pageSize = mod_righePagStato.numRowPag;
// pannello principale
mod_righePag.numRowPag = 10;
if (getPar("numRowPagColl_Main") != "")
{
try
{
mod_righePag.numRowPag = Convert.ToInt32(getPar("numRowPagColl_Main"));
}
catch
{ }
}
mod_collaudi.pageSize = mod_righePag.numRowPag;
// pannello secondario
mod_righePagPrev.numRowPag = 20;
if (getPar("numRowPagColl_Sec") != "")
{
try
{
mod_righePagPrev.numRowPag = Convert.ToInt32(getPar("numRowPagColl_Sec"));
}
catch
{ }
}
mod_collaudiPrev.pageSize = mod_righePagPrev.numRowPag;
}
/// <summary>
/// cerca di recuperare i 3 parametri selezionati dall'utente (SE ci sono su DB)
/// </summary>
private void tryGetParam()
{
// rileggo SE CI SONO i parametri filtrati...
if (getPar("ddlFase") != "")
{
ddlFase.DataBind();
try
{
ddlFase.SelectedValue = getPar("ddlFase");
}
catch
{
ddlFase.SelectedIndex = 0;
}
}
// rileggo SE CI SONO i parametri filtrati...
if (getPar("ddlDossier") != "")
{
ddlDossier.DataBind();
try
{
ddlDossier.SelectedValue = getPar("ddlDossier");
}
catch
{
ddlDossier.SelectedIndex = 0;
}
}
}
/// <summary>
/// recupera (se c'è) da db il parametro selezionato dall'utente
/// </summary>
/// <param name="paramName"></param>
/// <returns></returns>
protected string getPar(string paramName)
{
string answ = "";
try
{
answ = DtProxy.man.taUsrPar.getByKey(OpAuth.currAuth.email, paramName)[0].ParValue;
}
catch
{ }
return answ;
}
/// <summary>
/// salva su DB il parametro scelto dall'utente
/// </summary>
/// <param name="paramName"></param>
/// <param name="paramValue"></param>
protected void savePar(string paramName, string paramValue)
{
DtProxy.man.taUsrPar.upsert(OpAuth.currAuth.email, paramName, paramValue);
}
private void mod_righePagStato_eh_newNum(object sender, EventArgs e)
{
savePar("numRowPagColl_Stato", mod_righePagStato.numRowPag.ToString());
mod_StatoCollaudi.pageSize = mod_righePagStato.numRowPag;
}
void mod_righePag_eh_newNum(object sender, EventArgs e)
{
savePar("numRowPagColl_Main", mod_righePag.numRowPag.ToString());
mod_collaudi.pageSize = mod_righePag.numRowPag;
}
void mod_righePagPrev_eh_newNum(object sender, EventArgs e)
{
savePar("numRowPagColl_Sec", mod_righePagPrev.numRowPag.ToString());
mod_collaudiPrev.pageSize = mod_righePagPrev.numRowPag;
}
void mod_collaudi_eh_selezioneValore(object sender, EventArgs e)
{
fixControls();
}
/// <summary>
/// sistema pannelli PRINCIPALI
/// </summary>
private void fixPanels()
{
// tolgo css a blocco stato, main, hist
divStato.Attributes.Remove("class");
// verifico SE devo mostrare detail...
if (showDetail)
{
divStato.Attributes.Add("class", "col-md-5 col-lg-4");
divMain.Visible = true;
}
else
{
divStato.Attributes.Add("class", "col-sm-12");
divMain.Visible = false;
}
}
/// <summary>
/// sistema DropDownList
/// </summary>
private void fixControls()
{
btnShowHideHist.DataBind();
btnAddNewSetMis.DataBind();
btnAddNewSetMis.Visible = addNewVisible;
btnRemSetMis.DataBind();
btnRemSetMis.Visible = !addNewVisible && remMisVisible; // non devo inserire nulla e non ho nessuna misura inserita...
// aggiorno modulo stato..
mod_StatoCollaudi.Fase = Fase;
mod_StatoCollaudi.idxDossier = IdxDossier.ToString();
// rileggo SE CI SONO i parametri filtrati...
if (getPar("ddlSelScheda") != "")
{
mod_StatoCollaudi.CodSchedaVersNum = getPar("ddlSelScheda");
}
// aggiorno modulo collaudi
mod_collaudi.IdxDossier = IdxDossier;
mod_collaudi.CodSchedaVers = CodSchedaVers;
mod_collaudi.Fase = Fase;
mod_collaudi.doUpdate();
}
private void fixControlsPrev()
{
// aggiorno modulo stato..
mod_StatoCollaudi.idxDossier = IdxDossier.ToString();
mod_StatoCollaudi.Fase = Fase;
// tolgo css a blocco main
divMain.Attributes.Remove("class");
// verifico SE devo mostrare storico...
if (showHist)
{
// imposto css x mostrare 2 blocchi
divMain.Attributes.Add("class", "col-md-4 col-lg-4");
btnShowHideHist.Text = traduci("btnHideHist");
divHist.Visible = true;
// sistemo dati storici
mod_collaudiPrev.IdxDossier = IdxDossier;
mod_collaudiPrev.CodSchedaVers = CodSchedaVers;
mod_collaudiPrev.Fase = FasePrev;
mod_collaudiPrev.doUpdate();
}
else
{
// imposto css x mostrare solo blocco corrente e nascondo altro...
divMain.Attributes.Add("class", "col-md-7 col-lg-8");
btnShowHideHist.Text = traduci("btnShowHist");
divHist.Visible = false;
}
}
protected int IdxDossier
{
get
{
int answ = -1;
if (ddlDossier.SelectedValue != "")
{
try
{
answ = Convert.ToInt32(ddlDossier.SelectedValue);
}
catch
{ }
}
return answ;
}
set
{
ddlDossier.SelectedValue = value.ToString();
}
}
protected string CodSchedaVers
{
get
{
return mod_StatoCollaudi.CodSchedaVersNum;
}
set
{
mod_StatoCollaudi.CodSchedaVersNum = value;
}
}
protected string Fase
{
get
{
string answ = "-";
try
{
answ = ddlFase.SelectedValue;
}
catch
{
answ = "-";
}
return answ;
}
set
{
ddlFase.SelectedValue = value;
}
}
protected string FasePrev
{
get
{
string answ = "-";
try
{
answ = ddlFasePrev.SelectedValue;
}
catch
{
answ = "-";
}
return answ;
}
}
protected void ddlDossier_SelectedIndexChanged(object sender, EventArgs e)
{
// salvo!
savePar("ddlDossier", ddlDossier.SelectedValue);
// fix visualizzazione
fixControls();
fixControlsPrev();
}
protected void ddlFase_SelectedIndexChanged(object sender, EventArgs e)
{
// salvo!
savePar("ddlFase", ddlFase.SelectedValue);
// fix visualizzazione
ddlDossier.DataBind();
fixControls();
// salvo anche dossier!
savePar("ddlDossier", ddlDossier.SelectedValue);
}
protected void ddlFasePrev_SelectedIndexChanged(object sender, EventArgs e)
{
fixControlsPrev();
}
/// <summary>
/// wrapper traduzione
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return user_std.UtSn.Traduci(lemma);
}
/// <summary>
/// aggiungo set misure (eventualmente) mancanti
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAddNewSetMis_click(object sender, EventArgs e)
{
int idxDossier = Convert.ToInt32(ddlDossier.SelectedValue);
DtProxy.man.taMis.insMissing(idxDossier, CodSchedaVers, ddlFase.SelectedValue);
mod_collaudi.doUpdate();
fixControls();
}
/// <summary>
/// elimina set misure poiché VUOTE
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnRemSetMis_click(object sender, EventArgs e)
{
int idxDossier = Convert.ToInt32(ddlDossier.SelectedValue);
DtProxy.man.taMis.remSetMis(idxDossier, CodSchedaVers, ddlFase.SelectedValue);
mod_collaudi.doUpdate();
fixControls();
}
/// <summary>
/// verifico se sia possibile aggiungere records (= mancano misure x lo stato indicato...)
/// </summary>
public bool addNewVisible
{
get
{
bool answ = false;
if (ddlDossier.SelectedValue != "")
{
try
{
int idxDossier = Convert.ToInt32(ddlDossier.SelectedValue);
answ = DtProxy.man.taMis.getNum2Ins(idxDossier, CodSchedaVers, ddlFase.SelectedValue).Rows.Count > 0;
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("{0}", exc));
}
}
return answ;
}
}
/// <summary>
/// verifico se sia possibile rimuovere records (= NESSUNA misura INSERITA x lo stato indicato...)
/// </summary>
public bool remMisVisible
{
get
{
bool answ = false;
// in primis: deve essere selezionata SINGOLA scheda...
if (CodSchedaVers != "")
{
try
{
int idxDossier = Convert.ToInt32(ddlDossier.SelectedValue);
answ = DtProxy.man.taMis.getDataFilt(idxDossier, CodSchedaVers, ddlFase.SelectedValue).Select("Valoremis <> ''").Length == 0;
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("{0}", exc));
}
}
return answ;
}
}
protected void ddlFase_DataBound(object sender, EventArgs e)
{
fixControls();
}
/// <summary>
/// show/hide archivio collaudi
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnShowHideHist_Click(object sender, EventArgs e)
{
// toggle visibilità
showHist = !showHist;
// fixControls();
fixControlsPrev();
}
public bool showHist
{
get
{
return memLayer.ML.BoolSessionObj("showHist");
}
set
{
memLayer.ML.setSessionVal("showHist", value);
}
}
public bool showDetail
{
get
{
return memLayer.ML.BoolSessionObj("showDetail");
}
set
{
memLayer.ML.setSessionVal("showDetail", value);
}
}
if (!Page.IsPostBack)
{
((Bootstrap)this.Master).showSearch = true;
// default: nascondo dettagli e storico!
showDetail = false;
showHist = false;
fixPaginazione();
tryGetParam();
fixPanels();
fixControls();
fixControlsPrev();
}
mod_righePagStato.eh_newNum += mod_righePagStato_eh_newNum;
mod_righePag.eh_newNum += mod_righePag_eh_newNum;
mod_righePagPrev.eh_newNum += mod_righePagPrev_eh_newNum;
mod_StatoCollaudi.eh_ucev += Mod_StatoCollaudi_eh_ucev;
mod_collaudi.eh_ucev += Mod_collaudi_eh_ucev;
}
private void Mod_collaudi_eh_ucev(object sender, EventArgs e)
{
// verifico se devo fare un cambio di visibilità dettagli...
ucEvent evento = (ucEvent)e;
switch (evento.tipoEvento)
{
case ucEvType.ReqUpdateParent:
mod_StatoCollaudi.doUpdate();
break;
case ucEvType.Selected:
case ucEvType.Reset:
default:
break;
}
}
/// <summary>
/// gestione eventi selezione panel stato collaudi
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Mod_StatoCollaudi_eh_ucev(object sender, EventArgs e)
{
// verifico se devo fare un cambio di visibilità dettagli...
ucEvent evento = (ucEvent)e;
switch (evento.tipoEvento)
{
case ucEvType.ReqUpdateParent:
case ucEvType.Selected:
showDetail = true;
break;
case ucEvType.Reset:
default:
showDetail = false;
break;
}
// fix pannelli
fixPanels();
if (showDetail)
{
fixControls();
fixControlsPrev();
}
}
/// <summary>
/// sistemazione controlli paginazione
/// </summary>
private void fixPaginazione()
{
// pannello stato schede
mod_righePagStato.numRowPag = 10;
if (getPar("numRowPagColl_Stato") != "")
{
try
{
mod_righePagStato.numRowPag = Convert.ToInt32(getPar("numRowPagColl_Stato"));
}
catch
{ }
}
mod_StatoCollaudi.pageSize = mod_righePagStato.numRowPag;
// pannello principale
mod_righePag.numRowPag = 10;
if (getPar("numRowPagColl_Main") != "")
{
try
{
mod_righePag.numRowPag = Convert.ToInt32(getPar("numRowPagColl_Main"));
}
catch
{ }
}
mod_collaudi.pageSize = mod_righePag.numRowPag;
// pannello secondario
mod_righePagPrev.numRowPag = 20;
if (getPar("numRowPagColl_Sec") != "")
{
try
{
mod_righePagPrev.numRowPag = Convert.ToInt32(getPar("numRowPagColl_Sec"));
}
catch
{ }
}
mod_collaudiPrev.pageSize = mod_righePagPrev.numRowPag;
}
/// <summary>
/// cerca di recuperare i 3 parametri selezionati dall'utente (SE ci sono su DB)
/// </summary>
private void tryGetParam()
{
// rileggo SE CI SONO i parametri filtrati...
if (getPar("ddlFase") != "")
{
ddlFase.DataBind();
try
{
ddlFase.SelectedValue = getPar("ddlFase");
}
catch
{
ddlFase.SelectedIndex = 0;
}
}
// rileggo SE CI SONO i parametri filtrati...
if (getPar("ddlDossier") != "")
{
ddlDossier.DataBind();
try
{
ddlDossier.SelectedValue = getPar("ddlDossier");
}
catch
{
ddlDossier.SelectedIndex = 0;
}
}
}
/// <summary>
/// recupera (se c'è) da db il parametro selezionato dall'utente
/// </summary>
/// <param name="paramName"></param>
/// <returns></returns>
protected string getPar(string paramName)
{
string answ = "";
try
{
answ = DtProxy.man.taUsrPar.getByKey(OpAuth.currAuth.email, paramName)[0].ParValue;
}
catch
{ }
return answ;
}
/// <summary>
/// salva su DB il parametro scelto dall'utente
/// </summary>
/// <param name="paramName"></param>
/// <param name="paramValue"></param>
protected void savePar(string paramName, string paramValue)
{
DtProxy.man.taUsrPar.upsert(OpAuth.currAuth.email, paramName, paramValue);
}
private void mod_righePagStato_eh_newNum(object sender, EventArgs e)
{
savePar("numRowPagColl_Stato", mod_righePagStato.numRowPag.ToString());
mod_StatoCollaudi.pageSize = mod_righePagStato.numRowPag;
}
void mod_righePag_eh_newNum(object sender, EventArgs e)
{
savePar("numRowPagColl_Main", mod_righePag.numRowPag.ToString());
mod_collaudi.pageSize = mod_righePag.numRowPag;
}
void mod_righePagPrev_eh_newNum(object sender, EventArgs e)
{
savePar("numRowPagColl_Sec", mod_righePagPrev.numRowPag.ToString());
mod_collaudiPrev.pageSize = mod_righePagPrev.numRowPag;
}
void mod_collaudi_eh_selezioneValore(object sender, EventArgs e)
{
fixControls();
}
/// <summary>
/// sistema pannelli PRINCIPALI
/// </summary>
private void fixPanels()
{
// tolgo css a blocco stato, main, hist
divStato.Attributes.Remove("class");
// verifico SE devo mostrare detail...
if (showDetail)
{
divStato.Attributes.Add("class", "col-md-5 col-lg-4 fontSmall pr-0");
divMain.Visible = true;
}
else
{
divStato.Attributes.Add("class", "col-12 fontSmall pr-0");
divMain.Visible = false;
}
}
/// <summary>
/// sistema DropDownList
/// </summary>
private void fixControls()
{
btnShowHideHist.DataBind();
btnAddNewSetMis.DataBind();
btnAddNewSetMis.Visible = addNewVisible;
btnRemSetMis.DataBind();
btnRemSetMis.Visible = !addNewVisible && remMisVisible; // non devo inserire nulla e non ho nessuna misura inserita...
// aggiorno modulo stato..
mod_StatoCollaudi.Fase = Fase;
mod_StatoCollaudi.idxDossier = IdxDossier.ToString();
// rileggo SE CI SONO i parametri filtrati...
if (getPar("ddlSelScheda") != "")
{
mod_StatoCollaudi.CodSchedaVersNum = getPar("ddlSelScheda");
}
// aggiorno modulo collaudi
mod_collaudi.IdxDossier = IdxDossier;
mod_collaudi.CodSchedaVers = CodSchedaVers;
mod_collaudi.Fase = Fase;
mod_collaudi.doUpdate();
}
private void fixControlsPrev()
{
// aggiorno modulo stato..
mod_StatoCollaudi.idxDossier = IdxDossier.ToString();
mod_StatoCollaudi.Fase = Fase;
// tolgo css a blocco main
divMain.Attributes.Remove("class");
// verifico SE devo mostrare storico...
if (showHist)
{
// imposto css x mostrare 2 blocchi
divMain.Attributes.Add("class", "col-md-4 col-lg-4 fontSmall table-info pl-1");
btnShowHideHist.Text = traduci("btnHideHist");
divHist.Visible = true;
// sistemo dati storici
mod_collaudiPrev.IdxDossier = IdxDossier;
mod_collaudiPrev.CodSchedaVers = CodSchedaVers;
mod_collaudiPrev.Fase = FasePrev;
mod_collaudiPrev.doUpdate();
}
else
{
// imposto css x mostrare solo blocco corrente e nascondo altro...
divMain.Attributes.Add("class", "col-md-7 col-lg-8 fontSmall table-info pl-1");
btnShowHideHist.Text = traduci("btnShowHist");
divHist.Visible = false;
}
}
protected int IdxDossier
{
get
{
int answ = -1;
if (ddlDossier.SelectedValue != "")
{
try
{
answ = Convert.ToInt32(ddlDossier.SelectedValue);
}
catch
{ }
}
return answ;
}
set
{
ddlDossier.SelectedValue = value.ToString();
}
}
protected string CodSchedaVers
{
get
{
return mod_StatoCollaudi.CodSchedaVersNum;
}
set
{
mod_StatoCollaudi.CodSchedaVersNum = value;
}
}
protected string Fase
{
get
{
string answ = "-";
try
{
answ = ddlFase.SelectedValue;
}
catch
{
answ = "-";
}
return answ;
}
set
{
ddlFase.SelectedValue = value;
}
}
protected string FasePrev
{
get
{
string answ = "-";
try
{
answ = ddlFasePrev.SelectedValue;
}
catch
{
answ = "-";
}
return answ;
}
}
protected void ddlDossier_SelectedIndexChanged(object sender, EventArgs e)
{
// salvo!
savePar("ddlDossier", ddlDossier.SelectedValue);
// fix visualizzazione
fixControls();
fixControlsPrev();
}
protected void ddlFase_SelectedIndexChanged(object sender, EventArgs e)
{
// salvo!
savePar("ddlFase", ddlFase.SelectedValue);
// fix visualizzazione
ddlDossier.DataBind();
fixControls();
// salvo anche dossier!
savePar("ddlDossier", ddlDossier.SelectedValue);
}
protected void ddlFasePrev_SelectedIndexChanged(object sender, EventArgs e)
{
fixControlsPrev();
}
/// <summary>
/// wrapper traduzione
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return user_std.UtSn.Traduci(lemma);
}
/// <summary>
/// aggiungo set misure (eventualmente) mancanti
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAddNewSetMis_click(object sender, EventArgs e)
{
int idxDossier = Convert.ToInt32(ddlDossier.SelectedValue);
DtProxy.man.taMis.insMissing(idxDossier, CodSchedaVers, ddlFase.SelectedValue);
mod_collaudi.doUpdate();
fixControls();
}
/// <summary>
/// elimina set misure poiché VUOTE
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnRemSetMis_click(object sender, EventArgs e)
{
int idxDossier = Convert.ToInt32(ddlDossier.SelectedValue);
DtProxy.man.taMis.remSetMis(idxDossier, CodSchedaVers, ddlFase.SelectedValue);
mod_collaudi.doUpdate();
fixControls();
}
/// <summary>
/// verifico se sia possibile aggiungere records (= mancano misure x lo stato indicato...)
/// </summary>
public bool addNewVisible
{
get
{
bool answ = false;
if (ddlDossier.SelectedValue != "")
{
try
{
int idxDossier = Convert.ToInt32(ddlDossier.SelectedValue);
answ = DtProxy.man.taMis.getNum2Ins(idxDossier, CodSchedaVers, ddlFase.SelectedValue).Rows.Count > 0;
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("{0}", exc));
}
}
return answ;
}
}
/// <summary>
/// verifico se sia possibile rimuovere records (= NESSUNA misura INSERITA x lo stato indicato...)
/// </summary>
public bool remMisVisible
{
get
{
bool answ = false;
// in primis: deve essere selezionata SINGOLA scheda...
if (CodSchedaVers != "")
{
try
{
int idxDossier = Convert.ToInt32(ddlDossier.SelectedValue);
answ = DtProxy.man.taMis.getDataFilt(idxDossier, CodSchedaVers, ddlFase.SelectedValue).Select("Valoremis <> ''").Length == 0;
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("{0}", exc));
}
}
return answ;
}
}
protected void ddlFase_DataBound(object sender, EventArgs e)
{
fixControls();
}
/// <summary>
/// show/hide archivio collaudi
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnShowHideHist_Click(object sender, EventArgs e)
{
// toggle visibilità
showHist = !showHist;
// fixControls();
fixControlsPrev();
}
public bool showHist
{
get
{
return memLayer.ML.BoolSessionObj("showHist");
}
set
{
memLayer.ML.setSessionVal("showHist", value);
}
}
public bool showDetail
{
get
{
return memLayer.ML.BoolSessionObj("showDetail");
}
set
{
memLayer.ML.setSessionVal("showDetail", value);
}
}
}
}
+65 -66
View File
@@ -1,186 +1,185 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// <generato automaticamente>
// Codice generato da uno strumento.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
//------------------------------------------------------------------------------
namespace CMS_SC
{
namespace CMS_SC {
public partial class Collaudi {
/// <summary>
/// divStato control.
/// Controllo divStato.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divStato;
/// <summary>
/// ddlFase control.
/// Controllo ddlFase.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlFase;
/// <summary>
/// odsFase control.
/// Controllo odsFase.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsFase;
/// <summary>
/// ddlDossier control.
/// Controllo ddlDossier.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlDossier;
/// <summary>
/// odsDossier control.
/// Controllo odsDossier.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsDossier;
/// <summary>
/// mod_StatoCollaudi control.
/// Controllo mod_StatoCollaudi.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::CMS_SC.WebUserControls.mod_StatoCollaudi mod_StatoCollaudi;
/// <summary>
/// mod_righePagStato control.
/// Controllo mod_righePagStato.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::mod_righePag mod_righePagStato;
/// <summary>
/// divMain control.
/// Controllo divMain.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divMain;
/// <summary>
/// btnEmpty control.
/// Controllo btnEmpty.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnEmpty;
/// <summary>
/// btnAddNewSetMis control.
/// Controllo btnAddNewSetMis.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnAddNewSetMis;
/// <summary>
/// btnRemSetMis control.
/// Controllo btnRemSetMis.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnRemSetMis;
/// <summary>
/// btnShowHideHist control.
/// Controllo btnShowHideHist.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnShowHideHist;
/// <summary>
/// mod_collaudi control.
/// Controllo mod_collaudi.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::CMS_SC.WebUserControls.mod_collaudi mod_collaudi;
/// <summary>
/// mod_righePag control.
/// Controllo mod_righePag.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::mod_righePag mod_righePag;
/// <summary>
/// divHist control.
/// Controllo divHist.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divHist;
/// <summary>
/// ddlFasePrev control.
/// Controllo ddlFasePrev.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlFasePrev;
/// <summary>
/// odsFasePrev control.
/// Controllo odsFasePrev.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsFasePrev;
/// <summary>
/// mod_collaudiPrev control.
/// Controllo mod_collaudiPrev.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::CMS_SC.WebUserControls.mod_collaudi mod_collaudiPrev;
/// <summary>
/// mod_righePagPrev control.
/// Controllo mod_righePagPrev.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::mod_righePag mod_righePagPrev;
}
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -3,6 +3,9 @@
<EmptyDataTemplate>
<asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("NoRecords") %>' />
</EmptyDataTemplate>
<PagerStyle CssClass="active GridPager" />
<PagerSettings Mode="NumericFirstLast" />
<SelectedRowStyle CssClass="table-info" />
<Columns>
<asp:TemplateField ShowHeader="False" ItemStyle-Wrap="false">
<HeaderTemplate>
@@ -40,9 +43,6 @@
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="active GridPager" />
<PagerSettings Mode="NumericFirstLast" />
<SelectedRowStyle CssClass="info" />
</asp:GridView>
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByDossFase" TypeName="CMS_SC_Data.DS_ApplicazioneTableAdapters.StatoCollaudiTableAdapter">
<SelectParameters>
+130 -130
View File
@@ -2,7 +2,7 @@
<%@ Register Src="~/WebUserControls/mod_fileUpload.ascx" TagPrefix="uc1" TagName="mod_fileUpload" %>
<script type="text/javascript">
function enter(obj) {
function enter(obj) {
<%--if (event.keyCode == 40) //Down
{
document.getElementById("<%=btnDown.ClientID %>").click();
@@ -11,144 +11,144 @@
{
document.getElementById("<%=btnUp.ClientID %>").click();
}--%>
if (event.keyCode == 13) // Enter
{
document.getElementById("<%=btnSave.ClientID %>").click();
}
if (event.keyCode == 13) // Enter
{
document.getElementById("<%=btnSave.ClientID %>").click();
}
}
</script>
<%--<asp:Button runat="server" ID="btnUp" Text="UP" OnClick="btnUp_Click" CssClass="hiddenBtn" />
<asp:Button runat="server" ID="btnDown" Text="DOWN" OnClick="btnDown_Click" CssClass="hiddenBtn" />--%>
<asp:Button runat="server" ID="btnSave" Text="S" OnClick="btnSave_Click" CssClass="hiddenBtn" />
<asp:GridView ID="grView" runat="server" AutoGenerateColumns="False" DataKeyNames="IdxDossier,CodScheda,Vers,NumScheda,CodMisura,Fase" DataSourceID="ods" CssClass="table table-striped" AllowPaging="True" AllowSorting="True" OnRowCommand="grView_RowCommand" OnSelectedIndexChanged="grView_SelectedIndexChanged" OnRowDataBound="grView_RowDataBound" OnRowEditing="grView_RowEditing" onkeydown="enter(this)" onkeyup="enter(this)">
<PagerStyle CssClass="active GridPager" />
<PagerSettings Mode="NumericFirstLast" />
<SelectedRowStyle CssClass="info" />
<Columns>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="lbUpdate" runat="server" CausesValidation="True" CommandName="Update" ToolTip="Update" CssClass="fa fa-check" Font-Size="1.5em" />
&nbsp;<asp:LinkButton ID="lbCancel" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip="Cancel" CssClass="fa fa-undo" Font-Size="1.5em" />
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="lbEdit" runat="server" CausesValidation="False" CommandName="Edit" ToolTip="Edit" CssClass="fa fa-edit" Font-Size="1.5em" Visible='<%# Convert.ToBoolean(hfEditEnabled.Value) %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Scheda" SortExpression="CodSchedaVersNum">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("CodSchedaVersNum") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("CodSchedaVersNum") %>'></asp:Label>&nbsp;<asp:HyperLink runat="server" ID="hlDoc" Target="_blank" Visible='<%# hasDoc(Eval("CodSchedaVersNum")) %>' NavigateUrl='<%# urlDoc(Eval("CodSchedaVersNum")) %>' ToolTip='<%# urlDoc(Eval("CodSchedaVersNum")) %>'><i class="fa fa-file-pdf-o fa-2x"></i></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CodMisura" HeaderText="CodMis" ReadOnly="True" SortExpression="CodMisura" />
<asp:BoundField DataField="NomeMisura" HeaderText="Misura" SortExpression="NomeMisura" ReadOnly="true" />
<asp:TemplateField HeaderText="Val. Misura" SortExpression="ValoreMis">
<EditItemTemplate>
<div runat="server" id="divMisura" visible='<%# Eval("TipovalMisura").ToString()!="FILE" %>'>
<asp:TextBox ID="txtValoreMis" runat="server" Text='<%# Bind("ValoreMis") %>' />
</div>
<div runat="server" id="divFile" visible='<%# Eval("TipovalMisura").ToString()=="FILE" %>'>
<asp:HyperLink runat="server" ID="hlFileMan" Target="_blank" NavigateUrl='<%# fileTarget(Eval("ValoreMis"), "true") %>'><%# contaAllegati(Eval("ValoreMis")) %></asp:HyperLink>
<%--<uc1:mod_fileUpload runat="server" ID="mod_fileUpload" filtKey='<%# Bind("ValoreMis") %>' enableMod="true" />--%>
</div>
</EditItemTemplate>
<ItemTemplate>
<div runat="server" id="divMisura" visible='<%# Eval("TipovalMisura").ToString()!="FILE" %>'>
<asp:Label ID="lblValoreMis" runat="server" Text='<%# Eval("ValoreMis") %>' />
<br />
<asp:Label ID="lblLS_ValMis" runat="server" Text='<%# string.Format("({0} ÷ {1})",Eval("LIVal"),Eval("LSVal")) %>' Font-Size="0.8em" ForeColor="#696969" />
<%--Visible='<%# Eval("NomePar").ToString() != "" %>' --%>
</div>
<div runat="server" id="divFile" visible='<%# Eval("TipovalMisura").ToString()=="FILE" %>'>
<asp:HyperLink runat="server" ID="hlFileMan" Target="_blank" NavigateUrl='<%# fileTarget(Eval("ValoreMis"), "false") %>'><%# contaAllegati(Eval("ValoreMis")) %></asp:HyperLink>
<%--<asp:LinkButton ID="lbFileMan" runat="server" PostBackUrl='<%# fileTarget(Eval("ValoreMis"), "false") %>' OnDataBinding="lbFileMan_DataBinding"><%: traduci("FileAllegati") %></asp:LinkButton>--%>
<%--<uc1:mod_fileUpload runat="server" ID="mod_fileUpload" filtKey='<%# Eval("ValoreMis") %>' enableMod="false" />--%>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<EditItemTemplate>
<asp:Label ID="lblNomePar" runat="server" Text='<%# Eval("NomePar") %>' Visible='<%# Eval("NomePar").ToString() != "" %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblNomePar" runat="server" Text='<%# Eval("NomePar") %>' Visible='<%# Eval("NomePar").ToString() != "" %>' />
</ItemTemplate>
<HeaderTemplate>
<asp:Label runat="server" ID="lblHeadNomePar" Text="Param." Visible='<%# Convert.ToBoolean(hfEditEnabled.Value) %>' />
</HeaderTemplate>
</asp:TemplateField>
<asp:TemplateField>
<EditItemTemplate>
<asp:TextBox ID="txtValorePar" runat="server" Text='<%# Bind("ValorePar") %>' Visible='<%# Eval("NomePar").ToString() != "" %>' />
</EditItemTemplate>
<ItemTemplate>
<div runat="server" id="divValPar" visible='<%# Convert.ToBoolean(hfEditEnabled.Value) %>'>
<asp:Label ID="lblValorePar" runat="server" Text='<%# Eval("ValorePar") %>' Visible='<%# Eval("NomePar").ToString() != "" %>' />
<br />
<asp:Label ID="lblLS_ValPar" runat="server" Text='<%# string.Format("({0} ÷ {1})",Eval("MinPar"),Eval("MaxPar")) %>' Visible='<%# Eval("NomePar").ToString() != "" %>' Font-Size="0.8em" ForeColor="#696969" />
</div>
</ItemTemplate>
<HeaderTemplate>
<asp:Label runat="server" ID="lblHeadValPar" Text="Val.Par." Visible='<%# Convert.ToBoolean(hfEditEnabled.Value) %>' />
</HeaderTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Op." SortExpression="Operatore">
<EditItemTemplate>
<asp:Label ID="lblOperatore" runat="server" Text='<%# Eval("Operatore") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblOperatore" class="fa fa-user" Font-Size="1.5em" runat="server" ToolTip='<%# string.Format("{0} - {1:yyyy/MM/dd HH:mm}", Eval("Operatore"), Eval("DataOra")) %>' Visible='<%# Eval("Operatore").ToString() != "" %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ok" SortExpression="OkValMis">
<ItemTemplate>
<i id="iOK" runat="server" class="fa fa-check-circle" font-size="1.5em" visible='<%# Convert.ToBoolean(Eval("OkValMis")) && Eval("Operatore").ToString()!="" %>' style="color: green;"></i>
<i id="iKO" runat="server" class="fa fa-times-circle" font-size="1.5em" visible='<%# !Convert.ToBoolean(Eval("OkValMis")) && Eval("Operatore").ToString()!="" %>' style="color: red;"></i>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Der." SortExpression="CodDeroga">
<ItemTemplate>
<asp:LinkButton ID="lbCodDerogaAdd" CausesValidation="False" CommandName="Select" CommandArgument="ADD" runat="server" class="fa fa-plus-circle" Font-Size="1.5em" Visible='<%# hasDeroga("ADD", Eval("CodDeroga"), Eval("OkValMis")) && Eval("Operatore").ToString()!="" %>' Style="color: green;"></asp:LinkButton>
<asp:Label ID="lblCodDeroga" class="fa fa-graduation-cap" Font-Size="1.5em" runat="server" ToolTip='<%# Eval("CodDeroga") %>' Visible='<%# Eval("CodDeroga").ToString()!="" %>' ForeColor="Green" />
<asp:LinkButton ID="lbCodDerogaRem" CausesValidation="False" CommandName="Select" CommandArgument="REM" runat="server" class="fa fa-minus-circle" Font-Size="1.5em" Visible='<%# hasDeroga("REM", Eval("CodDeroga"), Eval("OkValMis")) && Eval("Operatore").ToString()!="" && Convert.ToBoolean(hfEditEnabled.Value) %>' Style="color: red;"></asp:LinkButton>
<asp:GridView ID="grView" runat="server" AutoGenerateColumns="False" DataKeyNames="IdxDossier,CodScheda,Vers,NumScheda,CodMisura,Fase" DataSourceID="ods" CssClass="table table-condensed table-sm table-striped m-0" AllowPaging="True" AllowSorting="True" OnRowCommand="grView_RowCommand" OnSelectedIndexChanged="grView_SelectedIndexChanged" OnRowDataBound="grView_RowDataBound" OnRowEditing="grView_RowEditing" onkeydown="enter(this)" onkeyup="enter(this)">
<PagerStyle CssClass="active GridPager" />
<PagerSettings Mode="NumericFirstLast" />
<SelectedRowStyle CssClass="info" />
<Columns>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="lbUpdate" runat="server" CausesValidation="True" CommandName="Update" ToolTip="Update" CssClass="fa fa-check" Font-Size="1.5em" />
&nbsp;<asp:LinkButton ID="lbCancel" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip="Cancel" CssClass="fa fa-undo" Font-Size="1.5em" />
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="lbEdit" runat="server" CausesValidation="False" CommandName="Edit" ToolTip="Edit" CssClass="fa fa-edit" Font-Size="1.5em" Visible='<%# Convert.ToBoolean(hfEditEnabled.Value) %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Scheda" SortExpression="CodSchedaVersNum">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("CodSchedaVersNum") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("CodSchedaVersNum") %>'></asp:Label>&nbsp;<asp:HyperLink runat="server" ID="hlDoc" Target="_blank" Visible='<%# hasDoc(Eval("CodSchedaVersNum")) %>' NavigateUrl='<%# urlDoc(Eval("CodSchedaVersNum")) %>' ToolTip='<%# urlDoc(Eval("CodSchedaVersNum")) %>'><i class="fa fa-file-pdf-o fa-2x"></i></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CodMisura" HeaderText="CodMis" ReadOnly="True" SortExpression="CodMisura" />
<asp:BoundField DataField="NomeMisura" HeaderText="Misura" SortExpression="NomeMisura" ReadOnly="true" />
<asp:TemplateField HeaderText="Val. Misura" SortExpression="ValoreMis">
<EditItemTemplate>
<div runat="server" id="divMisura" visible='<%# Eval("TipovalMisura").ToString()!="FILE" %>'>
<asp:TextBox ID="txtValoreMis" runat="server" Text='<%# Bind("ValoreMis") %>' />
</div>
<div runat="server" id="divFile" visible='<%# Eval("TipovalMisura").ToString()=="FILE" %>'>
<asp:HyperLink runat="server" ID="hlFileMan" Target="_blank" NavigateUrl='<%# fileTarget(Eval("ValoreMis"), "true") %>'><%# contaAllegati(Eval("ValoreMis")) %></asp:HyperLink>
<%--<uc1:mod_fileUpload runat="server" ID="mod_fileUpload" filtKey='<%# Bind("ValoreMis") %>' enableMod="true" />--%>
</div>
</EditItemTemplate>
<ItemTemplate>
<div runat="server" id="divMisura" visible='<%# Eval("TipovalMisura").ToString()!="FILE" %>'>
<asp:Label ID="lblValoreMis" runat="server" Text='<%# Eval("ValoreMis") %>' />
<br />
<asp:Label ID="lblLS_ValMis" runat="server" Text='<%# string.Format("({0} ÷ {1})",Eval("LIVal"),Eval("LSVal")) %>' Font-Size="0.8em" ForeColor="#696969" />
<%--Visible='<%# Eval("NomePar").ToString() != "" %>' --%>
</div>
<div runat="server" id="divFile" visible='<%# Eval("TipovalMisura").ToString()=="FILE" %>'>
<asp:HyperLink runat="server" ID="hlFileMan" Target="_blank" NavigateUrl='<%# fileTarget(Eval("ValoreMis"), "false") %>'><%# contaAllegati(Eval("ValoreMis")) %></asp:HyperLink>
<%--<asp:LinkButton ID="lbFileMan" runat="server" PostBackUrl='<%# fileTarget(Eval("ValoreMis"), "false") %>' OnDataBinding="lbFileMan_DataBinding"><%: traduci("FileAllegati") %></asp:LinkButton>--%>
<%--<uc1:mod_fileUpload runat="server" ID="mod_fileUpload" filtKey='<%# Eval("ValoreMis") %>' enableMod="false" />--%>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<EditItemTemplate>
<asp:Label ID="lblNomePar" runat="server" Text='<%# Eval("NomePar") %>' Visible='<%# Eval("NomePar").ToString() != "" %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblNomePar" runat="server" Text='<%# Eval("NomePar") %>' Visible='<%# Eval("NomePar").ToString() != "" %>' />
</ItemTemplate>
<HeaderTemplate>
<asp:Label runat="server" ID="lblHeadNomePar" Text="Param." Visible='<%# Convert.ToBoolean(hfEditEnabled.Value) %>' />
</HeaderTemplate>
</asp:TemplateField>
<asp:TemplateField>
<EditItemTemplate>
<asp:TextBox ID="txtValorePar" runat="server" Text='<%# Bind("ValorePar") %>' Visible='<%# Eval("NomePar").ToString() != "" %>' />
</EditItemTemplate>
<ItemTemplate>
<div runat="server" id="divValPar" visible='<%# Convert.ToBoolean(hfEditEnabled.Value) %>'>
<asp:Label ID="lblValorePar" runat="server" Text='<%# Eval("ValorePar") %>' Visible='<%# Eval("NomePar").ToString() != "" %>' />
<br />
<asp:Label ID="lblLS_ValPar" runat="server" Text='<%# string.Format("({0} ÷ {1})",Eval("MinPar"),Eval("MaxPar")) %>' Visible='<%# Eval("NomePar").ToString() != "" %>' Font-Size="0.8em" ForeColor="#696969" />
</div>
</ItemTemplate>
<HeaderTemplate>
<asp:Label runat="server" ID="lblHeadValPar" Text="Val.Par." Visible='<%# Convert.ToBoolean(hfEditEnabled.Value) %>' />
</HeaderTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Op." SortExpression="Operatore">
<EditItemTemplate>
<asp:Label ID="lblOperatore" runat="server" Text='<%# Eval("Operatore") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblOperatore" class="fa fa-user" Font-Size="1.5em" runat="server" ToolTip='<%# string.Format("{0} - {1:yyyy/MM/dd HH:mm}", Eval("Operatore"), Eval("DataOra")) %>' Visible='<%# Eval("Operatore").ToString() != "" %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ok" SortExpression="OkValMis">
<ItemTemplate>
<i id="iOK" runat="server" class="fa fa-check-circle" font-size="1.5em" visible='<%# Convert.ToBoolean(Eval("OkValMis")) && Eval("Operatore").ToString()!="" %>' style="color: green;"></i>
<i id="iKO" runat="server" class="fa fa-times-circle" font-size="1.5em" visible='<%# !Convert.ToBoolean(Eval("OkValMis")) && Eval("Operatore").ToString()!="" %>' style="color: red;"></i>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Der." SortExpression="CodDeroga">
<ItemTemplate>
<asp:LinkButton ID="lbCodDerogaAdd" CausesValidation="False" CommandName="Select" CommandArgument="ADD" runat="server" class="fa fa-plus-circle" Font-Size="1.5em" Visible='<%# hasDeroga("ADD", Eval("CodDeroga"), Eval("OkValMis")) && Eval("Operatore").ToString()!="" %>' Style="color: green;"></asp:LinkButton>
<asp:Label ID="lblCodDeroga" class="fa fa-graduation-cap" Font-Size="1.5em" runat="server" ToolTip='<%# Eval("CodDeroga") %>' Visible='<%# Eval("CodDeroga").ToString()!="" %>' ForeColor="Green" />
<asp:LinkButton ID="lbCodDerogaRem" CausesValidation="False" CommandName="Select" CommandArgument="REM" runat="server" class="fa fa-minus-circle" Font-Size="1.5em" Visible='<%# hasDeroga("REM", Eval("CodDeroga"), Eval("OkValMis")) && Eval("Operatore").ToString()!="" && Convert.ToBoolean(hfEditEnabled.Value) %>' Style="color: red;"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="lbUpdate2" runat="server" CausesValidation="True" CommandName="Update" ToolTip="Update" CssClass="fa fa-check" Font-Size="1.5em" />
&nbsp;<asp:LinkButton ID="lbCancel2" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip="Cancel" CssClass="fa fa-undo" Font-Size="1.5em" />
</EditItemTemplate>
<ItemTemplate>
<%--<asp:LinkButton ID="lbDelete" runat="server" CausesValidation="False" CommandName="Delete" ToolTip="Delete" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' CssClass="fa fa-trash" Font-Size="1.5em" />--%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="lbUpdate2" runat="server" CausesValidation="True" CommandName="Update" ToolTip="Update" CssClass="fa fa-check" Font-Size="1.5em" />
&nbsp;<asp:LinkButton ID="lbCancel2" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip="Cancel" CssClass="fa fa-undo" Font-Size="1.5em" />
</EditItemTemplate>
<ItemTemplate>
<%--<asp:LinkButton ID="lbDelete" runat="server" CausesValidation="False" CommandName="Delete" ToolTip="Delete" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' CssClass="fa fa-trash" Font-Size="1.5em" />--%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="getDataFilt" TypeName="CMS_SC_Data.DS_ApplicazioneTableAdapters.MisureTableAdapter" FilterExpression=" CodSchedaVersNum LIKE '%{0}%' OR CodMisura LIKE '%{0}%' OR NomeMisura LIKE '%{0}%' OR NomePar LIKE '%{0}%' " UpdateMethod="updateMis" OnUpdating="ods_Updating">
<FilterParameters>
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="searchVal" />
</FilterParameters>
<SelectParameters>
<asp:ControlParameter ControlID="hfIdxDossier" Name="IdxDossier" PropertyName="Value" Type="Int32" />
<asp:ControlParameter ControlID="hfCodSchedaVers" Name="CodSchedaVers" PropertyName="Value" Type="String" />
<asp:ControlParameter ControlID="hfFase" Name="Fase" PropertyName="Value" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Original_IdxDossier" Type="Int32" />
<asp:Parameter Name="Original_CodScheda" Type="String" />
<asp:Parameter Name="Original_Vers" Type="Int32" />
<asp:Parameter Name="Original_NumScheda" Type="Int32" />
<asp:Parameter Name="Original_CodMisura" Type="String" />
<asp:Parameter Name="Original_Fase" Type="String" />
<asp:Parameter Name="Operatore" Type="String" />
<asp:Parameter Name="ValorePar" Type="Double" />
<asp:Parameter Name="ValoreMis" Type="String" />
<asp:Parameter Name="CodVisib" Type="String" />
</UpdateParameters>
<FilterParameters>
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="searchVal" />
</FilterParameters>
<SelectParameters>
<asp:ControlParameter ControlID="hfIdxDossier" Name="IdxDossier" PropertyName="Value" Type="Int32" />
<asp:ControlParameter ControlID="hfCodSchedaVers" Name="CodSchedaVers" PropertyName="Value" Type="String" />
<asp:ControlParameter ControlID="hfFase" Name="Fase" PropertyName="Value" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Original_IdxDossier" Type="Int32" />
<asp:Parameter Name="Original_CodScheda" Type="String" />
<asp:Parameter Name="Original_Vers" Type="Int32" />
<asp:Parameter Name="Original_NumScheda" Type="Int32" />
<asp:Parameter Name="Original_CodMisura" Type="String" />
<asp:Parameter Name="Original_Fase" Type="String" />
<asp:Parameter Name="Operatore" Type="String" />
<asp:Parameter Name="ValorePar" Type="Double" />
<asp:Parameter Name="ValoreMis" Type="String" />
<asp:Parameter Name="CodVisib" Type="String" />
</UpdateParameters>
</asp:ObjectDataSource>
<asp:HiddenField runat="server" ID="hfIdxDossier" Value="0" />
<asp:HiddenField runat="server" ID="hfCodSchedaVers" Value="" />
+330 -329
View File
@@ -5,335 +5,336 @@ using System.Web.UI.WebControls;
namespace CMS_SC.WebUserControls
{
public partial class mod_collaudi : SteamWare.UserControl
public partial class mod_collaudi : SteamWare.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// dimensione pagina grid view
/// </summary>
public int pageSize
{
get
{
return grView.PageSize;
}
set
{
grView.PageSize = value;
}
}
public int IdxDossier
{
get
{
int answ = -1;
try
{
answ = Convert.ToInt32(hfIdxDossier.Value);
}
catch
{ }
return answ;
}
set
{
hfIdxDossier.Value = value.ToString();
}
}
public string CodSchedaVers
{
get
{
string answ = "-";
try
{
answ = hfCodSchedaVers.Value;
}
catch
{ }
return answ;
}
set
{
hfCodSchedaVers.Value = value;
}
}
public string Fase
{
get
{
string answ = "-";
try
{
answ = hfFase.Value;
}
catch
{ }
return answ;
}
set
{
hfFase.Value = value;
}
}
public void doUpdate()
{
try
{
grView.DataBind();
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Eccezione in databind, valori filtro{0}Dossier: [{1}]{0}CodScheda: [{2}]{0}Fase: [{3}]{0}Eccezione:{0}{4}", Environment.NewLine, IdxDossier, CodSchedaVers, Fase, exc));
}
}
/// <summary>
/// intercetto valori...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
{
// aggiungo operatore...
e.InputParameters["Operatore"] = user_std.UtSn.utente;
// fix eventuali null x misura...
if (e.InputParameters["ValoreMis"] == null) e.InputParameters["ValoreMis"] = "";
// ...e parametro
if (e.InputParameters["ValorePar"] == null) e.InputParameters["ValorePar"] = "0";
}
/// <summary>
/// verifica se l'utente sia un SuperUser (e possa di conseguenza operare...)
/// </summary>
protected bool userIsSuper
{
get
{
return (userIsCapoOfficina || userIsCapoGruppo);
}
}
/// <summary>
/// verifica se utente sia SuperUser
/// </summary>
public bool userIsCapoOfficina
{
get
{
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("CapoOfficinaRole"));
}
} /// <summary>
/// verifica se utente sia SuperUser
/// </summary>
public bool userIsCapoGruppo
{
get
{
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("CapoGruppo"));
}
}
/// <summary>
/// verifica la possibilità di deroga utente: se
/// - è KO la misura
/// - è utente admin
/// - in base al tipo di action (add/rem), dipende se ci sia deroga...
/// </summary>
/// <param name="actionType">azione x deroga: ADD / REM</param>
/// <param name="CodDeroga">valore attuale deroga</param>
/// <param name="OkValMis">valore di OK/KO misura</param>
/// <returns></returns>
public bool hasDeroga(string actionType, object CodDeroga, object OkValMis)
{
bool answ = false;
bool okAddRem = ((CodDeroga.ToString() == "" && actionType == "ADD") || (CodDeroga.ToString() != "" && actionType == "REM"));
try
{
answ = userIsSuper && !Convert.ToBoolean(OkValMis) && okAddRem;
}
catch
{ }
return answ;
}
/// <summary>
/// ultimo comando letto da link button
/// </summary>
public string lastCmd { get; set; }
/// <summary>
/// selezione comando (x intercettare deroghe)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
int IdxDossier = 0;
string CodScheda = "";
int Vers = 0;
int NumScheda = 0;
string CodMisura = "";
string Fase = "";
try
{
IdxDossier = Convert.ToInt32(grView.SelectedDataKey["IdxDossier"]);
CodScheda = grView.SelectedDataKey["CodScheda"].ToString();
Vers = Convert.ToInt32(grView.SelectedDataKey["Vers"]);
NumScheda = Convert.ToInt32(grView.SelectedDataKey["NumScheda"]);
CodMisura = grView.SelectedDataKey["CodMisura"].ToString();
Fase = grView.SelectedDataKey["Fase"].ToString();
}
catch
{ }
// verifico se ho cmd argumento x fare ADD/DEL...
switch (lastCmd)
{
case "ADD":
DtProxy.man.taMis.deroga(IdxDossier, CodScheda, Vers, NumScheda, CodMisura, Fase, string.Format("{0} - {1:yyyy/MM/dd HH:mm}", user_std.UtSn.utente, DateTime.Now));
break;
case "REM":
DtProxy.man.taMis.deroga(IdxDossier, CodScheda, Vers, NumScheda, CodMisura, Fase, "");
break;
}
grView.SelectedIndex = -1;
grView.DataBind();
}
protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
{
// salvo il command argument...
lastCmd = e.CommandArgument.ToString();
}
public bool editEnabled
{
get
{
bool answ = false;
try
{
answ = Convert.ToBoolean(hfEditEnabled.Value);
}
catch
{ }
return answ;
}
set
{
hfEditEnabled.Value = value.ToString();
}
}
/// <summary>
/// formatta URL x mostrare i file associati al record
/// </summary>
/// <param name="_filter"></param>
/// <param name="_enableMod"></param>
/// <returns></returns>
public string fileTarget(object _filter, object _enableMod)
{
string answ = "FileManager";
try
{
answ = string.Format(memLayer.ML.CRS("fileManUrl"), _filter, _enableMod);
}
catch
{ }
return answ;
}
public string contaAllegati(object filtro)
{
string answ = traduci("FileAllegati");
try
{
int numFile = DtProxy.man.taFiles.getByFiltKey(filtro.ToString()).Rows.Count;
answ = string.Format("{0} {1}", numFile, answ);
}
catch
{ }
return answ;
}
/// <summary>
/// save del record
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
//// salvo
//int idxEdit = grView.EditIndex;
//grView.UpdateRow(grView.EditIndex, false);
//grView.EditIndex = -1;
//grView.DataBind();
// verifico SE sia in editing...
if (grView.EditIndex >= 0)
{
// salvo
grView.UpdateRow(grView.EditIndex, false);
grView.EditIndex = -1;
grView.DataBind();
}
}
/// <summary>
/// recupera codice scheda/vers da scheda/vers/num
/// </summary>
/// <param name="codSchedaVers"></param>
/// <returns></returns>
protected string getPathDoc(string codSchedaVers)
{
string answ = "";
string codScheda = "";
if (codSchedaVers != "")
{
try
{
codScheda = codSchedaVers.Substring(0, codSchedaVers.LastIndexOf("."));
}
catch
{ }
if (codScheda != "")
{
try
{
answ = DtProxy.man.taASC.getByCodScheda(codScheda)[0].Path;
}
catch
{
answ = "";
}
}
}
return answ;
}
/// <summary>
/// verifica se ci sia un doc da mostrare...
/// </summary>
/// <param name="codSchedaVers"></param>
/// <returns></returns>
public bool hasDoc(object _currCodSchedaVers)
{
bool answ = false;
string pathDoc = getPathDoc(_currCodSchedaVers.ToString());
if (pathDoc != "")
{
answ = DtProxy.notNullDocPath(pathDoc);
}
return answ;
}
/// <summary>
/// link URL doc da mostrare...
/// </summary>
/// <param name="codSchedaVers"></param>
/// <returns></returns>
public string urlDoc(object _currCodSchedaVers)
{
string answ = "";
string pathDoc = getPathDoc(_currCodSchedaVers.ToString());
if (pathDoc != "")
{
answ = DtProxy.getDocPath(pathDoc);
}
return answ;
}
}
/// <summary>
/// dimensione pagina grid view
/// </summary>
public int pageSize
{
get
{
return grView.PageSize;
}
set
{
grView.PageSize = value;
}
}
public int IdxDossier
{
get
{
int answ = -1;
try
{
answ = Convert.ToInt32(hfIdxDossier.Value);
}
catch
{ }
return answ;
}
set
{
hfIdxDossier.Value = value.ToString();
}
}
public string CodSchedaVers
{
get
{
string answ = "-";
try
{
answ = hfCodSchedaVers.Value;
}
catch
{ }
return answ;
}
set
{
hfCodSchedaVers.Value = value;
}
}
public string Fase
{
get
{
string answ = "-";
try
{
answ = hfFase.Value;
}
catch
{ }
return answ;
}
set
{
hfFase.Value = value;
}
}
public void doUpdate()
{
try
{
grView.DataBind();
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Eccezione in databind, valori filtro{0}Dossier: [{1}]{0}CodScheda: [{2}]{0}Fase: [{3}]{0}Eccezione:{0}{4}", Environment.NewLine, IdxDossier, CodSchedaVers, Fase, exc));
}
}
/// <summary>
/// intercetto valori...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
{
// aggiungo operatore...
e.InputParameters["Operatore"] = user_std.UtSn.utente;
// fix eventuali null x misura...
if (e.InputParameters["ValoreMis"] == null) e.InputParameters["ValoreMis"] = "";
// ...e parametro
if (e.InputParameters["ValorePar"] == null) e.InputParameters["ValorePar"] = "0";
}
/// <summary>
/// verifica se l'utente sia un SuperUser (e possa di conseguenza operare...)
/// </summary>
protected bool userIsSuper
{
get
{
return (userIsCapoOfficina || userIsCapoGruppo);
}
}
/// <summary>
/// verifica se utente sia SuperUser
/// </summary>
public bool userIsCapoOfficina
{
get
{
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("CapoOfficinaRole"));
}
} /// <summary>
/// verifica se utente sia SuperUser
/// </summary>
public bool userIsCapoGruppo
{
get
{
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("CapoGruppo"));
}
}
/// <summary>
/// verifica la possibilità di deroga utente: se
/// - è KO la misura
/// - è utente admin
/// - in base al tipo di action (add/rem), dipende se ci sia deroga...
/// </summary>
/// <param name="actionType">azione x deroga: ADD / REM</param>
/// <param name="CodDeroga">valore attuale deroga</param>
/// <param name="OkValMis">valore di OK/KO misura</param>
/// <returns></returns>
public bool hasDeroga(string actionType, object CodDeroga, object OkValMis)
{
bool answ = false;
bool okAddRem = ((CodDeroga.ToString() == "" && actionType == "ADD") || (CodDeroga.ToString() != "" && actionType == "REM"));
try
{
answ = userIsSuper && !Convert.ToBoolean(OkValMis) && okAddRem;
}
catch
{ }
return answ;
}
/// <summary>
/// ultimo comando letto da link button
/// </summary>
public string lastCmd { get; set; }
/// <summary>
/// selezione comando (x intercettare deroghe)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
int IdxDossier = 0;
string CodScheda = "";
int Vers = 0;
int NumScheda = 0;
string CodMisura = "";
string Fase = "";
try
{
IdxDossier = Convert.ToInt32(grView.SelectedDataKey["IdxDossier"]);
CodScheda = grView.SelectedDataKey["CodScheda"].ToString();
Vers = Convert.ToInt32(grView.SelectedDataKey["Vers"]);
NumScheda = Convert.ToInt32(grView.SelectedDataKey["NumScheda"]);
CodMisura = grView.SelectedDataKey["CodMisura"].ToString();
Fase = grView.SelectedDataKey["Fase"].ToString();
}
catch
{ }
// verifico se ho cmd argumento x fare ADD/DEL...
switch (lastCmd)
{
case "ADD":
DtProxy.man.taMis.deroga(IdxDossier, CodScheda, Vers, NumScheda, CodMisura, Fase, string.Format("{0} - {1:yyyy/MM/dd HH:mm}", user_std.UtSn.utente, DateTime.Now));
break;
case "REM":
DtProxy.man.taMis.deroga(IdxDossier, CodScheda, Vers, NumScheda, CodMisura, Fase, "");
break;
}
grView.SelectedIndex = -1;
grView.DataBind();
raiseEvent(ucEvType.ReqUpdateParent);
}
protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
{
// salvo il command argument...
lastCmd = e.CommandArgument.ToString();
}
public bool editEnabled
{
get
{
bool answ = false;
try
{
answ = Convert.ToBoolean(hfEditEnabled.Value);
}
catch
{ }
return answ;
}
set
{
hfEditEnabled.Value = value.ToString();
}
}
/// <summary>
/// formatta URL x mostrare i file associati al record
/// </summary>
/// <param name="_filter"></param>
/// <param name="_enableMod"></param>
/// <returns></returns>
public string fileTarget(object _filter, object _enableMod)
{
string answ = "FileManager";
try
{
answ = string.Format(memLayer.ML.CRS("fileManUrl"), _filter, _enableMod);
}
catch
{ }
return answ;
}
public string contaAllegati(object filtro)
{
string answ = traduci("FileAllegati");
try
{
int numFile = DtProxy.man.taFiles.getByFiltKey(filtro.ToString()).Rows.Count;
answ = string.Format("{0} {1}", numFile, answ);
}
catch
{ }
return answ;
}
/// <summary>
/// save del record
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
//// salvo
//int idxEdit = grView.EditIndex;
//grView.UpdateRow(grView.EditIndex, false);
//grView.EditIndex = -1;
//grView.DataBind();
// verifico SE sia in editing...
if (grView.EditIndex >= 0)
{
// salvo
grView.UpdateRow(grView.EditIndex, false);
grView.EditIndex = -1;
grView.DataBind();
}
}
/// <summary>
/// recupera codice scheda/vers da scheda/vers/num
/// </summary>
/// <param name="codSchedaVers"></param>
/// <returns></returns>
protected string getPathDoc(string codSchedaVers)
{
string answ = "";
string codScheda = "";
if (codSchedaVers != "")
{
try
{
codScheda = codSchedaVers.Substring(0, codSchedaVers.LastIndexOf("."));
}
catch
{ }
if (codScheda != "")
{
try
{
answ = DtProxy.man.taASC.getByCodScheda(codScheda)[0].Path;
}
catch
{
answ = "";
}
}
}
return answ;
}
/// <summary>
/// verifica se ci sia un doc da mostrare...
/// </summary>
/// <param name="codSchedaVers"></param>
/// <returns></returns>
public bool hasDoc(object _currCodSchedaVers)
{
bool answ = false;
string pathDoc = getPathDoc(_currCodSchedaVers.ToString());
if (pathDoc != "")
{
answ = DtProxy.notNullDocPath(pathDoc);
}
return answ;
}
/// <summary>
/// link URL doc da mostrare...
/// </summary>
/// <param name="codSchedaVers"></param>
/// <returns></returns>
public string urlDoc(object _currCodSchedaVers)
{
string answ = "";
string pathDoc = getPathDoc(_currCodSchedaVers.ToString());
if (pathDoc != "")
{
answ = DtProxy.getDocPath(pathDoc);
}
return answ;
}
}
}
+29 -30
View File
@@ -1,78 +1,77 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// <generato automaticamente>
// Codice generato da uno strumento.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
//------------------------------------------------------------------------------
namespace CMS_SC.WebUserControls
{
namespace CMS_SC.WebUserControls {
public partial class mod_collaudi {
/// <summary>
/// btnSave control.
/// Controllo btnSave.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSave;
/// <summary>
/// grView control.
/// Controllo grView.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.GridView grView;
/// <summary>
/// ods control.
/// Controllo ods.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
/// <summary>
/// hfIdxDossier control.
/// Controllo hfIdxDossier.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfIdxDossier;
/// <summary>
/// hfCodSchedaVers control.
/// Controllo hfCodSchedaVers.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfCodSchedaVers;
/// <summary>
/// hfFase control.
/// Controllo hfFase.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfFase;
/// <summary>
/// hfEditEnabled control.
/// Controllo hfEditEnabled.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfEditEnabled;
}