diff --git a/GPW_Admin/WebUserControls/cmp_calWeek.ascx b/GPW_Admin/WebUserControls/cmp_calWeek.ascx
index 64bcc3b..a7455be 100644
--- a/GPW_Admin/WebUserControls/cmp_calWeek.ascx
+++ b/GPW_Admin/WebUserControls/cmp_calWeek.ascx
@@ -26,6 +26,8 @@
DataStartField="Inizio"
DataEndField="Fine"
HeaderDateFormat="ddd dd/MM"
+ CssOnly="true"
+ CssClass="Css"
TimeFormat="Clock24Hours"
ToolTip="ToolTip"
HeightSpec="BusinessHours"
diff --git a/GPW_Admin/WebUserControls/cmp_calWeek.ascx.cs b/GPW_Admin/WebUserControls/cmp_calWeek.ascx.cs
index fa3c58a..d5f6631 100644
--- a/GPW_Admin/WebUserControls/cmp_calWeek.ascx.cs
+++ b/GPW_Admin/WebUserControls/cmp_calWeek.ascx.cs
@@ -112,35 +112,6 @@ namespace GPW_Admin.WebUserControls
#region Protected Methods
- ///
- /// intercetto e cambio classe CSS...
- ///
- ///
- ///
- protected void WeekCalendar_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.Calendar.BeforeEventRenderEventArgs e)
- {
- if (e.Text.Contains("FEST"))
- {
- e.CssClass = "bg-danger text-warning";
- }
- else if (e.Text.Contains("FER"))
- {
- e.CssClass = "bg-warning";
- }
- else if (e.Text.Contains("MAL"))
- {
- e.CssClass = "bg-dark text-light";
- }
- else if (e.Text.Contains("104"))
- {
- e.CssClass = "g104Conf";
- }
- else if (e.Text.Contains("PERM"))
- {
- e.CssClass = "gPerConf";
- }
- }
-
protected string datiDip(object idxDip)
{
int idxDipendente = 0;
@@ -179,12 +150,6 @@ namespace GPW_Admin.WebUserControls
WeekCalendar.DataSource = getData();
DataBind();
}
-
-#if false
- repCal.Visible = chkLicOk;
- listaDip = licenzeGPW.getDipAttivi();
- divRichDip.Visible = showRichDip;
-#endif
}
#endregion Protected Methods
@@ -267,12 +232,11 @@ namespace GPW_Admin.WebUserControls
{
var elencoCFF = listCFF.Select(x => new CustomEvent()
{
- Inizio = x.data,
- Fine = x.data.AddDays(1),
+ Inizio = calcDuration(x.data, x.data).Item1,
+ Fine = calcDuration(x.data, x.data).Item2,
Name = $"{x.codGiust} - {x.descrizione}",
- Id = $"F{x.data:yyyyMMdd}",
- Tooltip = $"{x.codGiust} - {x.descrizione}",
- CssClass = x.codGiust == "FEST" ? "bg-danger text-warning" : "bg-warning"
+ Id = $"CFF{x.data:yyyyMMdd}",
+ Tooltip = $"{x.codGiust} - {x.descrizione}"
}).ToList();
al.AddRange(elencoCFF);
}
@@ -286,9 +250,8 @@ namespace GPW_Admin.WebUserControls
Inizio = x.DtInizio,
Fine = x.DtInizio.AddDays(x.NumGG),
Name = $"{datiDip(x.IdxDipendente)} | MAL",
- Id = $"M{x.IdxRegMal}",
- Tooltip = $"{datiDip(x.IdxDipendente)} | MAL - {x.CodCert}",
- CssClass = "bg-dark text-light"
+ Id = $"CM{x.IdxRegMal}",
+ Tooltip = $"{datiDip(x.IdxDipendente)} | MAL - {x.CodCert}"
}).ToList();
al.AddRange(elencoRM);
}
@@ -299,13 +262,11 @@ namespace GPW_Admin.WebUserControls
{
var elencoRR = listRR.Select(x => new CustomEvent()
{
- Inizio = x.DtStart,
- Fine = x.DtEnd.Subtract(x.DtStart).TotalHours > 0.1 ? x.DtEnd : x.DtEnd.AddDays(1),
- //AllDay = x.DtStart,
+ Inizio = calcDuration(x.DtStart, x.DtEnd).Item1,
+ Fine = calcDuration(x.DtStart, x.DtEnd).Item2,
Name = $"{datiDip(x.IdxDipendente)} | {x.CodGiust}",
- Id = $"R{x.IdxRegRich}",
- Tooltip = $"{datiDip(x.IdxDipendente)} | {x.CodGiust} - {x.Note}",
- CssClass = getCssClassReq(x.CodGiust, x.Conf)
+ Id = x.Conf ? $"RC{x.IdxRegRich}" : $"RNC{x.IdxRegRich}",
+ Tooltip = $"{datiDip(x.IdxDipendente)} | {x.CodGiust} - {x.Note}"
}).ToList();
al.AddRange(elencoRR);
}
@@ -314,30 +275,91 @@ namespace GPW_Admin.WebUserControls
return al;
}
- private string getCssClassReq(string codGiust, bool isConf)
+ ///
+ /// intercetto e cambio classe CSS...
+ ///
+ ///
+ ///
+ protected void WeekCalendar_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.Calendar.BeforeEventRenderEventArgs e)
{
- string answ = "";
- switch (codGiust)
+ if (e.Text.Contains("FEST"))
{
- case "104":
- answ = isConf ? "g104Conf" : "g104NC";
- break;
-
- case "FER":
- answ = isConf ? "gFerConf" : "gFerNC";
- break;
-
- case "PERM":
- answ = isConf ? "gPerConf" : "gPerNC";
- break;
-
- default:
- answ = "bg-dark text-light";
- break;
+ e.CssClass = "bg-danger text-warning";
+ }
+ else if (e.Text.Contains("FER"))
+ {
+ if (e.Id.StartsWith("RNC"))
+ {
+ e.CssClass = "gFerNC";
+ }
+ else if (e.Id.StartsWith("RC"))
+ {
+ e.CssClass = "gFerConf";
+ }
+ else
+ {
+ e.CssClass = "bg-warning";
+ }
+ }
+ else if (e.Text.Contains("MAL"))
+ {
+ e.CssClass = "bg-dark text-light";
+ }
+ else if (e.Text.Contains("104"))
+ {
+ if (e.Id.StartsWith("RNC"))
+ {
+ e.CssClass = "g104NC";
+ }
+ else if (e.Id.StartsWith("RC"))
+ {
+ e.CssClass = "g104Conf";
+ }
+ }
+ else if (e.Text.Contains("PERM"))
+ {
+ if (e.Id.StartsWith("RNC"))
+ {
+ e.CssClass = "gPerNC";
+ }
+ else if (e.Id.StartsWith("RC"))
+ {
+ e.CssClass = "gPerConf";
+ }
}
- return answ;
}
+ ///
+ /// Calcolo durata evento dato tipo, inizio e fine salvati:
+ /// - es ferie x 1 gg --> 8h
+ ///
+ ///
+ ///
+ ///
+ protected Tuple calcDuration(DateTime dtInizio, DateTime dtFine)
+ {
+ var durata = Math.Abs(dtFine.Subtract(dtInizio).TotalHours);
+ // giorno singolo
+ if (durata < 24)
+ {
+ // se durata zero = 1gg --> 8h
+ durata = durata == 0 ? 8 : durata;
+ }
+ else
+ {
+ // se è su più gg --> aggiungo 1
+ durata += 10;
+ }
+ // se inizio mezzanotte --> metto le 9:00...
+ if (dtInizio.Hour == 0)
+ {
+ dtInizio = dtInizio.AddHours(9);
+ }
+ // calcolo!
+ dtFine = dtInizio.AddHours(durata);
+ Tuple answ = new Tuple(dtInizio, dtFine);
+ return answ;
+ }
public class CustomEvent
{
private string name;
@@ -345,13 +367,8 @@ namespace GPW_Admin.WebUserControls
private DateTime start;
private DateTime end;
private string id;
- private string cssClass;
- public string CssClass
- {
- get => cssClass;
- set => cssClass = value;
- }
+
public string Name
{
get => name;
diff --git a/GPW_Admin/WebUserControls/cmp_gestRichDip.ascx b/GPW_Admin/WebUserControls/cmp_gestRichDip.ascx
index c6d33f6..026d122 100644
--- a/GPW_Admin/WebUserControls/cmp_gestRichDip.ascx
+++ b/GPW_Admin/WebUserControls/cmp_gestRichDip.ascx
@@ -113,7 +113,7 @@
-
-
+
+
diff --git a/GPW_Admin/WebUserControls/cmp_gestRichDip.ascx.cs b/GPW_Admin/WebUserControls/cmp_gestRichDip.ascx.cs
index 723fc82..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,45 +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)
- {
- cmp_calWeek.DataRif = richDip.DtStart.Date;
- }
- }
- }
-
- 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