Computer Project

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 35

CLASS XII COMPUTER SCIENCE PROJECT

EMPLOYEE DETAILS MANAGEMENT SYSTEM

ACADEMIC YEAR : 2022 – 23 CLASS : XII-E


STUDENT NAME :
PROJECT REPORT

Submitted in Fulfillment of Class XI Syllabus Requirement


in

COMPUTER SCIENCE(083)

CERTIFICATE

Certified that this is the bonafide record of project work carried out by

Roll No.

of Class XI of this school during the year 2021-2022.

Teacher-in-Charge Principal Examiner


1
INDEX
Sl.No Contents Page No.

1, Acknowledgment 4

2. Need for this Project 5

3. Objectives and Functionality 6

4. Software Requirements 7

5. Coding 11

6. Output 28

2
7. Bibliography 32

3
ACKNOWLEDGEMENT

I WOULD LIKE TO TAKE THIS OPPORTUNITY TO EXPRESS MY THANKS TO MANY OTHERS WHO
HAVE PLAYED A KEY ROLE IN THE SUCCESS OF THIS PROJECT.

I WOULD LIKE TO THANK MY COMPUTER SCIENCE TEACHERS FOR PROVIDING ME WITH ALL THE
GUIDANCE AND TOOLS THAT HAVE BEEN INSTRUMENTAL TO THE COMPLETION OF THIS
PROJECT.

I EXPRESS MY SINCERE GRATITUDE TOWARDS MY SCHOOL PRINCIPAL, FR. SABU KOODAPATU


CMI FOR HIS GUIDANCE THROUGHOUT THE ACADEMIC YEAR.

I WOULD ALSO LIKE TO EXPRESS MY APPRECIATION TOWARDS MY PARENTS WHO HAVE


UNCONDITIONALLY SUPPORTED AND ENCOURAGED ME THROUGHOUT THE MAKING OF THIS

PROJECT.

4
Need For This Project

We all know that our ideas will gain true meaning only if we are practical.
The main motive of this project is to let the people apply their
programming knowledge in the modern world and exposed them how
programming helps in developing a good software.

An efficient employee management system can be customized to meet the


needs of each company’s specific requirements so that the amount of
paperwork required can be reduced drastically. Why is this important?
When employee details are digital, employees as well as managers are
able to free up a lot more time in the week as collecting data becomes
easier and more efficient. This frees up a lot of time for both to focus on
areas needed instead of drowning in paperwork.

5
Objectives and Functionality

The basic need for this task is to create an Employee Management System
in Python. The source code will contain the following operations:

 Add Employees
 Remove Employees
 Promote Employees
 Display Employees
 Search Employee Details
 Update Employee Details

6
SOFTWARE REQUIREMENTS

PYTHON

Python is a high-level, interpreted, interactive and object-oriented


scripting language. Python is designed to be highly readable. It uses
English keywords frequently where as other languages use punctuation,
and it has fewer syntactical constructions than other languages. Python
was developed by Guido van Rossum in the late eighties and early nineties

7
at the National Research Institute for Mathematics and Computer Science
in the Netherlands. Python is derived from many other languages,
including ABC, Modula-3, C, C++, Algol-68, SmallTalk, and Unix shell and

other scripting languages. Python's simple, easy to learn syntax


emphasizes readability and therefore reduces the cost of program
maintenance. Python supports modules and packages, which encourages
program modularity and code reuse. The Python interpreter and the
extensive standard library are available in source or binary form without
charge for all major platforms, and can be freely distributed.

Download at - https://www.python.org/downloads/

8
MySQL

MySQL is a fast, easy-to-use RDBMS being used for many small and big
businesses. MySQL is developed, marketed and supported by MySQL AB,
which is a Swedish company. MySQL is becoming so popular because of
many good reasons −
 MySQL is released under an open-source license. So you
have nothing to pay to use it.
 MySQL is a very powerful program in its own right. It
handles a large subset of the functionality of the most
expensive and powerful database packages.
 MySQL uses a standard form of the well-known SQL data
language.
 MySQL works on many operating systems and with many
languages including PHP, PERL, C, C++, JAVA, etc.
 MySQL works very quickly and works well even with large
data sets.
9
 MySQL is very friendly to PHP, the most appreciated
language for web development.
 MySQL supports large databases, up to 50 million rows or
more in a table. The default file size limit for a table is 4GB,
but you can increase this (if your operating system can
handle it) to a theoretical limit of 8 million terabytes (TB).
 MySQL is customizable. The open-source GPL license allows
programmers to modify the MySQL software to fit their own
specific environments.

10
Coding:
import os
import mysql.connector
#making Connection
con =
mysql.connector.connect(host="localhost",user="root",password="2006"
)
mycursor= con.cursor() #allows row-by-row processing of the result
sets.
mycursor.execute("CREATE DATABASE employee")
import mysql.connector
#making Connection
con = mysql.connector.connect (
host = " localhost " , user = " root " , password = "2006" , database
= " employee " )
mycursor= con.cursor()
mycursor.execute("CREATE TABLE empdata ( Id INT(11) PRIMARY KEY ,
Name VARCHAR(1800),
11
Emial_Id TEXT(1800),Phone_no BIGINT( 11 ), Address TEXT(1000), Post
TEXT(1000), Salary
BIGINT(20))")
# Function to Add_Employee
def Add_Employ():
print("{:>60}".format("-->>Add Employee Record<<--"))
Id = input("Enter Employee Id: ")
# checking If Employee Id is Exit Or Not
if (check_employee(Id) == True):
print("Employee ID Already Exists\nTry Again..")
press = input("Press Any Key To Continue..")
Add_Employ()
Name = input("Enter Employee Name: ")
# checking If Employee Name is Exit Or Not
if (check_employee_name(Name) == True):
print("Employee Name Already Exists\nTry Again..")
press = input("Press Any Key To Continue..")

12
Add_Employ
Email_Id = input("Enter Employee Email ID: ")
press = input("Press Any Key To Continue..")
Add_Employ()

Phone_no = input("Enter Employee Phone No.: ")


if(Pattern.match(Phone_no)):
print("Valid Phone Number")
else:
print("Invalid Phone Number")
press = input("Press Any Key To Continue..")
Add_Employ()
Address = input("Enter Employee Address: ")
Post = input("Enter Employee Post: ")
Salary = input("Enter Employee Salary: ")
data = (Id, Name, Email_Id, Phone_no, Address, Post, Salary)
# Instering Employee Details in

13
# the Employee (empdata) Table
sql = 'insert into empdata values(%s,%s,%s,%s,%s,%s,%s)'
c = con.cursor()
# Executing the sql Query
c.execute(sql, data)
# Commit() method to make changes in the table
con.commit()
print("Successfully Added Employee Record")
press = input("Press Any Key To Continue..")
menu()
# Function To Check if Employee With
# given Name Exist or not
def check_employee_name(employee_name):
# query to select all Rows from
# employee(empdata) table
sql = 'select * from empdata where Name=%s'
# making cursor buffered to make

14
# rowcount method work properly
c = con.cursor(buffered=True)
data = (employee_name,)
# Execute the sql query
c.execute(sql, data)
# rowcount method to find number
# of rowa with given values
r = c.rowcount
if r == 1:
return True
else:
return False
# Function To Check if Employee With
# given Id Exist or not
def check_employee(employee_id):
# query to select all Rows from
# employee(empdata) table

15
sql = 'select * from empdata where Id=%s'
# making cursor buffered to make
# rowcount method work properly
c = con.cursor(buffered=True)
data = (employee_id,)
# Execute the sql query
c.execute(sql, data)
# rowcount method to find number
# of rowa with given values
r = c.rowcount
if r == 1:
return True
else:
return False
def Display_Employ():
print("{:>60}".format("-->> Display Employee Record <<--"))
# query to select all rows from Employee (empdata) Table

16
sql = 'select * from empdata'
c = con.cursor()
# Executing the sql query
c.execute(sql)
# Fetching all details of all the Employees
r = c.fetchall()
for i in r:
print("Employee Id: ", i[0])
print("Employee Name: ", i[1])
print("Employee Email Id: ", i[2])
print("Employee Phone No.: ", i[3])
print("Employee Address: ", i[4])
print("Employee Post: ", i[5])
print("Employee Salary: ", i[6])
print("\n")
press = input("Press Any key To Continue..")
menu()

17
def Update_Employ():
print("{:>60}".format("-->> Update Employee Record <<--\n"))
Id = input("Enter Employee Id: ")
# checking If Employee Id is Exit Or Not
if(check_employee(Id) == False):
print("Employee Record Not exists\nTry Again")
press = input("Press Any Key To Continue..")
menu()
else:
Email_Id = input("Enter Employee Email ID: ")
if(re.fullmatch(regex, Email_Id)):
print("Valid Email")
else:
print("Invalid Email")
press = input("Press Any Key To Continue..")
Update_Employ()
Phone_no = input("Enter Employee Phone No.: ")

18
if(Pattern.match(Phone_no)):
print("Valid Phone Number")
else:
print("Invalid Phone Number")
press = input("Press Any Key To Continue..")
Update_Employ()
Address = input("Enter Employee Address: ")
# Updating Employee details in empdata Table
sql = 'UPDATE empdata set Email_Id = %s, Phone_no = %s, Address = %s
where Id = %s'
data = (Email_Id, Phone_no, Address, Id)
c = con.cursor()
# Executing the sql query
c.execute(sql, data)
# commit() method to make changes in the table
con.commit()
print("Updated Employee Record")

19
press = input("Press Any Key To Continue..")
menu()

# Function to Promote_Employ
def Promote_Employ():
print("{:>60}".format("-->> Promote Employee Record <<--\n"))
Id = input("Enter Employee Id: ")
# checking If Employee Id is Exit Or Not
if(check_employee(Id) == False):
print("Employee Record Not exists\nTry Again")
press = input("Press Any Key To Continue..")
menu()
else:
Amount = int(input("Enter Increase Salary: "))
#query to fetch salary of Employee with given data
sql = 'select Salary from empdata where Id=%s'
data = (Id,)

20
c = con.cursor()

#executing the sql query


c.execute(sql, data)

#fetching salary of Employee with given Id


r = c.fetchone()
t = r[0]+Amount

#query to update salary of Employee with given id


sql = 'update empdata set Salary = %s where Id = %s'
d = (t, Id)
#executing the sql query
c.execute(sql, d)
#commit() method to make changes in the table
con.commit()
print("Employee Promoted")

21
press = input("Press Any key To Continue..")
menu()
# Function to
Remove_Employee def
Remove_Employ():
print("{:>60}".format("-->> Remove Employee Record <<--\n"))
Id = input("Enter Employee Id: ")
# checking If Employee Id is Exit Or Not
if(check_employee(Id) == False):
print("Employee Record Not exists\nTry Again")
press = input("Press Any Key To Continue..")
menu()
else:
#query to delete Employee from empdata table
sql = 'delete from empdata where Id = %s'
data = (Id,)
c = con.cursor()

22
#executing the sql query

23
c.execute(sql, data)
#commit() method to make changes in the empdata table
con.commit()
print("Employee Removed")
press = input("Press Any key To Continue..")
menu()
# Function to Search_Employ
def Search_Employ():
print("{:>60}".format("-->> Search Employee Record <<--\n"))
Id = input("Enter Employee Id: ")
# checking If Employee Id is Exit Or Not
if(check_employee(Id) == False):
print("Employee Record Not exists\nTry Again")
press = input("Press Any Key To Continue..")
menu()
else:
#query to search Employee from empdata table

24
sql = 'select * from empdata where Id = %s'
data = (Id,)
c = con.cursor()

#executing the sql query


c.execute(sql, data)
#fetching all details of all the employee
r = c.fetchall()
for i in r:
print("Employee Id: ", i[0])
print("Employee Name: ", i[1])
print("Employee Email Id: ", i[2])
print("Employee Phone No.: ", i[3])
print("Employee Address: ", i[4])
print("Employee Post: ", i[5])
print("Employee Salary: ", i[6])
print("\n")

25
press = input("Press Any key To Continue..")
menu()
# Menu function to display menu
def menu():
os.system("cls")
print("{:>60}".format("************************************"))
print("{:>60}".format("-->> Employee Management System <<--"))
print("{:>60}".format("************************************"))
file = open('help.txt','w')

file.write("This is an employee management system.Enter your


choice to continue. ")

print("1. Add Employee")


print("2. Display Employee Record")
print("3. Update Employee Record")
print("4. Promote Employee Record")
print("5. Remove Employee Record")
print("6. Search Employee Record")
print("7. Exit\n")
26
print("{:>60}".format("-->> Choice Options: [1/2/3/4/5/6/7] <<--"))
ch = int(input("Enter your Choice: "))

27
if ch == 1:
os.system("cls")
Add_Employ()
elif ch == 2:
os.system("cls")
Display_Employ()
elif ch == 3:
os.system("cls")
Update_Employ()
elif ch == 4:
os.system("cls")
Promote_Employ()
elif ch == 5:
os.system("cls")
Remove_Employ()
elif ch == 6:
os.system("cls")

28
Search_Employ()
elif ch == 7:
os.system("cls")
print("{:>60}7".format("Have A NIce Day :)"))
exit(0)
elif ch == 8:

file = open('help.txt','r')

help_file = file.read()

print(help_file)

else:
print("Invalid Choice!")
press = input("Press Any key To Continue..")
menu()
# Calling menu function
menu()

29
OUTPUT

30
31
32
33
Bibliography

1. Class 12 NCERT Textbook


2. www.geeksforgeeks.org
3. www.python.org

34

You might also like