diff --git a/WebSites/WebGIM/Appunti.txt b/WebSites/WebGIM/Appunti.txt
index 2c49e51..7fb5826 100644
--- a/WebSites/WebGIM/Appunti.txt
+++ b/WebSites/WebGIM/Appunti.txt
@@ -1,4 +1,10 @@
------------------------
+- 20080114
+------------------------
+Modificare comportamento cancellabilità impianti: il 1° NON DEVE ESSERE cancellabile...
+
+
+------------------------
- 20080113
------------------------
diff --git a/WebSites/WebGIM/impianti.aspx.cs b/WebSites/WebGIM/impianti.aspx.cs
index 1ea936c..2e7128b 100644
--- a/WebSites/WebGIM/impianti.aspx.cs
+++ b/WebSites/WebGIM/impianti.aspx.cs
@@ -11,13 +11,8 @@ public partial class impianti : System.Web.UI.Page
{
mod_impianti1.eh_selValore += new EventHandler(Mod_macchine1_eh_selValore);
mod_impianti1.eh_resetSelezione += new EventHandler(Mod_macchine1_eh_resetSelezione);
-#if false
- if (memLayer.ML.BoolSessionObj("fromJump"))
- {
- memLayer.ML.emptySessionVal("fromJump");
- Response.Redirect("macchine.aspx");
- }
-#endif
+ // abilito solo alla vista..
+ mod_macchine1.vistaModulo = SteamWare.tipoVistaMod.selezione;
}
void Mod_macchine1_eh_resetSelezione(object sender, EventArgs e)
diff --git a/WebSites/WebGIM/macchine.aspx b/WebSites/WebGIM/macchine.aspx
new file mode 100644
index 0000000..3d2b537
--- /dev/null
+++ b/WebSites/WebGIM/macchine.aspx
@@ -0,0 +1,8 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/AjaxSearch.master" AutoEventWireup="true" CodeFile="macchine.aspx.cs" Inherits="macchine" %>
+
+<%@ Register src="mod_macchine.ascx" tagname="mod_macchine" tagprefix="uc1" %>
+
+
+
+
+
diff --git a/WebSites/WebGIM/macchine.aspx.cs b/WebSites/WebGIM/macchine.aspx.cs
new file mode 100644
index 0000000..5004cf6
--- /dev/null
+++ b/WebSites/WebGIM/macchine.aspx.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+public partial class macchine : System.Web.UI.Page
+{
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ // abilitato editing
+ mod_macchine1.vistaModulo = SteamWare.tipoVistaMod.editing;
+ }
+}
diff --git a/WebSites/WebGIM/mod_impianti.ascx b/WebSites/WebGIM/mod_impianti.ascx
index 2ff0c3e..870da35 100644
--- a/WebSites/WebGIM/mod_impianti.ascx
+++ b/WebSites/WebGIM/mod_impianti.ascx
@@ -28,7 +28,7 @@
ToolTip='<%# traduci("Select") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.seleziona, SteamWare.dimImg.small) %>' />
+ ToolTip='<%# traduci("Edit") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.modifica, SteamWare.dimImg.small) %>' Visible='<%# isDeletable(Eval("idxImpianto")) %>' />
diff --git a/WebSites/WebGIM/mod_impianti.ascx.cs b/WebSites/WebGIM/mod_impianti.ascx.cs
index 2a10320..76edd02 100644
--- a/WebSites/WebGIM/mod_impianti.ascx.cs
+++ b/WebSites/WebGIM/mod_impianti.ascx.cs
@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
-using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
+using System.Data;
public partial class mod_impianti : ApplicationUserControl
{
@@ -14,7 +14,6 @@ public partial class mod_impianti : ApplicationUserControl
protected string _idxGridView;
protected string _idxGridViewExt;
- protected string _tabCache;
protected bool _showNewBtn = false;
///
@@ -128,7 +127,6 @@ public partial class mod_impianti : ApplicationUserControl
{
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
ods.Insert();
- SteamWare.memLayer.ML.emptyCacheVal(_tabCache);
}
///
/// annulla inserimento nuovo valore da footer
@@ -305,7 +303,6 @@ public partial class mod_impianti : ApplicationUserControl
{
base.OnInit(e);
_idxGridView = "idxImpianto";
- _tabCache = "tabImpianti";
}
///
/// setta selected alla riga il cui valore key è in session
@@ -352,7 +349,7 @@ public partial class mod_impianti : ApplicationUserControl
// reset selezione...
resetSelezione();
// i primi valori ("0") di default sono "ND"... li inserisco come standard...
- TA_app.obj.taImpianti.Insert("0000","-- [NUOVO] Nome Impianto non definito --", "tipo n.d.", DateTime.Today, DateTime.Today.AddYears(10));
+ TA_app.obj.taImpianti.Insert("0000", "-- [NUOVO] Nome Impianto non definito --", "tipo n.d.", DateTime.Today, DateTime.Today.AddYears(10));
grView.DataBind();
}
///
@@ -389,12 +386,29 @@ public partial class mod_impianti : ApplicationUserControl
// blocco update!
e.Cancel = true;
break;
- default:
+ default:
// faccio update!
break;
}
}
-
+ ///
+ /// determina se sia cancellabile dall'idx (1 e 2 NON LO SONO...)
+ ///
+ ///
+ ///
+ public bool isDeletable(object _idx)
+ {
+ bool answ = false;
+ int idx = -1;
+ try
+ {
+ idx = Convert.ToInt32(_idx);
+ }
+ catch
+ { }
+ if (idx > 2) answ = true;
+ return answ;
+ }
#endregion
}
\ No newline at end of file
diff --git a/WebSites/WebGIM/mod_macchine.ascx b/WebSites/WebGIM/mod_macchine.ascx
index 62519cd..bd6bad6 100644
--- a/WebSites/WebGIM/mod_macchine.ascx
+++ b/WebSites/WebGIM/mod_macchine.ascx
@@ -1,2 +1,232 @@
-<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_macchine.ascx.cs" Inherits="mod_macchine" %>
-here I am
\ No newline at end of file
+<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_macchine.ascx.cs"
+ Inherits="mod_macchine" %>
+<%@ Register Src="mod_selettore_ajax.ascx" TagName="mod_selettore_ajax" TagPrefix="uc1" %>
+<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebSites/WebGIM/mod_macchine.ascx.cs b/WebSites/WebGIM/mod_macchine.ascx.cs
index 6b148a7..220bc6e 100644
--- a/WebSites/WebGIM/mod_macchine.ascx.cs
+++ b/WebSites/WebGIM/mod_macchine.ascx.cs
@@ -3,11 +3,412 @@ using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
+using SteamWare;
+using System.Data;
-public partial class mod_macchine : System.Web.UI.UserControl
+public partial class mod_macchine : ApplicationUserControl
{
- protected void Page_Load(object sender, EventArgs e)
- {
+ protected tipoVistaMod _tipoVistaMod;
+ #region area da NON modificare
+ #region area protected
+
+ protected string _idxGridView;
+ protected string _idxGridViewExt;
+ protected bool _showNewBtn = false;
+
+ ///
+ /// imposta errore non cancellabilità per record correlati
+ ///
+ protected void setNoDeletableErrorMessage()
+ {
+ // mostro avviso di non cancellabilità...
+ lblWarning.Text = traduci("notDeletable_hasChild");
+ lblWarning.Visible = true;
+ grView.DataBind();
}
-}
+ ///
+ /// esegue cancellazione record
+ ///
+ protected void doDelete()
+ {
+ // posso cancellare...
+ lblWarning.Visible = false;
+ ods.Delete();
+ }
+ ///
+ /// Valida la cancellazione per i dati mostrati dal gridView
+ /// richiede sia preventivamentedichiarato _idxGridView
+ ///
+ ///
+ ///
+ protected virtual void validaDelete(object sender, ObjectDataSourceMethodEventArgs e)
+ {
+ int idx = Convert.ToInt32(e.InputParameters[string.Format("Original_{0}", _idxGridView)]);
+ if (objIsNotRelated(idx))
+ {
+ // annullo cancellazione...
+ e.Cancel = true;
+ // seleziono record... metto in session valore idx e poi ridisegno...
+ SteamWare.memLayer.ML.setSessionVal(_idxGridView, idx);
+ setNoDeletableErrorMessage();
+ }
+ else
+ {
+ doDelete();
+ }
+ }
+
+ ///
+ /// recupera i dati di un nuovo record contenuti nel footer di un gridView;
+ /// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
+ ///
+ ///
+ ///
+ protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e)
+ {
+ //recupero la riga footer...
+ DataColumnCollection colonne = colonneObj();
+ string nomeCol;
+ string tipoColonna = "";
+ foreach (DataColumn colonna in colonne)
+ {
+ nomeCol = colonna.ColumnName;
+ // cerco un textbox o quello che sia...
+ if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null)
+ {
+ tipoColonna = "textBox";
+ }
+ else if (grView.FooterRow.FindControl(string.Format("cal_{0}", nomeCol)) != null)
+ {
+ tipoColonna = "calTextBox";
+ }
+ else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null)
+ {
+ tipoColonna = "dropDownList";
+ }
+ else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null)
+ {
+ tipoColonna = "checkBox";
+ }
+ else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null)
+ {
+ tipoColonna = "selAjax";
+ }
+ // in base al tipo salvo negli inputparameters dell'ODS
+ switch (tipoColonna)
+ {
+ case "textBox":
+ e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text;
+ break;
+ case "calTextBox":
+ e.InputParameters[nomeCol] = Convert.ToDateTime(((TextBox)grView.FooterRow.FindControl(string.Format("cal_{0}", nomeCol))).Text);
+ break;
+ case "dropDownList":
+ e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue;
+ break;
+ case "checkBox":
+ e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).Checked;
+ break;
+ case "selAjax":
+ e.InputParameters[nomeCol] = ((mod_selettore_ajax)grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol))).valore;
+ break;
+ default:
+ break;
+ }
+ tipoColonna = "";
+ }
+ }
+ ///
+ /// inserisce nuovo valore da footer
+ ///
+ ///
+ ///
+ protected void lblIns_click(object sender, EventArgs e)
+ {
+ // click su inserimento, chiamo il metodo insert dell'ObjectDataSource
+ ods.Insert();
+ }
+ ///
+ /// annulla inserimento nuovo valore da footer
+ ///
+ ///
+ ///
+ protected void lblCanc_click(object sender, EventArgs e)
+ {
+ // annullo inserimento: nascondo footer, bind controlli...
+ grView.FooterRow.Visible = false;
+ }
+
+ ///
+ /// aggiorna controlli datagrid e numero righe in pagina
+ ///
+ protected override void aggiornaControlliDataGL()
+ {
+ base.aggiornaControlliDataGL();
+ grView.PageSize = _righeDataGridMed;
+ }
+ ///
+ /// 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 = "";
+ }
+ }
+ ///
+ /// gestione evento richeista nuovo valore (mostra footer, ...)
+ ///
+ ///
+ ///
+ protected void btnNew_Click(object sender, EventArgs e)
+ {
+ // reset selezione...
+ resetSelezione();
+ // mostro il footer oppure la riga dei dettagli x nuovo...
+ if (grView.FooterRow != null)
+ {
+ grView.FooterRow.Visible = true;
+ }
+ // sollevo evento nuovo valore...
+ if (eh_nuovoValore != null)
+ {
+ eh_nuovoValore(this, new EventArgs());
+ }
+ }
+ ///
+ /// reset della selezione
+ ///
+ ///
+ ///
+ protected void btnReset_Click(object sender, EventArgs e)
+ {
+ resetSelezione();
+ }
+ ///
+ /// gestione cambio selezione valore
+ ///
+ ///
+ ///
+ protected void grView_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ // salvo in session il valore selezionato...
+ SteamWare.memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue);
+ // sollevo evento nuovo valore...
+ if (eh_selValore != null)
+ {
+ eh_selValore(this, new EventArgs());
+ }
+ }
+ ///
+ /// resetta la selezione dei valori in caso di modifiche su altri controlli
+ ///
+ public void resetSelezione()
+ {
+ SteamWare.memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView));
+ grView.SelectedIndex = -1;
+ grView.DataBind();
+ lblWarning.Visible = false;
+ if (eh_resetSelezione != null)
+ {
+ eh_resetSelezione(this, new EventArgs());
+ }
+ }
+
+ #endregion
+
+ #region gestione eventi
+
+ public event EventHandler eh_resetSelezione;
+ public event EventHandler eh_nuovoValore;
+ public event EventHandler eh_selValore;
+
+ #endregion
+
+ #region public
+
+ ///
+ /// definisce visibilità btnNew
+ ///
+ public bool showNewBtn
+ {
+ get
+ {
+ return _showNewBtn;
+ }
+ set
+ {
+ _showNewBtn = value;
+ }
+ }
+ ///
+ /// effettua update del modulo
+ ///
+ public void doUpdate()
+ {
+ resetSelezione();
+ }
+
+
+ #endregion
+
+ #endregion
+
+ #region area codice variabile
+
+ ///
+ /// verifica complessiva non esistenza record child
+ ///
+ ///
+ ///
+ protected bool objIsNotRelated(object idxObj)
+ {
+ return false;// taMacchine.getByIdxFase(idxObj.ToString()).Rows.Count == 0;
+ }
+ ///
+ /// elenco colonne del datagrid
+ ///
+ ///
+ protected DataColumnCollection colonneObj()
+ {
+ DS_applicazione.AnagMacchineDataTable tabella = new DS_applicazione.AnagMacchineDataTable();
+ DataColumnCollection colonne = tabella.Columns;
+ return colonne;
+ }
+ ///
+ /// inizializzazione valori di default
+ ///
+ ///
+ protected override void OnInit(EventArgs e)
+ {
+ base.OnInit(e);
+ _idxGridView = "idxmacchina";
+ }
+ ///
+ /// setta selected alla riga il cui valore key è in session
+ ///
+ ///
+ ///
+ protected void grView_RowDataBound(object sender, GridViewRowEventArgs e)
+ {
+ // se riga di dati...
+ if (e.Row.RowType == DataControlRowType.DataRow)
+ {
+ // ottengo la riga tipizzata...
+ System.Data.DataRowView _drv = (System.Data.DataRowView)e.Row.DataItem;
+ DS_applicazione.AnagMacchineRow riga = (DS_applicazione.AnagMacchineRow)_drv.Row;
+ if (SteamWare.memLayer.ML.StringSessionObj(_idxGridView) == riga.idxImpianto.ToString())
+ {
+ grView.SelectedIndex = e.Row.RowIndex;
+ // salvo in session il valore selezionato...
+ SteamWare.memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), SteamWare.memLayer.ML.StringSessionObj(_idxGridView));
+ // sollevo evento nuovo valore...
+ if (eh_selValore != null)
+ {
+ eh_selValore(this, new EventArgs());
+ }
+ }
+ }
+ }
+ ///
+ /// svuoto da cache post update
+ ///
+ ///
+ ///
+ protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e)
+ {
+ // svuoto da cache...
+ }
+ ///
+ /// 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...
+ TA_app.obj.taMacchine.Insert(1, "0000", "-- [NUOVA] Nome Macchina non definito --", "modello n.d.", "", DateTime.Now.Year, 0, 0, DateTime.Today, DateTime.Today.AddYears(10));
+ grView.DataBind();
+ }
+ ///
+ /// salvo in session che il prox comando è clonare...
+ ///
+ ///
+ ///
+ protected void imgClona_Click(object sender, ImageClickEventArgs e)
+ {
+ SteamWare.memLayer.ML.setSessionVal("nextObjCommand", "clonaObj");
+ }
+ ///
+ /// in caso di aggiornamento verifico se sia salvato un comando clona...
+ ///
+ ///
+ ///
+ protected void grView_RowUpdating(object sender, GridViewUpdateEventArgs e)
+ {
+ // carico l'idx dell'oggetto
+ int _idx = Convert.ToInt32(e.Keys["idxMacchina"]);
+ string _comando = "";
+ if (SteamWare.memLayer.ML.isInSessionObject("nextObjCommand"))
+ {
+ _comando = SteamWare.memLayer.ML.StringSessionObj("nextObjCommand");
+ SteamWare.memLayer.ML.emptySessionVal("nextObjCommand");
+ }
+ // verifico il tipo di richiesta (up/down level, clona o update normale
+ switch (_comando)
+ {
+ case "clonaObj":
+#if false
+ TA_app.obj.taMacchina.sp_clonaImpianto(_idx);
+#endif
+ grView.EditIndex = -1;
+ grView.DataBind();
+ // blocco update!
+ e.Cancel = true;
+ break;
+ default:
+ // faccio update!
+ break;
+ }
+ }
+ ///
+ /// info x comportamento modulo
+ ///
+ public tipoVistaMod vistaModulo
+ {
+ get
+ {
+ return _tipoVistaMod;
+ }
+ set
+ {
+ _tipoVistaMod = value;
+ }
+ }
+
+ #endregion
+
+}
\ No newline at end of file
diff --git a/WebSites/WebGIM/mod_menuBottom.ascx b/WebSites/WebGIM/mod_menuBottom.ascx
index 10bacd2..d3d0019 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" %>
-153 -
+10 -