A comprehensive employee leave management system built with ASP.NET Core MVC, featuring role-based access control, leave request workflows, and analytics dashboards.
- Secure login system with BCrypt password hashing
- Role-based access control (Admin, Manager, Employee)
- Session-based authentication
- Custom authorization filters
- Complete CRUD operations for employees
- Department-based organization
- Manager-subordinate relationships
- Automatic leave balance initialization
- User account creation with employee records
- Submit leave requests with date ranges
- Automatic calculation of working days (excludes weekends and holidays)
- Leave balance validation
- Request status tracking (Pending, Approved, Rejected, Cancelled)
- Attachment support
- Multiple leave types (Annual, Sick, Maternity, Unpaid, Emergency)
- Managers approve requests from their department employees
- Approval/rejection with reason tracking
- Real-time balance updates upon approval
- Request history and audit trail
- Role-specific dashboards
- Admin: System-wide statistics and charts
- Manager: Department-specific metrics
- Employee: Personal leave summary
- Interactive charts using Chart.js
- Key metrics: total employees, pending requests, approval rates, availability
- Holiday management
- Department management
- Leave type configuration
- Leave balance tracking per employee per year
- Professional UI with Bootstrap 5
- Responsive design
- Custom exception handling middleware
- Comprehensive logging
- Framework: ASP.NET Core MVC (.NET 10.0)
- Database: SQL Server with Entity Framework Core
- Authentication: BCrypt.Net for password hashing
- UI: Bootstrap 5, Bootstrap Icons, Chart.js
- Architecture: 4-layer architecture (Core, Data, Services, Presentation)
- Patterns: Repository Pattern, Dependency Injection, MVC
LeaveManagement/
├── Leave.Core/ # Domain models and interfaces
│ ├── Models/ # Entity models
│ ├── Interfaces/ # Service and repository interfaces
│ └── Exceptions/ # Custom exceptions
├── Leave.Data/ # Data access layer
│ ├── Repositories/ # Repository implementations
│ ├── Migrations/ # EF Core migrations
│ ├── LeaveContext.cs # DbContext
│ └── DataSeeder.cs # Initial data seeding
├── Leave.Services/ # Business logic layer
│ └── Services/ # Service implementations
└── LeaveManagement/ # Presentation layer
├── Controllers/ # MVC controllers
├── Views/ # Razor views
├── Filters/ # Custom filters
├── Middleware/ # Custom middleware
└── wwwroot/ # Static files
- Full system access
- Manage all employees across departments
- View system-wide analytics
- Create/edit/delete employees
- Manage departments, leave types, and holidays
- View and manage employees in their department only
- Approve/reject leave requests from department employees
- View department-specific analytics
- Submit personal leave requests
- View personal profile and leave balances
- Submit leave requests
- View request history
- Cancel pending requests
- Admin logs in
- Navigate to Employees > Add Employee
- Fill in employee details and select department
- Assign role and create user credentials
- System automatically creates leave balances for all leave types
- Employee logs in
- Navigate to Profile or Leave Requests
- Select leave type, dates, and provide reason
- System validates balance and calculates working days
- Request is submitted for manager approval
- Manager logs in
- Navigate to Approvals
- View pending requests from department employees
- Approve or reject with optional reason
- System updates employee leave balance automatically
- Employees: Employee information and balances
- Users: Authentication and authorization
- Roles: User roles (Admin, Manager, Employee)
- Departments: Organizational units
- LeaveTypes: Types of leave available
- LeaveRequests: Leave request records
- LeaveBalances: Employee leave balances per type per year
- Holidays: Company holidays
Configure in DataSeeder.cs or through admin interface:
- Annual Leave: 20 days/year
- Sick Leave: 10 days/year
- Maternity Leave: 90 days/year
- Unpaid Leave: 30 days/year
- Emergency Leave: 3 days/year
Configure in Program.cs:
options.IdleTimeout = TimeSpan.FromMinutes(30);The application uses built-in ASP.NET Core logging:
- Log files stored in
LeaveManagement/logs/ - Configurable log levels in
appsettings.json - Structured logging for all operations
- Custom exception handling middleware
- User-friendly error messages
- Validation exceptions for business rule violations
- Not found exceptions for missing resources
- Automatic error logging
dotnet run --project LeaveManagementdeploy.bator
./deploy.ps1- Update
appsettings.Production.jsonwith Somee database credentials - Build the application:
dotnet publish LeaveManagement/LeaveManagement.csproj -c Release -o ./publish- Upload files from
./publishto Somee/wwwrootvia FTP - Configure .NET Core in Somee control panel
- Test at your Somee URL
For detailed deployment instructions, see DEPLOYMENT.md
- Email notifications for leave requests
- Calendar view for leave schedules
- Export reports to PDF/Excel
- Mobile application
- Multi-language support
- Leave carry-forward rules
- Delegation of approval authority
This project is licensed under the MIT License.
For issues and questions, please create an issue in the repository.