182 lines
4.6 KiB
C#
182 lines
4.6 KiB
C#
using CMS_SC_Data;
|
|
using SteamWare;
|
|
using System;
|
|
|
|
namespace CMS_SC.WebUserControls
|
|
{
|
|
public partial class mod_dossier : SteamWare.UserControl
|
|
{
|
|
protected override void OnInit(EventArgs e)
|
|
{
|
|
base.OnInit(e);
|
|
if (!Page.IsPostBack)
|
|
{
|
|
editFaseRev = false;
|
|
fixControls();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// evento valore selezionato
|
|
/// </summary>
|
|
public event EventHandler eh_valUpdated;
|
|
protected void raiseEvent()
|
|
{
|
|
// sollevo evento nuovo valore...
|
|
if (eh_valUpdated != null)
|
|
{
|
|
eh_valUpdated(this, new EventArgs());
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
public int idxDossier
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.IntSessionObj("idxDossierEdit");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("idxDossierEdit", value);
|
|
}
|
|
}
|
|
public bool editFaseRev
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.BoolSessionObj("editFaseRev");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("editFaseRev", value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Aggiorna controllo con update del campo note e eventualmente permettendo editing...
|
|
/// </summary>
|
|
public void fixControls()
|
|
{
|
|
try
|
|
{
|
|
if (idxDossier > 0)
|
|
{
|
|
DS_Applicazione.ElencoDossierRow riga = DtProxy.man.taED.getByDossier(idxDossier)[0];
|
|
txtNote.Text = riga.Note;
|
|
ddlFase.SelectedValue = riga.FaseAct;
|
|
lblRevAct.Text = riga.RevAct.ToString();
|
|
ddlFase.Enabled = editFaseRev;
|
|
txtNote.Enabled = editFaseRev;
|
|
icnCancel.Visible = editFaseRev;
|
|
icnEdit.Visible = !editFaseRev;
|
|
lbtNewRev.Visible = editFaseRev;
|
|
lblRevAct.Visible = !editFaseRev;
|
|
lblWarn.Visible = false;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
idxDossier = 0;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// mostra btn salvataggio / annullamento
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void txtNote_TextChanged(object sender, EventArgs e)
|
|
{
|
|
// mostra button salvataggio/annulla
|
|
showNoteBtn(true);
|
|
}
|
|
|
|
public void showNoteBtn(bool showSaveCancel)
|
|
{
|
|
lbtResetNote.Visible = showSaveCancel;
|
|
lbtSalvaNote.Visible = showSaveCancel;
|
|
lbtSalvaRev.Visible = false;
|
|
}
|
|
public void showRevBtn(bool showSaveCancel)
|
|
{
|
|
lbtResetNote.Visible = showSaveCancel;
|
|
lbtSalvaNote.Visible = false;
|
|
lbtSalvaRev.Visible = showSaveCancel;
|
|
}
|
|
|
|
protected void lbtResetNote_Click(object sender, EventArgs e)
|
|
{
|
|
editFaseRev = false;
|
|
fixControls();
|
|
showNoteBtn(false);
|
|
}
|
|
protected void lbtSalvaNote_Click(object sender, EventArgs e)
|
|
{
|
|
// salvo
|
|
if (idxDossier > 0)
|
|
{
|
|
// SE cambio fase --> aggiorno revisione... !!!FARE!!!
|
|
DtProxy.man.taED.updateNote(idxDossier, ddlFase.SelectedValue, txtNote.Text.Trim());
|
|
editFaseRev = false;
|
|
}
|
|
// ricarico
|
|
fixControls();
|
|
showNoteBtn(false);
|
|
showRevBtn(false);
|
|
raiseEvent();
|
|
}
|
|
protected void lbtSalvaRev_Click(object sender, EventArgs e)
|
|
{
|
|
// SE HO le note... sennò errore...
|
|
if (txtNote.Text.Trim() != "")
|
|
{
|
|
// crea una nuova revisione salvando le note e DUPLICANDO tutti i valori alla NUOVA revisione...
|
|
DtProxy.man.taED.createRev(idxDossier, user_std.UtSn.utente, txtNote.Text.Trim());
|
|
// ricarico
|
|
editFaseRev = false;
|
|
fixControls();
|
|
showNoteBtn(false);
|
|
showRevBtn(false);
|
|
}
|
|
else
|
|
{
|
|
// ricarico
|
|
fixControls();
|
|
lblWarn.Visible = true;
|
|
lblWarn.Text = traduci("ERR-NoteMandatory");
|
|
showNoteBtn(false);
|
|
showRevBtn(true);
|
|
}
|
|
raiseEvent();
|
|
}
|
|
protected void ddlFase_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// mostra button salvataggio/annulla
|
|
showNoteBtn(true);
|
|
}
|
|
/// <summary>
|
|
/// Abilita modalità editing FASE / REVISIONE
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtEnable_Click(object sender, EventArgs e)
|
|
{
|
|
editFaseRev = !editFaseRev;
|
|
fixControls();
|
|
if (!editFaseRev)
|
|
{
|
|
showNoteBtn(false);
|
|
showRevBtn(false);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Crea una nuova revisione
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtNewRev_Click(object sender, EventArgs e)
|
|
{
|
|
showRevBtn(true);
|
|
}
|
|
}
|
|
} |