Alinear BD local con esquema de produccion, login offline y publicacion portable
- Modelos renombrados para coincidir con columnas de MariaDB (ApPaterno/ApMaterno, HoraSalida, FechaFin, IdAsistenciaProfesor) - Agregado campo IdAlumno a DetalleContrato - Seed data con IDs reales de produccion (16451, 16493, profesor 15668563-1) - Login offline: solo valida RUT contra BD local, sin contraseña - ConnectivityService: checkea internet al inicio, bloquea si hay conexion - ViewLocator corregido: busca tipos en todos los ensamblados - Todos los ViewModels heredan de ViewModelBase - Publicacion self-contained para win-x64, linux-x64, osx-x64, osx-arm64 - Agregado .gitignore, removidos bin/obj/publish del tracking
This commit is contained in:
1 parent
9068122b6b
commit
fb275508ee
19 files changed
+196
-77
No files matched your search
@@ -6,7 +6,7 @@ using System.Collections.ObjectModel;
|
||||
|
||||
namespace Asistencia.ViewModels;
|
||||
|
||||
public partial class AsistenciaViewModel : ObservableObject
|
||||
public partial class AsistenciaViewModel : ViewModelBase
|
||||
{
|
||||
private readonly AsistenciaService _asistenciaService;
|
||||
private readonly AuthService _authService;
|
||||
@@ -91,7 +91,7 @@ public partial class AsistenciaViewModel : ObservableObject
|
||||
var sesion = await _asistenciaService.BuscarSesionActivaAsync(_curso.IdCursoAbierto);
|
||||
if (sesion != null)
|
||||
{
|
||||
await _asistenciaService.FinalizarSesionAsync(sesion.Id);
|
||||
await _asistenciaService.FinalizarSesionAsync(sesion.IdAsistenciaProfesor);
|
||||
}
|
||||
EnSesion = false;
|
||||
MensajeEstado = "Sesion finalizada";
|
||||
@@ -121,7 +121,7 @@ public partial class AsistenciaViewModel : ObservableObject
|
||||
}
|
||||
}
|
||||
|
||||
public partial class AlumnoAsistenciaViewModel : ObservableObject
|
||||
public partial class AlumnoAsistenciaViewModel : ViewModelBase
|
||||
{
|
||||
public int IdDetalleContrato { get; }
|
||||
public string NombreCompleto { get; }
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.ObjectModel;
|
||||
|
||||
namespace Asistencia.ViewModels;
|
||||
|
||||
public partial class DashboardViewModel : ObservableObject
|
||||
public partial class DashboardViewModel : ViewModelBase
|
||||
{
|
||||
private readonly AuthService _authService;
|
||||
private readonly AsistenciaService _asistenciaService;
|
||||
|
||||
@@ -4,7 +4,7 @@ using Asistencia.Services;
|
||||
|
||||
namespace Asistencia.ViewModels;
|
||||
|
||||
public partial class LoginViewModel : ObservableObject
|
||||
public partial class LoginViewModel : ViewModelBase
|
||||
{
|
||||
private readonly AuthService _authService;
|
||||
private readonly MainWindowViewModel _mainVm;
|
||||
|
||||
@@ -8,26 +8,51 @@ using System.Collections.ObjectModel;
|
||||
|
||||
namespace Asistencia.ViewModels;
|
||||
|
||||
public partial class MainWindowViewModel : ObservableObject
|
||||
public partial class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
private readonly AuthService _authService;
|
||||
private readonly AsistenciaService _asistenciaService;
|
||||
private readonly ConnectivityService _connectivityService;
|
||||
private object? _currentView;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _currentViewTitle = "Login";
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _conexionDisponible;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _mensajeConexion = string.Empty;
|
||||
|
||||
public object? CurrentView
|
||||
{
|
||||
get => _currentView;
|
||||
set => SetProperty(ref _currentView, value);
|
||||
}
|
||||
|
||||
public MainWindowViewModel(AuthService authService, AsistenciaService asistenciaService)
|
||||
public MainWindowViewModel(AuthService authService, AsistenciaService asistenciaService, ConnectivityService connectivityService)
|
||||
{
|
||||
_authService = authService;
|
||||
_asistenciaService = asistenciaService;
|
||||
CurrentView = new LoginViewModel(authService, this);
|
||||
_connectivityService = connectivityService;
|
||||
_ = VerificarConexionAsync();
|
||||
}
|
||||
|
||||
private async Task VerificarConexionAsync()
|
||||
{
|
||||
var hayInternet = await _connectivityService.HayConexionAsync();
|
||||
ConexionDisponible = hayInternet;
|
||||
|
||||
if (hayInternet)
|
||||
{
|
||||
MensajeConexion = "Aplicación no disponible con conexión a internet. Desconéctese para usar el sistema.";
|
||||
CurrentView = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
MensajeConexion = "Modo offline — Using local database";
|
||||
CurrentView = new LoginViewModel(_authService, this);
|
||||
}
|
||||
}
|
||||
|
||||
public void NavigateToLogin()
|
||||
|
||||
@@ -4,7 +4,7 @@ using Asistencia.Services;
|
||||
|
||||
namespace Asistencia.ViewModels;
|
||||
|
||||
public partial class PerfilViewModel : ObservableObject
|
||||
public partial class PerfilViewModel : ViewModelBase
|
||||
{
|
||||
private readonly AuthService _authService;
|
||||
private readonly MainWindowViewModel _mainVm;
|
||||
|
||||
Reference in new issue
Block a user