diff --git a/MP.Data/DatabaseModels/ODLModel.cs b/MP.Data/DatabaseModels/ODLModel.cs index ead0554b..6b140ff1 100644 --- a/MP.Data/DatabaseModels/ODLModel.cs +++ b/MP.Data/DatabaseModels/ODLModel.cs @@ -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; } diff --git a/MP.SPEC/Components/ListODL.razor b/MP.SPEC/Components/ListODL.razor index 2deaad4d..cf58da0e 100644 --- a/MP.SPEC/Components/ListODL.razor +++ b/MP.SPEC/Components/ListODL.razor @@ -38,8 +38,8 @@ else @if (record.Note != "") { -
- Note: @record.Note +
+ @record.Note
} @@ -70,7 +70,10 @@ else } else { - +
+
@($"{DateTime.Now:yyyy/MM/dd}")
+
@($"{DateTime.Now:ddd HH:mm:ss}")
+
}
diff --git a/MP.SPEC/Pages/ODL.razor.cs b/MP.SPEC/Pages/ODL.razor.cs index 6acde664..48cd0004 100644 --- a/MP.SPEC/Pages/ODL.razor.cs +++ b/MP.SPEC/Pages/ODL.razor.cs @@ -7,10 +7,22 @@ namespace MP.SPEC.Pages { public partial class ODL { - #region Public Properties + #region Public Methods + /// + /// Inizializzazione con periodo e arrotondamento + /// + /// + /// + 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); - } - /// - /// Inizializzazione con periodo e arrotondamento - /// - /// - /// - 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 } } \ No newline at end of file