How kbieszczad/car-dealership-system works
Purpose and runtime
SalonSamochodowy is a Windows desktop dealership-management application. It targets WPF/.NET Desktop Runtime and persists operational data through Entity Framework Core to SQL Server. The solution/project entry artifacts are SalonSamochodowy/SalonSamochodowy.sln and SalonSamochodowy/SalonSamochodowy.csproj; application startup is defined by SalonSamochodowy/App.xaml and SalonSamochodowy/App.xaml.cs.
UI composition and navigation
The application follows MVVM: XAML Views render screens while ViewModels own presentation state, commands, and screen orchestration. The main authenticated shell is SalonSamochodowy/Views/MainWindow.xaml, backed by SalonSamochodowy/ViewModels/MainWindowViewModel.cs. Login and initial deployment are separate flows in SalonSamochodowy/Views/LoginWindow.xaml and SalonSamochodowy/Views/FirstConfigWindow.xaml.
Identity, roles, and session boundary
Authentication and user/role logic are centralized in SalonSamochodowy/Services/AuthService.cs, using user and role entities in SalonSamochodowy/Entities/AppUser.cs and SalonSamochodowy/Entities/AppRole.cs. SalonSamochodowy/SessionContext.cs represents application-level active-user state. Role-aware navigation and permissions gate administrative, sales, service, client, and management workflows.
Persistence and transaction layer
SalonSamochodowy/Entities/AppDbContext.cs is the EF Core database boundary. Domain persistence is abstracted behind generic repository and unit-of-work contracts/implementations: SalonSamochodowy/Repositories/IRepository.cs, SalonSamochodowy/Repositories/Repository.cs, and SalonSamochodowy/Repositories/UnitOfWork.cs. This places query and coordinated save behavior below business services rather than ViewModels. Initial or demo database population is handled by SalonSamochodowy/Entities/DbSeeder.cs.
Core dealership domain and services
The data model covers dealership inventory, customers, orders, staffing, and service work: SalonSamochodowy/Entities/Vehicle.cs, SalonSamochodowy/Entities/SalesOrder.cs, and SalonSamochodowy/Entities/Job.cs, with related model/engine/trim/features entities. Service-layer use cases separate these domains: SalonSamochodowy/Services/VehicleService.cs, SalonSamochodowy/Services/ClientService.cs, SalonSamochodowy/Services/OrderService.cs, and SalonSamochodowy/Services/JobService.cs. Typical flow is View → ViewModel → domain service → Unit of Work/EF Core → SQL Server.
Operational screens and updates
Inventory/catalog flows are presented through SalonSamochodowy/ViewModels/VehiclesPageViewModel.cs and SalonSamochodowy/ViewModels/AddVehicleViewModel.cs; order creation through SalonSamochodowy/ViewModels/CreateOrderViewModel.cs; service operations through SalonSamochodowy/ViewModels/ServicesPageViewModel.cs. Cross-screen refreshes use application messages, notably SalonSamochodowy/Messages/DataChangedMessage.cs, avoiding direct coupling between independently displayed screens.
Reporting and localization
Management reporting is driven by SalonSamochodowy/ViewModels/ReportsPageViewModel.cs and SalonSamochodowy/Services/ReportGeneratorService.cs, with PDF/chart output delegated to SalonSamochodowy/Services/PdfChartGenerator.cs. Bilingual UI resources reside in SalonSamochodowy/Resources/Languages/Strings.en.xaml and SalonSamochodowy/Resources/Languages/Strings.pl.xaml; language changes propagate through SalonSamochodowy/Messages/LanguageChangedMessage.cs.
Main entry points: AppDbContext.cs EF Core Context · MainWindowViewModel.cs Shell Navigation · UnitOfWork.cs Unit of Work · LoginWindow.xaml Login & Setup
Components 20
WPF Presentation
- WPF Startup · Starts the desktop application and initial configuration flow.
SalonSamochodowy/App.xaml.cs - Login & Setup
SalonSamochodowy/Views/LoginWindow.xaml - Authenticated Shell
SalonSamochodowy/Views/MainWindow.xaml - Shell Navigation · Owns role-aware navigation and screen orchestration.
SalonSamochodowy/ViewModels/MainWindowViewModel.cs - Operational Workflows · Inventory, order creation, and service screen state.
SalonSamochodowy/ViewModels/VehiclesPageViewModel.cs - Reporting UI
SalonSamochodowy/ViewModels/ReportsPageViewModel.cs
Application Services
- Authentication & Roles
SalonSamochodowy/Services/AuthService.cs - Dealership Use Cases · Vehicle, client, order, and job operations.
SalonSamochodowy/Services/VehicleService.cs - Report Generation
SalonSamochodowy/Services/ReportGeneratorService.cs - PDF & Chart Output
SalonSamochodowy/Services/PdfChartGenerator.cs
Persistence
- Unit of Work · Coordinates repository persistence and saves.
SalonSamochodowy/Repositories/UnitOfWork.cs - Generic Repository
SalonSamochodowy/Repositories/Repository.cs - EF Core Context
SalonSamochodowy/Entities/AppDbContext.cs - Dealership Domain · Vehicles, sales orders, jobs, users, roles, and related records.
SalonSamochodowy/Entities/Vehicle.cs - Database Seeder · Populates initial or demo data.
SalonSamochodowy/Entities/DbSeeder.cs - SQL Server
Cross-Cutting
- Active User Session
SalonSamochodowy/SessionContext.cs - Data Change Messages · Refreshes independently displayed screens.
SalonSamochodowy/Messages/DataChangedMessage.cs - Language Messages
SalonSamochodowy/Messages/LanguageChangedMessage.cs - Bilingual Resources · English and Polish UI strings.
SalonSamochodowy/Resources/Languages/Strings.en.xaml
Connections 24
- WPF Startup → Login & Setup: opens
- WPF Startup → EF Core Context: initializes
- EF Core Context → Database Seeder: seeds
- Login & Setup → Authentication & Roles: authenticates via
- Authentication & Roles → Active User Session: sets
- Login & Setup → Authenticated Shell: on success
- Authenticated Shell → Shell Navigation: binds
- Shell Navigation → Active User Session: checks roles
- Shell Navigation → Operational Workflows: navigates to
- Shell Navigation → Reporting UI: navigates to
- Operational Workflows → Dealership Use Cases: executes use cases
- Dealership Use Cases → Data Change Messages: publishes updates
- Data Change Messages → Operational Workflows: triggers refresh
- Reporting UI → Report Generation: requests
- Report Generation → PDF & Chart Output: renders
- Dealership Use Cases → Unit of Work: persists through
- Report Generation → Unit of Work: queries through
- Authentication & Roles → Unit of Work: loads users and roles
- Unit of Work → Generic Repository: coordinates
- Generic Repository → EF Core Context: uses
- EF Core Context → Dealership Domain: maps
- EF Core Context → SQL Server: persists to
- Language Messages → Bilingual Resources: switches
- Language Messages → Authenticated Shell: updates UI