diff --git a/ETS_Data/Ds_ProjEts.Designer.cs b/ETS_Data/Ds_ProjEts.Designer.cs index 84a82ea..971e9c5 100644 --- a/ETS_Data/Ds_ProjEts.Designer.cs +++ b/ETS_Data/Ds_ProjEts.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18033 +// Runtime Version:4.0.30319.18046 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -5544,6 +5544,7 @@ namespace ETS_Data.Ds_ProjEtsTableAdapters { this._commandCollection[8].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@anno", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[8].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@idxProgetto", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[8].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@descrizioneFase", global::System.Data.SqlDbType.NVarChar, 250, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[8].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@isZero", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[9] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[9].Connection = this.Connection; this._commandCollection[9].CommandText = "dbo.stp_AF_InsertQuery"; @@ -5861,7 +5862,7 @@ namespace ETS_Data.Ds_ProjEtsTableAdapters { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - public virtual int InsertCommessa(global::System.Nullable anno, global::System.Nullable idxProgetto, string descrizioneFase) { + public virtual int InsertCommessa(global::System.Nullable anno, global::System.Nullable idxProgetto, string descrizioneFase, global::System.Nullable isZero) { global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[8]; if ((anno.HasValue == true)) { command.Parameters[1].Value = ((int)(anno.Value)); @@ -5881,6 +5882,12 @@ namespace ETS_Data.Ds_ProjEtsTableAdapters { else { command.Parameters[3].Value = ((string)(descrizioneFase)); } + if ((isZero.HasValue == true)) { + command.Parameters[4].Value = ((bool)(isZero.Value)); + } + else { + command.Parameters[4].Value = global::System.DBNull.Value; + } global::System.Data.ConnectionState previousConnectionState = command.Connection.State; if (((command.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { @@ -6287,13 +6294,19 @@ namespace ETS_Data.Ds_ProjEtsTableAdapters { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitCommandCollection() { - this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1]; + this._commandCollection = new global::System.Data.SqlClient.SqlCommand[2]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "dbo.stp_DC_getByIdxFase"; this._commandCollection[0].CommandType = global::System.Data.CommandType.StoredProcedure; this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@idxFase", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[1].Connection = this.Connection; + this._commandCollection[1].CommandText = "dbo.stp_DC_GetZeroByYear"; + this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@anno", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6332,6 +6345,23 @@ namespace ETS_Data.Ds_ProjEtsTableAdapters { return dataTable; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)] + public virtual Ds_ProjEts.DatiCommessaDataTable getZeroByYear(global::System.Nullable anno) { + this.Adapter.SelectCommand = this.CommandCollection[1]; + if ((anno.HasValue == true)) { + this.Adapter.SelectCommand.Parameters[1].Value = ((int)(anno.Value)); + } + else { + this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value; + } + Ds_ProjEts.DatiCommessaDataTable dataTable = new Ds_ProjEts.DatiCommessaDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] diff --git a/ETS_Data/Ds_ProjEts.xsd b/ETS_Data/Ds_ProjEts.xsd index 099c6ac..ebb553f 100644 --- a/ETS_Data/Ds_ProjEts.xsd +++ b/ETS_Data/Ds_ProjEts.xsd @@ -306,7 +306,7 @@ - + dbo.stp_AF_DC_Insert @@ -315,11 +315,12 @@ + - + dbo.stp_AF_InsertQuery @@ -338,7 +339,7 @@ - + dbo.stp_AF_updateFaseAncest @@ -350,7 +351,7 @@ - + dbo.stp_AF_updateProgetto @@ -362,7 +363,7 @@ - + dbo.stp_AF_updateQuery @@ -441,7 +442,19 @@ - + + + + + dbo.stp_DC_GetZeroByYear + + + + + + + + @@ -584,7 +597,7 @@ - + @@ -627,7 +640,7 @@ - + @@ -677,7 +690,7 @@ - + @@ -765,7 +778,7 @@ - + @@ -809,7 +822,7 @@ - + @@ -879,10 +892,10 @@ - - - - + + + + \ No newline at end of file diff --git a/ETS_Data/Ds_ProjEts.xss b/ETS_Data/Ds_ProjEts.xss index 38bc896..9c1febd 100644 --- a/ETS_Data/Ds_ProjEts.xss +++ b/ETS_Data/Ds_ProjEts.xss @@ -4,16 +4,16 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - + - - - - + + + + - + 370 @@ -25,7 +25,7 @@ - + 876 @@ -37,7 +37,7 @@ - + 1107 @@ -49,7 +49,7 @@ - + 1107 diff --git a/PROJ-ETS/PROJ-ETS/Web.config b/PROJ-ETS/PROJ-ETS/Web.config index 11d9acc..435726d 100644 --- a/PROJ-ETS/PROJ-ETS/Web.config +++ b/PROJ-ETS/PROJ-ETS/Web.config @@ -26,7 +26,7 @@ - + diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_commesse.ascx b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_commesse.ascx index a9a072c..2a02698 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_commesse.ascx +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_commesse.ascx @@ -17,6 +17,9 @@ +    + diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_commesse.ascx.cs b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_commesse.ascx.cs index 73c26ab..3b46495 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_commesse.ascx.cs +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_commesse.ascx.cs @@ -9,315 +9,326 @@ using ETS_Data; namespace PROJ_ETS.WebUserControls { - public partial class mod_commesse : System.Web.UI.UserControl - { + public partial class mod_commesse : System.Web.UI.UserControl + { - #region area standard (non modificare) + #region area standard (non modificare) - #region gestione eventi + #region gestione eventi - public event EventHandler eh_resetSelezione; - public event EventHandler eh_nuovoValore; + public event EventHandler eh_resetSelezione; + public event EventHandler eh_nuovoValore; - #endregion + #endregion - /// - /// reset della selezione - /// - /// - /// - protected void btnReset_Click(object sender, EventArgs e) - { - resetSelezione(); - } - /// - /// 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; - } - /// - /// traduce gli header delle colonne - /// - /// - /// - protected void grView_DataBound(object sender, EventArgs e) - { - if (grView.Rows.Count > 0) - { - 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 della selezione + /// + /// + /// + protected void btnReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + /// + /// 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; + } + /// + /// traduce gli header delle colonne + /// + /// + /// + protected void grView_DataBound(object sender, EventArgs e) + { + if (grView.Rows.Count > 0) + { + 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 = ""; + } + } - #endregion + #endregion - #region area CUSTOM (da modificare) + #region area CUSTOM (da modificare) - #region gestione eventi + #region gestione eventi - public event EventHandler eh_faseSel; + public event EventHandler eh_faseSel; - #endregion + #endregion - /// - /// uid base - /// - protected string sessionUid - { - get - { - return this.UniqueID.Replace("$", "-"); - } - } + /// + /// uid base + /// + protected string sessionUid + { + get + { + return this.UniqueID.Replace("$", "-"); + } + } - /// - /// idx del cliente selezionato - /// - public int idxCliente - { - get - { - return utils.obj.IntSessionObj(string.Format("idxCli_{0}", sessionUid)); - } - set - { - utils.obj.setSessionVal(string.Format("idxCli_{0}", sessionUid), value); - } - } - /// - /// idx del progetto selezionato - /// - public int idxProgetto - { - get - { - return utils.obj.IntSessionObj(string.Format("idxProj_{0}", sessionUid)); - } - set - { - utils.obj.setSessionVal(string.Format("idxProj_{0}", sessionUid), value); + /// + /// idx del cliente selezionato + /// + public int idxCliente + { + get + { + return utils.obj.IntSessionObj(string.Format("idxCli_{0}", sessionUid)); + } + set + { + utils.obj.setSessionVal(string.Format("idxCli_{0}", sessionUid), value); + } + } + /// + /// idx del progetto selezionato + /// + public int idxProgetto + { + get + { + return utils.obj.IntSessionObj(string.Format("idxProj_{0}", sessionUid)); + } + set + { + utils.obj.setSessionVal(string.Format("idxProj_{0}", sessionUid), value); - // svuoto select parameters - ods.SelectParameters.Clear(); - // imposto i parametri... - ods.SelectParameters.Add("idxProgetto", DbType.Int32, value.ToString()); - ods.DataBind(); - } - } - /// - /// valore della fase selezionata - /// - public int idxFase - { - get - { - int answ = 0; - if (grView.SelectedIndex >= 0) - { - try - { - answ = Convert.ToInt32(grView.SelectedValue); - } - catch - { } - } - return answ; - } - } - /// - /// pagina corrente (URL finale) - /// - public string _paginaCorrente { get; set; } - /// - /// caricamento - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - PagCorrente(); - } - setDetVisibility(); - } - /// - /// salva in variabile pagina il nome della pagina corrente - /// - protected void PagCorrente() - { - Uri MyUrl = Request.Url; - string delimStr = "/"; - char[] delimiter = delimStr.ToCharArray(); - string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter); - int n = finalUrl.Length; - _paginaCorrente = finalUrl[n - 1].ToString(); - } - /// - /// sistema visibilità area dettaglio RA - /// - private void setDetVisibility() - { - pnlDetRA.Visible = enableShowRA; - lblDet.Visible = (grView.SelectedIndex >= 0); - } + // svuoto select parameters + ods.SelectParameters.Clear(); + // imposto i parametri... + ods.SelectParameters.Add("idxProgetto", DbType.Int32, value.ToString()); + ods.DataBind(); + } + } + /// + /// valore della fase selezionata + /// + public int idxFase + { + get + { + int answ = 0; + if (grView.SelectedIndex >= 0) + { + try + { + answ = Convert.ToInt32(grView.SelectedValue); + } + catch + { } + } + return answ; + } + } + /// + /// pagina corrente (URL finale) + /// + public string _paginaCorrente { get; set; } + /// + /// caricamento + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + PagCorrente(); + } + setDetVisibility(); + } + /// + /// salva in variabile pagina il nome della pagina corrente + /// + protected void PagCorrente() + { + Uri MyUrl = Request.Url; + string delimStr = "/"; + char[] delimiter = delimStr.ToCharArray(); + string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter); + int n = finalUrl.Length; + _paginaCorrente = finalUrl[n - 1].ToString(); + } + /// + /// sistema visibilità area dettaglio RA + /// + private void setDetVisibility() + { + pnlDetRA.Visible = enableShowRA; + lblDet.Visible = (grView.SelectedIndex >= 0); + } - /// - /// 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("dl{0}", nomeCol)) != null) - { - tipoColonna = "dropDownList"; - } - else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null) - { - tipoColonna = "checkBox"; - } - // 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 "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("chk{0}", nomeCol))).Checked; - break; - default: - break; - } - tipoColonna = ""; - } - } - /// - /// gestione evento richiesta nuova commessa - /// - /// - /// - protected void btnNewComm_Click(object sender, EventArgs e) - { - // creo direttamente record con valori "standard" - DataProxy_ProjEts.DP.taAF.InsertCommessa(DateTime.Now.Year, utils.obj.IntSessionObj("idxProgetto_sel"), string.Format("Nuova Commessa del {0:dd/MM/yyyy} creata da {1}", DateTime.Now, utils.obj.currUserCognomeNome)); - grView.DataBind(); - } - /// - /// gestione evento richiesta nuovo valore (mostra footer, ...) - /// - /// - /// - protected void btnNew_Click(object sender, EventArgs e) - { - // controllo se c'è un argument x la fase... - string idxFaseAncest = "0"; - try - { - idxFaseAncest = ((ImageButton)sender).CommandArgument; - } - catch - { } - utils.obj.setSessionVal("idxFaseAncest", idxFaseAncest); - if (idxFaseAncest == "0") - { - // 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()); - } - } - /// - /// gestione evento richiesta nuovo valore QUANDO NON CI SIANO RECORDS! - /// - /// - /// - protected void btnNewEmpty_Click(object sender, EventArgs e) - { - utils.obj.setSessionVal("idxFaseAncest", "0"); - // !!!FARE!!! gestioen insert con calcolo num commessa, ... -#if false - DataProxy.DP.taAF.insertQuery(idxProgetto, 0, "NuovaFase", "DescrizioneFase", false, false, 0, 0, true); -#endif - grView.DataBind(); - // sollevo evento nuovo valore... - if (eh_nuovoValore != null) - { - eh_nuovoValore(this, new EventArgs()); - } - } - /// - /// elenco colonne del datagrid - /// - /// - protected DataColumnCollection colonneObj() - { - Ds_ProjEts.AnagFasiDataTable tabella = new Ds_ProjEts.AnagFasiDataTable(); - DataColumnCollection colonne = tabella.Columns; - return colonne; - } - /// - /// determina se sia eliminabile il record (=non usato) - /// - /// - /// - public bool delEnabled(object idxObj) - { - bool answ = isWritable(); - // solo se ha diritti scrittura controllo - if (answ) - { - // la cancellazione è SEMPRE logica, x cui controllo che si veda solo se è attivo... - try - { - answ = DataProxy_ProjEts.DP.taAF.getByIdx(Convert.ToInt32(idxObj))[0].Attivo; - } - catch - { } + /// + /// 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("dl{0}", nomeCol)) != null) + { + tipoColonna = "dropDownList"; + } + else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null) + { + tipoColonna = "checkBox"; + } + // 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 "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("chk{0}", nomeCol))).Checked; + break; + default: + break; + } + tipoColonna = ""; + } + } + /// + /// gestione evento richiesta nuova commessa + /// + /// + /// + protected void btnNewComm_Click(object sender, EventArgs e) + { + // creo direttamente record con valori "standard" + DataProxy_ProjEts.DP.taAF.InsertCommessa(DateTime.Now.Year, utils.obj.IntSessionObj("idxProgetto_sel"), string.Format("Nuova Commessa del {0:dd/MM/yyyy} creata da {1}", DateTime.Now, utils.obj.currUserCognomeNome), false); + grView.DataBind(); + } + /// + /// gestione evento richiesta nuovo valore (mostra footer, ...) + /// + /// + /// + protected void btnNew_Click(object sender, EventArgs e) + { + // controllo se c'è un argument x la fase... + string idxFaseAncest = "0"; + try + { + idxFaseAncest = ((ImageButton)sender).CommandArgument; + } + catch + { } + utils.obj.setSessionVal("idxFaseAncest", idxFaseAncest); + if (idxFaseAncest == "0") + { + // 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()); + } + } + /// + /// gestione evento richiesta nuovo valore QUANDO NON CI SIANO RECORDS! + /// + /// + /// + protected void btnNewEmpty_Click(object sender, EventArgs e) + { + DataProxy_ProjEts.DP.taAF.InsertCommessa(DateTime.Now.Year, utils.obj.IntSessionObj("idxProgetto_sel"), string.Format("Nuova Commessa del {0:dd/MM/yyyy} creata da {1}", DateTime.Now, utils.obj.currUserCognomeNome), false); + grView.DataBind(); + // sollevo evento nuovo valore... + if (eh_nuovoValore != null) + { + eh_nuovoValore(this, new EventArgs()); + } + } + /// + /// gestione evento richiesta nuovo valore QUANDO NON CI SIANO RECORDS! + /// + /// + /// + protected void btnNewEmptyZero_Click(object sender, EventArgs e) + { + DataProxy_ProjEts.DP.taAF.InsertCommessa(DateTime.Now.Year, utils.obj.IntSessionObj("idxProgetto_sel"), string.Format("Nuova Commessa '0000' del {0:dd/MM/yyyy} creata da {1}", DateTime.Now, utils.obj.currUserCognomeNome), true); + grView.DataBind(); + // sollevo evento nuovo valore... + if (eh_nuovoValore != null) + { + eh_nuovoValore(this, new EventArgs()); + } + } + /// + /// elenco colonne del datagrid + /// + /// + protected DataColumnCollection colonneObj() + { + Ds_ProjEts.AnagFasiDataTable tabella = new Ds_ProjEts.AnagFasiDataTable(); + DataColumnCollection colonne = tabella.Columns; + return colonne; + } + /// + /// determina se sia eliminabile il record (=non usato) + /// + /// + /// + public bool delEnabled(object idxObj) + { + bool answ = isWritable(); + // solo se ha diritti scrittura controllo + if (answ) + { + // la cancellazione è SEMPRE logica, x cui controllo che si veda solo se è attivo... + try + { + answ = DataProxy_ProjEts.DP.taAF.getByIdx(Convert.ToInt32(idxObj))[0].Attivo; + } + catch + { } #if false int trovati = 0; // controllo se sia una fase "ancestor" e in tal caso NON deve avere fasi child @@ -328,271 +339,288 @@ namespace PROJ_ETS.WebUserControls answ = false; } #endif - } - return answ; - } - /// - /// calcola classe css dato codice fase - /// - /// - /// - public string classByCod(object codFase) - { - string answ = ""; - int livello = 0; - // calcolo livello come num punti "." -1... - try - { - string[] array = codFase.ToString().Split('.'); - livello = array.Length; - } - catch - { } - if (livello < 4) - { - answ = "fontNormale textNero"; - } - else - { - answ = "fontPiccolo textAzzurro"; - } - return answ; - } - /// - /// determina dimensioni dell'oggetto spaziatore data la fase - /// - /// - /// - public Unit widthByCod(object codFase) - { - Unit answ = new Unit(0, UnitType.Pixel); - int livello = 0; - // calcolo livello come num punti "." -1... - try - { - string[] array = codFase.ToString().Split('.'); - livello = array.Length; - } - catch - { } - if (livello >= 4) - { - answ = new Unit((livello - 3) * 10, UnitType.Pixel); - } - return answ; - } - /// - /// inverte valore booleano - /// - /// - /// - public bool invBool(object valore) - { - bool answ = true; - try - { - answ = !Convert.ToBoolean(valore); - } - catch - { } - return answ; - } - /// - /// resetta la selezione dei valori in caso di modifiche su altri controlli - /// - public void resetSelezione() - { - grView.SelectedIndex = -1; - grView.DataBind(); - setDetVisibility(); - if (eh_resetSelezione != null) - { - eh_resetSelezione(this, new EventArgs()); - } - } - /// - /// indico cambio selezione valore... - /// - /// - /// - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - setDetVisibility(); - if (eh_faseSel != null) - { - eh_faseSel(this, new EventArgs()); - } - } - /// - /// restituisce una classe css a seconda dei valori passati: - /// green: bdgt > real - /// orange: real > bdgt*warning - /// red: real > bdgt - /// std: errore... - /// - /// - /// - /// - public string colorByVal(object real, object bdgt) - { - string answ = "badgeStd"; - try - { - double valoreReal = Convert.ToDouble(real); - double valoreBdget = Convert.ToDouble(bdgt); - double valoreWarn = Convert.ToDouble(bdgt) * Convert.ToDouble(utils.obj.confReadString("warningRatioPerc")) / 100; - if (valoreReal >= valoreBdget) - { - answ = "badgeRosso"; - } - else if (valoreReal >= valoreWarn) - { - answ = "badgeArancio"; - } - else - { - answ = "badgeVerde"; - } - } - catch - { - } - return "ui-corner-all " + answ; - } - /// - /// determina se sia visibile pnl dettaglio RA della fase selezionata - /// - public bool enableShowRA - { - get - { - return pnlDetRA.Visible; - } - set - { - pnlDetRA.Visible = value; - } - } - /// - /// possibilità creazioen nuovo - /// - public bool _enableNewFromEmpty { get; set; } - /// - /// determina se sia visibile creazione nuova commessa da selezione progetto empty - /// - public bool enableNewFromEmpty - { - get - { - return _enableNewFromEmpty; - } - set - { - _enableNewFromEmpty = value; - } - } - /// - /// calcola se sia ancestore la fase - /// - /// - /// - public bool isAncestor(object idxFaseAncest) - { - bool answ = isWritable(); - if (answ) - { - int idxFase = -1; - try - { - idxFase = Convert.ToInt32(idxFaseAncest); - } - catch - { } - answ = (idxFase == 0); - } - return answ; - } - /// - /// risponde alla domanda se l'utente abbia permesso tipo writable (S) nel permessi2funzione - /// - /// - public bool isWritable() - { - bool answ = true; - if (_paginaCorrente == null) - { - PagCorrente(); - } - //answ = user_std.UtSn.isPageWriteEnabled(_paginaCorrente); - return answ; - } - /// - /// check licenze in fase di update... - /// - /// - /// - protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e) - { + } + return answ; + } + /// + /// calcola classe css dato codice fase + /// + /// + /// + public string classByCod(object codFase) + { + string answ = ""; + int livello = 0; + // calcolo livello come num punti "." -1... + try + { + string[] array = codFase.ToString().Split('.'); + livello = array.Length; + } + catch + { } + if (livello < 4) + { + answ = "fontNormale textNero"; + } + else + { + answ = "fontPiccolo textAzzurro"; + } + return answ; + } + /// + /// determina dimensioni dell'oggetto spaziatore data la fase + /// + /// + /// + public Unit widthByCod(object codFase) + { + Unit answ = new Unit(0, UnitType.Pixel); + int livello = 0; + // calcolo livello come num punti "." -1... + try + { + string[] array = codFase.ToString().Split('.'); + livello = array.Length; + } + catch + { } + if (livello >= 4) + { + answ = new Unit((livello - 3) * 10, UnitType.Pixel); + } + return answ; + } + /// + /// inverte valore booleano + /// + /// + /// + public bool invBool(object valore) + { + bool answ = true; + try + { + answ = !Convert.ToBoolean(valore); + } + catch + { } + return answ; + } + /// + /// resetta la selezione dei valori in caso di modifiche su altri controlli + /// + public void resetSelezione() + { + grView.SelectedIndex = -1; + grView.DataBind(); + setDetVisibility(); + if (eh_resetSelezione != null) + { + eh_resetSelezione(this, new EventArgs()); + } + } + /// + /// indico cambio selezione valore... + /// + /// + /// + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + setDetVisibility(); + if (eh_faseSel != null) + { + eh_faseSel(this, new EventArgs()); + } + } + /// + /// restituisce una classe css a seconda dei valori passati: + /// green: bdgt > real + /// orange: real > bdgt*warning + /// red: real > bdgt + /// std: errore... + /// + /// + /// + /// + public string colorByVal(object real, object bdgt) + { + string answ = "badgeStd"; + try + { + double valoreReal = Convert.ToDouble(real); + double valoreBdget = Convert.ToDouble(bdgt); + double valoreWarn = Convert.ToDouble(bdgt) * Convert.ToDouble(utils.obj.confReadString("warningRatioPerc")) / 100; + if (valoreReal >= valoreBdget) + { + answ = "badgeRosso"; + } + else if (valoreReal >= valoreWarn) + { + answ = "badgeArancio"; + } + else + { + answ = "badgeVerde"; + } + } + catch + { + } + return "ui-corner-all " + answ; + } + /// + /// determina se sia visibile pnl dettaglio RA della fase selezionata + /// + public bool enableShowRA + { + get + { + return pnlDetRA.Visible; + } + set + { + pnlDetRA.Visible = value; + } + } + /// + /// possibilità creazioen nuovo + /// + public bool _enableNewFromEmpty { get; set; } + /// + /// determina se sia visibile creazione nuova commessa da selezione progetto empty + /// + public bool enableNewFromEmpty + { + get + { + return _enableNewFromEmpty; + } + set + { + _enableNewFromEmpty = value; + } + } + /// + /// restituisce true se sia possibile creare la commessa generica "0000-anno" + /// + public bool zeroIsAvailable + { + get + { + bool answ = false; + try + { + answ = DataProxy_ProjEts.DP.taDC.getZeroByYear(DateTime.Now.Year).Rows.Count == 0; + } + catch + { } + return answ; + } + } + /// + /// calcola se sia ancestore la fase + /// + /// + /// + public bool isAncestor(object idxFaseAncest) + { + bool answ = isWritable(); + if (answ) + { + int idxFase = -1; + try + { + idxFase = Convert.ToInt32(idxFaseAncest); + } + catch + { } + answ = (idxFase == 0); + } + return answ; + } + /// + /// risponde alla domanda se l'utente abbia permesso tipo writable (S) nel permessi2funzione + /// + /// + public bool isWritable() + { + bool answ = true; + if (_paginaCorrente == null) + { + PagCorrente(); + } + //answ = user_std.UtSn.isPageWriteEnabled(_paginaCorrente); + return answ; + } + /// + /// check licenze in fase di update... + /// + /// + /// + protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e) + { - } - /// - /// salvo in session che il prox comando è ettaglio commesse... - /// - /// - /// - protected void imgDettComm_Click(object sender, ImageClickEventArgs e) - { - utils.obj.setSessionVal("nextObjCommand", "dettComm"); - } - /// - /// intercetto eventuale update fittizio x rimandare a pagina dett fasi - /// - /// - /// - protected void grView_RowUpdating(object sender, GridViewUpdateEventArgs e) - { - // salvo progetto sel - utils.obj.setSessionVal("idxFase_sel", e.Keys["idxFase"]); - // quale comando? - string _comando = ""; - if (utils.obj.isInSessionObject("nextObjCommand")) - { - _comando = utils.obj.StringSessionObj("nextObjCommand"); - utils.obj.emptySessionVal("nextObjCommand"); - } - // verifico il tipo di richiesta (clona o update normale) - switch (_comando) - { - case "dettComm": - // salvo idxCli... - int idxCli = 0; - string nomeCli = ""; - try - { - idxCli = DataProxy_ProjEts.DP.taAP.getByIdxPrj(utils.obj.IntSessionObj("idxProgetto_sel"))[0].idxCliente; - } - catch - { } - // cerco di recuperare nome cliente... - try - { - nomeCli = DataProxy_ProjEts.DP.taSelCli.getByValue(idxCli)[0].label; - } - catch - { } - utils.obj.setSessionVal("idxCli_sel", idxCli); - utils.obj.setSessionVal("nomeCli_sel", nomeCli); - Response.Redirect("DatiCommessa"); - // blocco update! - e.Cancel = true; - break; - default: - // faccio update! - break; - } - } + } + /// + /// salvo in session che il prox comando è ettaglio commesse... + /// + /// + /// + protected void imgDettComm_Click(object sender, ImageClickEventArgs e) + { + utils.obj.setSessionVal("nextObjCommand", "dettComm"); + } + /// + /// intercetto eventuale update fittizio x rimandare a pagina dett fasi + /// + /// + /// + protected void grView_RowUpdating(object sender, GridViewUpdateEventArgs e) + { + // salvo progetto sel + utils.obj.setSessionVal("idxFase_sel", e.Keys["idxFase"]); + // quale comando? + string _comando = ""; + if (utils.obj.isInSessionObject("nextObjCommand")) + { + _comando = utils.obj.StringSessionObj("nextObjCommand"); + utils.obj.emptySessionVal("nextObjCommand"); + } + // verifico il tipo di richiesta (clona o update normale) + switch (_comando) + { + case "dettComm": + // salvo idxCli... + int idxCli = 0; + string nomeCli = ""; + try + { + idxCli = DataProxy_ProjEts.DP.taAP.getByIdxPrj(utils.obj.IntSessionObj("idxProgetto_sel"))[0].idxCliente; + } + catch + { } + // cerco di recuperare nome cliente... + try + { + nomeCli = DataProxy_ProjEts.DP.taSelCli.getByValue(idxCli)[0].label; + } + catch + { } + utils.obj.setSessionVal("idxCli_sel", idxCli); + utils.obj.setSessionVal("nomeCli_sel", nomeCli); + Response.Redirect("DatiCommessa"); + // blocco update! + e.Cancel = true; + break; + default: + // faccio update! + break; + } + } - #endregion + #endregion - } + } } \ No newline at end of file diff --git a/PROJ-ETS/PROJ-ETS/bin/ETS_Data.dll b/PROJ-ETS/PROJ-ETS/bin/ETS_Data.dll index bbe922d..e764b40 100644 Binary files a/PROJ-ETS/PROJ-ETS/bin/ETS_Data.dll and b/PROJ-ETS/PROJ-ETS/bin/ETS_Data.dll differ diff --git a/PROJ-ETS/PROJ-ETS/bin/PROJ-ETS.dll b/PROJ-ETS/PROJ-ETS/bin/PROJ-ETS.dll index a18722f..4fc6018 100644 Binary files a/PROJ-ETS/PROJ-ETS/bin/PROJ-ETS.dll and b/PROJ-ETS/PROJ-ETS/bin/PROJ-ETS.dll differ