Skip to content

adamsaidane/HR-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

88 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏒 HR Management System

ASP.NET Core C# SQL Server Entity Framework Bootstrap License

A comprehensive, enterprise-grade Human Resource Management System built with ASP.NET Core, C#, and SQL Server. Designed for large organisations to streamline employee management, recruitment, payroll, and all day-to-day HR operations from a single platform.


πŸ“‹ Table of Contents


🎯 Overview

The HR Management System (HRMS) is a modern full-stack web application for managing the complete employee lifecycle. It covers everything from onboarding and payroll to recruitment pipelines and analytics β€” all secured behind a role-based access control layer.


✨ Features

πŸ‘₯ Employee Management

  • Complete employee profiles with personal and contact information
  • Employment history, contract tracking, and status management (active / inactive / on leave)
  • Department and position assignment
  • Emergency contact information and skill / certification tracking
  • Document upload and management per employee

πŸ’° Payroll Management

  • Salary calculation, processing, and history
  • Monthly payroll run with bonus allocation
  • Benefits management (health insurance, retirement, etc.)
  • Tax calculations and department-level salary analysis
  • Exportable salary reports

🎯 Recruitment

  • Job offer creation and lifecycle management
  • Multi-stage candidate pipeline with status tracking
  • Interview scheduling, evaluation forms, and feedback recording
  • Hiring analytics and trends by month and department

πŸ“Š Analytics Dashboard (40+ views)

  • Live counts: total employees, open job offers, monthly salary totals
  • Charts: employees by department, status, gender, age range, contract type
  • Salary evolution trends and recent promotions list
  • Recruitment: candidates by stage, job offers by department, hiring trends
  • Equipment status overview and bonuses by department
  • Interview success rates and employee growth projections

πŸ“‹ Document Management

  • Document upload, categorisation, and versioning
  • Access audit trails per document

βš™οΈ Equipment Management

  • Full inventory tracking and assignment to employees
  • Maintenance schedules and status monitoring
  • Reports by equipment type and status

πŸ” Security & Access Control

  • Role-based access control (Admin, Manager, Employee)
  • Department-level data filtering
  • Audit logging across all sensitive operations
  • Secure password policy enforcement

πŸ’» Tech Stack

Layer Technology
Framework ASP.NET Core 8.0+
Language C# 12.0+
Database SQL Server 2019+
ORM Entity Framework Core 8
Frontend HTML5, CSS3, Bootstrap 5, JavaScript
Authentication Cookie-based Authentication
Authorization Role-Based Access Control (RBAC)
Logging Serilog
Charting Chart.js, Plotly.js
Hosting IIS Express (dev) / Azure App Service (prod)

πŸ—οΈ System Architecture

HR-Management-System/
β”‚
β”œβ”€β”€ Controllers/                  # MVC Controllers
β”‚   β”œβ”€β”€ HomeController            # Dashboard & reports
β”‚   β”œβ”€β”€ EmployeesController       # Employee CRUD
β”‚   β”œβ”€β”€ DepartmentsController     # Department management
β”‚   β”œβ”€β”€ SalariesController        # Payroll operations
β”‚   β”œβ”€β”€ RecruitmentController     # Hiring process
β”‚   β”œβ”€β”€ InterviewController       # Interview management
β”‚   β”œβ”€β”€ PromotionsController      # Career progression
β”‚   β”œβ”€β”€ EquipmentController       # Asset management
β”‚   β”œβ”€β”€ AccountController         # Authentication
β”‚   └── DocumentsController       # File management
β”‚
β”œβ”€β”€ Services/                     # Business Logic
β”‚   β”œβ”€β”€ DashboardService
β”‚   β”œβ”€β”€ EmployeeService
β”‚   β”œβ”€β”€ DepartmentService
β”‚   β”œβ”€β”€ SalaryService
β”‚   β”œβ”€β”€ RecruitmentService
β”‚   β”œβ”€β”€ PromotionService
β”‚   β”œβ”€β”€ EquipmentService
β”‚   β”œβ”€β”€ AccountService
β”‚   └── DocumentService
β”‚
β”œβ”€β”€ Repositories/                 # Data Access Layer
β”‚   β”œβ”€β”€ EmployeeRepository
β”‚   β”œβ”€β”€ DepartmentRepository
β”‚   β”œβ”€β”€ SalaryRepository
β”‚   β”œβ”€β”€ CandidateRepository
β”‚   β”œβ”€β”€ EquipmentRepository
β”‚   └── DocumentRepository
β”‚
β”œβ”€β”€ Models/                       # EF Core Entities
β”‚   β”œβ”€β”€ Employee, Department, Position
β”‚   β”œβ”€β”€ Salary, Bonus, Benefit
β”‚   β”œβ”€β”€ Candidate, JobOffer, Interview
β”‚   β”œβ”€β”€ Equipment, EquipmentAssignment
β”‚   └── Promotion, User, Document
β”‚
β”œβ”€β”€ ViewModels/                   # 30+ View Models
β”‚   β”œβ”€β”€ DashboardViewModel
β”‚   β”œβ”€β”€ EmployeeFormViewModel
β”‚   β”œβ”€β”€ SalaryReportViewModel
β”‚   β”œβ”€β”€ RecruitmentViewModel
β”‚   └── ...
β”‚
β”œβ”€β”€ Enums/
β”‚   β”œβ”€β”€ EmployeeStatus, ContractType
β”‚   β”œβ”€β”€ EquipmentStatus, CandidateStatus
β”‚   β”œβ”€β”€ JobOfferStatus, InterviewResult
β”‚   └── UserRole
β”‚
β”œβ”€β”€ Views/
β”‚   β”œβ”€β”€ Home/Index.cshtml         # Main dashboard
β”‚   β”œβ”€β”€ Employees/                # List, Create, Edit, Details
β”‚   β”œβ”€β”€ Salaries/                 # Salary management & reports
β”‚   β”œβ”€β”€ Recruitment/              # Job offers & candidates
β”‚   β”œβ”€β”€ Shared/                   # Layout, NavBar, Footer
β”‚   └── Account/                  # Login, Register, ChangePassword
β”‚
└── Data/
    └── AppDbContext              # EF Core context + migrations

πŸš€ Installation

Prerequisites

  • .NET 8.0 SDK or later
  • SQL Server 2019 or later
  • Visual Studio 2022 or VS Code
  • Git

Step 1 β€” Clone the repository

git clone https://github.com/adamsaidane/HR-Management-System.git
cd HR-Management-System

Step 2 β€” Restore dependencies

dotnet restore

Step 3 β€” Configure the database connection

Edit appsettings.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Database=HRMS;Trusted_Connection=true;TrustServerCertificate=true;"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning"
    }
  }
}

Step 4 β€” Apply migrations

dotnet ef database update

Step 5 β€” Run the application

dotnet run

The app will be available at https://localhost:5001


πŸ—„οΈ Database Setup

Create the database

CREATE DATABASE HRMS;

EF Core migration commands

# Create a new migration
dotnet ef migrations add InitialCreate

# Apply all pending migrations
dotnet ef database update

# List migration history
dotnet ef migrations list

Seed initial data

In Program.cs, seed the database on startup:

var scope = app.Services.CreateScope();
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
DbInitializer.Initialize(context);

Key database tables

Table Description
Users System users and login credentials
Employees Core employee records
Departments Organisation structure
Positions Job positions and grades
Salaries Salary records and history
Bonuses Bonus allocations
Benefits Employee benefits
Candidates Job applicants
JobOffers Active job postings
Interviews Interview records and results
Equipment Company assets
EquipmentAssignments Asset-to-employee allocation
Promotions Career advancement records
Documents HR documents and files

βš™οΈ Configuration

appsettings.json

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=...;Database=HRMS;..."
  },
  "Authentication": {
    "CookieName": "HRMS.Auth",
    "ExpireTimeSpan": 480
  },
  "Email": {
    "Host": "smtp.gmail.com",
    "Port": 587,
    "Username": "your-email@gmail.com",
    "Password": "your-app-password"
  },
  "FileUpload": {
    "MaxFileSize": 5242880,
    "AllowedExtensions": [".pdf", ".docx", ".doc", ".xlsx"]
  }
}

Service registration (Program.cs)

builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));

builder.Services.AddScoped<IEmployeeService, EmployeeService>();
builder.Services.AddScoped<IDashboardService, DashboardService>();
builder.Services.AddScoped<ISalaryService, SalaryService>();
builder.Services.AddScoped<IRecruitmentService, RecruitmentService>();

builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
    .AddCookie(options =>
    {
        options.LoginPath = "/Account/Login";
        options.AccessDeniedPath = "/Account/AccessDenied";
    });

builder.Services.AddAuthorization();

πŸ“– Usage Guide

Administrator workflow

  1. Log in with admin credentials at /Account/Login
  2. View the main dashboard for live statistics and charts
  3. Manage employees under Employees β†’ Add Employee
  4. Process payroll under Salaries
  5. Track open roles and candidates under Recruitment

Adding an employee

  1. Navigate to Employees
  2. Click Add Employee
  3. Complete the employee form (personal info, department, position)
  4. Save β€” then assign salary and benefits under Salaries

Running payroll

  1. Go to Salaries
  2. Review and update individual salary records as needed
  3. Add bonuses and assign benefits
  4. Generate and export the payroll report

Managing the recruitment pipeline

  1. Create a job offer under Recruitment β†’ Job Offers
  2. Review incoming candidate applications
  3. Schedule interviews and record feedback
  4. Update candidate status through each stage
  5. On hire, convert the candidate record into a new employee

πŸ“Œ API Documentation

This is an MVC application. Below are the key controller actions available via HTTP.

EmployeesController

// GET  /Employees
public async Task<IActionResult> Index(string searchString, int? departmentId)

// GET  /Employees/Details/{id}
public async Task<IActionResult> Details(int id)

// GET  /Employees/Create          [AdminRH only]
// POST /Employees/Create
public async Task<IActionResult> Create(EmployeeFormViewModel model)

SalariesController

// GET  /Salaries
public async Task<IActionResult> Index()

// GET  /Salaries/EmployeeSalary/{employeeId}
public async Task<IActionResult> EmployeeSalary(int employeeId)

// POST /Salaries/UpdateSalary
public async Task<IActionResult> UpdateSalary(int employeeId, decimal newSalary)

// POST /Salaries/AddBonus
public async Task<IActionResult> AddBonus(Bonus bonus)

RecruitmentController

// GET  /Recruitment/JobOffers
public async Task<IActionResult> JobOffers()

// POST /Recruitment/CreateJobOffer
public async Task<IActionResult> CreateJobOffer(JobOfferFormViewModel model)

// GET  /Recruitment/Candidates
public async Task<IActionResult> Candidates()

// POST /Interview/Create
public async Task<IActionResult> ScheduleInterview(Interview interview)

πŸ” Security

Authentication

  • Cookie-based authentication with configurable session timeout
  • Password hashing with bcrypt
  • Automatic redirect to login on session expiry

Authorization

  • Three built-in roles: AdminRH, Manager, Employee
  • Department-level data filtering enforced at the service layer
  • Sensitive actions protected with [Authorize(Roles = "AdminRH")]

Password policy

builder.Services.AddIdentity<IdentityUser, IdentityRole>(options =>
{
    options.Password.RequiredLength = 8;
    options.Password.RequireNonAlphanumeric = true;
    options.Password.RequireUppercase = true;
    options.Password.RequireLowercase = true;
    options.Lockout.MaxFailedAccessAttempts = 5;
});

Best practices applied

  • HTTPS enforced on all connections
  • CSRF token validation on all POST forms
  • Input validation and sanitisation throughout
  • Full audit logging for sensitive operations

πŸš€ Deployment

Azure App Service

# Publish a release build
dotnet publish -c Release -o ./publish

# Create an App Service plan
az appservice plan create \
  --name hrms-plan \
  --resource-group myResourceGroup \
  --sku B1 --is-linux

# Deploy the zip
az webapp deployment source config-zip \
  --resource-group myResourceGroup \
  --name hrms-app \
  --src publish.zip

Docker

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
COPY --from=builder /app/publish .
EXPOSE 80
ENTRYPOINT ["dotnet", "HRMS.dll"]
docker build -t hrms:latest .
docker run -p 80:80 hrms:latest

πŸ› Troubleshooting

Migration errors

# Remove the last migration
dotnet ef migrations remove

# Reset and re-apply the database
dotnet ef database drop --force
dotnet ef database update

Connection string issues

# Test SQL Server connectivity
sqlcmd -S localhost -U sa -P YourPassword

Build errors

# Clean and rebuild
dotnet clean
dotnet build

🀝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature-name
  3. Commit your changes: git commit -m "feat: describe your change"
  4. Push to the branch: git push origin feature/your-feature-name
  5. Open a Pull Request against master

Please include tests for any new functionality and follow the existing code style.


πŸ“š Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors