diff --git a/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs b/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs index 274cde6..5babab4 100644 --- a/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs @@ -10,626 +10,615 @@ using System.Data; namespace GPW_Admin.WebUserControls { - public partial class mod_commAttivitaDesk : System.Web.UI.UserControl + public partial class mod_commAttivitaDesk : System.Web.UI.UserControl + { + + #region area protected / private + + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + refreshControlli(); + pnlHeader.Visible = enableFull; + lblTitle.Text = string.Format("{0:dddd dd/MM/yyyy}", valoreDateTime); + } + } + /// + /// minuti selezionati nel controllo radio in testa + /// + protected int minutiSel + { + get + { + return memLayer.ML.IntSessionObj("stdMinDurata"); + } + set + { + memLayer.ML.setSessionVal("stdMinDurata", value); + } + } + /// + /// refresh dei controlli + /// + private void refreshControlli() + { + bool doDataBound = true; + switch (stato) + { + case statoControllo.edit: + doDataBound = true; + //grView.ShowFooter = false; + //grView.SelectedIndex = grView.EditIndex; + //int idxRASel = Convert.ToInt32(grView.SelectedDataKey["idxRA"]); + //// pre-seleziono idx progetto x ods fase... + //idxFaseSel = DataProxy.DP.taRA.getByKey(idxRASel)[0].idxFase; + //idxProjSel = idxPrjByFase(idxFaseSel); + break; + case statoControllo.insert: + grView.ShowFooter = true; + grView.DataBind(); + // imposto arrotondato ad ora... + DateTime inizio = valoreDateTime.Date.AddHours(DateTime.Now.Hour); + // imposto durate standard! + int minuti = minutiSel; + if (minuti < 0) + { + minuti = 60; + } + // cerco ultimo valore inserito odierno (se c'è) + try + { + DS_Applicazione.RegAttivitaDataTable tabRA = DataProxy.DP.taRA.getByDipData(idxDipCurr, inizio.Date, inizio.Date.AddDays(1)); + inizio = tabRA[tabRA.Rows.Count - 1].fine; + } + catch + { + } + // cerco di impostare inizio/fine + try + { + ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime = inizio; + ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime = inizio.AddMinutes(minuti); + } + catch + { } + doDataBound = false; + break; + case statoControllo.item: + grView.ShowFooter = false; + // cerco di impostare inizio/fine + if (grView.EditIndex >= 0) + { + if (minutiSel > 0) + { + try + { + //salvo valori selezionati + string descrizione = ((TextBox)grView.Rows[grView.EditIndex].FindControl("txtDescrizione")).Text; + DateTime inizioEdit = ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtInizio")).valoreDateTime; + grView.DataBind(); + // reimposto! con durata calcolata + ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtInizio")).valoreDateTime = inizioEdit; + ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtFine")).valoreDateTime = inizioEdit.AddMinutes(minutiSel); + ((TextBox)grView.Rows[grView.EditIndex].FindControl("txtDescrizione")).Text = descrizione; + // DISATTIVO COLLEGAMENTO A DATI... + doDataBound = false; + } + catch + { } + } + } + break; + default: + break; + } + if (doDataBound) + { + grView.DataBind(); + } + } + /// + /// salvo in session che il prox comando è clonare... + /// + /// + /// + protected void imgClona_Click(object sender, ImageClickEventArgs e) + { + ImageButton lbtn = (ImageButton)sender; + int idxRa = 0; + try + { + idxRa = Convert.ToInt32(lbtn.CommandArgument); + } + catch + { } + // chiamo clona! + DataProxy.DP.taRA.clonaRecord(idxRa); + updateControl(); + } + /// + /// fa update del controllo e chiama evento update esterno + /// + private void updateControl() + { + grView.SelectedIndex = -1; + refreshControlli(); + // sollevo evento nuovo valore... + if (eh_nuovoValore != null) + { + eh_nuovoValore(this, new EventArgs()); + } + } + /// + /// completato insert! aggiorno! + /// + /// + /// + protected void odsRA_Inserted(object sender, ObjectDataSourceStatusEventArgs e) + { + stato = statoControllo.item; + refreshControlli(); + } + /// + /// effettuato update + /// + /// + /// + protected void grView_RowUpdated(object sender, GridViewUpdatedEventArgs e) + { + updateControl(); + } + /// + /// riga eliminata + /// + /// + /// + protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e) + { + updateControl(); + } + /// + /// 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 doInsert() + { + //recupero la riga footer... + int idxDip = DataProxy.idxDipendente; + int idxFase = 0; + DateTime inizio = DateTime.Now; + DateTime fine = DateTime.Now; + string descr = ""; + try + { + idxFase = Convert.ToInt32(((DropDownList)grView.FooterRow.FindControl("ddlFase")).SelectedValue); + inizio = ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime; + fine = ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime; + descr = ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text; + } + catch + { } + DataProxy.DP.taRA.Insert(idxDip, idxFase, inizio, fine, descr, 0); + } + /// + /// riga in edit + /// + /// + /// + protected void grView_RowEditing(object sender, GridViewEditEventArgs e) + { + grView.SelectedIndex = e.NewEditIndex; + int idxRASel = Convert.ToInt32(grView.SelectedDataKey["idxRA"]); + // salvo in sessione valori selezionati + idxFaseSel = DataProxy.DP.taRA.getByKey(idxRASel)[0].idxFase; + idxProjSel = idxPrjByFase(idxFaseSel); + } + /// + /// riga popolata + /// + /// + /// + protected void grView_RowDataBound(object sender, GridViewRowEventArgs e) + { + // controllo la riga + GridViewRow riga = e.Row; + if (grView.EditIndex >= 0 || grView.ShowFooter) + { + try + { + //pre-seleziono idx progetto x ods fase... + DropDownList ddlProj_int = (DropDownList)riga.FindControl("ddlProgetto"); + if (idxProjSel >= 0 && (ddlProj_int != null)) + { + ddlProj_int.SelectedValue = idxProjSel.ToString(); + } + DropDownList ddlFase_int = (DropDownList)riga.FindControl("ddlFase"); + if (idxFaseSel >= 0 && (ddlFase_int != null)) + { + ddlFase_int.SelectedValue = idxFaseSel.ToString(); + } + } + catch + { } + } + } + /// + /// intercetto update! + /// + /// + /// + protected void odsRA_Updating(object sender, ObjectDataSourceMethodEventArgs e) + { + DropDownList ddlfase_int = (DropDownList)grView.Rows[grView.EditIndex].FindControl("ddlFase"); + e.InputParameters["idxFase"] = ddlfase_int.SelectedValue; + } + /// + /// aggiorno ods fasi... + /// + /// + /// + protected void ddlProgetto_SelectedIndexChanged(object sender, EventArgs e) + { + // salvo in session idxProjSel! + DropDownList ddlProj_int = (DropDownList)sender; + idxProjSel = Convert.ToInt32(ddlProj_int.SelectedValue); + // ricarico dati fasi + odsFase.DataBind(); + // se in insert salvo orari e testo... + DateTime inizio = DateTime.Now; + DateTime fine = DateTime.Now; + string descr = ""; + if (stato == statoControllo.insert) + { + inizio = ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime; + fine = ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime; + descr = ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text; + } + else + { + // se è edit... + int idx = grView.EditIndex; + inizio = ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime; + fine = ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime; + descr = ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text; + } + refreshControlli(); + // se in insert riporto orari e testo... + if (stato == statoControllo.insert) + { + ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime = inizio; + ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime = fine; + ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text = descr; + try + { + DropDownList ddlFase_int = (DropDownList)grView.FooterRow.FindControl("ddlFase"); + ddlFase_int.SelectedIndex = 1; + } + catch + { } + } + else + { + // se è edit... + int idx = grView.EditIndex; + ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime = inizio; + ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime = fine; + ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text = descr; + try + { + DropDownList ddlFase_int = (DropDownList)grView.Rows[idx].FindControl("ddlFase"); + ddlFase_int.SelectedIndex = 1; + } + catch + { } + } + } + /// + /// progetto selezionato + /// + protected int idxProjSel + { + get + { + return memLayer.ML.IntSessionObj("idxProjSel"); + } + set + { + memLayer.ML.setSessionVal("idxProjSel", value); + } + } + /// + /// fase selezionata + /// + protected int idxFaseSel + { + get + { + return memLayer.ML.IntSessionObj("idxFaseSel"); + } + set + { + memLayer.ML.setSessionVal("idxFaseSel", value); + } + } + /// + /// generico comando riga + /// + /// + /// + protected void grView_RowCommand(object sender, GridViewCommandEventArgs e) + { + switch (e.CommandName) + { + case "Cancel": + stato = statoControllo.item; + updateControl(); + break; + case "Insert": + doInsert(); + stato = statoControllo.item; + updateControl(); + break; + default: + break; + } + } + + #endregion + + #region area public + + /// + /// idxDipendente selezionato (0=tutti) + /// + public int idxDipCurr + { + get + { + return memLayer.ML.IntSessionObj("idxDipCurr"); + } + set + { + memLayer.ML.setSessionVal("idxDipCurr", value); + } + } + /// + /// progetto selezionato.. + /// + public string idxProgetto + { + get + { + return idxProjSel.ToString(); + } + } + /// + /// abilitato editing + nuovo + delete + clona + /// + public bool enableFull + { + get + { + bool answ = false; + try + { + answ = memLayer.ML.BoolSessionObj("enableEditComm"); + } + catch + { } + return answ; + } + set + { + memLayer.ML.setSessionVal("enableEditComm", value); + } + } + /// + /// stato attuale del controllo + /// + public statoControllo stato + { + get + { + statoControllo answ = statoControllo.item; + try + { + answ = (statoControllo)memLayer.ML.objSessionObj("statoControlloRA"); + } + catch + { } + return answ; + } + set + { + memLayer.ML.setSessionVal("statoControlloRA", value); + } + } + /// + /// valore datetime selezionato! + /// + public DateTime valoreDateTime + { + get + { + DateTime answ = DateTime.Now; + try + { + answ = Convert.ToDateTime(memLayer.ML.objSessionObj("dataRif")); + } + catch + { } + return answ; + } + set + { + memLayer.ML.setSessionVal("dataRif", value); + lblTitle.Text = string.Format("{0:dddd dd/MM/yyyy}", value); + } + } + /// + /// evento update valori + /// + public event EventHandler eh_nuovoValore; + /// + /// effettua traduzione del lemma + /// + /// + /// + public string traduci(string lemma) + { + return user_std.UtSn.Traduci(lemma); + } + /// + /// aggiorna + /// + public void doUpdate() + { + refreshControlli(); + } + + /// + /// calcola idxProgetto da idxFase + /// + /// + /// + public int idxPrjByFase(object idxFase) + { + int answ = 0; + try + { + answ = DataProxy.DP.taAF.getByIdx(Convert.ToInt32(idxFase))[0].idxProgetto; + } + catch + { } + return answ; + } + /// + /// sistemo eventuali "headers" + /// + /// + /// + protected void ddlFase_DataBound(object sender, EventArgs e) + { + // cerco eventuali controlli tipo "ancestor" e li disattivo! + DropDownList ddlFase_int = (DropDownList)sender; + ListItem li = new ListItem(); + while (li != null) + { + li = ddlFase_int.Items.FindByValue("0"); + try + { + li.Attributes.Add("style", "color:gray;"); + li.Attributes.Add("disabled", "true"); + li.Value = "-1"; + li.Text = string.Format("[ {0} ]", li.Text); + } + catch + { } + } + try + { + ddlFase_int.SelectedIndex = 1; + } + catch + { } + } + /// + /// richiesta creazioen nuovo record + /// + /// + /// + protected void btnNew_Click(object sender, EventArgs e) + { + if (grView.Rows.Count > 0) + { + // controllo: se ho righe mostro il footer... + stato = statoControllo.insert; + refreshControlli(); + } + else + { + // default: inizia ora la dichiarazione + double oraStart = DateTime.Now.Hour; + int durataMinuti = memLayer.ML.IntSessionObj("stdMinDurata"); + // se c'è timbratura ingresso prendo quella come ora inizio... + try + { + DS_Applicazione.TimbratureRow riga = DataProxy.DP.taTimb.getByIdxDipPeriodo(DataProxy.idxDipendente, valoreDateTime, valoreDateTime.AddDays(1))[0]; + oraStart = Convert.ToDouble(riga.dataOra.Hour + riga.dataOra.Minute / 60); + } + catch + { } + // altrimenti duplico ultima entry utente.. + DataProxy.DP.taRA.clonaLastRA_Utente(DataProxy.idxDipendente, valoreDateTime.AddHours(oraStart), durataMinuti); + updateControl(); + } + } + + /// + /// esegue ricerca progetto/fase x sovrascrivere + /// + /// + /// + protected void txtSearchFase_TextChanged(object sender, EventArgs e) { - #region area protected / private - - protected void Page_Load(object sender, EventArgs e) + // recupero testo... + string search = ""; + try + { + search = ((TextBox)sender).Text.Trim(); + } + catch + { } + if (search != "") + { + // faccio ricerca x progetto e fase... + GPW_data.DS_Utility.stp_VSProjFasi_searchDataTable tabRes = DataProxy.DP.taVSProjFasiSearch.GetData(search); + if (tabRes.Rows.Count > 0) { - if (!Page.IsPostBack) - { - refreshControlli(); - pnlHeader.Visible = enableFull; - lblTitle.Text = string.Format("{0:dddd dd/MM/yyyy}", valoreDateTime); - } + idxFaseSel = tabRes[0].idxFase; + idxProjSel = tabRes[0].idxProgetto; } - /// - /// minuti selezionati nel controllo radio in testa - /// - protected int minutiSel - { - get - { - return memLayer.ML.IntSessionObj("stdMinDurata"); - } - set - { - memLayer.ML.setSessionVal("stdMinDurata", value); - } - } - /// - /// refresh dei controlli - /// - private void refreshControlli() - { - bool doDataBound = true; - switch (stato) - { - case statoControllo.edit: - doDataBound = true; - //grView.ShowFooter = false; - //grView.SelectedIndex = grView.EditIndex; - //int idxRASel = Convert.ToInt32(grView.SelectedDataKey["idxRA"]); - //// pre-seleziono idx progetto x ods fase... - //idxFaseSel = DataProxy.DP.taRA.getByKey(idxRASel)[0].idxFase; - //idxProjSel = idxPrjByFase(idxFaseSel); - break; - case statoControllo.insert: - grView.ShowFooter = true; - grView.DataBind(); - // imposto arrotondato ad ora... - DateTime inizio = valoreDateTime.Date.AddHours(DateTime.Now.Hour); - // imposto durate standard! - int minuti = minutiSel; - if (minuti < 0) - { - minuti = 60; - } - // cerco ultimo valore inserito odierno (se c'è) - try - { - DS_Applicazione.RegAttivitaDataTable tabRA = DataProxy.DP.taRA.getByDipData(idxDipCurr, inizio.Date, inizio.Date.AddDays(1)); - inizio = tabRA[tabRA.Rows.Count - 1].fine; - } - catch - { - } -#if false - // provo a leggere valore editato (se c'è...) - try - { - DateTime inizioSel = ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime; - if (inizioSel != inizio && inizio != valoreDateTime.Date.AddHours(DateTime.Now.Hour)) inizio = inizioSel; - } - catch - { - } -#endif - // cerco di impostare inizio/fine - try - { - ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime = inizio; - ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime = inizio.AddMinutes(minuti); - } - catch - { } - doDataBound = false; - break; - case statoControllo.item: - grView.ShowFooter = false; - // cerco di impostare inizio/fine - if (grView.EditIndex >= 0) - { - if (minutiSel > 0) - { - try - { - //salvo valori selezionati - string descrizione = ((TextBox)grView.Rows[grView.EditIndex].FindControl("txtDescrizione")).Text; - DateTime inizioEdit = ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtInizio")).valoreDateTime; - grView.DataBind(); - // reimposto! con durata calcolata - ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtInizio")).valoreDateTime = inizioEdit; - ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtFine")).valoreDateTime = inizioEdit.AddMinutes(minutiSel); - ((TextBox)grView.Rows[grView.EditIndex].FindControl("txtDescrizione")).Text = descrizione; - // DISATTIVO COLLEGAMENTO A DATI... - doDataBound = false; - } - catch - { } - } - } - break; - default: - break; - } - if (doDataBound) - { - grView.DataBind(); - } - } - /// - /// salvo in session che il prox comando è clonare... - /// - /// - /// - protected void imgClona_Click(object sender, ImageClickEventArgs e) - { - ImageButton lbtn = (ImageButton)sender; - int idxRa = 0; - try - { - idxRa = Convert.ToInt32(lbtn.CommandArgument); - } - catch - { } - // chiamo clona! - DataProxy.DP.taRA.clonaRecord(idxRa); - updateControl(); - } - /// - /// fa update del controllo e chiama evento update esterno - /// - private void updateControl() - { - grView.SelectedIndex = -1; - refreshControlli(); - // sollevo evento nuovo valore... - if (eh_nuovoValore != null) - { - eh_nuovoValore(this, new EventArgs()); - } - } - /// - /// completato insert! aggiorno! - /// - /// - /// - protected void odsRA_Inserted(object sender, ObjectDataSourceStatusEventArgs e) - { - stato = statoControllo.item; - refreshControlli(); - } - /// - /// effettuato update - /// - /// - /// - protected void grView_RowUpdated(object sender, GridViewUpdatedEventArgs e) - { - updateControl(); - } - /// - /// riga eliminata - /// - /// - /// - protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e) - { - updateControl(); - } - /// - /// 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 doInsert() - { - //recupero la riga footer... - int idxDip = DataProxy.idxDipendente; - int idxFase = 0; - DateTime inizio = DateTime.Now; - DateTime fine = DateTime.Now; - string descr = ""; - try - { - idxFase = Convert.ToInt32(((DropDownList)grView.FooterRow.FindControl("ddlFase")).SelectedValue); - inizio = ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime; - fine = ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime; - descr = ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text; - } - catch - { } - DataProxy.DP.taRA.Insert(idxDip, idxFase, inizio, fine, descr, 0); - } - /// - /// riga in edit - /// - /// - /// - protected void grView_RowEditing(object sender, GridViewEditEventArgs e) - { - grView.SelectedIndex = e.NewEditIndex; - int idxRASel = Convert.ToInt32(grView.SelectedDataKey["idxRA"]); - // salvo in sessione valori selezionati - idxFaseSel = DataProxy.DP.taRA.getByKey(idxRASel)[0].idxFase; - idxProjSel = idxPrjByFase(idxFaseSel); - } - /// - /// riga popolata - /// - /// - /// - protected void grView_RowDataBound(object sender, GridViewRowEventArgs e) - { - // controllo la riga - GridViewRow riga = e.Row; - if (grView.EditIndex >= 0 || grView.ShowFooter) - { - try - { - //pre-seleziono idx progetto x ods fase... - DropDownList ddlProj_int = (DropDownList)riga.FindControl("ddlProgetto"); - if (idxProjSel >= 0 && (ddlProj_int != null)) - { - ddlProj_int.SelectedValue = idxProjSel.ToString(); - } - DropDownList ddlFase_int = (DropDownList)riga.FindControl("ddlFase"); - if (idxFaseSel >= 0 && (ddlFase_int != null)) - { - ddlFase_int.SelectedValue = idxFaseSel.ToString(); - } - } - catch - { } - } - } - /// - /// intercetto update! - /// - /// - /// - protected void odsRA_Updating(object sender, ObjectDataSourceMethodEventArgs e) - { - DropDownList ddlfase_int = (DropDownList)grView.Rows[grView.EditIndex].FindControl("ddlFase"); - e.InputParameters["idxFase"] = ddlfase_int.SelectedValue; - } - /// - /// aggiorno ods fasi... - /// - /// - /// - protected void ddlProgetto_SelectedIndexChanged(object sender, EventArgs e) - { - // salvo in session idxProjSel! - DropDownList ddlProj_int = (DropDownList)sender; - idxProjSel = Convert.ToInt32(ddlProj_int.SelectedValue); - // ricarico dati fasi - odsFase.DataBind(); - // se in insert salvo orari e testo... - DateTime inizio = DateTime.Now; - DateTime fine = DateTime.Now; - string descr = ""; - if (stato == statoControllo.insert) - { - inizio = ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime; - fine = ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime; - descr = ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text; - } - else - { - // se è edit... - int idx = grView.EditIndex; - inizio = ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime; - fine = ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime; - descr = ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text; - } - refreshControlli(); - // se in insert riporto orari e testo... - if (stato == statoControllo.insert) - { - ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime = inizio; - ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime = fine; - ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text = descr; - try - { - DropDownList ddlFase_int = (DropDownList)grView.FooterRow.FindControl("ddlFase"); - ddlFase_int.SelectedIndex = 1; - } - catch - { } - } - else - { - // se è edit... - int idx = grView.EditIndex; - ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime = inizio; - ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime = fine; - ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text = descr; - try - { - DropDownList ddlFase_int = (DropDownList)grView.Rows[idx].FindControl("ddlFase"); - ddlFase_int.SelectedIndex = 1; - } - catch - { } - } - } - /// - /// progetto selezionato - /// - protected int idxProjSel - { - get - { - return memLayer.ML.IntSessionObj("idxProjSel"); - } - set - { - memLayer.ML.setSessionVal("idxProjSel", value); - } - } - /// - /// fase selezionata - /// - protected int idxFaseSel - { - get - { - return memLayer.ML.IntSessionObj("idxFaseSel"); - } - set - { - memLayer.ML.setSessionVal("idxFaseSel", value); - } - } - /// - /// generico comando riga - /// - /// - /// - protected void grView_RowCommand(object sender, GridViewCommandEventArgs e) - { - switch (e.CommandName) - { - case "Cancel": - stato = statoControllo.item; - updateControl(); - break; - case "Insert": - doInsert(); - stato = statoControllo.item; - updateControl(); - break; - default: - break; - } - } - - #endregion - - #region area public - - /// - /// idxDipendente selezionato (0=tutti) - /// - public int idxDipCurr - { - get - { - return memLayer.ML.IntSessionObj("idxDipCurr"); - } - set - { - memLayer.ML.setSessionVal("idxDipCurr", value); - } - } - /// - /// progetto selezionato.. - /// - public string idxProgetto - { - get - { - return idxProjSel.ToString(); - } - } - /// - /// abilitato editing + nuovo + delete + clona - /// - public bool enableFull - { - get - { - bool answ = false; - try - { - answ = memLayer.ML.BoolSessionObj("enableEditComm"); - } - catch - { } - return answ; - } - set - { - memLayer.ML.setSessionVal("enableEditComm", value); - } - } - /// - /// stato attuale del controllo - /// - public statoControllo stato - { - get - { - statoControllo answ = statoControllo.item; - try - { - answ = (statoControllo)memLayer.ML.objSessionObj("statoControlloRA"); - } - catch - { } - return answ; - } - set - { - memLayer.ML.setSessionVal("statoControlloRA", value); - } - } - /// - /// valore datetime selezionato! - /// - public DateTime valoreDateTime - { - get - { - DateTime answ = DateTime.Now; - try - { - answ = Convert.ToDateTime(memLayer.ML.objSessionObj("dataRif")); - } - catch - { } - return answ; - } - set - { - memLayer.ML.setSessionVal("dataRif", value); - lblTitle.Text = string.Format("{0:dddd dd/MM/yyyy}", value); - } - } - /// - /// evento update valori - /// - public event EventHandler eh_nuovoValore; - /// - /// effettua traduzione del lemma - /// - /// - /// - public string traduci(string lemma) - { - return user_std.UtSn.Traduci(lemma); - } - /// - /// aggiorna - /// - public void doUpdate() - { - refreshControlli(); - } - - /// - /// calcola idxProgetto da idxFase - /// - /// - /// - public int idxPrjByFase(object idxFase) - { - int answ = 0; - try - { - answ = DataProxy.DP.taAF.getByIdx(Convert.ToInt32(idxFase))[0].idxProgetto; - } - catch - { } - return answ; - } - /// - /// sistemo eventuali "headers" - /// - /// - /// - protected void ddlFase_DataBound(object sender, EventArgs e) - { - // cerco eventuali controlli tipo "ancestor" e li disattivo! - DropDownList ddlFase_int = (DropDownList)sender; - ListItem li = new ListItem(); - while (li != null) - { - li = ddlFase_int.Items.FindByValue("0"); - try - { - li.Attributes.Add("style", "color:gray;"); - li.Attributes.Add("disabled", "true"); - li.Value = "-1"; - li.Text = string.Format("[ {0} ]", li.Text); - } - catch - { } - } - try - { - ddlFase_int.SelectedIndex = 1; - } - catch - { } - } - /// - /// richiesta creazioen nuovo record - /// - /// - /// - protected void btnNew_Click(object sender, EventArgs e) - { - if (grView.Rows.Count > 0) - { - // controllo: se ho righe mostro il footer... - stato = statoControllo.insert; - refreshControlli(); - } - else - { - // default: inizia ora la dichiarazione - double oraStart = DateTime.Now.Hour; - int durataMinuti = memLayer.ML.IntSessionObj("stdMinDurata"); - // se c'è timbratura ingresso prendo quella come ora inizio... - try - { - DS_Applicazione.TimbratureRow riga = DataProxy.DP.taTimb.getByIdxDipPeriodo(DataProxy.idxDipendente, valoreDateTime, valoreDateTime.AddDays(1))[0]; - oraStart = Convert.ToDouble(riga.dataOra.Hour + riga.dataOra.Minute / 60); - } - catch - { } - // altrimenti duplico ultima entry utente.. - DataProxy.DP.taRA.clonaLastRA_Utente(DataProxy.idxDipendente, valoreDateTime.AddHours(oraStart), durataMinuti); - updateControl(); - } - } - - /// - /// esegue ricerca progetto/fase x sovrascrivere - /// - /// - /// - protected void txtSearchFase_TextChanged(object sender, EventArgs e) - { - - // recupero testo... - string search = ""; - try - { - search = ((TextBox)sender).Text.Trim(); - } - catch - { } - if (search != "") - { - // faccio ricerca x progetto e fase... - GPW_data.DS_Utility.stp_VSProjFasi_searchDataTable tabRes = DataProxy.DP.taVSProjFasiSearch.GetData(search); - if (tabRes.Rows.Count > 0) - { - idxFaseSel = tabRes[0].idxFase; - idxProjSel = tabRes[0].idxProgetto; - } - } - //stato = statoControllo.edit; - //refreshControlli(); - //stato = statoControllo.item; - //minutiSel = -1; - refreshControlli(); - } - - - /// - /// formatta la durata in ore secondo web.config (centesimale/ore:min) - /// - /// - /// - public string formatDurata(object oreCent) - { - decimal ore = 0; - try - { - ore = Convert.ToDecimal(oreCent); - } - catch - { } - string answ = ""; - if (memLayer.ML.confReadBool("reviewShowOreMin")) - { - answ = utils.formOreMin(ore); - } - else - { - answ = ore.ToString("0.00"); - } - return answ; - } - - #endregion - + } + //stato = statoControllo.edit; + //refreshControlli(); + //stato = statoControllo.item; + //minutiSel = -1; + refreshControlli(); } + + + /// + /// formatta la durata in ore secondo web.config (centesimale/ore:min) + /// + /// + /// + public string formatDurata(object oreCent) + { + decimal ore = 0; + try + { + ore = Convert.ToDecimal(oreCent); + } + catch + { } + string answ = ""; + if (memLayer.ML.confReadBool("reviewShowOreMin")) + { + answ = utils.formOreMin(ore); + } + else + { + answ = ore.ToString("0.00"); + } + return answ; + } + + #endregion + + } } \ No newline at end of file diff --git a/GPW_Data/utils.cs b/GPW_Data/utils.cs index e6e4601..fa14475 100644 --- a/GPW_Data/utils.cs +++ b/GPW_Data/utils.cs @@ -14,43 +14,7 @@ namespace GPW_data /// protected utils() { -#if false - setupElencoClienti(); -#endif } -#if false - /// - /// setup delle tabella elencoClienti - /// - protected void setupElencoClienti() - { - string redKey = memLayer.ML.redHash("elencoClienti"); - try - { - string rawData = memLayer.ML.getRSV(redKey); - if (string.IsNullOrEmpty(rawData)) - { - - } - else - { - elencoClienti = ricaricaElencoClienti(); - - } - if (memLayer.ML.isInCacheObject("elencoClienti")) - { - elencoClienti = (Dictionary)memLayer.ML.objCacheObj("elencoClienti"); - } - else - { - elencoClienti = ricaricaElencoClienti(); - memLayer.ML.setCacheVal("elencoClienti", elencoClienti, false); - } - } - catch - { } - } -#endif /// /// restituisce elenco clienti trasformato in dictionary /// diff --git a/GPW_Smart/Site.Master.cs b/GPW_Smart/Site.Master.cs index 2aa5376..bc4ed13 100644 --- a/GPW_Smart/Site.Master.cs +++ b/GPW_Smart/Site.Master.cs @@ -42,29 +42,5 @@ namespace GPW_Smart cmp_menuTop.disableCheckCookie = value; } } - -#if false - public bool showSettings { get; set; } - public bool showLeftPnl { get; set; } - - public string hideSettings - { - get - { - string answ = ""; - if (!showSettings) answ = "hidden"; - return answ; - } - } - public string hideLeftPnl - { - get - { - string answ = ""; - if (!showLeftPnl) answ = "hidden"; - return answ; - } - } -#endif } } \ No newline at end of file diff --git a/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs b/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs index f921601..8b8f24a 100644 --- a/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs +++ b/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs @@ -232,26 +232,5 @@ namespace GPW_Smart.WebUserControls } return answ; } -#if false - /// - /// salva in variabile pagina il nome della pagina corrente - /// - protected string PagCorrente() - { - string answ = ""; - try - { - Uri MyUrl = Request.Url; - string delimStr = "/"; - char[] delimiter = delimStr.ToCharArray(); - string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter); - int n = finalUrl.Length; - answ = finalUrl[n - 1].ToString(); - } - catch - { } - return answ; - } -#endif } } \ No newline at end of file diff --git a/GPW_Smart/WebUserControls/mod_timbrature.ascx.cs b/GPW_Smart/WebUserControls/mod_timbrature.ascx.cs index 6c3e73e..80218c3 100644 --- a/GPW_Smart/WebUserControls/mod_timbrature.ascx.cs +++ b/GPW_Smart/WebUserControls/mod_timbrature.ascx.cs @@ -145,15 +145,6 @@ namespace GPW.WebUserControls bool isEntrata = false; registraTimbratura(isEntrata); } -#if false - /// - /// Abilita tutti i buttons - /// - public void abilitaAll() - { - forceButtons = false; - } -#endif /// /// Aggiorno visualizzazione /// diff --git a/Jenkinsfile b/Jenkinsfile index 318053a..0ebb01d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=4104']) { + withEnv(['NEXT_BUILD_NUMBER=4105']) { // env.versionNumber = VersionNumber(versionNumberString : '2.6.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '2.6.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'GPW'