Ok colore date
This commit is contained in:
@@ -33,25 +33,44 @@ namespace GPW.CORE.Smart.Components
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
dtCurr = DateTime.Today;
|
||||
DateTime MeseStart = new DateTime(dtCurr.Year, dtCurr.Month, 1);
|
||||
DateTime MeseEnd = MeseStart.AddMonths(1);
|
||||
await Task.Delay(1);
|
||||
|
||||
listRecords = await CSDataService.DailyDetails(IdxDipendente, MeseStart, MeseEnd);
|
||||
await reloadData();
|
||||
//Random rnd = new Random();
|
||||
//// random colorate...
|
||||
//for (int i = 0; i < 10; i++)
|
||||
//{
|
||||
// DateTime newDate = dtCurr.AddDays(rnd.Next(-5, 10)).Date;
|
||||
// if (!DateCheck.ContainsKey(newDate))
|
||||
// {
|
||||
// DateCheck.Add(newDate, "bg-success text-light rounded-circle p-2");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// DateCheck[newDate] = "bg-warning text-light rounded-circle p-2";
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
DateTime MeseStart = new DateTime(dtCurr.Year, dtCurr.Month, 1);
|
||||
DateTime MeseEnd = MeseStart.AddMonths(1);
|
||||
listRecords = await CSDataService.DailyDetails(IdxDipendente, MeseStart, MeseEnd);
|
||||
DateCheck = new Dictionary<DateTime, string>();
|
||||
Random rnd = new Random();
|
||||
// random colorate...
|
||||
for (int i = 0; i < 10; i++)
|
||||
string cssOkComm = "bg-success text-light rounded-circle p-2";
|
||||
string cssOkLav = "bg-warning text-light rounded-circle p-2";
|
||||
if (listRecords != null)
|
||||
{
|
||||
DateTime newDate = dtCurr.AddDays(rnd.Next(-5, 10)).Date;
|
||||
if (!DateCheck.ContainsKey(newDate))
|
||||
string currCss = "";
|
||||
foreach (var giorno in listRecords)
|
||||
{
|
||||
DateCheck.Add(newDate, "bg-success text-light rounded-circle p-2");
|
||||
}
|
||||
else
|
||||
{
|
||||
DateCheck[newDate] = "bg-warning text-light rounded-circle p-2";
|
||||
currCss = giorno.OreLav == 0 ? "" : cssOkLav;
|
||||
if (Math.Abs((giorno.OreLav - giorno.OreComm)) < 0.5 && giorno.OreLav > 0)
|
||||
{
|
||||
currCss = cssOkComm;
|
||||
}
|
||||
DateCheck.Add(giorno.DtRif, currCss);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user