Files
SSC/CMS_SC/WebUserControls/mod_elencoSchedeDossier.ascx.cs
T
2017-04-28 18:10:17 +02:00

146 lines
4.5 KiB
C#

using CMS_SC_Data;
using System;
using System.Web.UI.WebControls;
namespace CMS_SC.WebUserControls
{
public partial class mod_elencoSchedeDossier : SteamWare.UserControl
{
/// <summary>
/// selezione valore in DettScheda
/// </summary>
public event EventHandler eh_selezioneValore;
/// <summary>
/// sollevo evento selezione
/// </summary>
protected void raiseEvent()
{
// sollevo evento nuovo valore...
if (eh_selezioneValore != null)
{
eh_selezioneValore(this, new EventArgs());
}
}
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;
}
}
/// <summary>
/// dossier selezionato
/// </summary>
public string idxDossier
{
get
{
return hfIdxDossier.Value;
}
set
{
hfIdxDossier.Value = value;
grView.DataBind();
}
}
public void doUpdate()
{
grView.DataBind();
}
/// <summary>
/// selezione scheda...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
// verifico se ho un argomento di tipo moveUp / moveDown... quale comando?
string _comando = "";
string CodSchedaVersNum = "";
if (SteamWare.memLayer.ML.isInSessionObject("nextObjCommand"))
{
_comando = SteamWare.memLayer.ML.StringSessionObj("nextObjCommand");
SteamWare.memLayer.ML.emptySessionVal("nextObjCommand");
}
if (_comando != "")
{
CodSchedaVersNum = string.Format("{0}.{1}.{2}", grView.SelectedDataKey["CodScheda"], grView.SelectedDataKey["Vers"], grView.SelectedDataKey["NumScheda"]);
// SE c'era comando eseguo move...
switch (_comando)
{
case "moveUp":
case "moveDown":
DtProxy.man.taSCM.moveUpDown(_comando, Convert.ToInt32(idxDossier), CodSchedaVersNum);
break;
//case "clone":
// DtProxy.man.taDS.clone(memLayer.ML.QSS("CodSchedaVers"), grView.SelectedDataKey["CodMisura"].ToString());
// break;
default:
break;
}
resetSelezione();
}
else
{
raiseEvent();
}
}
protected void btnReset_Click(object sender, EventArgs e)
{
resetSelezione();
}
/// <summary>
/// resetto selezione
/// </summary>
private void resetSelezione()
{
grView.SelectedIndex = -1;
grView.DataBind();
raiseEvent();
}
/// <summary>
/// determina visibilità frecce spostamento
/// </summary>
/// <param name="direction">direzione: UP / DOWN</param>
/// <param name="_Ordinale">Ordinale</param>
/// <returns></returns>
public bool arrowVisible(object _direction, object _Ordinale)
{
bool answ = false;
string direction = _direction.ToString();
int Ordinale = Convert.ToInt32(_Ordinale.ToString());
switch (direction)
{
case "UP":
answ = Ordinale > 1;
break;
case "DOWN":
answ = Ordinale < DtProxy.man.taSCM.getByDossier(Convert.ToInt32(idxDossier)).Rows.Count;
break;
default:
break;
}
return answ;
}
/// <summary>
/// salvo in session il prox comando
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lb_Click(object sender, EventArgs e)
{
SteamWare.memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument);
}
}
}