Skip to main content

Employee Management System with CRUD, Validations & Auto-Code Generation (ASP.NET MVC + ADO.NET)

 

Project Key Points 

  • Developed a complete Employee Management System using ASP.NET MVC (Framework) and ADO.NET.

  • Implemented CRUD operations (Create, Read, Update, Delete) with SQL Server.

  • Added auto-generated Employee Code (EMP001, EMP002…) using MAX(YewID) logic.

  • Used Stored Procedure (YTSPCRUD) for Insert/Update with flag-based operations.

  • Applied Data Annotation validations for Email, Mobile, Salary, etc.

  • Implemented custom validation based on Designation (Peon/Manager salary range).

  • Integrated Remote Email Validation using AJAX to check duplicates without page reload.

  • Built a responsive UI using Bootstrap 5 with user-friendly form and report table.

  • Created Report View showing employee data with Edit/Delete actions.

  • Added Delete confirmation using JavaScript popup.

  • Designed separate Connection class for centralized ADO.NET database connectivity.

  • Used SqlConnection, SqlCommand, SqlDataAdapter for database operations.

  • Ensured safe parameterized queries to prevent SQL Injection.

  • Maintained a clean MVC architecture with Controller, Model, View separation.


Coding Section:
Sql Code:

Store Procedure: 

CREATE PROCEDURE YTSPCRUD
    @YewID INT,
    @EMPID NVARCHAR(MAX),
    @LastName NVARCHAR(MAX),
    @FirstName NVARCHAR(MAX),
    @DOB NVARCHAR(MAX),
    @Email NVARCHAR(MAX),
    @Mobile NVARCHAR(MAX),
    @Department NVARCHAR(MAX),
    @Designation NVARCHAR(MAX),
    @Salary DECIMAL(10,2),
    @flag NVARCHAR(1)
AS
BEGIN
    -- Insert
    IF (@flag = 'I')
    BEGIN
        INSERT INTO Yew_Technology
        (
            EMPID, LastName, FirstName, DOB, Email,
            Mobile, Department, Designation, Salary
        )
        VALUES
        (
            @EMPID, @LastName, @FirstName, @DOB, @Email,
            @Mobile, @Department, @Designation, @Salary
        );
    END

    -- Update
    IF (@flag = 'U')
    BEGIN
        UPDATE Yew_Technology
        SET
            EMPID = @EMPID,
            LastName = @LastName,
            FirstName = @FirstName,
            DOB = @DOB,
            Email = @Email,
            Mobile = @Mobile,
            Department = @Department,
            Designation = @Designation,
            Salary = @Salary
        WHERE YewID = @YewID;
    END
END;
GO


Sql Connection Code:

Model Code:

(YT_Employee_Model):



Report_View_Model:

Controller Code:

Action Method (Create the views):



Post Method to Save Data and Update the Data in Database:



GetBy Method for Getting Data for Update:


Automatic Employee Code Generation Method:


Report View Method (For Showing the data in Report Format in View):


Delete Method for Deleting the Record from the Database:


Email Id Validate Method to Check this email id already exist in database:


View Code

Employee Registration View Code:


Report View Code:

Index View Code:

RenderBody Added in Common Layout(_layout.cshtml):

User Interface:



LINK: https://tinyurl.com/mu36prx2







Comments

Popular posts from this blog

Entity_Framework Project (Employee registration, dynamic post dropdown, stored-procedure-based reporting, search, Radio Button and pagination, edit/update, and delete functionality)

Project Summary Project is an Employee Management System built using ASP.NET MVC with the following features: 1️⃣ Employee Registration Add and update employee details Auto-generate employee codes (EMP001, EMP002…) Validations applied for all fields Stores post, DOB, DOJ, and contact details 2️⃣ Post Dropdown Retrieves post data from the EFT_PostMaster table Used in both Add and Edit forms 3️⃣ Employee Report (List Page) Displays employee data using Stored Procedure (SpEmployee) Shows PostName from joined table Supports search and pagination (10 records per page) Edit and delete options available 4️⃣ Pagination Dynamic page navigation Calculates current and total pages 5️⃣ Delete Functionality Deletes employee by ID using Entity Framework 6️⃣ Partial View for Editing Loads employee data for edit in same view 7️⃣ Stored Procedure Integration Data is fetched using SpEmployee() SP returns employee + post information  Coding Section: Sql Code: Store Procedure for Report View: Solution ...

SmartEMP – Employee Management System using ASP.NET Core, ADO.NET & SQL Server (Login Page, Session Implemented, Auto Employee Code Generation, Dropdown, Image Attachment, Validation Implemented).

  ✅ FEATURES IMPLEMENTED IN THE PROJECT  1️⃣ Employee Registration (Insert) Add a new employee with: First Name, Last Name DOB, Email, Mobile Department, Designation Salary Employee Image Upload Employee Code auto-generated (EMP001, EMP002…) 2️⃣ Employee Update (Edit) Load employee data by ID Display in the form for editing Update stored record via stored procedure 3️⃣ Employee Delete Delete employee record by ID Removed from database using SQL query 4️⃣ Employee Listing / Report Show all employees in a table: Code, Name, Email, Mobile Department, Designation Salary Employee Image Edit / Delete options for each row 5️⃣ Pagination (PagedList) Employee report supports page navigation Displays limited records per page 6️⃣ Employee Image Upload Upload image through <input type="file"> Save image to folder /SaveImage/ Save path in database Show image in report table 7️⃣ Dropd...