How aliasar1/hotel-management-system works
Project type and purpose
• This is a Windows-Forms based desktop application written in C# (.NET Framework) that implements a Hotel Management System (HMS).
• It uses an MS SQL Server database (script: HotelManagementDB.sql) to persist hotels, bookings, guests, employees, rooms, services, discounts, payments, etc.
• The system supports a “SaaS-like” model: a super-admin provisions hotels (users), each hotel owner logs in, changes password, and exercises CRUD operations on all domain entities.
File structure
• Top-level solution (Hotel Management System.sln) and project folder with .csproj, App.config, Program.cs.
• DatabaseConnection.cs & Statics.cs serve as the data-access helper and constants layer.
• The “Screens” folder houses ~20 WinForms screens (Login, Dashboard, BookingsScreen, RoomsScreen, etc.) each split into Designer.cs, .cs, .resx.
• packages.config lists NuGet dependencies (if any) used in the project.
Key architecture insights from README
• Layers implied:
• Presentation (WinForms screens + Guna UI)
• Business logic (code-behind in each form + Statics)
• Data access (DatabaseConnection.cs)
• Database (MS SQL)
• Core CRUD features for all entities and aggregate reporting for bookings/revenue.
Main components
a. Presentation Layer (WinForms UI)
• Forms: Login, SuperAdminLogin, Create/Reset Password, SplashScreen, Dashboard, then domain screens (Hotels, Employees, Guests, Rooms, RoomTypes, Departments, Services, Discounts, Bookings, Payments, Reports)
• Guna UI Framework (external library)
b. Business Logic Layer (BLL)
• Form code-behind classes encapsulating validation, user-session management, business rules (e.g., calculating revenue, applying discounts)
• Statics.cs: shared constants, tokens for foreign-key workarounds
c. Data Access Layer (DAL)
• DatabaseConnection.cs: opens SQL connections, executes parameterized commands, returns DataSets or DataReaders
d. Database
• MS SQL Server instance with tables: Hotel, User (super-admin, hotel-admin, employees), Department, RoomType, Room, Service, Discount, Booking, Guest, Payment
• Relationships:
• Hotel 1–* Room, Employee, Service, Discount
• Employee 1–* Booking, Guest (via role)
• Booking *–1 Guest, *–1 Room, *–1 Discount
• Payment 1–1 Booking
e. External/Infrastructure
• App.config for connection strings
• SQL script for schema (HotelManagementDB.sql)
• Visual Studio IDE
Relationships and interactions
• User launches the WinForms app → SplashScreen → Login/SuperAdminLogin form
• On successful authentication, Dashboard loads; user clicks domain modules → corresponding Form instance
• Form code-behind calls DatabaseConnection methods to run SQL queries/stored procedures
• Results are displayed in DataGridViews or controls; business logic applies discount, calculates totals, updates Statics if needed
• CRUD operations modify the SQL Server database; triggers or constraints enforce data integrity
• Reports module queries aggregate data and renders summary to user
Architectural patterns and principles
• Layered architecture (UI → BLL → DAL → DB)
• Separation of concerns: each Form only handles presentation + direct calls to DAL; no UI SQL strings scattered in Dashboard.cs beyond DAL helper
• Basic n-tier approach; could be evolved into true Repository/Service patterns
• Use of configuration (App.config) for environment decoupling
• Token-based foreign key workaround (from Statics.cs) due to initial constraints
Technologies and frameworks
• .NET Framework (C#)
• Windows Forms + Guna UI controls
• MS SQL Server
• Visual Studio
• ADO.NET (SqlConnection, SqlCommand, DataAdapter)