diff --git a/ETS_Data/DataProxy_ProjEts.cs b/ETS_Data/DataProxy_ProjEts.cs index 522d1cc..1062d0e 100644 --- a/ETS_Data/DataProxy_ProjEts.cs +++ b/ETS_Data/DataProxy_ProjEts.cs @@ -288,7 +288,7 @@ namespace ETS_Data // leggo tutte commesse ed i dipendenti... tabComm = DataProxy_ProjEts.DP.taSelCom.GetData(); tabDip = DataProxy_ProjEts.DP.taDip.GetData(); - tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd(); + tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd(true); Ds_ProjEts.DipendentiRow rigaDip; // ciclo su TUTTI i dipendenti inseriti come risorse in bazaar diff --git a/ETS_Data/Ds_ProjEts.Designer.cs b/ETS_Data/Ds_ProjEts.Designer.cs index a81cd30..f57686c 100644 --- a/ETS_Data/Ds_ProjEts.Designer.cs +++ b/ETS_Data/Ds_ProjEts.Designer.cs @@ -21273,6 +21273,7 @@ SELECT CodTipoRisorsa, DescrTipoRisorsa, costoOrario FROM AnagTipoRisorse WHERE this._commandCollection[2].CommandText = "dbo.stp_D2ATR_getBazOrd"; this._commandCollection[2].CommandType = global::System.Data.CommandType.StoredProcedure; this._commandCollection[2].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[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@showAll", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[3] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[3].Connection = this.Connection; this._commandCollection[3].CommandText = "dbo.stp_D2ATR_getByGroup"; @@ -21323,8 +21324,14 @@ SELECT CodTipoRisorsa, DescrTipoRisorsa, costoOrario FROM AnagTipoRisorse WHERE [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.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.Dip2ATRDataTable getBazOrd() { + public virtual Ds_ProjEts.Dip2ATRDataTable getBazOrd(global::System.Nullable showAll) { this.Adapter.SelectCommand = this.CommandCollection[2]; + if ((showAll.HasValue == true)) { + this.Adapter.SelectCommand.Parameters[1].Value = ((bool)(showAll.Value)); + } + else { + this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value; + } Ds_ProjEts.Dip2ATRDataTable dataTable = new Ds_ProjEts.Dip2ATRDataTable(); this.Adapter.Fill(dataTable); return dataTable; @@ -21604,6 +21611,7 @@ SELECT CodTipoRisorsa, DescrTipoRisorsa, costoOrario FROM AnagTipoRisorse WHERE this._commandCollection[1].CommandText = "dbo.stp_Dip_Baz"; 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("@showAll", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -21634,8 +21642,14 @@ SELECT CodTipoRisorsa, DescrTipoRisorsa, costoOrario FROM AnagTipoRisorse WHERE [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.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.DipendentiDataTable getBazEnab() { + public virtual Ds_ProjEts.DipendentiDataTable getBazEnab(global::System.Nullable showAll) { this.Adapter.SelectCommand = this.CommandCollection[1]; + if ((showAll.HasValue == true)) { + this.Adapter.SelectCommand.Parameters[1].Value = ((bool)(showAll.Value)); + } + else { + this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value; + } Ds_ProjEts.DipendentiDataTable dataTable = new Ds_ProjEts.DipendentiDataTable(); this.Adapter.Fill(dataTable); return dataTable; @@ -21878,6 +21892,7 @@ SELECT Anno, Sett, idxDipendente, idxFase, Allocazione, SchemaWeek, OreTot FROM this._commandCollection[6].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[6].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[6].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Sett", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[6].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@showAll", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[7] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[7].Connection = this.Connection; this._commandCollection[7].CommandText = "dbo.stp_BAZ_getByAnnoSettCC"; @@ -21943,7 +21958,7 @@ SELECT Anno, Sett, idxDipendente, idxFase, Allocazione, SchemaWeek, OreTot FROM [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.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.BazaarRisorseDataTable getByAnnoSett(global::System.Nullable Anno, global::System.Nullable Sett) { + public virtual Ds_ProjEts.BazaarRisorseDataTable getByAnnoSett(global::System.Nullable Anno, global::System.Nullable Sett, global::System.Nullable showAll) { this.Adapter.SelectCommand = this.CommandCollection[6]; if ((Anno.HasValue == true)) { this.Adapter.SelectCommand.Parameters[1].Value = ((int)(Anno.Value)); @@ -21957,6 +21972,12 @@ SELECT Anno, Sett, idxDipendente, idxFase, Allocazione, SchemaWeek, OreTot FROM else { this.Adapter.SelectCommand.Parameters[2].Value = global::System.DBNull.Value; } + if ((showAll.HasValue == true)) { + this.Adapter.SelectCommand.Parameters[3].Value = ((bool)(showAll.Value)); + } + else { + this.Adapter.SelectCommand.Parameters[3].Value = global::System.DBNull.Value; + } Ds_ProjEts.BazaarRisorseDataTable dataTable = new Ds_ProjEts.BazaarRisorseDataTable(); this.Adapter.Fill(dataTable); return dataTable; diff --git a/ETS_Data/Ds_ProjEts.xsd b/ETS_Data/Ds_ProjEts.xsd index 0c3cbb5..7904295 100644 --- a/ETS_Data/Ds_ProjEts.xsd +++ b/ETS_Data/Ds_ProjEts.xsd @@ -977,7 +977,7 @@ SELECT CodTipoRisorsa, DescrTipoRisorsa, costoOrario FROM AnagTipoRisorse WHERE - + dbo.stp_D2ATR_deleteQuery @@ -994,6 +994,7 @@ SELECT CodTipoRisorsa, DescrTipoRisorsa, costoOrario FROM AnagTipoRisorse WHERE dbo.stp_D2ATR_getBazOrd + @@ -1009,7 +1010,7 @@ SELECT CodTipoRisorsa, DescrTipoRisorsa, costoOrario FROM AnagTipoRisorse WHERE - + dbo.stp_D2ATR_insertMissing @@ -1082,6 +1083,7 @@ SELECT CodTipoRisorsa, DescrTipoRisorsa, costoOrario FROM AnagTipoRisorse WHERE dbo.stp_Dip_Baz + @@ -1233,6 +1235,7 @@ SELECT Anno, Sett, idxDipendente, idxFase, Allocazione, SchemaWeek, OreTot FROM + @@ -2037,7 +2040,7 @@ ORDER BY OrdGruppo - + @@ -2080,7 +2083,7 @@ ORDER BY OrdGruppo - + @@ -2130,7 +2133,7 @@ ORDER BY OrdGruppo - + @@ -2226,7 +2229,7 @@ ORDER BY OrdGruppo - + @@ -2277,7 +2280,7 @@ ORDER BY OrdGruppo - + @@ -2329,7 +2332,7 @@ ORDER BY OrdGruppo - + @@ -2432,7 +2435,7 @@ ORDER BY OrdGruppo - + @@ -2480,7 +2483,7 @@ ORDER BY OrdGruppo - + @@ -2497,7 +2500,7 @@ ORDER BY OrdGruppo - + @@ -2518,7 +2521,7 @@ ORDER BY OrdGruppo - + @@ -2563,7 +2566,7 @@ ORDER BY OrdGruppo - + @@ -2698,7 +2701,7 @@ ORDER BY OrdGruppo - + @@ -2717,7 +2720,7 @@ ORDER BY OrdGruppo - + @@ -2728,7 +2731,7 @@ ORDER BY OrdGruppo - + @@ -2744,7 +2747,7 @@ ORDER BY OrdGruppo - + @@ -2773,7 +2776,7 @@ ORDER BY OrdGruppo - + @@ -2793,7 +2796,7 @@ ORDER BY OrdGruppo - + @@ -2807,7 +2810,7 @@ ORDER BY OrdGruppo - + @@ -2822,7 +2825,7 @@ ORDER BY OrdGruppo - + @@ -2838,7 +2841,7 @@ ORDER BY OrdGruppo - + @@ -2937,7 +2940,7 @@ ORDER BY OrdGruppo - + @@ -3060,13 +3063,13 @@ ORDER BY OrdGruppo - - - - - - - + + + + + + + \ No newline at end of file diff --git a/ETS_Data/Ds_ProjEts.xss b/ETS_Data/Ds_ProjEts.xss index ee4d197..a3b798f 100644 --- a/ETS_Data/Ds_ProjEts.xss +++ b/ETS_Data/Ds_ProjEts.xss @@ -4,7 +4,7 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - + @@ -15,18 +15,18 @@ - - - - + + + + - - - - + + + + @@ -101,7 +101,7 @@ - + 172 diff --git a/ETS_Data/SQL/ETS_PROJ/ETS_PROJ_2110.sql b/ETS_Data/SQL/ETS_PROJ/ETS_PROJ_2110.sql index 4331cea..9558f65 100644 --- a/ETS_Data/SQL/ETS_PROJ/ETS_PROJ_2110.sql +++ b/ETS_Data/SQL/ETS_PROJ/ETS_PROJ_2110.sql @@ -478,4 +478,120 @@ FROM v_selCommesseShort vsc INNER JOIN cteFasi cte ON vsc.value = cte.idxFase -GO \ No newline at end of file +GO + + +/********************************************************** +* STORED stp_BAZ_getByAnnoSett +* +* recupera record di Bazaar Risorse per anno e settimana selezionate +* +* mod: S.E.L. 2013.09.04 +* mod: S.E.L. 2021.10.19 +* +**********************************************************/ +ALTER PROCEDURE [dbo].[stp_BAZ_getByAnnoSett] +( + @Anno int, + @Sett int, + @showAll BIT = 1 -- 1 = mostra tutti, 0 = solo impostati a visibili in gruppi +) +AS +SET NOCOUNT ON; + +-- seleziono i dip (TUTTI distinct) +WITH cteDip AS +( + SELECT DISTINCT D2A.idxDipendente + FROM Dip2ATR D2A + INNER JOIN AnagGruppi AG ON D2A.Gruppo = AG.Gruppo + WHERE (AG.Visibile = 1 OR @showAll = 1) +) +-- le fasi +, cteFasi AS +( + SELECT DISTINCT idxFase + FROM dbo.BazaarRisorse + WHERE Anno = @Anno AND Sett = @Sett +) +-- le combinazioni (TUTTE) a zero... +, cteComb AS +( + SELECT @Anno as Anno, @Sett as Sett, cteDip.idxDipendente, cteFasi.idxFase, 0 as Allocazione, '00000' as SchemaWeek, 0 as OreTot + FROM cteDip CROSS JOIN cteFasi +) +-- le combinazioni NON esplicite +, cteMiss AS +( + SELECT cte.* + FROM cteComb cte LEFT OUTER JOIN BazaarRisorse br ON cte.Anno=br.anno AND cte.Sett=br.Sett AND cte.idxDipendente=br.idxDipendente AND cte.idxFase = br.idxFase + WHERE br.Allocazione is null +) + +SELECT * +FROM cteMiss + +UNION + +SELECT BR.* +FROM dbo.BazaarRisorse BR + INNER JOIN Dip2ATR D2A ON BR.idxDipendente = D2A.idxDipendente + INNER JOIN AnagGruppi AG ON D2A.Gruppo = AG.Gruppo +WHERE (AG.Visibile = 1 OR @showAll = 1) + AND Anno = @Anno AND Sett = @Sett + +GO + + + +/********************************************************** +* STORED stp_D2ATR_getBazOrd +* +* recupera elenco dipendenti abilitati a bazaar +* +* mod: S.E.L. 2017.07.18 +* mod: S.E.L. 2021.10.15 revisione sistema gruppi ed ordinamento +* mod: S.E.L. 2021.10.19 criterio show SOLO se visibili (x display filtrato) +**********************************************************/ +alter PROCEDURE [dbo].[stp_Dip_Baz] +( + @showAll BIT = 1 -- 1 = mostra tutti, 0 = solo impostati a visibili in gruppi +) +AS + +SELECT dip.* +FROM Dipendenti dip + INNER JOIN Dip2ATR D2A ON dip.idxDipendente=D2A.idxDipendente + INNER JOIN AnagGruppi AG ON D2A.Gruppo = AG.Gruppo +WHERE (AG.Visibile = 1 OR @showAll = 1) +ORDER BY AG.OrdGruppo, D2A.GrpOrder + +RETURN +GO + + + +/********************************************************** +* STORED stp_D2ATR_getBazOrd +* +* recupera elenco dipendenti abilitati a bazaar ordinati x i gruppi validi +* +* mod: S.E.L. 2013.09.04 - release +* mod: S.E.L. 2021.10.15 revisione sistema gruppi ed ordinamento +* mod: S.E.L. 2021.10.19 revisione x filtraggio visibili o tutti +* +**********************************************************/ +ALTER PROCEDURE [dbo].[stp_D2ATR_getBazOrd] +( + @showAll BIT = 1 -- 1 = mostra tutti, 0 = solo impostati a visibili in gruppi +) +AS + +SELECT D2A.* +FROM v_Dip2ATR D2A + INNER JOIN AnagGruppi AG ON D2A.Gruppo = AG.Gruppo +WHERE (AG.Visibile = 1 OR @showAll = 1) +ORDER BY AG.OrdGruppo, D2A.GrpOrder + +RETURN +GO diff --git a/ETS_Data/obj/Debug/TempPE/Ds_ProjEts.Designer.cs.dll b/ETS_Data/obj/Debug/TempPE/Ds_ProjEts.Designer.cs.dll index f1cf9c1..95b5806 100644 Binary files a/ETS_Data/obj/Debug/TempPE/Ds_ProjEts.Designer.cs.dll and b/ETS_Data/obj/Debug/TempPE/Ds_ProjEts.Designer.cs.dll differ diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_ImportBazaarCSV.ascx.cs b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_ImportBazaarCSV.ascx.cs index 4bf84ab..55deeb4 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_ImportBazaarCSV.ascx.cs +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_ImportBazaarCSV.ascx.cs @@ -9,520 +9,559 @@ using System.Web.UI.WebControls; namespace PROJ_ETS.WebUserControls { - public partial class mod_ImportBazaarCSV : System.Web.UI.UserControl - { - /// - /// Elenco risorse - /// - public List elRisorse + public partial class mod_ImportBazaarCSV : System.Web.UI.UserControl { - get - { - List answ = new List(); - try - { - answ = (List)utils.obj.objSessionObj("elRisorse"); - } - catch - { } - return answ; - } - set - { - utils.obj.setSessionVal("elRisorse", value); - } - } - /// - /// Elenco commesse - /// - public List elCommesse - { - get - { - List answ = new List(); - try - { - answ = (List)utils.obj.objSessionObj("elCommesse"); - } - catch - { } - return answ; - } - set - { - utils.obj.setSessionVal("elCommesse", value); - } - } - /// - /// Elenco allocazioni risorse... - /// - public List elAllocazioni - { - get - { - List answ = new List(); - try - { - answ = (List)utils.obj.objSessionObj("elAllocazioni"); - } - catch - { } - return answ; - } - set - { - utils.obj.setSessionVal("elAllocazioni", value); - } - } - /// - /// Oggetto elenco commesse - /// - public Ds_ProjEts.v_CommessaDataTable tabComm - { - get - { - Ds_ProjEts.v_CommessaDataTable answ = null; - try - { - answ = (Ds_ProjEts.v_CommessaDataTable)utils.obj.objSessionObj("tabComm"); - } - catch - { } - return answ; - } - set - { - utils.obj.setSessionVal("tabComm", value); - } - } - /// - /// Oggetto elenco dipendenti - /// - public Ds_ProjEts.DipendentiDataTable tabDip - { - get - { - Ds_ProjEts.DipendentiDataTable answ = null; - try - { - answ = (Ds_ProjEts.DipendentiDataTable)utils.obj.objSessionObj("tabDip"); - } - catch - { } - return answ; - } - set - { - utils.obj.setSessionVal("tabDip", value); - } - } - /// - /// Anno minimo da recuperare x commesse - /// - public int minYear = 0; + #region Public Fields - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - // inizializzo... - lblStep02.Text = ""; - lblStep03.Text = ""; - lblStep04.Text = ""; - lblErr.Text = ""; - lblOut.Text = ""; - lbtShow.Visible = false; - lbtShowErr.Visible = false; - //elRisorse = new List(); - //elCommesse = new List(); - //elAllocazioni = new List(); - minYear = DateTime.Today.Year; - } - mod_fileUpload.eh_fileCaricato += Mod_fileUpload_eh_fileCaricato; - mod_fileUpload.eh_error += Mod_fileUpload_eh_error; - } + /// + /// Anno minimo da recuperare x commesse + /// + public int minYear = 0; - private void Mod_fileUpload_eh_error(object sender, EventArgs e) - { - // INDICO ERRORE - lblStep02.Text = "Errore! " + mod_fileUpload.lastError; - lblStep03.Text = ""; - lbtConferma.Visible = false; - if (elRisorse != null) elRisorse.Clear(); - if (elCommesse != null) elCommesse.Clear(); - } + #endregion Public Fields - /// - /// Caricato file, procedo! - /// - /// - /// - private void Mod_fileUpload_eh_fileCaricato(object sender, EventArgs e) - { - // inizio processing! - processFile(); - } - /// - /// Separatore - /// - protected char charSep - { - get - { - char answ = ';'; - try + #region Protected Properties + + /// + /// anno selezionato (wrapper) + /// + protected int anno { - answ = txtCharSep.Text.Trim().Length == 1 ? txtCharSep.Text.Trim()[0] : ';'; - } - catch - { } - return answ; - } - } - /// - /// Recupera il file caricato e lo processa - /// - private void processFile() - { - // reset vettori commesse, risorse... - elRisorse = new List(); - elCommesse = new List(); - elAllocazioni = new List(); - int numErrRis = 0; - int numErrCom = 0; - lblStep02.Text = ""; - lblStep03.Text = ""; - lblStep04.Text = ""; - lblOut.Text = ""; - lblErr.Text = ""; - lbtShow.Visible = false; - lbtShowErr.Visible = false; - // inizio processing... - lblStep02.Text = string.Format("Caricato il file {0}.", mod_fileUpload.nomeFile); - // ora lo leggo e verifico - int totRighe = 0; - string fileName = string.Format(@"{0}\{1}", mod_fileUpload.folderPath, mod_fileUpload.nomeFile); - string linea; - totRighe = File.ReadLines(fileName).Count(); - if (totRighe > 0) - { - lbtShow.Visible = true; - // carica da file... - System.IO.StreamReader file = new System.IO.StreamReader(fileName); - // leggo 1 linea alla volta... - int numRiga = 0; - while ((linea = file.ReadLine()) != null) - { - // se è la prima riga LEGGO INTESTAZIONE... - if (numRiga == 0) - { - decodeRisorse(linea, charSep); - numRiga++; - } - else - { - // SE non è un commento... - if (linea.Substring(0, 1) != "#") + get { - decodeCommessa(linea, charSep); - numRiga++; + return mod_navigaWeek1.anno; } - } - } - // chiudo file - file.Close(); - - // recupero elenco dipendenti... - tabDip = DataProxy_ProjEts.DP.taDip.getBazEnab(); - // recupero elenco commesse... - tabComm = DataProxy_ProjEts.DP.taVComm.getByYearMin(minYear); - // controllo tutti i dipendenti rilevati.. - foreach (var item in elRisorse) - { - // verifico SE ci sia tra i dipendenti... - if (tabDip.Select(string.Format("codHw ='{0}'", item)).Length == 0) - { - numErrRis++; - lblErr.Text += string.Format("KO Risorsa: {0}
", item); - lbtShowErr.Visible = true; - } - } - //controllo le commesse rilevate - foreach (var item in elCommesse) - { - // verifico SE ci sia tra i dipendenti... - if (tabComm.Select(string.Format("nomeFase ='{0}'", item)).Length == 0) - { - numErrCom++; - lblErr.Text += string.Format("KO Commessa: {0}
", item); - lbtShowErr.Visible = true; - } } - // mostro risultato lettura - lblStep03.Text += string.Format("Righe file: {0}
", totRighe); - lblStep03.Text += string.Format("Num Risorse: {0} ({1} errori)
", elRisorse.Count, numErrRis); - lblStep03.Text += string.Format("Num Commesse: {0} ({1} errori)
", elCommesse.Count, numErrCom); - lblStep03.Text += string.Format("Num allocazioni schedulate: {0}
", elAllocazioni.Count); + /// + /// Separatore + /// + protected char charSep + { + get + { + char answ = ';'; + try + { + answ = txtCharSep.Text.Trim().Length == 1 ? txtCharSep.Text.Trim()[0] : ';'; + } + catch + { } + return answ; + } + } - // salvo allocazioni riconosciute - foreach (var item in elAllocazioni) + /// + /// definisce se create/update/delete siano abilitati + /// + protected bool cudEnabled { - lblStep04.Text += string.Format("{0} | {1} | {2:00000}
", item.commessa, item.risorsa, item.allocazione); + get + { + // controllo le condizioni: in primis se in web config è abilitato edit passato è ok... + bool answ = utils.obj.confReadBool("bazCudPastEnabled"); + // se non globalmente permesso controllo se sia anno/sett successiva a quella corrente + if (!answ) + { + DateTime ora = DateTime.Now; + if ((anno > ora.Year) || ((anno == ora.Year) && (settimana > datario.WeekOfYearISO8601(ora)))) + { + answ = true; + } + } + return answ; + } } - // se passano i controlli mostro pulsante carica... - if (numErrCom == 0) - { - lbtConferma.Visible = true; - } - else - { - lbtConferma.Visible = false; - } - } - else - { - lblStep03.Text += "Errore! file vuoto"; - } - } - /// - /// Decodifica riga intestazione (risorse) - /// - /// - /// - /// - protected void decodeRisorse(string linea, char separator) - { - string[] valori = linea.Split(separator); - bool skipDone = false; - // la prima va ignorata, poi sono 1 campo e 4 vuoti, procedo... - foreach (var valore in valori) - { - if (valore != "" && skipDone) + /// + /// settimana selezionato (wrapper) + /// + protected int settimana { - elRisorse.Add(valore); + get + { + return mod_navigaWeek1.settimana; + } } - else - { - skipDone = true; - } - } - } - /// - /// Decodifica riga commessa (codice + allocazioni) - /// - /// - /// - /// - protected void decodeCommessa(string linea, char separator) - { - string[] valori = linea.Split(separator); - int _allocazione = 0; - int annoC = 0; - // la prima è la commessa, poi allocazioni giornaliere a blocchi di 5... SE c'è (!="") - if (valori[0] != "") - { - elCommesse.Add(valori[0]); - // verifico anno minimo... - try - { - annoC = Convert.ToInt32(valori[0].Split('-')[1]); - minYear = annoC < minYear ? annoC : minYear; - } - catch - { } - // ciclo a blocchi di 5 sull'elenco risorse... - for (int i = 0; i < elRisorse.Count; i++) - { - _allocazione = decodifica(valori[5 * i + 1], valori[5 * i + 2], valori[5 * i + 3], valori[5 * i + 4], valori[5 * i + 5]); - // se il valore è >0 --> salvo in obj! - if (_allocazione > 0) - { - elAllocazioni.Add(new allocRis(valori[0], elRisorse[i], _allocazione)); - } - } - } - } - /// - /// decodifica un vettore di 5 valori SE PRESENTI in un numero 00000 - 88888 - /// - /// - /// - /// - /// - /// - /// - private int decodifica(string v1, string v2, string v3, string v4, string v5) - { - int answ = 0; - try - { - answ += Convert.ToInt32(v1) * 10000; - answ += Convert.ToInt32(v2) * 1000; - answ += Convert.ToInt32(v3) * 100; - answ += Convert.ToInt32(v4) * 10; - answ += Convert.ToInt32(v5) * 1; - } - catch - { } - return answ; - } - /// - /// definisce se create/update/delete siano abilitati - /// - protected bool cudEnabled - { - get - { - // controllo le condizioni: in primis se in web config è abilitato edit passato è ok... - bool answ = utils.obj.confReadBool("bazCudPastEnabled"); - // se non globalmente permesso controllo se sia anno/sett successiva a quella corrente - if (!answ) - { - DateTime ora = DateTime.Now; - if ((anno > ora.Year) || ((anno == ora.Year) && (settimana > datario.WeekOfYearISO8601(ora)))) - { - answ = true; - } - } - return answ; - } - } - /// - /// anno selezionato (wrapper) - /// - protected int anno - { - get - { - return mod_navigaWeek1.anno; - } - } - /// - /// settimana selezionato (wrapper) - /// - protected int settimana - { - get - { - return mod_navigaWeek1.settimana; - } - } - /// - /// 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; - user_std.pagCorrente = finalUrl[n - 1].ToString(); - } - /// - /// risponde alla domanda se l'utente abbia permesso tipo writable (S) nel permessi2funzione - /// - /// - public bool isWritable() - { - bool answ = false; - if (user_std.pagCorrente == null) - { - PagCorrente(); - } - answ = user_std.UtSn.isPageWriteEnabled(user_std.pagCorrente); - return answ; - } - /// - /// indica se la settimana sia già stata rilasciata (c'è record in tab ReleasedWeek e quindi è stato esportato su GPW) - /// - public bool isReleased - { - get - { - bool answ = false; - try - { - answ = DataProxy_ProjEts.DP.taReW.getByAnnoWeek(anno, settimana).Rows.Count > 0; - } - catch - { } - return answ; - } - } + #endregion Protected Properties - protected void lbtShow_Click(object sender, EventArgs e) - { - divPreview.Visible = !divPreview.Visible; - if (divPreview.Visible) - { - lbtShow.Text = "Nascondi Anteprima Dati"; - } - else - { - lbtShow.Text = "Mostra Anteprima Dati"; - } - } + #region Public Properties - protected void lbtShowErr_Click(object sender, EventArgs e) - { - divErr.Visible = !divErr.Visible; - if (divErr.Visible) - { - lbtShowErr.Text = "Nascondi Anteprima ERRORI"; - } - else - { - lbtShowErr.Text = "Mostra Anteprima ERRORI"; - } - } - /// - /// Effettua caricamento dati - /// - /// - /// - protected void lbtConferma_Click(object sender, EventArgs e) - { - // verifico periodo sia ok (FUTURO...) - if (cudEnabled) - { - int idxDipendente = 0; - int idxFase = 0; - // elimino eventuali vecchi dati - DataProxy_ProjEts.DP.taBaz.deleteWeek(anno, settimana); - // effettuo caricamento dati! - foreach (var item in elAllocazioni) + /// + /// Elenco allocazioni risorse... + /// + public List elAllocazioni { - idxDipendente = 0; - idxFase = 0; - try - { - // recupero idxFase (commessa) - idxFase = ((Ds_ProjEts.v_CommessaRow)(tabComm.Select(string.Format("nomeFase ='{0}'", item.commessa))[0])).idxFase; - // recupero idxDip - idxDipendente = ((Ds_ProjEts.DipendentiRow)(tabDip.Select(string.Format("codHw ='{0}'", item.risorsa))[0])).idxDipendente; - } - catch(Exception exc) - { - utils.lg.Error(exc, "Eccezzione in fase di caricamento dati: {0} | {1} | {2}", item.commessa, item.risorsa, item.allocazione); - } - // se ho i dati procedo! - if (idxDipendente > 0 && idxFase > 0) - { - //inserisco! - DataProxy_ProjEts.DP.taBaz.Insert(anno, settimana, idxDipendente, idxFase, item.allocazione); - } + get + { + List answ = new List(); + try + { + answ = (List)utils.obj.objSessionObj("elAllocazioni"); + } + catch + { } + return answ; + } + set + { + utils.obj.setSessionVal("elAllocazioni", value); + } } - // mostro esito - lblOut.Text = "OK! dati caricati"; - } - else - { - lblOut.Text = "Errore: impossibile caricare i dati sulla settimana indicata (periodo protetto)"; - } + + /// + /// Elenco commesse + /// + public List elCommesse + { + get + { + List answ = new List(); + try + { + answ = (List)utils.obj.objSessionObj("elCommesse"); + } + catch + { } + return answ; + } + set + { + utils.obj.setSessionVal("elCommesse", value); + } + } + + /// + /// Elenco risorse + /// + public List elRisorse + { + get + { + List answ = new List(); + try + { + answ = (List)utils.obj.objSessionObj("elRisorse"); + } + catch + { } + return answ; + } + set + { + utils.obj.setSessionVal("elRisorse", value); + } + } + + /// + /// indica se la settimana sia già stata rilasciata (c'è record in tab ReleasedWeek e quindi è stato esportato su GPW) + /// + public bool isReleased + { + get + { + bool answ = false; + try + { + answ = DataProxy_ProjEts.DP.taReW.getByAnnoWeek(anno, settimana).Rows.Count > 0; + } + catch + { } + return answ; + } + } + + /// + /// Oggetto elenco commesse + /// + public Ds_ProjEts.v_CommessaDataTable tabComm + { + get + { + Ds_ProjEts.v_CommessaDataTable answ = null; + try + { + answ = (Ds_ProjEts.v_CommessaDataTable)utils.obj.objSessionObj("tabComm"); + } + catch + { } + return answ; + } + set + { + utils.obj.setSessionVal("tabComm", value); + } + } + + /// + /// Oggetto elenco dipendenti + /// + public Ds_ProjEts.DipendentiDataTable tabDip + { + get + { + Ds_ProjEts.DipendentiDataTable answ = null; + try + { + answ = (Ds_ProjEts.DipendentiDataTable)utils.obj.objSessionObj("tabDip"); + } + catch + { } + return answ; + } + set + { + utils.obj.setSessionVal("tabDip", value); + } + } + + #endregion Public Properties + + #region Private Methods + + /// + /// decodifica un vettore di 5 valori SE PRESENTI in un numero 00000 - 88888 + /// + /// + /// + /// + /// + /// + /// + private int decodifica(string v1, string v2, string v3, string v4, string v5) + { + int answ = 0; + try + { + answ += Convert.ToInt32(v1) * 10000; + answ += Convert.ToInt32(v2) * 1000; + answ += Convert.ToInt32(v3) * 100; + answ += Convert.ToInt32(v4) * 10; + answ += Convert.ToInt32(v5) * 1; + } + catch + { } + return answ; + } + + private void Mod_fileUpload_eh_error(object sender, EventArgs e) + { + // INDICO ERRORE + lblStep02.Text = "Errore! " + mod_fileUpload.lastError; + lblStep03.Text = ""; + lbtConferma.Visible = false; + if (elRisorse != null) elRisorse.Clear(); + if (elCommesse != null) elCommesse.Clear(); + } + + /// + /// Caricato file, procedo! + /// + /// + /// + private void Mod_fileUpload_eh_fileCaricato(object sender, EventArgs e) + { + // inizio processing! + processFile(); + } + + /// + /// Recupera il file caricato e lo processa + /// + private void processFile() + { + // reset vettori commesse, risorse... + elRisorse = new List(); + elCommesse = new List(); + elAllocazioni = new List(); + int numErrRis = 0; + int numErrCom = 0; + lblStep02.Text = ""; + lblStep03.Text = ""; + lblStep04.Text = ""; + lblOut.Text = ""; + lblErr.Text = ""; + lbtShow.Visible = false; + lbtShowErr.Visible = false; + // inizio processing... + lblStep02.Text = string.Format("Caricato il file {0}.", mod_fileUpload.nomeFile); + // ora lo leggo e verifico + int totRighe = 0; + string fileName = string.Format(@"{0}\{1}", mod_fileUpload.folderPath, mod_fileUpload.nomeFile); + string linea; + totRighe = File.ReadLines(fileName).Count(); + if (totRighe > 0) + { + lbtShow.Visible = true; + // carica da file... + System.IO.StreamReader file = new System.IO.StreamReader(fileName); + // leggo 1 linea alla volta... + int numRiga = 0; + while ((linea = file.ReadLine()) != null) + { + // se è la prima riga LEGGO INTESTAZIONE... + if (numRiga == 0) + { + decodeRisorse(linea, charSep); + numRiga++; + } + else + { + // SE non è un commento... + if (linea.Substring(0, 1) != "#") + { + decodeCommessa(linea, charSep); + numRiga++; + } + } + } + // chiudo file + file.Close(); + + // recupero elenco dipendenti... + tabDip = DataProxy_ProjEts.DP.taDip.getBazEnab(true); + // recupero elenco commesse... + tabComm = DataProxy_ProjEts.DP.taVComm.getByYearMin(minYear); + // controllo tutti i dipendenti rilevati.. + foreach (var item in elRisorse) + { + // verifico SE ci sia tra i dipendenti... + if (tabDip.Select(string.Format("codHw ='{0}'", item)).Length == 0) + { + numErrRis++; + lblErr.Text += string.Format("KO Risorsa: {0}
", item); + lbtShowErr.Visible = true; + } + } + //controllo le commesse rilevate + foreach (var item in elCommesse) + { + // verifico SE ci sia tra i dipendenti... + if (tabComm.Select(string.Format("nomeFase ='{0}'", item)).Length == 0) + { + numErrCom++; + lblErr.Text += string.Format("KO Commessa: {0}
", item); + lbtShowErr.Visible = true; + } + } + + // mostro risultato lettura + lblStep03.Text += string.Format("Righe file: {0}
", totRighe); + lblStep03.Text += string.Format("Num Risorse: {0} ({1} errori)
", elRisorse.Count, numErrRis); + lblStep03.Text += string.Format("Num Commesse: {0} ({1} errori)
", elCommesse.Count, numErrCom); + lblStep03.Text += string.Format("Num allocazioni schedulate: {0}
", elAllocazioni.Count); + + // salvo allocazioni riconosciute + foreach (var item in elAllocazioni) + { + lblStep04.Text += string.Format("{0} | {1} | {2:00000}
", item.commessa, item.risorsa, item.allocazione); + } + // se passano i controlli mostro pulsante carica... + if (numErrCom == 0) + { + lbtConferma.Visible = true; + } + else + { + lbtConferma.Visible = false; + } + } + else + { + lblStep03.Text += "Errore! file vuoto"; + } + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// Decodifica riga commessa (codice + allocazioni) + /// + /// + /// + /// + protected void decodeCommessa(string linea, char separator) + { + string[] valori = linea.Split(separator); + int _allocazione = 0; + int annoC = 0; + // la prima è la commessa, poi allocazioni giornaliere a blocchi di 5... SE c'è (!="") + if (valori[0] != "") + { + elCommesse.Add(valori[0]); + // verifico anno minimo... + try + { + annoC = Convert.ToInt32(valori[0].Split('-')[1]); + minYear = annoC < minYear ? annoC : minYear; + } + catch + { } + // ciclo a blocchi di 5 sull'elenco risorse... + for (int i = 0; i < elRisorse.Count; i++) + { + _allocazione = decodifica(valori[5 * i + 1], valori[5 * i + 2], valori[5 * i + 3], valori[5 * i + 4], valori[5 * i + 5]); + // se il valore è >0 --> salvo in obj! + if (_allocazione > 0) + { + elAllocazioni.Add(new allocRis(valori[0], elRisorse[i], _allocazione)); + } + } + } + } + + /// + /// Decodifica riga intestazione (risorse) + /// + /// + /// + /// + protected void decodeRisorse(string linea, char separator) + { + string[] valori = linea.Split(separator); + bool skipDone = false; + // la prima va ignorata, poi sono 1 campo e 4 vuoti, procedo... + foreach (var valore in valori) + { + if (valore != "" && skipDone) + { + elRisorse.Add(valore); + } + else + { + skipDone = true; + } + } + } + + /// + /// Effettua caricamento dati + /// + /// + /// + protected void lbtConferma_Click(object sender, EventArgs e) + { + // verifico periodo sia ok (FUTURO...) + if (cudEnabled) + { + int idxDipendente = 0; + int idxFase = 0; + // elimino eventuali vecchi dati + DataProxy_ProjEts.DP.taBaz.deleteWeek(anno, settimana); + // effettuo caricamento dati! + foreach (var item in elAllocazioni) + { + idxDipendente = 0; + idxFase = 0; + try + { + // recupero idxFase (commessa) + idxFase = ((Ds_ProjEts.v_CommessaRow)(tabComm.Select(string.Format("nomeFase ='{0}'", item.commessa))[0])).idxFase; + // recupero idxDip + idxDipendente = ((Ds_ProjEts.DipendentiRow)(tabDip.Select(string.Format("codHw ='{0}'", item.risorsa))[0])).idxDipendente; + } + catch (Exception exc) + { + utils.lg.Error(exc, "Eccezzione in fase di caricamento dati: {0} | {1} | {2}", item.commessa, item.risorsa, item.allocazione); + } + // se ho i dati procedo! + if (idxDipendente > 0 && idxFase > 0) + { + //inserisco! + DataProxy_ProjEts.DP.taBaz.Insert(anno, settimana, idxDipendente, idxFase, item.allocazione); + } + } + // mostro esito + lblOut.Text = "OK! dati caricati"; + } + else + { + lblOut.Text = "Errore: impossibile caricare i dati sulla settimana indicata (periodo protetto)"; + } + } + + protected void lbtShow_Click(object sender, EventArgs e) + { + divPreview.Visible = !divPreview.Visible; + if (divPreview.Visible) + { + lbtShow.Text = "Nascondi Anteprima Dati"; + } + else + { + lbtShow.Text = "Mostra Anteprima Dati"; + } + } + + protected void lbtShowErr_Click(object sender, EventArgs e) + { + divErr.Visible = !divErr.Visible; + if (divErr.Visible) + { + lbtShowErr.Text = "Nascondi Anteprima ERRORI"; + } + else + { + lbtShowErr.Text = "Mostra Anteprima ERRORI"; + } + } + + /// + /// 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; + user_std.pagCorrente = finalUrl[n - 1].ToString(); + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + // inizializzo... + lblStep02.Text = ""; + lblStep03.Text = ""; + lblStep04.Text = ""; + lblErr.Text = ""; + lblOut.Text = ""; + lbtShow.Visible = false; + lbtShowErr.Visible = false; + //elRisorse = new List(); + //elCommesse = new List(); + //elAllocazioni = new List(); + minYear = DateTime.Today.Year; + } + mod_fileUpload.eh_fileCaricato += Mod_fileUpload_eh_fileCaricato; + mod_fileUpload.eh_error += Mod_fileUpload_eh_error; + } + + #endregion Protected Methods + + #region Public Methods + + /// + /// risponde alla domanda se l'utente abbia permesso tipo writable (S) nel permessi2funzione + /// + /// + public bool isWritable() + { + bool answ = false; + if (user_std.pagCorrente == null) + { + PagCorrente(); + } + answ = user_std.UtSn.isPageWriteEnabled(user_std.pagCorrente); + return answ; + } + + #endregion Public Methods } - } } \ No newline at end of file diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx index 8f68745..25d2624 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx @@ -26,5 +26,9 @@
+
+ + TUTTI +
\ No newline at end of file diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx.cs b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx.cs index 31447da..ab11eb7 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx.cs +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx.cs @@ -11,10 +11,22 @@ namespace PROJ_ETS.WebUserControls { public partial class mod_navigaWeek : System.Web.UI.UserControl { + #region Public Events + /// /// evento nuovi valori selezionati /// public event EventHandler eh_newWeekSelected; + + /// + /// evento cambio show/hide tutti i dipendenti + /// + public event EventHandler eh_showDipChanged; + + #endregion Public Events + + #region Public Properties + /// /// istante corrente /// @@ -39,27 +51,7 @@ namespace PROJ_ETS.WebUserControls return answ; } } - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - DateTime ora = DateTime.Now; - setDdlPeriodo(); - //importo sett corrente - lnkW.Text = string.Format("W{0:0#}", datario.WeekOfYearISO8601(ora)); - lblPeriodo.Text = string.Format("{0:dd MMM yy} --> {1:dd MMM yy}", ora.AddDays(1 - (int)ora.DayOfWeek), ora.AddDays(7 - (int)ora.DayOfWeek)); - } - } - /// - /// imposta DDL del periodo - /// - public void setDdlPeriodo() - { - ddlAnno.SelectedValue = adesso.Year.ToString(); - ddlWeek.SelectedValue = (datario.WeekOfYearISO8601(adesso)).ToString(); - // ricalcolo periodo! - DataProxy_ProjEts.DP.taIR.importSettimana(anno, settimana); - } + /// /// anno selezionato /// @@ -77,6 +69,7 @@ namespace PROJ_ETS.WebUserControls return answ; } } + /// /// settimana selezionato /// @@ -94,6 +87,31 @@ namespace PROJ_ETS.WebUserControls return answ; } } + + public bool showAllDip + { + get + { + return chkShowAll.Checked; + } + set + { + chkShowAll.Checked = value; + } + } + + #endregion Public Properties + + #region Protected Methods + + protected void chkShowAll_CheckedChanged(object sender, EventArgs e) + { + if (eh_showDipChanged != null) + { + eh_showDipChanged(this, new EventArgs()); + } + } + protected void ddlAnno_SelectedIndexChanged(object sender, EventArgs e) { // salvo nuovo anno & nuova week! @@ -105,6 +123,7 @@ namespace PROJ_ETS.WebUserControls eh_newWeekSelected(this, new EventArgs()); } } + /// /// cambiata sett da ddl /// @@ -121,6 +140,7 @@ namespace PROJ_ETS.WebUserControls eh_newWeekSelected(this, new EventArgs()); } } + /// /// effettua selezione periodo rapida: 0 = corrente (ovvero la PROSSIMA), +1 = successiva (a seleizonata), -1 = precedente (a selezionata) /// @@ -148,5 +168,34 @@ namespace PROJ_ETS.WebUserControls eh_newWeekSelected(this, new EventArgs()); } } + + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + DateTime ora = DateTime.Now; + setDdlPeriodo(); + //importo sett corrente + lnkW.Text = string.Format("W{0:0#}", datario.WeekOfYearISO8601(ora)); + lblPeriodo.Text = string.Format("{0:dd MMM yy} --> {1:dd MMM yy}", ora.AddDays(1 - (int)ora.DayOfWeek), ora.AddDays(7 - (int)ora.DayOfWeek)); + } + } + + #endregion Protected Methods + + #region Public Methods + + /// + /// imposta DDL del periodo + /// + public void setDdlPeriodo() + { + ddlAnno.SelectedValue = adesso.Year.ToString(); + ddlWeek.SelectedValue = (datario.WeekOfYearISO8601(adesso)).ToString(); + // ricalcolo periodo! + DataProxy_ProjEts.DP.taIR.importSettimana(anno, settimana); + } + + #endregion Public Methods } } \ No newline at end of file diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx.designer.cs b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx.designer.cs index 596c1ae..15e5166 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx.designer.cs +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_navigaWeek.ascx.designer.cs @@ -85,5 +85,14 @@ namespace PROJ_ETS.WebUserControls /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblPeriodo; + + /// + /// chkShowAll control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkShowAll; } } diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekPlan.ascx b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekPlan.ascx index 32f13ce..4e2806f 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekPlan.ascx +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekPlan.ascx @@ -74,8 +74,8 @@
- -   + +   diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekPlan.ascx.cs b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekPlan.ascx.cs index ca90fb4..c0a2c43 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekPlan.ascx.cs +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekPlan.ascx.cs @@ -17,6 +17,7 @@ namespace PROJ_ETS.WebUserControls protected Logger lg = LogManager.GetCurrentClassLogger(); + protected List ListIdxLocked; protected int numComm = 0; protected int numDip = 0; @@ -56,12 +57,10 @@ namespace PROJ_ETS.WebUserControls protected ETS_Data.Type.BazaarRes[,] TabellaRisorse; - protected string userLockTable = utils.obj.redHash("LOCK:UserLockTable"); - /// - /// String x veto udpate tabella (ridisegno) + /// String x gestione tabella lock da REDIS /// - protected string vetoUpdate = utils.obj.redHash("VETO:UpdateWeekPlan"); + protected string userLockTable = utils.obj.redHash("LOCK:UserLockTable"); #endregion Protected Fields @@ -126,6 +125,31 @@ namespace PROJ_ETS.WebUserControls } } + protected List calcListIdxLocked + { + get + { + List answ = new List(); + //cero in redis + var rawData = utils.obj.getRSV(userLockTable); + if (!string.IsNullOrEmpty(rawData)) + { + answ = JsonConvert.DeserializeObject>(rawData); + } + else + { + var tabDati = DataProxy_ProjEts.DP.taTLB.GetData(); + answ = tabDati + .Select(x => x.idxDipendente) + .ToList(); + rawData = JsonConvert.SerializeObject(answ); + utils.obj.setRSV(userLockTable, rawData, 10); + } + //restituisco... + return answ; + } + } + /// /// definisce se create/update/delete siano abilitati /// @@ -200,31 +224,6 @@ namespace PROJ_ETS.WebUserControls } } - protected List ListIdxLocked - { - get - { - List answ = new List(); - //cero in redis - var rawData = utils.obj.getRSV(userLockTable); - if (!string.IsNullOrEmpty(rawData)) - { - answ = JsonConvert.DeserializeObject>(rawData); - } - else - { - var tabDati = DataProxy_ProjEts.DP.taTLB.GetData(); - answ = tabDati - .Select(x => x.idxDipendente) - .ToList(); - rawData = JsonConvert.SerializeObject(answ); - utils.obj.setRSV(userLockTable, rawData, 10); - } - //restituisco... - return answ; - } - } - /// /// settimana selezionato (wrapper) /// @@ -281,8 +280,7 @@ namespace PROJ_ETS.WebUserControls try { // carico TUTTE le celle del bazaar... - tabBaz = DataProxy_ProjEts.DP.taBaz.getByAnnoSett(anno, settimana); - + tabBaz = DataProxy_ProjEts.DP.taBaz.getByAnnoSett(anno, settimana, mod_navigaWeek1.showAllDip); tabComm = DataProxy_ProjEts.DP.taSelCom.getByWeek(anno, settimana); // leggo tutte commesse... tabCommShort = DataProxy_ProjEts.DP.taSelCom.getCommShort(anno, settimana); // leggo tutte commesse formato short (nickname...) @@ -301,15 +299,11 @@ namespace PROJ_ETS.WebUserControls numComm = 0; } - //stopWatch.Restart(); - //stopWatch.Stop(); - //ts = stopWatch.Elapsed; - //lg.Info($"caricaDatiBlocco 02 | {ts.TotalMilliseconds} ms"); - if (numDip > 0 && numComm > 0) { // inizializzo i miei array... TabellaRisorse = new ETS_Data.Type.BazaarRes[numDip, numComm]; + ListIdxLocked = calcListIdxLocked; oreTotDip = new int[numDip]; oreTotComm = new int[numComm]; schemaOreDip = new string[numDip]; @@ -326,10 +320,13 @@ namespace PROJ_ETS.WebUserControls try { // carico valori x la singola cella - rigaBaz = (Ds_ProjEts.BazaarRisorseRow)tabBaz.Select(string.Format("idxDipendente={0} AND idxFase={1}", tabD2ATR[pos_x].idxDipendente, tabBazSingle[pos_y].idxFase))[0]; - rigaDip = (Ds_ProjEts.DipendentiRow)tabDip.Select(string.Format("idxDipendente={0}", tabD2ATR[pos_x].idxDipendente))[0]; - rigaComm = (DS_utilsProjEts.v_selCommesseRow)tabComm.Select(string.Format("value = {0}", tabBazSingle[pos_y].idxFase))[0]; - rigaCommShort = (DS_utilsProjEts.v_selCommesseRow)tabCommShort.Select(string.Format("value = {0}", tabBazSingle[pos_y].idxFase))[0]; + int currIdxDip = tabD2ATR[pos_x].idxDipendente; + int currIdxFase = tabBazSingle[pos_y].idxFase; + rigaBaz = (Ds_ProjEts.BazaarRisorseRow)tabBaz.Select($"idxDipendente={currIdxDip} AND idxFase={currIdxFase}")[0]; + rigaDip = (Ds_ProjEts.DipendentiRow)tabDip.Select($"idxDipendente={currIdxDip}")[0]; + rigaComm = (DS_utilsProjEts.v_selCommesseRow)tabComm.Select($"value = {currIdxFase}")[0]; + rigaCommShort = (DS_utilsProjEts.v_selCommesseRow)tabCommShort.Select($"value = {currIdxFase}")[0]; + if (rigaBaz.OreTot == 0) { css = "cTab cEmp"; @@ -354,8 +351,8 @@ namespace PROJ_ETS.WebUserControls { css = "cTab cOvr"; } - tooltip = string.Format("{2} / {0} {1}", rigaDip.Nome, rigaDip.Cognome, rigaCommShort.label.Substring(0, 9)); - TabellaRisorse[pos_x, pos_y] = new ETS_Data.Type.BazaarRes(rigaBaz.SchemaWeek, tooltip, css, rigaBaz.idxDipendente, string.Format("{0} {1}", rigaDip.Nome, rigaDip.Cognome), rigaDip.SIGLA, rigaBaz.idxFase, rigaBaz.SchemaWeek, rigaBaz.OreTot); + tooltip = $"{rigaCommShort.label.Substring(0, 9)} / {rigaDip.Nome} {rigaDip.Cognome}"; + TabellaRisorse[pos_x, pos_y] = new ETS_Data.Type.BazaarRes(rigaBaz.SchemaWeek, tooltip, css, rigaBaz.idxDipendente, $"{rigaDip.Nome} {rigaDip.Cognome}", rigaDip.SIGLA, rigaBaz.idxFase, rigaBaz.SchemaWeek, rigaBaz.OreTot); // aggiorno totali righe/colonne (comemsse/dip) oreTotDip[pos_x] += rigaBaz.OreTot; schemaOreDip[pos_x] = oreWeek.addOre(schemaOreDip[pos_x].ToString(), rigaBaz.SchemaWeek, 8); @@ -509,7 +506,6 @@ namespace PROJ_ETS.WebUserControls rigaComm = (DS_utilsProjEts.v_selCommesseRow)tabComm.Select(string.Format("value = {0}", IdxFaseSel))[0]; lblOut.Text = string.Format("Edit corrente: {0} {1} / {2} - valore originale {3}", rigaDip.Nome, rigaDip.Cognome, rigaComm.label.Substring(0, 9), rigaBaz.SchemaWeek); - utils.obj.setRSV(vetoUpdate, "", 1); doUpdate(); } @@ -563,7 +559,13 @@ namespace PROJ_ETS.WebUserControls /// private void mod_navigaWeek1_eh_newWeekSelected(object sender, EventArgs e) { - utils.obj.setRSV(vetoUpdate, "", 1); + doUpdate(); + } + + private void Mod_navigaWeek1_eh_showDipChanged(object sender, EventArgs e) + { + tabDip = DataProxy_ProjEts.DP.taDip.getBazEnab(mod_navigaWeek1.showAllDip); + tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd(mod_navigaWeek1.showAllDip); doUpdate(); } @@ -815,7 +817,6 @@ namespace PROJ_ETS.WebUserControls { eh_newVal(this, new EventArgs()); } - utils.obj.setRSV(vetoUpdate, "", 1); doUpdate(); } } @@ -965,24 +966,28 @@ namespace PROJ_ETS.WebUserControls /// protected void Page_Load(object sender, EventArgs e) { + Stopwatch myStopWatch = new Stopwatch(); if (!Page.IsPostBack) { showPnlAddNewComm(false); lblOut.Text = ""; - utils.obj.setRSV(vetoUpdate, "", 1); } - stopWatch.Start(); + myStopWatch.Start(); // carico tabelle: elenco dipendenti (raggruppato x tipo) ed elenco dip in bazaar... - tabDip = DataProxy_ProjEts.DP.taDip.GetData(); - tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd(); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; + tabDip = DataProxy_ProjEts.DP.taDip.getBazEnab(mod_navigaWeek1.showAllDip); + tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd(mod_navigaWeek1.showAllDip); + myStopWatch.Stop(); + TimeSpan ts = myStopWatch.Elapsed; lg.Info($"Effettuata lettura da DB per tabDip e tabD2ATR: {ts.TotalMilliseconds} ms"); - // faccio update! + myStopWatch.Restart(); doUpdate(); mod_navigaWeek1.eh_newWeekSelected += mod_navigaWeek1_eh_newWeekSelected; + mod_navigaWeek1.eh_showDipChanged += Mod_navigaWeek1_eh_showDipChanged; + myStopWatch.Stop(); + ts = myStopWatch.Elapsed; + lg.Info($"Effettuato doUpdate in Page_Load: {ts.TotalMilliseconds} ms"); } protected void txtAllocazione_TextChanged(object sender, EventArgs e) @@ -991,10 +996,10 @@ namespace PROJ_ETS.WebUserControls { btnSalva.Focus(); showPnlAddNewComm(!pnlAddNew.Visible); - rigaBaz = (Ds_ProjEts.BazaarRisorseRow)tabBaz.Select(string.Format("idxDipendente={0} AND idxFase={1}", IdxDipSel, IdxFaseSel))[0]; - rigaDip = (Ds_ProjEts.DipendentiRow)tabDip.Select(string.Format("idxDipendente={0}", IdxDipSel))[0]; - rigaComm = (DS_utilsProjEts.v_selCommesseRow)tabComm.Select(string.Format("value = {0}", IdxFaseSel))[0]; - lblOut.Text = string.Format("Edit corrente: {0} {1} / {2} - valore originale {3}", rigaDip.Nome, rigaDip.Cognome, rigaComm.label.Substring(0, 9), rigaBaz.SchemaWeek); + rigaBaz = (Ds_ProjEts.BazaarRisorseRow)tabBaz.Select($"idxDipendente={IdxDipSel} AND idxFase={IdxFaseSel}")[0]; + rigaDip = (Ds_ProjEts.DipendentiRow)tabDip.Select($"idxDipendente={IdxDipSel}")[0]; + rigaComm = (DS_utilsProjEts.v_selCommesseRow)tabComm.Select($"value = {IdxFaseSel}")[0]; + lblOut.Text = $"Edit corrente: {rigaDip.Nome} {rigaDip.Cognome} / {rigaComm.label.Substring(0, 9)} - valore originale {rigaBaz.SchemaWeek}"; } catch (Exception exc) { @@ -1010,29 +1015,6 @@ namespace PROJ_ETS.WebUserControls protected bool userIsLocked(int IdxDipendente) { bool answ = false; -#if false - Ds_ProjEts.TLockBazRADataTable tabDati = null; - // cerco in cache - var rawData = utils.obj.getRSV(userLockTable); - if (!string.IsNullOrEmpty(rawData)) - { - tabDati = JsonConvert.DeserializeObject(rawData); - } - // sennò leggo da DB - else - { - tabDati = DataProxy_ProjEts.DP.taTLB.GetData(); - rawData = JsonConvert.SerializeObject(tabDati); - utils.obj.setRSV(userLockTable, rawData, 10); - } - - if (tabDati != null && tabDati.Count > 0) - { - answ = tabDati - .Where(x => x.idxDipendente == IdxDipendente) - .Count() > 0; - } -#endif if (ListIdxLocked.Count > 0) { answ = (ListIdxLocked.Contains(IdxDipendente)); @@ -1051,18 +1033,28 @@ namespace PROJ_ETS.WebUserControls /// public void doUpdate() { - string rawData = utils.obj.getRSV(vetoUpdate); - if (string.IsNullOrEmpty(rawData)) - { - setBtnStatus(); + TimeSpan ts; + stopWatch.Restart(); - caricaDatiBlocco(); + setBtnStatus(); - disegnaTabella(); + stopWatch.Stop(); + ts = stopWatch.Elapsed; + lg.Info($"Effettuati step 01 | {ts.TotalMilliseconds}ms"); + stopWatch.Restart(); - // salvo veto ridisegno x 10 sec... - utils.obj.setRSV(vetoUpdate, $"VETO doUpdate", 5); - } + caricaDatiBlocco(); + + stopWatch.Stop(); + ts = stopWatch.Elapsed; + lg.Info($"Effettuati step 02 | {ts.TotalMilliseconds}ms"); + stopWatch.Restart(); + + disegnaTabella(); + + stopWatch.Stop(); + ts = stopWatch.Elapsed; + lg.Info($"Effettuati step 03 | {ts.TotalMilliseconds}ms"); } /// diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekRA.ascx.cs b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekRA.ascx.cs index 7c94136..1ab639b 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekRA.ascx.cs +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekRA.ascx.cs @@ -236,6 +236,13 @@ namespace PROJ_ETS.WebUserControls doUpdate(); } + private void Mod_navigaWeek1_eh_showDipChanged(object sender, EventArgs e) + { + tabDip = DataProxy_ProjEts.DP.taDip.getBazEnab(mod_navigaWeek1.showAllDip); + tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd(mod_navigaWeek1.showAllDip); + doUpdate(); + } + /// /// crea una cella per il numero dei livelli /// @@ -379,11 +386,12 @@ namespace PROJ_ETS.WebUserControls protected void Page_Load(object sender, EventArgs e) { // carico tabelle: elenco dipendenti (raggruppato x tipo) ed elenco dip in Impiego... - tabDip = DataProxy_ProjEts.DP.taDip.GetData(); - tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd(); + tabDip = DataProxy_ProjEts.DP.taDip.getBazEnab(mod_navigaWeek1.showAllDip); + tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd(mod_navigaWeek1.showAllDip); // faccio update! doUpdate(); mod_navigaWeek1.eh_newWeekSelected += mod_navigaWeek1_eh_newWeekSelected; + mod_navigaWeek1.eh_showDipChanged += Mod_navigaWeek1_eh_showDipChanged; } #endregion Protected Methods diff --git a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekVerify.ascx.cs b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekVerify.ascx.cs index d2fe3b0..abe19ff 100644 --- a/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekVerify.ascx.cs +++ b/PROJ-ETS/PROJ-ETS/WebUserControls/mod_weekVerify.ascx.cs @@ -126,7 +126,7 @@ namespace PROJ_ETS.WebUserControls { // carico TUTTE le celle del Impiego... tabIR = DataProxy_ProjEts.DP.taIR.getFullWeek(anno, settimana); - tabBaz = DataProxy_ProjEts.DP.taBaz.getByAnnoSett(anno, settimana); + tabBaz = DataProxy_ProjEts.DP.taBaz.getByAnnoSett(anno, settimana, mod_navigaWeek1.showAllDip); tabComm = DataProxy_ProjEts.DP.taSelCom.GetData(); // leggo tutte commesse... tabCommShort = DataProxy_ProjEts.DP.taSelCom.getCommShort(anno, settimana); // leggo tutte commesse formato short (nickname...) // calcolo il primo dip @@ -342,6 +342,13 @@ namespace PROJ_ETS.WebUserControls doUpdate(); } + private void Mod_navigaWeek1_eh_showDipChanged(object sender, EventArgs e) + { + tabDip = DataProxy_ProjEts.DP.taDip.getBazEnab(mod_navigaWeek1.showAllDip); + tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd(mod_navigaWeek1.showAllDip); + doUpdate(); + } + /// /// crea una cella per il numero dei livelli /// @@ -481,10 +488,11 @@ namespace PROJ_ETS.WebUserControls protected void Page_Load(object sender, EventArgs e) { // carico tabelle: elenco dipendenti (raggruppato x tipo) ed elenco dip in Impiego... - tabDip = DataProxy_ProjEts.DP.taDip.GetData(); - tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd(); + tabDip = DataProxy_ProjEts.DP.taDip.getBazEnab(mod_navigaWeek1.showAllDip); + tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd(mod_navigaWeek1.showAllDip); doUpdate(); mod_navigaWeek1.eh_newWeekSelected += mod_navigaWeek1_eh_newWeekSelected; + mod_navigaWeek1.eh_showDipChanged += Mod_navigaWeek1_eh_showDipChanged; } #endregion Protected Methods @@ -516,63 +524,5 @@ namespace PROJ_ETS.WebUserControls } #endregion Public Methods - -#if false - /// - /// risponde alla domanda se l'utente sia PowerUser - /// - /// - public bool isPowerUser - { - get - { - return user_std.UtSn.userHasRight("PowerUser"); - } - } - /// - /// risponde alla domanda se l'utente sia PowerReader - /// - /// - public bool isPowerReader - { - get - { - return user_std.UtSn.userHasRight("PowerReader"); - } - } - /// - /// risponde alla domanda se l'utente sia User - /// - /// - public bool isUser - { - get - { - return user_std.UtSn.userHasRight("User"); - } - } - /// - /// risponde alla domanda se l'utente sia CapoCommessa - /// - /// - public bool isCC - { - get - { - return user_std.UtSn.userHasRight("CC"); - } - } - /// - /// risponde alla domanda se l'utente sia ProjectManager - /// - /// - public bool isPM - { - get - { - return user_std.UtSn.userHasRight("PM"); - } - } -#endif } } \ 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 379f147..5626b4e 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 e434cb6..fe9c6b0 100644 Binary files a/PROJ-ETS/PROJ-ETS/bin/PROJ-ETS.dll and b/PROJ-ETS/PROJ-ETS/bin/PROJ-ETS.dll differ