diff --git a/GPW_Admin/WebUserControls/cmp_gestRichDip.ascx.cs b/GPW_Admin/WebUserControls/cmp_gestRichDip.ascx.cs index 9d7faf3..56ab8cb 100644 --- a/GPW_Admin/WebUserControls/cmp_gestRichDip.ascx.cs +++ b/GPW_Admin/WebUserControls/cmp_gestRichDip.ascx.cs @@ -21,7 +21,6 @@ namespace GPW_Admin.WebUserControls grView.DataBind(); } - #endregion Public Methods #region Protected Properties @@ -99,13 +98,17 @@ namespace GPW_Admin.WebUserControls #region Protected Methods - protected void chkShowAll_CheckedChanged(object sender, EventArgs e) { chkShowAll.Text = chkShowAll.Checked ? "Mostra Tutti" : "Da Confermare"; cmp_calAnnuale.showAlsoConf = chkShowAll.Checked; } + protected void chkWeek_CheckedChanged(object sender, EventArgs e) + { + fixCalDisplay(); + } + protected string datiDip(object idxDip) { int idxDipendente = 0; @@ -124,12 +127,35 @@ namespace GPW_Admin.WebUserControls listRR = RRListByAnno(anno); } - protected void ods_Deleted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e) + protected void grView_SelectedIndexChanged(object sender, EventArgs e) { - doUpdateCal(); + // recupero richiesta... + string sIdx = $"{grView.SelectedDataKey["IdxRegRich"]}"; + if (!string.IsNullOrEmpty(sIdx)) + { + int IdxRegRich = 0; + int.TryParse(sIdx, out IdxRegRich); + if (listRR == null || listRR.Count == 0) + { + doUpdateCal(); + } + // cerco richeista + var richDip = listRR.Where(x => x.IdxRegRich == IdxRegRich).FirstOrDefault(); + if (richDip != null) + { + // metto come data il lUNEDI' della data indicata... + var dtRif = richDip.DtStart.Date; + if (dtRif.DayOfWeek != DayOfWeek.Monday) + { + int offset = dtRif.DayOfWeek - DayOfWeek.Monday; + dtRif = dtRif.AddDays(-offset); + } + cmp_calWeek.DataRif = dtRif; + } + } } - protected void ods_Updated(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e) + protected void ods_Deleted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e) { doUpdateCal(); } @@ -210,6 +236,11 @@ namespace GPW_Admin.WebUserControls } } + protected void ods_Updated(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e) + { + doUpdateCal(); + } + /// /// check licenze in fase di update... /// @@ -313,6 +344,13 @@ namespace GPW_Admin.WebUserControls doUpdateCal(); } + protected void txtNumGG_TextChanged(object sender, EventArgs e) + { + int numGG = 10; + int.TryParse(txtNumGG.Text, out numGG); + cmp_calWeek.NumGG = numGG; + } + #endregion Protected Methods #region Private Methods @@ -324,6 +362,13 @@ namespace GPW_Admin.WebUserControls doUpdate(); } + private void fixCalDisplay() + { + // verifico cosa mostrare... + cmp_calAnnuale.Visible = !chkWeek.Checked; + cmp_calWeek.Visible = chkWeek.Checked; + } + private void reportAnno() { Inizio = new DateTime(anno, 1, 1); @@ -351,52 +396,5 @@ namespace GPW_Admin.WebUserControls } #endregion Private Methods - - protected void chkWeek_CheckedChanged(object sender, EventArgs e) - { - fixCalDisplay(); - } - - private void fixCalDisplay() - { - // verifico cosa mostrare... - cmp_calAnnuale.Visible = !chkWeek.Checked; - cmp_calWeek.Visible = chkWeek.Checked; - } - - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - // recupero richiesta... - string sIdx = $"{grView.SelectedDataKey["IdxRegRich"]}"; - if (!string.IsNullOrEmpty(sIdx)) - { - int IdxRegRich = 0; - int.TryParse(sIdx, out IdxRegRich); - if (listRR == null || listRR.Count == 0) - { - doUpdateCal(); - } - // cerco richeista - var richDip = listRR.Where(x => x.IdxRegRich == IdxRegRich).FirstOrDefault(); - if (richDip != null) - { - // metto come data il lUNEDI' della data indicata... - var dtRif = richDip.DtStart.Date; - if(dtRif.DayOfWeek!= DayOfWeek.Monday) - { - int offset = dtRif.DayOfWeek - DayOfWeek.Monday; - dtRif = dtRif.AddDays(-offset); - } - cmp_calWeek.DataRif = dtRif; - } - } - } - - protected void txtNumGG_TextChanged(object sender, EventArgs e) - { - int numGG = 10; - int.TryParse(txtNumGG.Text, out numGG); - cmp_calWeek.NumGG = numGG; - } } } \ No newline at end of file