Skip to content

A robust Employee Management System built with C# (WinForms) and SQL Server. Features LINQ to SQL data mapping, SMTP-based password recovery, and dynamic RDLC reporting.

Notifications You must be signed in to change notification settings

TonyTheSlacker/EMPNhom4

Repository files navigation

Employee Management System (EMS)

Language Framework Database ORM

A comprehensive desktop ERP solution designed to streamline HR operations. Built with C# (Windows Forms) and SQL Server, this application manages the full employee lifecycle—from onboarding to payroll processing and reporting.

It demonstrates enterprise-level features including SMTP-based Two-Factor Authentication (OTP) for password recovery and RDLC Reporting for payroll generation.


🏢 Key Features

🔐 Security & Authentication

  • Secure Login: Encrypted credential verification against the SQL database.
  • Password Recovery: Integrated SMTP client to send One-Time Passwords (OTP) via email (Gmail API) for account recovery.

👥 Core Management

  • Employee CRUD: Complete lifecycle management (Hire, Update, Fire) with image blob storage.
  • Department Architecture: Relational linking between employees and their operational departments.
  • Payroll System: logic to calculate salaries based on pay periods and unpaid days.

📊 Analytics & Reporting

  • Interactive Dashboards: Visual statistics using Chart controls to analyze salary distributions.
  • Automated Reporting: Generates professional PDF payroll reports using Microsoft RDLC Report Viewer.

🛠️ Technical Architecture

Database Schema (SQL Server)

The system is built on a normalized relational database:

  • Department (1) ↔ (N) Employee
  • Employee (1) ↔ (N) Salary
  • Account: Stores administrative credentials.

Data Access Layer

Instead of raw SQL strings, the application uses LINQ to SQL (Employee.dbml) to map database objects directly to C# classes, ensuring type safety and cleaner code.

// Example: Using LINQ to fetch employees
var highEarners = from emp in context.Employees
                  where emp.EmpSal > 1000
                  select emp;

🚀 Installation & Setup

Prerequisites

  • Visual Studio 2022 (Desktop Development workload installed)
  • SQL Server (Express, Developer, or Standard edition)
  • .NET Framework 4.7.2
  1. Clone the Repository git clone https://github.com/TonyTheSlacker/EMPNhom4.git

  2. Database Setup

    • Open SQL Server Management Studio (SSMS).
    • Create a new database named EmployeeManagementSystem.
    • Run the provided script SQLQuery1.sql to generate the tables (Employee, Department, Salary, Account).
  3. Configure Connection

    • Open EmployeeManagementSystem.sln in Visual Studio.

    • Open App.config.

    • Update the connectionString to match your local SQL instance (e.g., .\SQLEXPRESS):

      <add name="EmployeeManagementSystem.Properties.Settings.EmployeeManagementSystemConnectionString"
       connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=EmployeeManagementSystem;Integrated Security=True"
       providerName="System.Data.SqlClient" />
  4. Configure Email (Optional)

    • To test the "Forgot Password" feature:
      • Open ForgetPasswordForm.cs.

      • Locate the btnRequest_Click method.

      • Replace the email credentials with your own (requires a Google App Password if using Gmail):

          var from = new MailAddress("your-email@gmail.com");
          const string frompass = "your-16-digit-app-password";
  5. Run

    • Press F5 to build and launch the application

Disclaimer: This is a portfolio project simulating an internal HR tool. Sensitive credentials (like email passwords) should be managed via Environment Variables in a production environment.

About

A robust Employee Management System built with C# (WinForms) and SQL Server. Features LINQ to SQL data mapping, SMTP-based password recovery, and dynamic RDLC reporting.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages