Update minori pagina ODL

This commit is contained in:
Samuele Locatelli
2022-10-07 18:43:32 +02:00
parent dd26773590
commit 4f03661182
3 changed files with 76 additions and 75 deletions
+8 -10
View File
@@ -39,17 +39,15 @@ namespace MP.Data.DatabaseModels
get
{
string answ = "";
if (DataFine != null)
DateTime end = DataFine != null ? (DateTime)DataFine : DateTime.Now;
var tsDurata = (end).Subtract((DateTime)DataInizio);
if (tsDurata.TotalDays < 1)
{
var tsDurata = ((DateTime)DataFine).Subtract((DateTime)DataInizio);
if (tsDurata.TotalDays < 1)
{
answ = $"{tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
}
else
{
answ = $"{tsDurata.Days}gg {tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
}
answ = $"{tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
}
else
{
answ = $"{tsDurata.Days}gg {tsDurata.Hours:00}h";
}
return answ;
}
+6 -3
View File
@@ -38,8 +38,8 @@ else
</div>
@if (record.Note != "")
{
<div class="small textConsensed text-secondary badge text-bg-light border border-primary rounded">
<b class="text-dark">Note:</b> <span class="text-wrap text-start"> @record.Note </span>
<div class="small textConsensed text-secondary badge text-bg-light border border-secondary rounded">
<b class="text-dark"></b> <span class="text-wrap text-start"> @record.Note </span>
</div>
}
</td>
@@ -70,7 +70,10 @@ else
}
else
{
<b><i class="fa-solid fa-hourglass-half"></i></b>
<div class="text-secondary">
<div><b>@($"{DateTime.Now:yyyy/MM/dd}")</b></div>
<div>@($"{DateTime.Now:ddd HH:mm:ss}")</div>
</div>
}
</div>
</div>
+62 -62
View File
@@ -7,10 +7,22 @@ namespace MP.SPEC.Pages
{
public partial class ODL
{
#region Public Properties
#region Public Methods
/// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime RoundDatetime(int minRound)
{
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
return endRounded;
}
#endregion Public Properties
#endregion Public Methods
#region Protected Fields
@@ -20,6 +32,12 @@ namespace MP.SPEC.Pages
#region Protected Properties
protected bool isActive
{
get => currFilter.IsActive;
set => currFilter.IsActive = value;
}
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
@@ -29,6 +47,30 @@ namespace MP.SPEC.Pages
[Inject]
protected MessageService MsgService { get; set; } = null!;
protected DateTime selDtEnd
{
get => currFilter.DtEnd;
set
{
if (currFilter.DtEnd != value)
{
currFilter.DtEnd = value;
}
}
}
protected DateTime selDtStart
{
get => currFilter.DtStart;
set
{
if (currFilter.DtStart != value)
{
currFilter.DtStart = value;
}
}
}
#endregion Protected Properties
#region Protected Methods
@@ -52,7 +94,7 @@ namespace MP.SPEC.Pages
ListStati = await MDService.AnagStatiComm();
#if false
// carico dati
await reloadData();
await reloadData();
#endif
}
@@ -64,6 +106,13 @@ namespace MP.SPEC.Pages
}
}
protected void setDtMax()
{
// copio il filtro
currFilter.DtEnd = RoundDatetime(5);
currFilter.DtStart = RoundDatetime(5).AddDays(-1);
}
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
@@ -89,19 +138,28 @@ namespace MP.SPEC.Pages
private bool isLoading { get; set; } = false;
private string leftStringCSS
{
get => isActive ? "text-secondary" : "text-dark fw-bold";
}
private int numRecord
{
get => MsgService.numRecord;
set => MsgService.numRecord = value;
}
private string rightStringCSS
{
get => isActive ? "text-dark fw-bold" : "text-secondary";
}
private string selStato
{
get => currFilter.CodStato;
set => currFilter.CodStato = value;
}
private int totalCount
{
get => MsgService.totalCount;
@@ -109,63 +167,5 @@ namespace MP.SPEC.Pages
}
#endregion Private Properties
#region Private Methods
protected bool isActive
{
get => currFilter.IsActive;
set => currFilter.IsActive = value;
}
protected DateTime selDtStart
{
get => currFilter.DtStart;
set
{
if (currFilter.DtStart != value)
{
currFilter.DtStart = value;
}
}
}
protected DateTime selDtEnd
{
get => currFilter.DtEnd;
set
{
if (currFilter.DtEnd != value)
{
currFilter.DtEnd = value;
}
}
}
private string leftStringCSS
{
get => isActive ? "text-secondary" : "text-dark";
}
private string rightStringCSS
{
get => isActive ? "text-dark" : "text-secondary";
}
protected void setDtMax()
{
// copio il filtro
currFilter.DtEnd = RoundDatetime(5);
currFilter.DtStart = RoundDatetime(5).AddDays(-1);
}
/// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime RoundDatetime(int minRound)
{
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
return endRounded;
}
#endregion Private Methods
}
}