diff --git a/WebSites/WebGIM/famiglieMacchine.aspx b/WebSites/WebGIM/famiglieMacchine.aspx new file mode 100644 index 0000000..642de79 --- /dev/null +++ b/WebSites/WebGIM/famiglieMacchine.aspx @@ -0,0 +1,8 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/AjaxSearch.master" AutoEventWireup="true" CodeFile="famiglieMacchine.aspx.cs" Inherits="famiglieMacchine" %> + +<%@ Register src="mod_famiglieMacchine.ascx" tagname="mod_famiglieMacchine" tagprefix="uc1" %> + + + + + diff --git a/WebSites/WebGIM/famiglieMacchine.aspx.cs b/WebSites/WebGIM/famiglieMacchine.aspx.cs new file mode 100644 index 0000000..346458b --- /dev/null +++ b/WebSites/WebGIM/famiglieMacchine.aspx.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +public partial class famiglieMacchine : System.Web.UI.Page +{ + protected void Page_Load(object sender, EventArgs e) + { + + } +} diff --git a/WebSites/WebGIM/mod_elFamMacch.ascx b/WebSites/WebGIM/mod_elFamMacch.ascx new file mode 100644 index 0000000..abe1cbb --- /dev/null +++ b/WebSites/WebGIM/mod_elFamMacch.ascx @@ -0,0 +1,88 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_elFamMacch.ascx.cs" + Inherits="mod_elFamMacch" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebSites/WebGIM/mod_elFamMacch.ascx.cs b/WebSites/WebGIM/mod_elFamMacch.ascx.cs new file mode 100644 index 0000000..0c34c9f --- /dev/null +++ b/WebSites/WebGIM/mod_elFamMacch.ascx.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using SteamWare; + +public partial class mod_elFamMacch : ApplicationUserControl +{ + public event EventHandler eh_selezioneValore; + public event EventHandler eh_resetSelezione; + /// + /// evento dati associati a controllo + /// + /// + /// + protected void grView_DataBound(object sender, EventArgs e) + { + if (grView.Rows.Count > 0) + { + LinkButton lb; + // aggiorno gli headers + foreach (TableCell cella in grView.HeaderRow.Cells) + { + try + { + lb = (LinkButton)cella.Controls[0]; + lb.Text = traduci(lb.Text); + } + catch + { } + } + int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1); + lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord); + } + else + { + lblNumRec.Text = ""; + } + } + /// + /// reset delle selezioni + /// + /// + /// + protected void btnReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + /// + /// resetta la selezione dei valori in caso di modifiche su altri controlli + /// + public void resetSelezione() + { + grView.SelectedIndex = -1; + grView.DataBind(); + if (eh_resetSelezione != null) + { + eh_resetSelezione(this, new EventArgs()); + } + } + /// + /// seleziono valore in editing... + /// + /// + /// + protected void grView_RowEditing(object sender, GridViewEditEventArgs e) + { + // seleziono la riga corrente... + grView.SelectedIndex = e.NewEditIndex; + } + /// + /// gestione evento inserimento nuovo record standard (se ZERO presenti) + /// + /// + /// + protected void btnNewFromEmpty_Click(object sender, EventArgs e) + { + // reset selezione... + resetSelezione(); + // i primi valori ("0") di default sono "ND"... li inserisco come standard... + DS_applicazioneTableAdapters.AnagFamMacchineTableAdapter taFamMacc = new DS_applicazioneTableAdapters.AnagFamMacchineTableAdapter(); + taFamMacc.Insert("-- [NUOVA] n.d. --"); + grView.DataBind(); + } + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + if (eh_selezioneValore != null) + { + eh_selezioneValore(this, new EventArgs()); + } + } + /// + /// restituisce il valore selezionato... + /// + public int idxFamMacc_sel + { + get + { + return Convert.ToInt32(grView.SelectedValue); + } + } + protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e) + { + grView.SelectedIndex = -1; + grView.DataBind(); + } + /// + /// determina se sia cancellabile + /// + /// + /// + public bool isDeletable(object idx) + { + bool answ=false; + if (TA_app.obj.taMacc2Fam.getByFam(Convert.ToInt32(idx)).Rows.Count == 0) + { + answ = true; + } + return answ; + } + /// + /// esegue update + /// + public void doUpdate() + { + grView.DataBind(); + } +} diff --git a/WebSites/WebGIM/mod_elMacch2Fam.ascx b/WebSites/WebGIM/mod_elMacch2Fam.ascx new file mode 100644 index 0000000..5092f77 --- /dev/null +++ b/WebSites/WebGIM/mod_elMacch2Fam.ascx @@ -0,0 +1,56 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_elMacch2Fam.ascx.cs" + Inherits="mod_elMacch2Fam" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebSites/WebGIM/mod_elMacch2Fam.ascx.cs b/WebSites/WebGIM/mod_elMacch2Fam.ascx.cs new file mode 100644 index 0000000..34f70f6 --- /dev/null +++ b/WebSites/WebGIM/mod_elMacch2Fam.ascx.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using SteamWare; + +public partial class mod_elMacch2Fam : ApplicationUserControl +{ + public event EventHandler eh_selezioneValore; + public event EventHandler eh_delValore; + /// + /// evento dati associati a controllo + /// + /// + /// + protected void grView_DataBound(object sender, EventArgs e) + { + if (grView.Rows.Count > 0) + { + LinkButton lb; + // aggiorno gli headers + foreach (TableCell cella in grView.HeaderRow.Cells) + { + try + { + lb = (LinkButton)cella.Controls[0]; + lb.Text = traduci(lb.Text); + } + catch + { } + } + int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1); + lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord); + } + else + { + lblNumRec.Text = ""; + } + } + /// + /// indica il valore dell'impianto filtrato in visualizzazione + /// + public int idxFamMacchSel + { + get + { + return Convert.ToInt32(lblFamMacc.Text); + } + set + { + lblFamMacc.Text = value.ToString(); + } + } + /// + /// eliminato il valore genera l'evento + /// + /// + /// + protected void ods_Deleted(object sender, ObjectDataSourceStatusEventArgs e) + { + if (eh_delValore != null) + { + eh_delValore(this, new EventArgs()); + } + } +} diff --git a/WebSites/WebGIM/mod_famiglieMacchine.ascx b/WebSites/WebGIM/mod_famiglieMacchine.ascx new file mode 100644 index 0000000..7083513 --- /dev/null +++ b/WebSites/WebGIM/mod_famiglieMacchine.ascx @@ -0,0 +1,19 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_famiglieMacchine.ascx.cs" + Inherits="mod_famiglieMacchine" %> +<%@ Register Src="mod_elFamMacch.ascx" TagName="mod_elFamMacch" TagPrefix="uc1" %> +<%@ Register Src="mod_elMacch2Fam.ascx" TagName="mod_elMacch2Fam" TagPrefix="uc2" %> +<%@ Register Src="mod_selettore.ascx" TagName="mod_selettore" TagPrefix="uc3" %> +
+
+ +
+ + + + aaa + +
+
+ +
+
diff --git a/WebSites/WebGIM/mod_famiglieMacchine.ascx.cs b/WebSites/WebGIM/mod_famiglieMacchine.ascx.cs new file mode 100644 index 0000000..8680967 --- /dev/null +++ b/WebSites/WebGIM/mod_famiglieMacchine.ascx.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using SteamWare; + +public partial class mod_famiglieMacchine : System.Web.UI.UserControl +{ + protected void Page_Load(object sender, EventArgs e) + { + mod_elFamMacch1.eh_selezioneValore += new EventHandler(mod_elFamMacch1_eh_selezioneValore); + mod_elFamMacch1.eh_resetSelezione += new EventHandler(mod_elFamMacch1_eh_resetSelezione); + mod_elMacch2Fam1.eh_delValore += new EventHandler(mod_elMacch2Fam1_eh_delValore); + traduci(); + } + + private void traduci() + { + btnShowAdd.Text = user_std.UtSn.Traduci("showAddMacchine"); + btnAddMacchine.Text = user_std.UtSn.Traduci("AddMacchine2Fam"); + } + + void mod_elMacch2Fam1_eh_delValore(object sender, EventArgs e) + { + mod_elFamMacch1.doUpdate(); + } + + void mod_elFamMacch1_eh_resetSelezione(object sender, EventArgs e) + { + mod_elMacch2Fam1.Visible = false; + } + + void mod_elFamMacch1_eh_selezioneValore(object sender, EventArgs e) + { + mod_elMacch2Fam1.idxFamMacchSel = mod_elFamMacch1.idxFamMacc_sel; + mod_elMacch2Fam1.Visible = true; + } + protected void btnAddMacchine_Click(object sender, EventArgs e) + { + // salvo... + } + protected void btnShowAdd_Click(object sender, EventArgs e) + { + pnlSceltaMacchine.Visible = !pnlSceltaMacchine.Visible; + if (pnlSceltaMacchine.Visible) + { + btnShowAdd.Text = user_std.UtSn.Traduci("hideAddMacchine"); + } + else + { + btnShowAdd.Text = user_std.UtSn.Traduci("showAddMacchine"); + } + + } +} diff --git a/WebSites/WebGIM/mod_menuBottom.ascx b/WebSites/WebGIM/mod_menuBottom.ascx index 6e595ab..7e391a0 100644 --- a/WebSites/WebGIM/mod_menuBottom.ascx +++ b/WebSites/WebGIM/mod_menuBottom.ascx @@ -1,4 +1,4 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_menuBottom.ascx.cs" Inherits="mod_menuBottom" %> -17 - +20 - diff --git a/WebSites/WebGIM/mod_selettore.ascx b/WebSites/WebGIM/mod_selettore.ascx new file mode 100644 index 0000000..be3d0be --- /dev/null +++ b/WebSites/WebGIM/mod_selettore.ascx @@ -0,0 +1,58 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_selettore.ascx.cs" + Inherits="mod_selettore" %> + + + + + + + +
+ + + + +
+ +   + +   + +   + +
+
+ + + + + + + + + + + + + + + + + + + + + + +    + + + + + +
diff --git a/WebSites/WebGIM/mod_selettore.ascx.cs b/WebSites/WebGIM/mod_selettore.ascx.cs new file mode 100644 index 0000000..847fa2a --- /dev/null +++ b/WebSites/WebGIM/mod_selettore.ascx.cs @@ -0,0 +1,486 @@ +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; +using SteamWare; + +[ValidationProperty("valore")] +public partial class mod_selettore : ApplicationUserControl +{ + + protected bool _chkVisibile = false; + protected bool _isValueVisible = false; + protected bool _cambioTipo = false; + + protected string _valoreFull; + protected string _val1; + protected string _val2; + #region gestione eventi + + public event EventHandler eh_selDone; + public event EventHandler eh_update; + + #endregion + + #region gestione pagina + + protected override void Page_Load(object sender, EventArgs e) + { + base.Page_Load(sender, e); + updateChkOpzione(); + if (!Page.IsPostBack) + { + memLayer.ML.emptySessionVal(searchSessionName); + } + } + + protected override void traduciObj() + { + base.traduciObj(); + lblCerca.Text = traduci("lblCerca"); + btnCerca.Text = traduci("search"); + if (_chkVisibile) + { + updateChkOpzione(); + } + } + + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + if (!Page.IsPostBack) + { + _val1 = ""; + _val2 = ""; + traduciObj(); + } + if (vistaModulo == tipoVistaMod.editing) + { + setSearchValue(); + impostaCampoRicerca(); + } + } + /// + /// imposta il valore della ricerca da quello in session + /// + private void setSearchValue() + { + if (memLayer.ML.isInSessionObject(searchSessionName)) + { + testoRicerca = memLayer.ML.StringSessionObj(searchSessionName); + } + } + /// + /// imposta i campi del filtro ricerca in session + /// + private void impostaCampoRicerca() + { + // imposto il nome del valore session x ricerca a campo univoco... + SessionParameter parametroFiltro = new SessionParameter(); + parametroFiltro.SessionField = searchSessionName; + parametroFiltro.Name = searchSessionName; + parametroFiltro.DefaultValue = "*"; + ods.FilterParameters.Clear(); + ods.FilterParameters.Add(parametroFiltro); + } + /// + /// setta il nome del campo di ricerca + /// + protected string searchSessionName + { + get + { + return string.Format("ricerca_{0}", _tipoSelettore); + } + } + + #endregion + + #region area protected + + protected string _conditio = ""; + protected string testoRicerca + { + get + { + return txtCerca.Text.Trim(); + } + set + { + txtCerca.Text = value; + } + } + + protected selettori _selettori = new selettori(); + /// + /// a seconda del tipo di selettore cambierà l'origine ods + /// + /// + /// + protected void chkOpzione_CheckedChanged(object sender, EventArgs e) + { + fixChkOds(); + } + + protected void setCheck() + { + if (_tipoSelettore == tipoSelettore.utentiAll || _tipoSelettore == tipoSelettore.utentiCdc) + { + _chkVisibile = true; + } + else + { + _chkVisibile = false; + } + } + + /// + /// aggiorna visualizzazione del check opzionale con label e visibilità + /// + protected void updateChkOpzione() + { + // se definito il tipo decido SE mostrare il check e tradurre la label... + if (_tipoSelettore == tipoSelettore.utentiAll || _tipoSelettore == tipoSelettore.utentiCdc) + { + chkOpzione.Visible = true; + chkOpzione.Text = traduci("chkSoloGer"); + if (_tipoSelettore == tipoSelettore.utentiCdc) + { + chkOpzione.Checked = true; + } + } + else + { + chkOpzione.Visible = false; + } + } + + + /// + /// aggiorna label e valore principale da una chiave multipart + /// + private void aggiornaDaValMulti() + { + // eseguo SE E SOLO SE entrambi i valori sono popolati + if (val1 != "" && val1 != null) + { + if (val2 != "" && val2 != null && val2 != "na") + { + _valoreFull = string.Format("{0}#{1}", val1, val2); + } + else + { + _valoreFull = val1; + } + } + } + + + /// + /// tipo di valori mostrati + /// + protected tipoSelettore _tipoSelettore = tipoSelettore.cdc; + /// + /// nome del controllo gestito dal nostro popup + /// + protected string _targetControl = ""; + /// + /// sistemo gli ods + /// + protected override void bindControlli() + { + base.bindControlli(); + fixChkOds(); + fixOds(); + } + /// + /// sistema l'ods dato lo stato del chk + /// + protected void fixChkOds() + { + if (_tipoSelettore == tipoSelettore.utentiAll || _tipoSelettore == tipoSelettore.utentiCdc) + { + // verifico se sia o meno checked "solo cdc utente"... + if (chkOpzione.Checked) + { + //imposto nuovo tipo selettore + _tipoSelettore = tipoSelettore.utentiCdc; + fixOds(); + } + else + { + //imposto nuovo tipo selettore + _tipoSelettore = tipoSelettore.utentiAll; + fixOds(); + } + // faccio databind... + grView.PageIndex = 0; + grView.DataBind(); + } +#if false + else if (_tipoSelettore == tipoSelettore.utentiAD_All || _tipoSelettore == tipoSelettore.utentiAD_cdc) + { + // verifico se sia o meno checked "solo cdc utente"... + if (chkOpzione.Checked) + { + //imposto nuovo tipo selettore + _tipoSelettore = tipoSelettore.utentiAD_cdc; + fixOds(); + } + else + { + //imposto nuovo tipo selettore + _tipoSelettore = tipoSelettore.utentiAD_All; + fixOds(); + } + // faccio databind... + grView.PageIndex = 0; + grView.DataBind(); + } +#endif + } + /// + /// sistemazione fonte ods... + /// + protected void fixOds() + { + string _selectMethod = ""; + switch (_tipoSelettore) + { + case tipoSelettore.cdc: + _selectMethod = "getSelAllCdC"; + break; + case tipoSelettore.impianti: + _selectMethod = "getSelImpianti"; + break; + case tipoSelettore.macchine: + _selectMethod = "getSelMacchine"; + break; + case tipoSelettore.utentiAll: + _selectMethod = "getSelAllUsers"; + break; + case tipoSelettore.utentiCdc: + _selectMethod = "getSelUsersGer"; + break; + } + ods.SelectMethod = _selectMethod; + } + + /// + /// traduce gli header delle colonne + /// + /// + /// + protected void grView_DataBound(object sender, EventArgs e) + { + if (grView.Rows.Count > 0) + { + LinkButton lb; + // aggiorno gli headers + foreach (TableCell cella in grView.HeaderRow.Cells) + { + try + { + lb = (LinkButton)cella.Controls[0]; + lb.Text = traduci(lb.Text); + } + catch + { } + } + int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1); + lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord); + } + else + { + lblNumRec.Text = ""; + } + } + /// + /// selezione annullata su cambio pagina + /// + /// + /// + protected void grView_PageIndexChanged(object sender, EventArgs e) + { + grView.SelectedIndex = -1; + } + /// + /// aggiornamento filtro da stringa di ricerca del popup + /// + /// + /// + protected void txtCerca_TextChanged(object sender, EventArgs e) + { + // se cambio filtro tolgo il selected... + grView.SelectedIndex = -1; + // salvo la ricerca in session e filter dell'ods... + memLayer.ML.setSessionVal(searchSessionName, txtCerca.Text); + impostaCampoRicerca(); + fixChkOds(); + fixOds(); + } + /// + /// salvo il valore selezionato + /// + /// + /// + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + string valore = grView.SelectedValue.ToString(); + // se ho una chiave multiparte salvo nei 2 valori... + if (valore.IndexOf('#') > -1) + { + string[] valori = valore.Split('#'); + val1 = valori[0]; + val2 = valori[1]; + } + if (eh_selDone != null) + { + eh_selDone(this, new EventArgs()); + } + } + + /// + /// resetta ricerca e selezione + /// + /// + /// + protected void btnReset_Click(object sender, EventArgs e) + { + grView.SelectedIndex = -1; + testoRicerca = ""; + memLayer.ML.emptySessionVal(searchSessionName); + } + + #endregion + + #region area public + + /// + /// tipo di selettore da istanziare + /// + public tipoSelettore tipo + { + get + { + return _tipoSelettore; + } + set + { + _tipoSelettore = value; + setCheck(); + } + } + + /// + /// effettua update del controllo + /// + public void doUpdate() + { + // svuoto ricerca... + memLayer.ML.emptySessionVal(searchSessionName); + testoRicerca = ""; + // imposto valori cercati... + setSearchValue(); + impostaCampoRicerca(); + // continuo con update + updateChkOpzione(); + fixOds(); + aggiornaDaValMulti(); + // faccio databind... + grView.PageIndex = 0; + grView.DataBind(); + } + + /// + /// valore mostrato nel campo testo del selettore + /// + public string valore + { + get + { + return grView.SelectedValue.ToString(); + } + set + { + _valoreFull = value; + } + } + /// + /// valore di una chiave multiparte + /// + public string val1 + { + get + { + return _val1; + } + set + { + _val1 = value; + aggiornaDaValMulti(); + } + } + + /// + /// valore di una chiave multiparte + /// + public string val2 + { + get + { + return _val2; + } + set + { + _val2 = value; + aggiornaDaValMulti(); + } + } + /// + /// impone una condizione di filtro sui valori mostrati + /// + public string conditio + { + get + { + return _conditio; + } + set + { + _conditio = value; + if (_conditio != "") + { + ods.SelectParameters.Clear(); + ods.SelectParameters.Add("where", string.Format(" conditio = '{0}' ", _conditio)); + } + else + { + ods.SelectParameters.Clear(); + ods.SelectParameters.Add("where", " conditio = '*' "); + } + } + } + /// + /// determina se il valore da selezionare sia da visualizzare o meno + /// + public bool isValueVisible + { + get + { + return _isValueVisible; + } + set + { + _isValueVisible = value; + } + } + + #endregion +} diff --git a/WebSites/WebGIM/mod_selettore_ajax.ascx.cs b/WebSites/WebGIM/mod_selettore_ajax.ascx.cs index e83fea4..7a6e5a7 100644 --- a/WebSites/WebGIM/mod_selettore_ajax.ascx.cs +++ b/WebSites/WebGIM/mod_selettore_ajax.ascx.cs @@ -497,11 +497,3 @@ public partial class mod_selettore_ajax : ApplicationUserControl #endregion } -public enum tipoSelettore -{ - cdc, - impianti, - macchine, - utentiAll, - utentiCdc -} \ No newline at end of file