using CMS_SC_Data; using SteamWare; using System; using System.Web.UI.WebControls; namespace CMS_SC.WebUserControls { public partial class mod_SchemaCollFamMacc : SteamWare.UserControl {/// /// selezione valore in DettScheda /// public event EventHandler eh_selezioneValore; /// /// richiesta SAVE (da enter) /// public event EventHandler eh_reqSave; /// /// sollevo evento selezione /// protected void raiseEvent() { // sollevo evento nuovo valore... if (eh_selezioneValore != null) { eh_selezioneValore(this, new EventArgs()); } } /// /// resetto selezione /// private void resetSelezione() { grView.SelectedIndex = -1; grView.DataBind(); raiseEvent(); } protected void Page_Load(object sender, EventArgs e) { } /// /// dimensione pagina grid view /// public int pageSize { get { return grView.PageSize; } set { grView.PageSize = value; } } /// /// inserimento nuovo record x chiave indicata /// /// /// public void addNewFromSel(string CodSchedaVers, string codFam) { // inserisco nuovo record DtProxy.man.taSCFM.insertQuery(CodSchedaVers, codFam); // update! grView.DataBind(); } /// /// clona una combinazione schede famiglia ad un altra /// /// /// 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) { } /// /// CodFam selezionata /// public string CodFamSel { get { string answ = ""; try { answ = grView.SelectedDataKey["CodFam"].ToString(); } catch { } return answ; } } /// /// CodSchedaVers selezionata /// public string CodSchedaVersSel { get { string answ = ""; try { answ = grView.SelectedDataKey["CodSchedaVers"].ToString(); } catch { } return answ; } } /// /// selezionato valore /// /// /// 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(); } } /// /// salvo in session il prox comando /// /// /// protected void lb_Click(object sender, EventArgs e) { SteamWare.memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument); } /// /// determina visibilità frecce spostamento /// /// direzione: UP / DOWN /// Ordinale /// 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; } } }