From 024aab5266184cf12b5a2bca8d4750d2204fcfa1 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 18 Jan 2021 10:57:41 +0100 Subject: [PATCH] Aggiunta gestione show all x nuovi dipendenti --- .../WebUserControls/mod_commUtLog.ascx | 9 +- .../WebUserControls/mod_commUtLog.ascx.cs | 631 +++++++++--------- 2 files changed, 340 insertions(+), 300 deletions(-) diff --git a/GPW_Commesse/WebUserControls/mod_commUtLog.ascx b/GPW_Commesse/WebUserControls/mod_commUtLog.ascx index 9bf636b..f8bdcfd 100644 --- a/GPW_Commesse/WebUserControls/mod_commUtLog.ascx +++ b/GPW_Commesse/WebUserControls/mod_commUtLog.ascx @@ -59,7 +59,14 @@ - No record +
+
+ No record +
+
+ Mostra Tutto +
+
+ /// Determina se visualizzare entrambe le schede... + /// + protected bool openBoth + { + get + { + return cmp_toggle.toggleValue; + } + set + { + cmp_toggle.toggleValue = value; + } + } + + #endregion Protected Properties + + #region Public Properties + public modoCommesse activeMode { get @@ -78,17 +99,321 @@ namespace GPW_Commesse.WebUserControls } } - /// - /// Determina se visualizzare entrambe le schede... - /// - protected bool openBoth + #endregion Public Properties + + #region Private Methods + + private void cmp_rilTemp_ehCancel(object sender, EventArgs e) { - get + activeMode = modoCommesse.elenco; + showPanels(); + grView.SelectedIndex = -1; + grView.DataBind(); + } + + private void cmp_rilTemp_ehSave(object sender, EventArgs e) + { + activeMode = modoCommesse.elenco; + showPanels(); + } + + private void Cmp_toggle_ehToggle(object sender, EventArgs e) + { + showPanels(); + } + + private void editCommDay(string dataRif) + { + CultureInfo ita = new CultureInfo("it-IT"); + mod_commAttivitaDesk1.idxDipCurr = DataProxy.idxDipendente; + mod_commAttivitaDesk1.valoreDateTime = Convert.ToDateTime(dataRif, ita); + mod_TagCloudProgetti1.dataRif = Convert.ToDateTime(dataRif, ita); + //salvo in sessione dati x detail timbrature + memLayer.ML.setSessionVal("inizioDet", Convert.ToDateTime(dataRif, ita).Date); + memLayer.ML.setSessionVal("fineDet", Convert.ToDateTime(dataRif, ita).Date.AddDays(1)); + memLayer.ML.setSessionVal("idxDip_det", DataProxy.idxDipendente); + // imposto modalità + activeMode = modoCommesse.editRegAtt; + showPanels(); + mod_commAttivitaDesk1.doUpdate(); + } + + private void editTemp(string dataRif) + { + CultureInfo ita = new CultureInfo("it-IT"); + cmp_rilTemp.dtRif = Convert.ToDateTime(dataRif, ita); + cmp_chart.dtRif = Convert.ToDateTime(dataRif, ita); + //salvo in sessione dati x detail timbrature + memLayer.ML.setSessionVal("idxDip_det", DataProxy.idxDipendente); + // imposto modalità + activeMode = modoCommesse.editRilTemp; + showPanels(); + } + + private void editTimbr(string dataRif) + { + DateTime adesso = DateTime.Now; + CultureInfo ita = new CultureInfo("it-IT"); + mod_commUtMancTimbr1.valoreDateTime = Convert.ToDateTime(dataRif, ita).AddHours(adesso.Hour).AddMinutes(adesso.Minute - adesso.Minute % 5); + //salvo in sessione dati x detail timbrature + memLayer.ML.setSessionVal("inizioDet", Convert.ToDateTime(dataRif, ita).Date); + memLayer.ML.setSessionVal("fineDet", Convert.ToDateTime(dataRif, ita).Date.AddDays(1)); + memLayer.ML.setSessionVal("idxDip_det", DataProxy.idxDipendente); + // imposto modalità + activeMode = modoCommesse.editTimb; + showPanels(); + } + + private void mod_commAttivitaDesk1_eh_nuovoValore(object sender, EventArgs e) + { + mod_TagCloudProgetti1.doUpdate(); + grView.DataBind(); + } + + private void mod_commUtMancTimbr1_eh_nuovoValore(object sender, EventArgs e) + { + grView.DataBind(); + } + + private void mod_periodoAnalisi1_eh_doUpdate(object sender, EventArgs e) + { + // 2016.04.07: salvo intervallo nei 2 hidden field + hfDataFrom.Value = mod_periodoAnalisi1.intervalloAnalisi.inizio.ToString(); + hfDataTo.Value = mod_periodoAnalisi1.intervalloAnalisi.fine.ToString(); + // update + mod_commAttivitaDesk1.doUpdate(); + grView.DataBind(); + } + + private void mod_TagCloudProgetti1_eh_newVal(object sender, EventArgs e) + { + mod_commAttivitaDesk1.doUpdate(); + grView.DataBind(); + } + + private void mod_TagCloudProgetti1_eh_refresh(object sender, EventArgs e) + { + mod_commAttivitaDesk1.doUpdate(); + grView.DataBind(); + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// chiamata del button close (entrambi) + /// + /// + /// + protected void btnClose_Click(object sender, EventArgs e) + { + activeMode = modoCommesse.elenco; + showPanels(); + grView.DataBind(); + } + + protected void lbShowTemp_Click(object sender, EventArgs e) + { + string dataRif = ((LinkButton)sender).CommandArgument; + // verifico se dip sia attivo... + if (DataProxy.currDipIsActive) { - return cmp_toggle.toggleValue; + editTemp(dataRif); } } + protected void lbtShowAll_Click(object sender, EventArgs e) + { + openBoth = true; + // mostra tutto su data corrente... + string dataRif = DateTime.Today.ToString("yyyy-MM-dd"); + editTimbr(dataRif); + editCommDay(dataRif); + } + + protected void lnkEditComm_Click(object sender, EventArgs e) + { + string dataRif = ((LinkButton)sender).CommandArgument; + // verifico se dip sia attivo... + if (DataProxy.currDipIsActive) + { + editCommDay(dataRif); + // apro anche data dell'altro SE abilitato + if (openBoth) + { + editTimbr(dataRif); + } + } + } + + protected void lnkEditTimbr_Click(object sender, EventArgs e) + { + string dataRif = ((LinkButton)sender).CommandArgument; + // verifico se dip sia attivo... + if (DataProxy.currDipIsActive) + { + editTimbr(dataRif); + // apro anche data dell'altro SE abilitato + if (openBoth) + { + editCommDay(dataRif); + } + } + } + + /// + /// Avvio pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + memLayer.ML.setSessionVal("maxErrMin", memLayer.ML.confReadInt("maxErrMin")); + memLayer.ML.setSessionVal("maxErrPlus", memLayer.ML.confReadInt("maxErrPlus")); + if (!Page.IsPostBack) + { + activeMode = modoCommesse.elenco; + intervalloDate periodo = new intervalloDate(); + periodo.fine = DateTime.Now.AddDays(1); + periodo.inizio = periodo.fine.AddDays(memLayer.ML.confReadInt("defDayFrom")); + mod_periodoAnalisi1.intervalloAnalisi = periodo; + // salvo link in HF + hfDataFrom.Value = periodo.inizio.ToString(); + hfDataTo.Value = periodo.fine.ToString(); + // imposto modo tag cloud + string modoTC = memLayer.ML.confReadString("TagCloudMode"); + switch (modoTC) + { + case "elenco": + mod_TagCloudProgetti1.modo = TagCloudMode.elenco; + break; + + case "elencoCPF": + mod_TagCloudProgetti1.modo = TagCloudMode.elencoCPF; + break; + + case "piramide": + mod_TagCloudProgetti1.modo = TagCloudMode.piramide; + break; + + case "standard": + default: + mod_TagCloudProgetti1.modo = TagCloudMode.standard; + break; + } + } + showPanels(); + grView.DataBind(); + mod_commUtMancTimbr1.eh_nuovoValore += new EventHandler(mod_commUtMancTimbr1_eh_nuovoValore); + mod_commAttivitaDesk1.eh_nuovoValore += new EventHandler(mod_commAttivitaDesk1_eh_nuovoValore); + mod_TagCloudProgetti1.eh_newVal += new EventHandler(mod_TagCloudProgetti1_eh_newVal); + mod_TagCloudProgetti1.eh_refresh += mod_TagCloudProgetti1_eh_refresh; + mod_periodoAnalisi1.eh_doUpdate += mod_periodoAnalisi1_eh_doUpdate; + cmp_toggle.ehToggle += Cmp_toggle_ehToggle; + cmp_rilTemp.ehCancel += cmp_rilTemp_ehCancel; + cmp_rilTemp.ehSave += cmp_rilTemp_ehSave; + } + + /// + /// imposta visualizzazione dei pannelli opzionali laterali a seocnda del modo attivo + /// + protected void showPanels() + { + // 2016.04.07: salvo intervallo nei 2 hidden field + hfDataFrom.Value = mod_periodoAnalisi1.intervalloAnalisi.inizio.ToString(); + hfDataTo.Value = mod_periodoAnalisi1.intervalloAnalisi.fine.ToString(); + + // imposto valori default + bool commesse = false; + bool temp = false; + bool timbr = false; + divDx.Attributes.Remove("class"); + divCn.Attributes.Remove("class"); + divSx.Attributes.Remove("class"); + if (openBoth) + { + switch (activeMode) + { + case modoCommesse.editTimb: + case modoCommesse.editRegAtt: + commesse = true; + timbr = true; + divCn.Attributes.Add("class", "col-sm-6 px-1"); + divSx.Attributes.Add("class", "col-sm-2 pr-0"); + divDx.Attributes.Add("class", "col-sm-4 pl-0"); + divDx.Visible = true; + divSx.Visible = true; + break; + + case modoCommesse.editRilTemp: + temp = true; + divCn.Attributes.Add("class", "col-sm-7 col-md-8 col-lg-9"); + divSx.Attributes.Add("class", "col-sm-5 col-md-4 col-lg-3"); + divDx.Visible = false; + divSx.Visible = true; + break; + + case modoCommesse.elenco: + default: + divCn.Attributes.Add("class", "col-12"); + divDx.Visible = false; + divSx.Visible = false; + break; + } + } + else + { + switch (activeMode) + { + case modoCommesse.editTimb: + timbr = true; + divCn.Attributes.Add("class", "col-sm-7 col-md-8 col-lg-9"); + divSx.Attributes.Add("class", "col-sm-5 col-md-4 col-lg-3"); + divDx.Visible = false; + divSx.Visible = true; + break; + + case modoCommesse.editRilTemp: + temp = true; + divCn.Attributes.Add("class", "col-12"); + divDx.Visible = false; + divSx.Visible = false; + break; + + case modoCommesse.editRegAtt: + commesse = true; + divCn.Attributes.Add("class", "col-sm-6 col-md-7 col-lg-8"); + divDx.Attributes.Add("class", "col-sm-6 col-md-5 col-lg-4"); + divDx.Visible = true; + divSx.Visible = false; + break; + + case modoCommesse.elenco: + default: + divCn.Attributes.Add("class", "col-12"); + divDx.Visible = false; + divSx.Visible = false; + break; + } + } + // fix finale! + pnlEditCom.Visible = commesse; + pnlEditOre.Visible = timbr; + mod_commAttivitaDesk1.Visible = commesse; + mod_commUtMancTimbr1.Visible = timbr; + divRilTemp.Visible = temp; + cmp_rilTemp.Visible = temp; + cmp_chart.Visible = true; + + upMain.Update(); + upCharts.Update(); + } + + #endregion Protected Methods + + #region Public Methods + /// /// Calcola classe da permesso /// @@ -276,298 +601,6 @@ namespace GPW_Commesse.WebUserControls return answ; } - /// - /// chiamata del button close (entrambi) - /// - /// - /// - protected void btnClose_Click(object sender, EventArgs e) - { - activeMode = modoCommesse.elenco; - showPanels(); - grView.DataBind(); - } - - protected void lbShowTemp_Click(object sender, EventArgs e) - { - string dataRif = ((LinkButton)sender).CommandArgument; - // verifico se dip sia attivo... - if (DataProxy.currDipIsActive) - { - editTemp(dataRif); - } - } - - protected void lnkEditComm_Click(object sender, EventArgs e) - { - string dataRif = ((LinkButton)sender).CommandArgument; - // verifico se dip sia attivo... - if (DataProxy.currDipIsActive) - { - editCommDay(dataRif); - // apro anche data dell'altro SE abilitato - if (openBoth) - { - editTimbr(dataRif); - } - } - } - - protected void lnkEditTimbr_Click(object sender, EventArgs e) - { - string dataRif = ((LinkButton)sender).CommandArgument; - // verifico se dip sia attivo... - if (DataProxy.currDipIsActive) - { - editTimbr(dataRif); - // apro anche data dell'altro SE abilitato - if (openBoth) - { - editCommDay(dataRif); - } - } - } - - /// - /// Avvio pagina - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) - { - memLayer.ML.setSessionVal("maxErrMin", memLayer.ML.confReadInt("maxErrMin")); - memLayer.ML.setSessionVal("maxErrPlus", memLayer.ML.confReadInt("maxErrPlus")); - if (!Page.IsPostBack) - { - activeMode = modoCommesse.elenco; - intervalloDate periodo = new intervalloDate(); - periodo.fine = DateTime.Now.AddDays(1); - periodo.inizio = periodo.fine.AddDays(memLayer.ML.confReadInt("defDayFrom")); - mod_periodoAnalisi1.intervalloAnalisi = periodo; - // salvo link in HF - hfDataFrom.Value = periodo.inizio.ToString(); - hfDataTo.Value = periodo.fine.ToString(); - // imposto modo tag cloud - string modoTC = memLayer.ML.confReadString("TagCloudMode"); - switch (modoTC) - { - case "elenco": - mod_TagCloudProgetti1.modo = TagCloudMode.elenco; - break; - - case "elencoCPF": - mod_TagCloudProgetti1.modo = TagCloudMode.elencoCPF; - break; - - case "piramide": - mod_TagCloudProgetti1.modo = TagCloudMode.piramide; - break; - - case "standard": - default: - mod_TagCloudProgetti1.modo = TagCloudMode.standard; - break; - } - } - showPanels(); - grView.DataBind(); - mod_commUtMancTimbr1.eh_nuovoValore += new EventHandler(mod_commUtMancTimbr1_eh_nuovoValore); - mod_commAttivitaDesk1.eh_nuovoValore += new EventHandler(mod_commAttivitaDesk1_eh_nuovoValore); - mod_TagCloudProgetti1.eh_newVal += new EventHandler(mod_TagCloudProgetti1_eh_newVal); - mod_TagCloudProgetti1.eh_refresh += mod_TagCloudProgetti1_eh_refresh; - mod_periodoAnalisi1.eh_doUpdate += mod_periodoAnalisi1_eh_doUpdate; - cmp_toggle.ehToggle += Cmp_toggle_ehToggle; - cmp_rilTemp.ehCancel += cmp_rilTemp_ehCancel; - cmp_rilTemp.ehSave += cmp_rilTemp_ehSave; - } - - /// - /// imposta visualizzazione dei pannelli opzionali laterali a seocnda del modo attivo - /// - protected void showPanels() - { - // 2016.04.07: salvo intervallo nei 2 hidden field - hfDataFrom.Value = mod_periodoAnalisi1.intervalloAnalisi.inizio.ToString(); - hfDataTo.Value = mod_periodoAnalisi1.intervalloAnalisi.fine.ToString(); - - // imposto valori default - bool commesse = false; - bool temp = false; - bool timbr = false; - divDx.Attributes.Remove("class"); - divCn.Attributes.Remove("class"); - divSx.Attributes.Remove("class"); - if (openBoth) - { - switch (activeMode) - { - case modoCommesse.editTimb: - case modoCommesse.editRegAtt: - commesse = true; - timbr = true; - divCn.Attributes.Add("class", "col-sm-6 px-1"); - divSx.Attributes.Add("class", "col-sm-2 pr-0"); - divDx.Attributes.Add("class", "col-sm-4 pl-0"); - divDx.Visible = true; - divSx.Visible = true; - break; - - case modoCommesse.editRilTemp: - temp = true; - divCn.Attributes.Add("class", "col-sm-7 col-md-8 col-lg-9"); - divSx.Attributes.Add("class", "col-sm-5 col-md-4 col-lg-3"); - divDx.Visible = false; - divSx.Visible = true; - break; - - case modoCommesse.elenco: - default: - divCn.Attributes.Add("class", "col-12"); - divDx.Visible = false; - divSx.Visible = false; - break; - } - } - else - { - switch (activeMode) - { - case modoCommesse.editTimb: - timbr = true; - divCn.Attributes.Add("class", "col-sm-7 col-md-8 col-lg-9"); - divSx.Attributes.Add("class", "col-sm-5 col-md-4 col-lg-3"); - divDx.Visible = false; - divSx.Visible = true; - break; - - case modoCommesse.editRilTemp: - temp = true; - divCn.Attributes.Add("class", "col-12"); - divDx.Visible = false; - divSx.Visible = false; - break; - - case modoCommesse.editRegAtt: - commesse = true; - divCn.Attributes.Add("class", "col-sm-6 col-md-7 col-lg-8"); - divDx.Attributes.Add("class", "col-sm-6 col-md-5 col-lg-4"); - divDx.Visible = true; - divSx.Visible = false; - break; - - case modoCommesse.elenco: - default: - divCn.Attributes.Add("class", "col-12"); - divDx.Visible = false; - divSx.Visible = false; - break; - } - } - // fix finale! - pnlEditCom.Visible = commesse; - pnlEditOre.Visible = timbr; - mod_commAttivitaDesk1.Visible = commesse; - mod_commUtMancTimbr1.Visible = timbr; - divRilTemp.Visible = temp; - cmp_rilTemp.Visible = temp; - cmp_chart.Visible = true; - - upMain.Update(); - upCharts.Update(); - } - - private void cmp_rilTemp_ehCancel(object sender, EventArgs e) - { - activeMode = modoCommesse.elenco; - showPanels(); - grView.SelectedIndex = -1; - grView.DataBind(); - } - - private void cmp_rilTemp_ehSave(object sender, EventArgs e) - { - activeMode = modoCommesse.elenco; - showPanels(); - } - - private void Cmp_toggle_ehToggle(object sender, EventArgs e) - { - showPanels(); - } - - private void editCommDay(string dataRif) - { - CultureInfo ita = new CultureInfo("it-IT"); - mod_commAttivitaDesk1.idxDipCurr = DataProxy.idxDipendente; - mod_commAttivitaDesk1.valoreDateTime = Convert.ToDateTime(dataRif, ita); - mod_TagCloudProgetti1.dataRif = Convert.ToDateTime(dataRif, ita); - //salvo in sessione dati x detail timbrature - memLayer.ML.setSessionVal("inizioDet", Convert.ToDateTime(dataRif, ita).Date); - memLayer.ML.setSessionVal("fineDet", Convert.ToDateTime(dataRif, ita).Date.AddDays(1)); - memLayer.ML.setSessionVal("idxDip_det", DataProxy.idxDipendente); - // imposto modalità - activeMode = modoCommesse.editRegAtt; - showPanels(); - mod_commAttivitaDesk1.doUpdate(); - } - - private void editTemp(string dataRif) - { - CultureInfo ita = new CultureInfo("it-IT"); - cmp_rilTemp.dtRif = Convert.ToDateTime(dataRif, ita); - cmp_chart.dtRif = Convert.ToDateTime(dataRif, ita); - //salvo in sessione dati x detail timbrature - memLayer.ML.setSessionVal("idxDip_det", DataProxy.idxDipendente); - // imposto modalità - activeMode = modoCommesse.editRilTemp; - showPanels(); - } - - private void editTimbr(string dataRif) - { - DateTime adesso = DateTime.Now; - CultureInfo ita = new CultureInfo("it-IT"); - mod_commUtMancTimbr1.valoreDateTime = Convert.ToDateTime(dataRif, ita).AddHours(adesso.Hour).AddMinutes(adesso.Minute - adesso.Minute % 5); - //salvo in sessione dati x detail timbrature - memLayer.ML.setSessionVal("inizioDet", Convert.ToDateTime(dataRif, ita).Date); - memLayer.ML.setSessionVal("fineDet", Convert.ToDateTime(dataRif, ita).Date.AddDays(1)); - memLayer.ML.setSessionVal("idxDip_det", DataProxy.idxDipendente); - // imposto modalità - activeMode = modoCommesse.editTimb; - showPanels(); - } - - private void mod_commAttivitaDesk1_eh_nuovoValore(object sender, EventArgs e) - { - mod_TagCloudProgetti1.doUpdate(); - grView.DataBind(); - } - - private void mod_commUtMancTimbr1_eh_nuovoValore(object sender, EventArgs e) - { - grView.DataBind(); - } - - private void mod_periodoAnalisi1_eh_doUpdate(object sender, EventArgs e) - { - // 2016.04.07: salvo intervallo nei 2 hidden field - hfDataFrom.Value = mod_periodoAnalisi1.intervalloAnalisi.inizio.ToString(); - hfDataTo.Value = mod_periodoAnalisi1.intervalloAnalisi.fine.ToString(); - // update - mod_commAttivitaDesk1.doUpdate(); - grView.DataBind(); - } - - private void mod_TagCloudProgetti1_eh_newVal(object sender, EventArgs e) - { - mod_commAttivitaDesk1.doUpdate(); - grView.DataBind(); - } - - private void mod_TagCloudProgetti1_eh_refresh(object sender, EventArgs e) - { - mod_commAttivitaDesk1.doUpdate(); - grView.DataBind(); - } + #endregion Public Methods } } \ No newline at end of file