diff --git a/GPW.CORE.UI/Data/WeatherForecast.cs b/GPW.CORE.UI/Data/WeatherForecast.cs deleted file mode 100644 index 7c22a58..0000000 --- a/GPW.CORE.UI/Data/WeatherForecast.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace GPW.CORE.UI.Data -{ - public class WeatherForecast - { - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } - } -} \ No newline at end of file diff --git a/GPW.CORE.UI/Data/WeatherForecastService.cs b/GPW.CORE.UI/Data/WeatherForecastService.cs deleted file mode 100644 index 11321b8..0000000 --- a/GPW.CORE.UI/Data/WeatherForecastService.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace GPW.CORE.UI.Data -{ - public class WeatherForecastService - { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - public Task GetForecastAsync(DateTime startDate) - { - return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = startDate.AddDays(index), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }).ToArray()); - } - } -} \ No newline at end of file diff --git a/GPW.CORE.UI/Pages/Dipendenti.razor b/GPW.CORE.UI/Pages/Dipendenti.razor new file mode 100644 index 0000000..8dc6c09 --- /dev/null +++ b/GPW.CORE.UI/Pages/Dipendenti.razor @@ -0,0 +1,73 @@ +@page "/Dipendenti" + +@using GPW.CORE.UI.Components + +Dipendenti + +
+
+

Dipendenti

+
+
+ @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
No Record Found
+ } + else + { +
+
+ @*
*@ + + + + @**@ + + + + + + + + + @foreach (var record in ListRecords) + { + + @**@ + + + + + + + } + +
CognomeNomeAnagrafeDominioUsername
+ + + @record.Cognome + + @record.Nome + + nato a @record.LuogoNascita, @record.ProvNascita il @record.DataNascita + + @record.Dominio + + @record.Utente +
+
+
+ } +
+ +
+ + diff --git a/GPW.CORE.UI/Pages/Dipendenti.razor.cs b/GPW.CORE.UI/Pages/Dipendenti.razor.cs new file mode 100644 index 0000000..ad9a3e9 --- /dev/null +++ b/GPW.CORE.UI/Pages/Dipendenti.razor.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using GPW.CORE.UI; +using GPW.CORE.UI.Shared; +using GPW.CORE.UI.Components; +using GPW.CORE.Data.DbModels; +using GPW.CORE.UI.Data; + +namespace GPW.CORE.UI.Pages +{ + public partial class Dipendenti : ComponentBase, IDisposable + { + #region Private Fields + + private List ListRecords = null!; + private List SearchRecords = null!; + + #endregion Private Fields + + #region Private Properties + + private int _currPage { get; set; } = 1; + + private int _numRecord { get; set; } = 10; + + private int currPage + { + get => _currPage; + set + { + if (_currPage != value) + { + _currPage = value; + ReloadData().ConfigureAwait(false); + } + } + } + + private bool isLoading { get; set; } = false; + + private int IdxDipSel = 0; + + [Inject] + private NavigationManager NavManager { get; set; } = null!; + + private int numRecord + { + get => _numRecord; + set + { + if (_numRecord != value) + { + _numRecord = value; + ReloadData().ConfigureAwait(false); + } + } + } + + #endregion Private Properties + + #region Protected Properties + + [Inject] + + protected MessageService AppMService { get; set; } = null!; + + [Inject] + protected GpwDataService DataService { get; set; } = null!; + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + protected int totalCount + { + get + { + int answ = 0; + if (SearchRecords != null) + { + answ = SearchRecords.Count; + } + return answ; + } + } + + #endregion Protected Properties + + #region Private Methods + + private async Task ReloadData() + { + isLoading = true; + SearchRecords = await DataService.DipendentiGetAll(); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + + #region Protected Methods + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } + + protected override async Task OnInitializedAsync() + { + await ReloadData(); + } + + protected void ResetData() + { + //DataService.rollBackEdit(currRecord); + } + + protected void Select(DipendentiModel selRecord) + { + IdxDipSel = selRecord.IdxDipendente; + //// rimando a remnants + //NavManager.NavigateTo($"Remnants"); + } + + #endregion Protected Methods + + #region Public Methods + + public void Dispose() + { + //AppMService.EA_SearchUpdated -= OnSeachUpdated; + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/GPW.CORE.UI/Pages/FetchData.razor b/GPW.CORE.UI/Pages/FetchData.razor deleted file mode 100644 index 550fb95..0000000 --- a/GPW.CORE.UI/Pages/FetchData.razor +++ /dev/null @@ -1,48 +0,0 @@ -@page "/fetchdata" - -Weather forecast - -@using GPW.CORE.UI.Data -@inject WeatherForecastService ForecastService - -

Weather forecast

- -

This component demonstrates fetching data from a service.

- -@if (forecasts == null) -{ -

Loading...

-} -else -{ - - - - - - - - - - - @foreach (var forecast in forecasts) - { - - - - - - - } - -
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
-} - -@code { - private WeatherForecast[]? forecasts; - - protected override async Task OnInitializedAsync() - { - forecasts = await ForecastService.GetForecastAsync(DateTime.Now); - } -} diff --git a/GPW.CORE.UI/Program.cs b/GPW.CORE.UI/Program.cs index a649cef..7e49134 100644 --- a/GPW.CORE.UI/Program.cs +++ b/GPW.CORE.UI/Program.cs @@ -15,9 +15,16 @@ builder.Services.AddAuthorization(options => options.FallbackPolicy = options.DefaultPolicy; }); +builder.Services.AddStackExchangeRedisCache(options => +{ + options.ConfigurationOptions = new StackExchange.Redis.ConfigurationOptions() { KeepAlive = 180, DefaultDatabase = 15, EndPoints = { { "localhost", 6379 } } }; + options.InstanceName = "GPW-CORE:"; +}); + builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); -builder.Services.AddSingleton(); +builder.Services.AddSingleton(); +builder.Services.AddScoped(); var app = builder.Build(); diff --git a/GPW.CORE.UI/Shared/NavMenu.razor b/GPW.CORE.UI/Shared/NavMenu.razor index 4cc0f8b..17f024a 100644 --- a/GPW.CORE.UI/Shared/NavMenu.razor +++ b/GPW.CORE.UI/Shared/NavMenu.razor @@ -30,8 +30,8 @@ diff --git a/GPW.CORE.UI/appsettings.json b/GPW.CORE.UI/appsettings.json index 10f68b8..7ab6d4c 100644 --- a/GPW.CORE.UI/appsettings.json +++ b/GPW.CORE.UI/appsettings.json @@ -5,5 +5,9 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "ConnectionStrings": { + "GPW.DB": "Server=SQLSTEAM;Database=GPW; User ID=sa;Password=keyhammer; integrated security=False; MultipleActiveResultSets=True; App=GPW.CORE.UI;", + "Redis": "localhost:6379" + } }