Visual C++ Program for the Implementation of Employee Management System | IT1253 - Software Engineering Laboratory

ABSTRACT:
The aim of our project is to develop a software for implementing “Employee management system” using VISUAL C++ . The development of this particular project is to perform the formalities / operation in EMPLOYEE MANAGEMENT SYSTEM. This project deals with the employee details, employee salary, and maintenance in its process. The customers are instructed in an easy way to feel comfortable with the processing.

REQUIREMENTS ANALYSIS:

SOFTWARE REQUIREMENTS:
    Front End   :    ‘C++’ language.
    Back End   :     File Management System (using Dat files)
    Operating system:    Any Operating System (Window or Linux)

HARDWARE REQUIREMENTS:

    Processor     :     3.06 GHZ operating speed.
    Hard Disk    :      80GB Capacity.
    RAM           :       256MB
    Monitor       :       CRT 17’
    Mouse         :       OPTICAL
    Keyboard    :       Alphanumeric keys.
     The specified hardware requirements are the minimum requirements that are needed to implement in the project.

FUNCTIONAL REQUIREMENTS:
    As mentioned in the requirements, the Employee management system involves the following function or process
Employee management system consists of four modules. They are
    Module 1: Insert Module
    Module 2: Delete Module
    Module 3: Display Module
    Module 4: Exit

Insert Module:
In this module the user enters the Employee details such as Employee name, Employee no, etc.
Delete Module:
    In this module the user deletes the Employee details.
Display Module:
    In this module the employee details are displayed.
Exit:
    In this module the user can quit from the project.

NON FUNCTIONAL REQUIREMENTS:
    It is reliable software. Whenever the user wants to retrieve any information from the database, it returns with the correct information. Provided, the information stored is a correct one. The cost of maintenance of the software is very low. The size of the software is less. This means, it is a portable one. If any request is given, the time taken for the response is low. This makes the software more efficient.

SOURCE CODE:
#include<windows.h>                 
#include<sqlext.h>
#include<stdio.h>
#include<string.h>
#define TEST_LEN 50
int main()
{
    int c;
    char ch='y';
    SQLINTEGER emno,salary;
    SQLCHAR name[TEST_LEN+1], department[TEST_LEN+1], section[TEST_LEN+1], adress[TEST_LEN+1];
    HENV hEnv=NULL;
    HDBC hDBC=NULL;
    HSTMT hStmt=NULL;
    UCHAR szSqlStr[]="insert into emp(emno,name,department,section,adress,salary) values(?,?,?,?,?,?)";
    UCHAR szSqlStr1[]="delete * from emp where emno = ?";
    UCHAR szSqlStr2[]="select * from emp";
    UCHAR szDSN[SQL_MAX_DSN_LENGTH]="employee";
    UCHAR *szUID=NULL;
    UCHAR *szPasswd=NULL;
    UCHAR szModel1[128];
    CHAR szModel2[128];
    UCHAR szModel3[128];
    UCHAR szModel4[128];
    UCHAR szModel5[128];
    UCHAR szModel6[128];
    SDWORD cbModel1;
    SDWORD cbModel2;
    SDWORD cbModel3;
    SDWORD cbModel4;
    SDWORD cbModel5;
    SDWORD cbModel6;
    SDWORD cbtest=SQL_NTS;
    RETCODE retcode;
do
{
    printf("=======================================\n");
    printf("EMPLOYEE MANAGEMENT SYSTEM");
    printf("\n=======================================\n");
    printf("1.Enter the detail \n2.Delete the detail\n3.Display the detail\n\n");
    printf("enter ur option......\n");
    scanf("%d",&c);
    switch(c)
    {
        case 1:
        printf("\n-----------------------------------------");
        printf("\nEnter the details");
        printf("\n-----------------------------------------");
        printf("\nEnter the Employeeno:\t");
        scanf("%d",&emno);
        printf("\nEnter the Employeename:\t");
        scanf("%s",&name);
        printf("\nEnter the department:\t");
        scanf("%s",&department);
        printf("\nEnter the section:\t");
        scanf("%s",&section);
        printf("\nadress:\t");
        scanf("%s",&adress);
        printf("\nsalary:\t");
        scanf("%d",&salary);
        printf("\n-----------------------------------------");
        SQLAllocEnv(&hEnv);
        SQLAllocConnect(hEnv,&hDBC);
        retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
        if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
        {
            retcode=SQLAllocStmt(hDBC,&hStmt);
            retcode=SQLPrepare(hStmt,szSqlStr,sizeof(szSqlStr));
SQLBindParameter(hStmt,1,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&emno,0,&emno);
SQLBindParameter(hStmt,2,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,name,0,&cbtest);
SQLBindParameter(hStmt,3,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,department,0,&cbtest);
SQLBindParameter(hStmt,4,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,section,0,&cbtest);
SQLBindParameter(hStmt,5,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,adress,0,&cbtest);
SQLBindParameter(hStmt,6,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&salary,0,&salary);
             retcode=SQLExecute(hStmt);
            printf("\n\n Detail is inserted.......... \n\n");
        }
        break;
    case 2:
        printf("\nDelete the detail\n");
        SQLAllocEnv(&hEnv);
        SQLAllocConnect(hEnv,&hDBC);
        retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,
            SQL_NTS,szPasswd,SQL_NTS);
        if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
        {
            retcode=SQLAllocStmt(hDBC,&hStmt);
            retcode=SQLPrepare(hStmt,szSqlStr1,sizeof(szSqlStr1));
 SQLBindParameter(hStmt,1,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&emno,0,&emno);
            printf("entr the emno\n");
            scanf("%d",&emno);
            retcode=SQLExecute(hStmt);
            printf("detail has been deleted\n\n");
        }
        break;
    case 3:
        printf("\nDisplay the detail\n");
        SQLAllocEnv(&hEnv);
        SQLAllocConnect(hEnv,&hDBC);
        retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
        if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
        {
            retcode=SQLAllocStmt(hDBC,&hStmt);
            retcode=SQLPrepare(hStmt,szSqlStr2,sizeof(szSqlStr2));
            retcode=SQLExecute(hStmt);
            SQLBindCol(hStmt,1,SQL_C_CHAR,szModel1,sizeof(szModel1),&cbModel1);
            SQLBindCol(hStmt,2,SQL_C_CHAR,szModel2,sizeof(szModel2),&cbModel2);
            SQLBindCol(hStmt,3,SQL_C_CHAR,szModel3,sizeof(szModel3),&cbModel3);
            SQLBindCol(hStmt,4,SQL_C_CHAR,szModel4,sizeof(szModel4),&cbModel4);
            SQLBindCol(hStmt,5,SQL_C_CHAR,szModel5,sizeof(szModel5),&cbModel5);
            SQLBindCol(hStmt,6,SQL_C_CHAR,szModel6,sizeof(szModel6),&cbModel6);
            retcode=SQLFetch(hStmt);
            printf("\n\tRegno\tName\tDepartment\tSection\tAddress\t Salary\n\n");
               while(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
            {
                printf("\t%s\t%s\t%s\t\t%s\t%s\t%s\n", szModel1, szModel2, szModel3, szModel4, szModel5, szModel6);
               retcode=SQLFetch(hStmt);
               }
        }
        break;    
        }
     flushall();
     printf("\nDo u wan to cont (y/n)");
     scanf("%s",&ch);
  }
  while(ch=='y');
  return 0;
}

OUTPUT:

INSERTION:

DISPLAY:

DELETION:

DISPLAY:


CONCLUSION:
             The  project we have done here is “EMPLOYEE MANAGEMENT SYSTEM” using C language.
In this project we have designed a software to implement the customer details that any user can perform
it in a simple and a better way. This way of format helps us to have clear database.
Previous
Next Post »

If you still didn't find what you're looking for, you can search this website below: