195 lines
5.9 KiB
C#
195 lines
5.9 KiB
C#
using CMS_SC_Data;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace CMS_SC.WebUserControls
|
|
{
|
|
public partial class mod_SchemaCollFamMacc : SteamWare.UserControl
|
|
{/// <summary>
|
|
/// selezione valore in DettScheda
|
|
/// </summary>
|
|
public event EventHandler eh_selezioneValore;
|
|
/// <summary>
|
|
/// richiesta SAVE (da enter)
|
|
/// </summary>
|
|
public event EventHandler eh_reqSave;
|
|
/// <summary>
|
|
/// sollevo evento selezione
|
|
/// </summary>
|
|
protected void raiseEvent()
|
|
{
|
|
// sollevo evento nuovo valore...
|
|
if (eh_selezioneValore != null)
|
|
{
|
|
eh_selezioneValore(this, new EventArgs());
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// resetto selezione
|
|
/// </summary>
|
|
private void resetSelezione()
|
|
{
|
|
grView.SelectedIndex = -1;
|
|
grView.DataBind();
|
|
raiseEvent();
|
|
}
|
|
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>
|
|
/// inserimento nuovo record x chiave indicata
|
|
/// </summary>
|
|
/// <param name="CodSchedaVers"></param>
|
|
/// <param name="codFam"></param>
|
|
public void addNewFromSel(string CodSchedaVers, string codFam)
|
|
{
|
|
// inserisco nuovo record
|
|
DtProxy.man.taSCFM.insertQuery(CodSchedaVers, codFam);
|
|
// update!
|
|
grView.DataBind();
|
|
}
|
|
/// <summary>
|
|
/// clona una combinazione schede famiglia ad un altra
|
|
/// </summary>
|
|
/// <param name="codFamSrc"></param>
|
|
/// <param name="codFamDest"></param>
|
|
public void clonaFamMacc(string codFamSrc, string codFamDest)
|
|
{
|
|
// inserisco nuovo record
|
|
DtProxy.man.taSCFM.clonaFamMacc(codFamSrc, codFamDest);
|
|
// update!
|
|
grView.DataBind();
|
|
}
|
|
|
|
internal void doUpdate()
|
|
{
|
|
grView.DataBind();
|
|
}
|
|
|
|
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// CodFam selezionata
|
|
/// </summary>
|
|
public string CodFamSel
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
answ = grView.SelectedDataKey["CodFam"].ToString();
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// CodSchedaVers selezionata
|
|
/// </summary>
|
|
public string CodSchedaVersSel
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
answ = grView.SelectedDataKey["CodSchedaVers"].ToString();
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// selezionato valore
|
|
/// </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 = "";
|
|
if (SteamWare.memLayer.ML.isInSessionObject("nextObjCommand"))
|
|
{
|
|
_comando = SteamWare.memLayer.ML.StringSessionObj("nextObjCommand");
|
|
SteamWare.memLayer.ML.emptySessionVal("nextObjCommand");
|
|
}
|
|
if (_comando != "")
|
|
{
|
|
// SE c'era comando eseguo move...
|
|
switch (_comando)
|
|
{
|
|
case "moveUp":
|
|
case "moveDown":
|
|
DtProxy.man.taSCFM.moveUpDown(_comando, CodFamSel, CodSchedaVersSel);
|
|
break;
|
|
//case "clone":
|
|
// DtProxy.man.taDS.clone(memLayer.ML.QSS("CodSchedaVers"), grView.SelectedDataKey["CodMisura"].ToString());
|
|
// break;
|
|
default:
|
|
break;
|
|
}
|
|
resetSelezione();
|
|
}
|
|
else
|
|
{
|
|
raiseEvent();
|
|
}
|
|
}
|
|
/// <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);
|
|
}
|
|
/// <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());
|
|
if (memLayer.ML.BoolSessionObj("filtByFamMac"))
|
|
{
|
|
switch (direction)
|
|
{
|
|
case "UP":
|
|
answ = Ordinale > 1;
|
|
break;
|
|
case "DOWN":
|
|
answ = Ordinale < DtProxy.man.taSCFM.getByFamMacc(memLayer.ML.QSS("CodFam")).Rows.Count;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
} |