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

BI for HRP (2018)

BUSINESS INTELLIGENCE (BI) FOR


HUMAN RESOURCE (HR) PLANNING
A Project Report
Submitted by
SONAL
P.U. Roll No. :
6th Semester
SESSION – 2015-2018
UNDER THE GUIDANCE OF
Mr. LOGANATHAN.A.
(Microsoft Technical Lead)
In partial fulfilment of the requirements for the award of the degree
Master of Computer Applications (MCA)
2018
Patna Women’s College
Patna University
3rd Cycle NAAC Accredited – A Grade with CGPA 3.58/4.
“College with Potential for Excellence”(CPE) status accorded by UGC

Page 1 Submitted by: SONAL


BI for HRP (2018)

Title of the Project


BUSINESS INTELLIGENCE (BI) FOR
HUMAN RESOURCE (HR)

PLANNING

Jean Martin Systems India Private


Limited, Chennai
SONAL Guided By:

Resistration No. : Mr. LOGANATHAN.A.

P.U. Roll No. : (Microsoft Technical Lead)


Page 2 Submitted by: SONAL
Session : 2015-2018
BI for HRP (2018)

CERTIFICATE OF APPROVAL

This is hereby certifying that the Project “Business Intelligence for


Human Resource Planning” was completed successfully at Jean
Martin Systems India Private Limited, Chennai and is a bonafide
work of SONAL.

It is being accepted in partial fulfilment of the requirements of the


degree of Master of Computer Application (MCA) at Patna
Women’s College.

__________________ __________________ __________________

External Internal Head of Department

Page 3 Submitted by: SONAL


BI for HRP (2018)

CERTIFICATE OF ORIGINALITY

This is to certify that the project entitled Business Intelligence for


Human Resource Planning submitted to Patna Women’s College,
Patna University in partial fulfilment of the requirement for the award of
the degree of MASTER OF COMPUTER APPLICATION(MCA) is an
authentic and original work carried out by Ms. SONAL with Roll no: 03
under my guidance.

The matter embodied in this project is genuine work done by the


student and has not been submitted whether to this university or to any
other university/Institute for the fulfilment of the requirements of any
course of study.

Signature of the Student Signature of the Guide

Date: .............................................. Date: ..............................................

Name and Address of the Student Name, Designation and Address of


the Guide
.........................................................................
.........................................................................
.........................................................................
.........................................................................
.........................................................................
.........................................................................
.........................................................................
.........................................................................
Roll No.: ...............

Page 4 Submitted by: SONAL


BI for HRP (2018)

ACKNOWLEDGEMENT

I feel enraptured while expressing my deepest gratitude and


indebtedness by few words towards everyone concern in the making of
this project named “BUSINESS INTELLIGENCE FOR HUMAN
RESOURCE PLANNING” for Jean Martin Systems India Private
Limited, Chennai.

First and foremost, I would like to thank our supervisor of this project, for
the valuable guidance and advice. He inspired me greatly to work in this
project. I would also like to thank him for guiding me with some samples
that related to the topic of our project. Besides, I would also like to thank
the authority of Jean Martin, Chennai for providing me with a good
environment and facilities to complete this project.

I specially thank the CO-ORDINATOR of MCA, Dr. BHAWNA SINHA


and all faculty members of the MCA department of Patna Women’s
College for the supervision in my project and their kind presence during
completion of the MCA course with a keen interest, enthusiasm and
their helping nature.

I would like to extend heartfelt thanks to Mr.LOGANATHAN.A,


Microsoft Technical Lead, Jean Martin for providing me all possible
help in availing practical facilities.

I want to express my sincere thanks to Mr.Selvan. K, for his kind


cooperation and permission for completing the project in his
organization. I would also like to thank all the staff members of Jean
Martin for their kind cooperation.

Page 5 Submitted by: SONAL


BI for HRP (2018)

INDEX OF SYNOPSIS

Contents
1. ABOUT THE ORGANISATION..................................................................................................8
2. INTRODUCTION.........................................................................................................................9
3. PROJECT OBJECTIVE..............................................................................................................10
4. TOOLS AND PLATFORM REQUIRED....................................................................................11
5. SDLC...........................................................................................................................................15
5.1. PRELIMINARY INVESTIGATION.......................................................................................16
5.2. REQUIREMENT GATHERING AND ANALYSIS :.............................................................17
5.3. FEASIBILITY STUDY...........................................................................................................18
5.4. PROJECT PLANNING...........................................................................................................20
5.5. PROJECT SCHEDULING......................................................................................................21
5.7. ERD (ENTITY RELATIONSHIP DIAGRAM)......................................................................25
5.8. FLOW CHART.......................................................................................................................32
5.9. DFD ( DATAFLOW DIAGRAM )..........................................................................................34
5.10. FUNCTIONAL DESCRIPTION.........................................................................................39
6. SYSTEM DESIGN......................................................................................................................40
6.1. MODULARISATION DETAIL..............................................................................................41
6.2. DATABASE DESIGN............................................................................................................42
6.3. USER INTERFACE DESIGN.................................................................................................48
7. CODING.....................................................................................................................................55
8. TESTING..................................................................................................................................153
9. IMPLEMENTING BI................................................................................................................157
9.1. BI for HR PLANNING..........................................................................................................158
9.2. WORKING WITH BI (MS-SQL AND FLAT FILES)..........................................................160
9.3. BI DASHBOARD, REPORTS AND MODELS....................................................................161
9.4. WORKING WITH POWER BI DESKTOP..........................................................................162
10. REPORTS.............................................................................................................................201
11. SYSTEM MAINTENANCE.................................................................................................205
12. FUTURE SCOPE..................................................................................................................206
13. PROJECT LIMITATION AND FURTHER DEVELPOMENT............................................207
14. CONCLUSION.....................................................................................................................208
15. REFERENCES......................................................................................................................209

Page 6 Submitted by: SONAL


BI for HRP (2018)

1. ABOUT THE ORGANISATION


Jean Martin Systems India Private Limited is a Private incorporated on
27th April 2004. It is classified as Non-govt company and is registered at
Registrar of Companies, Chennai. Its authorized share capital is Rs.
2,500,000 and its paid up capital is Rs. 2,046,000.

Objective:

 Software publishing
 Consultancy and supply [Software publishing includes production
supply and documentation of ready-made (non-customized)
software, operating systems software, business & other
applications software, computer games software for all platforms.
Consultancy includes providing the best solution in the form of
custom software after analyzing the users’ needs and problems.
Custom software also includes made-to-order software based on
orders from specific users. Also, included are writing of software of
any kind following directives of the users; software maintenance,
web-page design].

Page 7 Submitted by: SONAL


BI for HRP (2018)

2. INTRODUCTION
The technology, methods, and applications used for integration and presentation of
business information, is known as Business Intelligence System.

The business decisions making made by an enterprise is supported by the Business


Intelligence System.

Through Business Intelligence, one is enabled to have a more tactical and meaningful
business decisions.

We provide suitable design and apply BI that encompasses a wide


variety of tools, applications and methodologies that will enable
organization to first collect data for the human resource planning and
then access data source; prepare it for analysis; develop and run queries
against the data; and create reports, dashboards and data visualizations
to make the analytical results available to corporate decision-makers, as
well as operational workers.

Smooth and faster operations at all levels improve the working


atmosphere of the entire organization. The database needs to be
maintained as per the requirement.

The project has the following advantages:-

1. It is user friendly.
2. It is having less paperwork.
3. Efficient tractability.
4. Various reports and forms can be generated.

Page 8 Submitted by: SONAL


BI for HRP (2018)

3. PROJECT OBJECTIVE

Aim of this project is to computerize and manage employee’s detail in


the organization that often enables to keep a track of daily reports which
includes the resource availability, salary slip, attendance report, etc.

Business Intelligence for Human Resource Planning has the following


objective:
 Facilitate gathering, storing, analysing, and accessing business data
across the organization.
 Provide ease of maintaining records of employees, processing
salary, managing attendance and loans.
 Serve the user with the meaningful information and provide an
accurate picture of each employees’ performance.
 Provide access to easy-to-use reporting and analysis tools to make
decisions based on facts.

PRESUMPTION OF THE SYSTEM:

The project is based on real life scenario that proves to be helpful for the
organization to earn profit and analyse the performance via bringing in
software driven or process driven resources management.

The system should also offer the following:


 Sequential management of various processes.
 Centralization of section
 Data availability and quality
 Data authenticity

Methodical Organized Well - controlled


Centralized

Automate
Intelligence process

Page 9 Submitted by: SONAL


BI for HRP (2018)

4. TOOLS AND PLATFORM REQUIRED

 SOFTWARE REQUIREMENTS:

 Platform : Microsoft Power BI


 Operating system : Windows 7 or higher
 Front-end tool : ASP.NET with C#
 Back-end tool : MS-SQL
 Connectivity : ADO.NET

 MINIMUM HARDWARE REQUIREMENTS:

 Processor : Pentium IV or higher


 Hard Disk : 500 GB
 RAM : 2 GB or higher

 Microsoft Power BI

Power BI is a business analytics service provided


by Microsoft. It provides interactive visualizations with
self-service business intelligence capabilities, where end
users can create reports and dashboards by themselves, without
having to depend on information technology staff or database
administrators.

Power BI is a Data Visualization and Business Intelligence tool that


converts data from different data sources to interactive dashboards and
BI reports. Power BI suite provides multiple software, connector, and
services - Power BI desktop, Power BI service based on Saas, and mobile
Power BI apps available for different platforms. These set of services are
used by business users to consume data and build BI reports. This
Page 10 Submitted by: SONAL
BI for HRP (2018)

tutorial covers all the important concepts in Power BI and provides a


foundational understanding on how to use Power BI.
 ASP.NET

ASP.NET is a web application framework developed and marketed by


Microsoft to allow programmers to build dynamic web sites. It allows
you to use a full featured programming language such as C# or VB.NET
to build web applications easily.

ASP.NET is a web development platform, which provides a


programming model, a comprehensive software infrastructure and
various services required to build up robust web applications for PC, as
well as mobile devices.

The ASP.NET application codes can be written in any of the following


languages:

 C#
 Visual Basic.Net
 Jscript
 J#

ASP.NET is used to produce interactive, data-driven web applications
over the internet. It consists of a large number of controls such as text
boxes, buttons, and labels for assembling, configuring, and
manipulating code to create HTML pages.

 C#

C# is a modern, general-purpose, object-oriented programming


language developed by Microsoft and approved by European Computer
Manufacturers Association (ECMA) and International Standards
Organization (ISO).
C# was developed by Anders Hejlsberg and his team during the
development of .Net Framework.

Page 11 Submitted by: SONAL


BI for HRP (2018)

C# is designed for Common Language Infrastructure (CLI), which


consists of the executable code and runtime environment that allows
use of various high-level languages on different computer platforms
and architectures.
The following reasons make C# a widely used professional language −

 It is a modern, general-purpose programming language


 It is object oriented.
 It is component oriented.
 It is easy to learn.
 It is a structured language.
 It produces efficient programs.
 It can be compiled on a variety of computer platforms.
 It is a part of .Net Framework.

 MS-SQL

 It is a software, developed by Microsoft, which is implemented


from the specification of RDBMS.
 It is also an ORDBMS.
 It is platform dependent.
 It is both GUI and command based software.
 It supports SQL (SEQUEL) language which is an IBM product, non-
procedural, common database and case insensitive language.
 Usage of SQL Server
 To create databases.
 To maintain databases.
 To analyze the data through SQL Server Analysis Services (SSAS).
 To generate reports through SQL Server Reporting Services (SSRS).
 To carry out ETL operations through SQL Server Integration
Services (SSIS).

SQL Server Management Studio is a workstation component\client


tool that will be installed if we select workstation component in
installation steps. This allows you to connect to and manage your SQL

Page 12 Submitted by: SONAL


BI for HRP (2018)

Server from a graphical interface instead of having to use the


command line.
In order to connect to a remote instance of an SQL Server, you will
need this or similar software. It is used by Administrators, Developers,
Testers, etc.

 ADO.NET

ADO.NET provides a bridge between


the front end controls and the back end
database. The ADO.NET objects
encapsulate all the data access
operations and the controls interact
with these objects to display data, thus
hiding the details of movement of data.

ASP.NET life cycle specifies, how:

 ASP.NET processes pages to produce dynamic output


 The application and its pages are instantiated and processed
 ASP.NET compiles the pages dynamically
The ASP.NET life cycle could be divided into two groups:

 Application Life Cycle


 Page Life Cycle

Page 13 Submitted by: SONAL


BI for HRP (2018)

5. SDLC
SDLC (Software Development life cycle) models describe phases of the
software cycle and the order in which those phases are executed. Each
phase produces deliverables required by the next phase in the life cycle.
Requirements are translated into design. Code is produced according to
the design which is called development phase. After coding and
development the testing verifies the deliverable of the implementation
phase against requirements. The testing team follows Software Testing
Life Cycle (STLC) which is similar to the development cycle followed by
the development team.

Page 14 Submitted by: SONAL


BI for HRP (2018)

5.1. PRELIMINARY INVESTIGATION

One of the most difficult tasks of the system analyst, to identifying real
problem of the existing system. Without clear understanding of the
problem in the system, any further work done could lead to wastage of
effort at a later stage.

Problem definition defines the user requirements or what the user


expects from the system. This also sets the project boundaries, defining
what part of the system can be changed by the project and what part to
remain without any change.

Problem identification helps in:

 Pinpointing the problems the existing software works on


manual system.
 Setting proper system goals to transform the whole manual
day to day operations to fully automated computerized system.
 Determining the boundaries of the project  system is
designed only for admin not for other users.

Page 15 Submitted by: SONAL


BI for HRP (2018)

5.2. REQUIREMENT GATHERING AND


ANALYSIS :

In this phase Business requirements are gathered. This phase is the main
focus of the project managers and stake holders. Meetings with
managers, stake holders and users are held in order to determine the
requirements like;

 Who is going to use the system?

 How will they use the system?

 What data should be input into the system?

 What data should be output by the system?

These are general questions that get answered during a requirements


gathering phase. Once the requirements are gathered these
requirements are analyzed for their validity and the possibility of
incorporating the requirements in the system to be development is also
studied.

Finally, a Requirement Specification document is created which serves


the purpose of guideline for the next phase of the model. The testing
team follows the Software Testing Life Cycle and starts the Test Planning
phase after the requirements analysis is completed.

Page 16 Submitted by: SONAL


BI for HRP (2018)

5.3. FEASIBILITY STUDY

Feasibility is defined as the practical extent to which a project can be


performed successfully. To evaluate feasibility, a feasibility study is
performed, that determines whether the solution considered to
accomplish the requirements is practical and workable in the software.
Information such as resource availability, cost estimation for software
development benefits of the software to the organization after it is
developed and cost to be incurred on its maintenance are considered
during the feasibility study.
The objective of the feasibility study is to establish the reasons for
developing the software that is acceptable to users, adaptable to change
and conformable to established standards. Various other objectives of
feasibility study are listed below:
 To analyze whether the software will meet organizational
requirements.
 To determine whether the software can be implemented using the
current technology and within the specified budget and
scheduling.
 To determine whether the software can be integrated with other
existing software.
There are various types of Feasibility Study that are considered, some of
them conducted for this project includes:

 Operational Feasibility:
The proposed system solves the problems, and takes advantage of
the opportunities identified during scope definition and satisfies
the requirements identified in the requirements analysis phase of
system development.
It often focuses on the degree to which the proposed development
project fits in with the existing business environment and

Page 17 Submitted by: SONAL


BI for HRP (2018)

objectives with regard to development schedule, delivery


date, corporate culture and existing business processes.
 Schedule Feasibility:
An estimate is considered for this project that how long the system
will take to develop, and if it can be completed in a given time
period using some methods. We focus on the measure of how
reasonable the project timetable is. Technical expertise guided to
achieve the project goal within the project deadline.

 Technical Feasibility:
The management provides latest hardware and software facilities
for the successful completion of the projects. With these latest
hardware and software support the system will perform extremely
well.

Page 18 Submitted by: SONAL


BI for HRP (2018)

5.4. PROJECT PLANNING


The project objective is determined and the requirements to produce the
product are considered. An estimate about the resource required to
build the project is considered such as personnel and costs, is prepared,
along with the concept for the new products. All of the information is
analysed to insure whether there is an alternative solution for creating a
whole new product.

 Existing System: The existing system depends on the


maintenance of multiple employee files and huge collection of
records. Human resources departments are maintained to go
through all the information and make recruitment and payroll
information. Every month a lot of time is spent on updating
employees’ record and analyzing the organisation performance
with several key factors.

 Proposed System: Business Intelligence for Human Resource


Planning emphasizes onto detailing strategic decision making
against volatile demands and challenges.

We need to depend through BI tools to assess, analyse data sets


and present analytical findings in reports, summaries, dashboards,
graphs, charts and maps to provide users with detailed intelligence
about state of the business. The system offers exploiting
intelligence reports.

ADVANTAGES OF PROPOSED SYSTEM

 Very simple and easy to implement


 Ensure data accuracy
 Reduces manual data entry
 Greater efficiency
 User friendly and interactive
 Less time consuming and low cost
 Paperless communication
Page 19 Submitted by: SONAL
BI for HRP (2018)

5.5. PROJECT SCHEDULING

Project scheduling is the mechanism to communicate what tasks need to


get done and which organizational resources will be allocated to
complete those tasks in what timeframe. A project schedule is a
document collecting all the work needed to deliver the project on time.

A project is made up of many tasks, and each task is given a start and
end (or due date), so it can be completed on time. Likewise, people have
different schedules, and their availability and vacation or leave dates
need to be documented in order to successfully plan those tasks.

 PERT CHART:
A PERT chart is a project management tool used to schedule, organize,
and coordinate tasks within a project.

It is a methodology developed by the U.S. Navy in the 1950s to manage


the Polaris submarine missile program. A similar methodology,
the Critical Path Method (CPM) was developed for project management
in the private sector at about the same time.

It consists of a network of boxes and arrows. The boxes represent


activities and arrows represent task and dependencies.

PERT is organized by events and activities or tasks. PERT have more


advantages and they are likely to be used for complex projects. Through
PERT CHART various tasks are defined.

PERT enabled the calculation of critical part. Each part consists of


combination of tasks, which must be completed. The time and the cost
associated with each task along a path are calculated, and the path that
requires the greatest amount of elapsed time is critical path. Calculation
of the critical path enables project manager to monitor this series of task
more closely than others to shift resources to it, if it begins to fall behind
schedule.
Page 20 Submitted by: SONAL
BI for HRP (2018)

The PERT chart representation of the “BI for HR Planning” is shown below:

11th Jan 20th Jan 11th Jan 26th Feb 21st Mar
To To To To To
20th Jan 10th Feb 25th Feb 20th Mar 31st Mar

Data
Database Coding
Project Gathering
Design Part
Specificatio Part
Part
n
2nd Jan 21st Apr 1st Apr
To To To
th
10 Jan th
30 Apr 20th Apr
Flowchar
Start Finish BI Part
t
Design

GUI Business
Work Testing
Design Warehousin
Analysis Part
Part g

 GANTT CHART:
A Gantt chart is a type of bar chart that illustrates a project schedule.
Modern Gantt charts also show the dependency relationships between
activities and current schedule status.

Gantt charts allow project managers to track the progress of the entire
project. Through Gantt charts, the project manager can keep a track of
the individual tasks as well as of the overall project progression.

Gantt chart was invented by a mechanical engineer named Henry Gantt


in 1910. Since the invention, Gantt chart has come a long way. By today,
it takes different forms from simple paper based charts to sophisticated
software packages.

Page 21 Submitted by: SONAL


BI for HRP (2018)

The GANNT chart representation of the “BI for HR Planning” is shown


below:

Jan 2 Jan 20 Feb 10 Feb 25 Mar 20 Mar 31 Apr 20 Apr 30

Specification
& Analysis

Design
Flowchart

Design
Database

Design GUI

Code GUI
Part

Code
Database
Part

Testing

Business Intelligence

Write User Manual

Page 22 Submitted by: SONAL


BI for HRP (2018)

5.6. AGILE MODEL

Agile SDLC model is a combination of iterative and incremental process


models with focus on process adaptability and customer satisfaction by
rapid delivery of working software product. Agile methods break the
product into small incremental builds. These builds are provided in
iterations. Each iteration involves cross functional teams working
simultaneously on various areas such as:
 Planning
 Requirement Analysis
 Design
 Unit Testing and
 Acceptance Testing

At the end of the iteration, a working product is displayed to the


customer and important stakeholders.

The graphical illustration of the Agile Model is as follows:

Advantage of this
methodology:
 Efficient and face-to-face communication
 Very short feedback loop and adaptation cycle
 Quality focus.

Page 23 Submitted by: SONAL


BI for HRP (2018)

5.7. ERD (ENTITY RELATIONSHIP


DIAGRAM)

An entity–relationship diagram is usually the result of systematic analysis


to define and describe what is important to processes in an area of a
business. It does not define the business processes; it only presents a
business data schema in graphical form. It is usually drawn in a graphical
form as: Boxes (entities) that are connected by Lines (relationships) which
express the associations and dependencies between entities.
.
ADVANTAGES OF ERD:

 It shows the structural model of system.


 It shows the database design.
 It shows the relationship between the entities of database.

Page 24 Submitted by: SONAL


BI for HRP (2018)

ad_username

ad_id ad_password

IAdminLogin
A div_name
div_id

C
handles
IDivisionMaster

ILeaveMasters

dept_name
dept_id
lev_id div_id
lev_day

casual_type
forml_type IDepartmentMaster

lev_day

desig_name
desig_id

IDesignationMaster

Page 25 Submitted by: SONAL


BI for HRP (2018)

gender

L_name dob

marital_status
f_nama

A
title nationality

emp_id contact

manages email
IEmpTable
div_id

doj
dept_id

to_date desig_id

from_date
add1
temp_reason

register & revise add2


per_reason
has add3
S_inact
add_city
status
add_state
year_exp
add_district
B position
add_pin
prev_company
add_proof

Work_exp qualification

certification

Page 26 Submitted by: SONAL


monthly_salary BI for HRP (2018)
emp_id
bp

dr_allownc
B ISalaryReg
hra_allownc

en_allownc

modify_date convy_allownc

net_pay med_allownc

tot_ded pf

tot_earn

sick_leave

casual_leave year

C emp_id month

days
id
wdays
maintains
tbl_attendance Total_Number_of_Days_Pr
esent

casual_leave_taken

D
sick_leave_taken

Page 27 Submitted by: SONAL


BI for HRP (2018)

Title Fname
D Lname
emp_id
Division

Department

Attendancupdate_master Designation

Year

Available_Sick_Leave
Month

Total_Days
Sick_Leave_Taken
Working_Days

Available_Casual_Leave Total_Number_Of_Days_Present

Casual_Leave_Taken

Page 28 Submitted by: SONAL


BI for HRP (2018)

Page 29 Submitted by: SONAL


BI for HRP (2018)

Page 30 Submitted by: SONAL


BI for HRP (2018)

5.8. FLOW CHART

Flowcharts use special shapes to represent different


types of actions or steps in a process. Lines and
arrows show the sequence of the steps, and the
relationships among them. These are known as
flowchart symbols.
The type of diagram dictates the flowchart symbols
that are used. For example, a data flow diagram may
contain an Input/output Symbol (also known as an
I/O Symbol), but you wouldn't expect to see it in
most process flow diagrams.

Microsoft Visio (formerly Microsoft Office Visio) is a diagramming


and vector graphics application and is part of the Microsoft Office family.
The product was first introduced in 1992, made by the Shapeware
Corporation. It was acquired by Microsoft in 2000.

Page 31 Submitted by: SONAL


BI for HRP (2018)

Page 32 Submitted by: SONAL


BI for HRP (2018)

5.9. DFD ( DATAFLOW DIAGRAM )

A data flow diagram (DFD) is a graphical representation of the "flow" of


data through an information system, modelling its process aspects.

It is often used as a preliminary step to create an overview of the system


without going into great detail, which can later be elaborated. DFDs can
also be used for the visualization of data processing (structured design).

A DFD shows what kind of information will be input to and output from
the system, how the data will advance through the system, and where
the data will be stored. It does not show information about process
timing or whether processes will operate in sequence or in parallel,
unlike a traditional structured flowchart which focuses on control flow, or
a UML activity workflow diagram, which presents both control and data,
flows as a unified model.

CHARACTERISTICS OF DFD:

 A DFD consists of a series of bubbles joined by lines.


 The bubbles represents data flow transformation and the lines
represents data flows in the system.
 External entities sent and receive data flows from the system.
 DFD is also known as bubble chart. It is also known as bubble chart
because multiple bubbles are used for processing data.
 DFD supports top-down approach for analysis.

Page 33 Submitted by: SONAL


BI for HRP (2018)

A. Context Level DFD:

provide username and


HR maintains and
passoword
updates
ADMIN SYSTEM databases
successful login

B. 1ST Level DFD:

1.0
enters Master Database maintains and
information updates
ADMIN master
databases

provides information

2.0 maintains and


Employee updates
Management IEmpTable
provides
information

provides information
3.0 maintains and
Salary updates
Management ISalaryRegTable
provides
information

provides
4.0 information
Attendance tbl_attendance
updates
Management

upload
information
5.0
proceeds Payroll provides attendancupdate_
Processing information master

Page 34 Submitted by: SONAL


BI for HRP (2018)

C. 2ND Level DFD:

1.1
enters division Division
name Handling process maintains and IDivisionMaster
ADMIN
updates

provides information

select division 1.2


Department
enters
Handling process maintains and IDepartmentMaster
ddepartment
updates

1.3
Designation
enters designation name Handling process maintains and IDesignationMaster
updates

1.4
select leave type Leave
Handling process maintains and ILeaveMaster
enter number of days updates

Page 35 Submitted by: SONAL


BI for HRP (2018)

IDivisionMaster
provides information

provides information IDesignationMaster

2.1
Register New registered
process successfully
insert employee IEmpTable
ADMIN
details

provides information

edit information 2.2


Edit Employee
process updates

provides information

select Employee ID 3.1


Salary
enters monthly salary Registeration register salary
ISalaryRegTable
process

provides information

3.2
select Employee ID Revise Salary
process modify
edit monthly salary

Page 36 Submitted by: SONAL


BI for HRP (2018)

provides information IEmpTable

4.1
Export provides
select year,month Attendance information
ADMIN enter working days process tbl_attendance
updates

provides information

4.2
Import
Attendance
enter information insert attendancupdate_
process
data master

provides information

5.1
Process Payroll
proceeds

update
5.2
Edit Attendance
process
edit values

provides information

provides information
ISalaryRegTable
generates 5.2
Payslip
Generation
process payslip available
ADMIN

Page 37 Submitted by: SONAL


BI for HRP (2018)

5.10. FUNCTIONAL DESCRIPTION


Business Intelligence for Human Resource Planning provides employee’s details that
could be used by the HR to analyze proper functioning of the organization.

It helps in the followings:


 Reporting; allow the HR to know what has already happened.
 Analysis; focus on why things happened.
 Monitoring; Dashboards, and alerts to make decisions to create good results
proactively and avoid bad performance before it accumulates.
  Predictive Analytics; process the data to come up with forecast of what
might happen in the future.

This project allows HR to plan, develop and administer policies and programmes
designed to make expeditious use of organisation’s human resources.

The various modules involved in Business Intelligence for Human Resource re as


follows:
 Employee Registration: submit and store the employees’ detail
 Salary Registration: defining salary structure of the employee
 Attendance: maintains attendance records of employees’ and in future
advance attendance methods such as biometric could be implemented.
 Payroll: after processing all the information, the entire expense of the
organization is depicted.

At last BI is applied.

Page 38 Submitted by: SONAL


BI for HRP (2018)

6. SYSTEM DESIGN

Systems design is the process of defining the architecture, modules,


interfaces, and data for a system to satisfy specified requirements.
Systems design could be seen as the application of systems
theory to product development.

The architectural design of a system emphasizes the design of


the system architecture that describes the structure, behavior and
more views of that system and analysis.
Few requirements about the system are decided, such as:

 Input requirement,
 Output requirements,
 Storage requirements,
 Processing requirements,
 System control and backup or recovery.
System design can generally be broken down into three sub-tasks:

Process Design

Data Design

User Interface Design

Page 39 Submitted by: SONAL


BI for HRP (2018)

6.1. MODULARISATION DETAIL


In this approach the system is subdivided into smaller parts called
modules that can be independently created and then used in different
systems. A modular system can be characterized by functional
partitioning into discrete scalable, reusable modules; rigorous use of
well-defined modular interfaces; and making use of industry standards
for interfaces.

 Admin Module : This module is used by the admin to


define and edit the Division, Department, Designation and
,meanwhile the admin can handle the employee records,
their salary, attendance and generate payroll for them.

Various forms have been used by the admin for the above
that are as follows:

 Division Form
 Department Form
 Designation Form
 Employee Registration Form
 Employee Edit Form
 Salary Registration Form
 Salary Review Form
 Attendance Handling Form
 Payroll Processing Form

Page 40 Submitted by: SONAL


BI for HRP (2018)

6.2. DATABASE DESIGN

1. IAdminLogin Table : This table holds the attributes regarding


the login information.

Field name Data Type Size Constraint Description


ad_id int Primary key Admin Id
ad_username varchar 20 Not null Username
ad_password varchar 20 Not null Password

2. IDivisionMaster Table : This table holds the divisions’


information.

Field name Data Type Size Constraint Description


div_id int Primary key Division Id
div_name varchar 20 Not null Division name

3. IDepartmentMaster Table: This table holds the departments’


information.

Field name Data Type Size Constraint Description


dept_id int Primary key Department Id
dept_name varchar 20 Not null Department name
div_id int Foreign key Division Id

4. IDesignationMaster Table: This table holds the designations’


information.

Field name Data Type Size Constraint Description


desig_id int Primary key Designation Id
desig_name varchar 20 Not null Designation name
Page 41 Submitted by: SONAL
BI for HRP (2018)

5. ILeaveMaster Table: This table holds the available leave


information.

Field name Data Type SizeConstraint Description


lev_id Int Primary key Leave Id
lev_type Nvarchar MAX Not null Leave type
lev_day Nvarchar MAX Not null Number of days
the leave could be
allowed

6. IEmpTable : This table holds the employees’ information.

Field name Data Type Size Constraint Description


emp_id Int Primary Key Employee Id
Title Varchar 10 Not null Title
f_name nvarchar MAX Not null First name
l_name nvarchar MAX Not null Last name
Gender nvarchar MAX Not null Gender
Dob datetime Not null Date of birth
marital_status nvarchar MAX Not null Marital status
Nationality Varchar 20 Not null Nationality
Contact nvarchar MAX Not null Contact
Email nvarchar MAX Not null Email Id
div_id Int Foreign Key Division Id
dept_id Int Foreign Key Department Id
desig_id Int Foreign Key Designation Id
add1 nvarchar MAX Not null Address
add2 nvarchar MAX Not null Address
add3 nvarchar MAX Not null Address
add_city Varchar 20 Not null City
add_state Varchar 20 Not null State

Page 42 Submitted by: SONAL


BI for HRP (2018)

add_district Varchar 20 Not null District


add_pin Int Not null Pincode
add_proof nvarchar MAX Not null ID Proof
qualification varchar 20 Not null Qualification
certification Varchar 100 Not null Skill
work_exp nvarchar MAX Not null Work experience(
Experienced/
Fresher)
prev_compan Varchar 20 Not null Previous
y company
position nvarchar MAX Not null Position
year_exp nvarchar MAX Not null Years of
experience
status nvarchar MAX Not null Employee status
s_inact nvarchar MAX Not null Type of Inactive
status
per_reason nvarchar MAX Not null Reason for
permanent
Inactive
temp_reason nvarchar MAX Not null Reason for
temporary
Inactive
from_date nvarchar MAX Not null Inactive from
to_date nvarchar MAX Not null Date on which
the record was
registered to the
system
doj nvarchar MAX Not null Date of joining
Casual_Leave nvarchar MAX Not null Casual Leave
available
sick_Leave nvarchar MAX Not null Sick Leave
available

Page 43 Submitted by: SONAL


BI for HRP (2018)

7. ISalaryRegTable : This table holds the employees’ salary


information.

Field name Data Type Size Constraint Description


emp_id Int Foreign Key Employee Id
monthly_salar Numeric 18,2 Not null Monthly salary
y
Bp Numeric 18,2 Allow null Basic pay
dr_allownc Numeric 18,2 Allow null Dearness
allowance
hra_allownc Numeric 18,2 Allow null House rent
allowance
en_allownc Numeric 18,2 Allow null Entertainment
allowance
convy_allownc Numeric 18,2 Allow null Conveyance
allowance
med_allownc Numeric 18,2 Allow null Medical
allowance
Pf numeric( 18,2 Allow null Provident fund
tot_earn Numeric 18,2 Allow null Total earning
tot_ded Numeric 18,2 Allow null Total deduction
net_pay Numeric 18,2 Allow null Net pay
modified_date nvarchar MAX Allow null Modified date

8. tblAttendance Table : This table holds the information that will


be used to export the attendance related data to the excel.

Field name Data Type Size Constraint Description


Id Int Allow null ID
Empid Nvarchar MAX Allow null Employee Id
Casulleave Nvarchar MAX Allow null Available Casual
Leave
Sickleave Nvarchar MAX Allow null Available Sick
Page 44 Submitted by: SONAL
BI for HRP (2018)

Leave
Year Nvarchar MAX Allow null Year
Month nvarchar MAX Allow null Month
days nvarchar MAX Allow null Number of days
in the month
wdays nvarchar MAX Allow null Total number of
working days
Total_Numb nvarchar MAX Allow null Total number of
er_Of_Days_ days present
Present
Casual_Leav nvarchar MAX Allow null Number of days
e_Taken casual leave
taken
Sick_Leave_T nvarchar MAX Allow null Number of days
aken sick leave taken

9. tblAttendance Table : This table holds the information that will


be used to export the attendance related data to the excel.

Field name Data Size Constraint Description


Type
Empid nvarchar MAX Allow null Employee Id
Title nvarchar MAX Allow null Title
Fnane nvarchar MAX Allow null First name
Lname nvarchar MAX Allow null Last name
Division nvarchar MAX Allow null Division
Department nvarchar MAX Allow null Department
Desgination nvarchar MAX Allow null Desigantion
Year nvarchar MAX Allow null Year
Month nvarchar MAX Allow null Month
Total_Days nvarchar MAX Allow null Total days of
Page 45 Submitted by: SONAL
BI for HRP (2018)

month
Working_Days nvarchar MAX Allow null Total working
days
Total_Number Nvarchar MAX Allow null Number of days
_Of_Days_Pres present
ent
Casual_Leave_ Nvarchar MAX Allow null Number of days
Taken casual leave
taken
Available_casu Nvarchar MAX Allow null Number of days
al_Leave Casual leave
allowed
Sick_Leave_Ta Nvarchar MAX Allow null Number of days
ken Sick leave taken
Available_Sick nvarchar MAX Allow null Number of days
_Leave Sick leave
allowed

Page 46 Submitted by: SONAL


BI for HRP (2018)

6.3. USER INTERFACE DESIGN

1. Login Page:

2. Dashboard:

Page 47 Submitted by: SONAL


BI for HRP (2018)

3. Division Master Page :

4. Department Master Page :

Page 48 Submitted by: SONAL


BI for HRP (2018)

5. Designation Master Page :

6. Leave Master Page :

Page 49 Submitted by: SONAL


BI for HRP (2018)

7. Register New Page :

8. Edit Employee Detail Page :

Page 50 Submitted by: SONAL


BI for HRP (2018)

9. Register Salary Page :

10. Export Attendance Page :

Page 51 Submitted by: SONAL


BI for HRP (2018)

11. Upload Attendance Page :

12. Payroll Processing Page :

Page 52 Submitted by: SONAL


BI for HRP (2018)

13. Edit Attendance Page :

14. Payslip Page :

Page 53 Submitted by: SONAL


BI for HRP (2018)

7. CODING

a) Login Page:

 Login.aspx code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs"
Inherits="pages_examples_Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link rel="stylesheet"
href="../../bower_components/bootstrap/dist/css/bootstrap.min.css">

<link rel="stylesheet" href="../../bower_components/font-awesome/css/font-


awesome.min.css">

<link rel="stylesheet" href="../../bower_components/Ionicons/css/ionicons.min.css">

<link rel="stylesheet" href="../../dist/css/AdminLTE.min.css">

<link rel="stylesheet" href="../../plugins/iCheck/square/blue.css">

<link rel="stylesheet" href="https://fonts.googleapis.com/css?


family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
<style type="text/css">
.modal
{
position: fixed;
top: 0;
left: 0;
background-color: black;
z-index: 99;
opacity: 0.8;
filter: alpha(opacity=80);
-moz-opacity: 0.8;
min-height: 100%;
width: 100%;
}
.loading
{
font-family: Arial;
font-size: 10pt;

width: 200px;
height: 100px;
display: none;
position: fixed;
background-color: White;
z-index: 999;
margin-top:-120PX;

Page 54 Submitted by: SONAL


BI for HRP (2018)
}
</style>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
function ShowProgress() {
setTimeout(function () {
var modal = $('<div />');
modal.addClass("modal");
$('body').append(modal);
var loading = $(".loading");
loading.show();
var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2,
0);
var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2,
0);
loading.css({ top: top, left: left });
}, 200);
}
$('form').live("submit", function () {
ShowProgress();
});
</script>
</head>
<body class="hold-transition login-page">
<form id="form1" runat="server">
<div>
<div class="login-box">
<div class="login-logo">
<a href="#"><b>HRP</b>-Login</a>
</div>

<div class="login-box-body">

<img src="images/banner-login-form-2.jpg" class="img-responsive"/>


<p class="login-box-msg">Sign in to start your session</p>

<div>
<div class="form-group has-feedback">

<asp:TextBox ID="txt_userid" runat="server" class="form-


control"></asp:TextBox>
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<asp:TextBox ID="txt_pass" runat="server" class="form-control"
TextMode="Password"></asp:TextBox>
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
</div>
<div class="row">
<div class="col-xs-12">

<asp:Button ID="Button1" runat="server" Text="Login"


class="btn btn-primary btn-block btn-flat" onclick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="SignUp"
class="btn btn-primary btn-block btn-flat" onclick="Button2_Click" />
</div>

</div>

Page 55 Submitted by: SONAL


BI for HRP (2018)
<div class="loading" align="center">
Loading. Please wait.<br />
<br />
<img src="loader.gif" alt="" />
</div>
</div>

<a href="#"></a><br>

</div>
</div>

<script src="../../bower_components/jquery/dist/jquery.min.js"></script>
<script src="../../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="../../plugins/iCheck/icheck.min.js"></script>
<script>
$(function () {
$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%' /* optional */
});
});
</script>
</div>
</form>
</body>
</html>

 Login.aspx.cs code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class pages_examples_Login : System.Web.UI.Page


{
SqlConnection con = new
SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["hms"].Conne
ctionString);
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

this.data();

}
}
private void data()
{

string qry = "select *From dbo.IAdminLogin";


SqlDataAdapter da = new SqlDataAdapter(qry,con);

Page 56 Submitted by: SONAL


BI for HRP (2018)
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

Button1.Visible = true;
Button2.Visible = false;

}
else
{

Button1.Visible = false;
Button2.Visible = true;

}
protected void Button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
string qry = "select ad_username, ad_password From dbo.IAdminLogin where
ad_username='" + txt_userid.Text.Trim() + "' and ad_password='"+txt_pass.Text.Trim()
+"'";
SqlDataAdapter da = new SqlDataAdapter(qry, con);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
Session["uid"] = txt_userid.Text;
Response.Redirect("Main.aspx");

}
else
{

Response.Write("<script>alert('Please enter valid User Id and


Password...!')</script>");

}
protected void Button2_Click(object sender, EventArgs e)
{
con.Open();
string qry = "insert into dbo.IAdminLogin( ad_username, ad_password) values('"
+ txt_userid.Text.Trim() + "','" + txt_pass.Text.Trim() + "')";
SqlCommand cmd = new SqlCommand(qry, con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("Login.aspx");
}
}

Page 57 Submitted by: SONAL


BI for HRP (2018)

b) Dashboard:

 Main.aspx code:
<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"
AutoEventWireup="true" CodeFile="Main.aspx.cs" Inherits="pages_examples_Main" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<img src="images/dashboard_pic.jpg" />

</asp:Content>

 Main.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class pages_examples_Main : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

}
}

Page 58 Submitted by: SONAL


BI for HRP (2018)

c) Division Master:

 Division.aspx code:
<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"
AutoEventWireup="true" CodeFile="Division.aspx.cs" Inherits="pages_examples_Division"
%>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<script type="text/javascript" src="scripts/jquery.blockUI.js"></script>


<script type = "text/javascript">

function BlockUI(elementID) {
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(function () {
$("#" + elementID).block({ message: '<table align = "center"><tr><td>' +
'<img src="images/loadingAnim.gif"/></td></tr></table>',
css: {},
overlayCSS: { backgroundColor: '#000000', opacity: 0.6, border: '3px
solid #63B2EB'
}
});
});
prm.add_endRequest(function () {
$("#" + elementID).unblock();
});
}
$(document).ready(function () {

BlockUI("dvGrid");
$.blockUI.defaults.css = {};
});
</script>
<script>
function upper(ustr) {
var str = ustr.value;
ustr.value = str.toUpperCase();
}

function lower(ustr) {
var str = ustr.value;
ustr.value = str.toLowerCase();
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content-wrapper" style="margin-top:-900px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Division Master
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#"> Division Master </a></li>
<li class="active">Add Division </li>
</ol>
</section>

Page 59 Submitted by: SONAL


BI for HRP (2018)

<!-- Main content -->


<section class="content">

<div class="row">
<div class="col-md-4">

<!-- Profile Image -->


<div class="box box-primary">
<div class="box-body box-profile">
<asp:TextBox ID="TextBox1" runat="server" class="form-control"
placeholder="Enter Division Name" onkeyup="upper(this)"></asp:TextBox>
<br />

<asp:Button ID="Button1" runat="server" Text="Save" class="btn btn-primary btn-block"


onclick="Button1_Click"></asp:Button>

</div>
<!-- /.box-body -->
</div>
<!-- /.box -->

<!-- About Me Box -->

<!-- /.box -->


</div>
<!-- /.col -->
<div class="col-md-8">
<div class="well">
<asp:ScriptManager
ID="ScriptManager2" runat="server">
</asp:ScriptManager>
<div id = "dvGrid" class="alert-dismissible">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" Width = "500px"
AutoGenerateColumns = "false" Font-Names = "Arial"
Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B"
HeaderStyle-BackColor = "#3c8dbc" AllowPaging ="true" HeaderStyle-
ForeColor="White"
OnPageIndexChanging = "OnPaging" onrowediting="EditCustomer"
onrowupdating="UpdateCustomer" onrowcancelingedit="CancelEdit"
PageSize = "10" class="table table-condensed">
<Columns>
<asp:TemplateField ItemStyle-Width = "100px" HeaderText = "S.No"
Visible="false">
<ItemTemplate>
<asp:Label ID="lblsn" runat="server" Text='<%# Eval("div_id")
%>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-Width = "200px" HeaderText = "Division Name" >


<ItemTemplate>
<asp:Label ID="lblname" runat="server" Text='<%# Eval("div_name")
%>'></asp:Label>

Page 60 Submitted by: SONAL


BI for HRP (2018)
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtnamnew" runat="server" Text='<%# Eval("div_name")
%>' onkeyup="upper(this)"></asp:TextBox>
</EditItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-Width = "200px">


<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" CommandArgument = '<%#
Eval("div_id")%>'
OnClientClick = "return confirm('Do you want to delete?')"
Text = "Delete" OnClick = "DeleteCustomer"></asp:LinkButton>
</ItemTemplate>

</asp:TemplateField>

<asp:CommandField ShowEditButton="True" />


</Columns>
<AlternatingRowStyle BackColor="#C2D69B" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID = "GridView1" />
</Triggers>
</asp:UpdatePanel>
</div>

<!-- /.tab-content -->


</div>
<!-- /.nav-tabs-custom -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->

</section>
<!-- /.content -->
</div>
</asp:Content>

 Division.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

Page 61 Submitted by: SONAL


BI for HRP (2018)

public partial class pages_examples_Division : System.Web.UI.Page


{
private String strConnString =
ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

GETDATA();

}
}
private void GETDATA()
{
string query = "select *from IDivisionMaster";
SqlDataAdapter da = new SqlDataAdapter(query,strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
GridView1.DataSource = dt;
GridView1.DataBind();

}
private DataTable GetData(SqlCommand cmd)
{
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection(strConnString);
SqlDataAdapter sda = new SqlDataAdapter();
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open();
sda.SelectCommand = cmd;
sda.Fill(dt);
return dt;
}
protected void OnPaging(object sender, GridViewPageEventArgs e)
{
GETDATA();
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}

protected void DeleteCustomer(object sender, EventArgs e)


{
LinkButton lnkRemove = (LinkButton)sender;
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from IDivisionMaster where " +
"div_id=@id;" +

Page 62 Submitted by: SONAL


BI for HRP (2018)
"select * from IDivisionMaster";
cmd.Parameters.Add("@id", SqlDbType.VarChar).Value =
lnkRemove.CommandArgument;
GridView1.DataSource = GetData(cmd);
GridView1.DataBind();
}
protected void EditCustomer(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
GETDATA();
}
protected void CancelEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
GETDATA();
}
protected void UpdateCustomer(object sender, GridViewUpdateEventArgs e)
{
string ID = ((Label)GridView1.Rows[e.RowIndex].FindControl("lblsn")).Text;
string txtDate =
((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtnamnew")).Text;

SqlConnection con = new SqlConnection(strConnString);


SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;

cmd.CommandText = "update IDivisionMaster set div_name=@div_name " +


"where div_id='" + ID + "';" +
"select * from IDivisionMaster";
cmd.Parameters.Add("@div_name", SqlDbType.VarChar).Value = txtDate;

GridView1.EditIndex = -1;
GridView1.DataSource = GetData(cmd);
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{

SqlConnection con = new SqlConnection(strConnString);


SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into dbo.IDivisionMaster(div_name) " +
"values( @div_name);" +
"select * from IDivisionMaster";
cmd.Parameters.Add("@div_name", SqlDbType.VarChar).Value =
TextBox1.Text.Trim();
TextBox1.Text = "";

GridView1.DataSource = GetData(cmd);
GridView1.DataBind();

}
}

Page 63 Submitted by: SONAL


BI for HRP (2018)

Page 64 Submitted by: SONAL


BI for HRP (2018)

d) Department Master:

 Adddepartment.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="Adddepartment.aspx.cs"
Inherits="pages_examples_Adddepartment" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content-wrapper" style="margin-top:-900px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Department Master
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#"> Department Master </a></li>
<li class="active">Add Department </li>
</ol>
</section>
<script>
function upper(ustr) {
var str = ustr.value;
ustr.value = str.toUpperCase();
}

function lower(ustr) {
var str = ustr.value;
ustr.value = str.toLowerCase();
}
</script>
<!-- Main content -->
<section class="content">

<div class="row">
<div class="col-md-4">

<!-- Profile Image -->


<div class="box box-primary">
<div class="box-body box-profile">
<asp:DropDownList ID="DropDownList1" runat="server" class="form-
control"></asp:DropDownList>

<br />
<asp:TextBox ID="TextBox1" runat="server" class="form-control"
placeholder="Enter Department Name" onkeyup="upper(this)"></asp:TextBox>
<br />

<asp:Button ID="Button1" runat="server" Text="Save" class="btn btn-primary btn-block"


onclick="Button1_Click"></asp:Button>

Page 65 Submitted by: SONAL


BI for HRP (2018)

</div>
<!-- /.box-body -->
</div>
<!-- /.box -->

<!-- About Me Box -->

<!-- /.box -->


</div>
<!-- /.col -->
<div class="col-md-8">
<div class="well">
<asp:ScriptManager
ID="ScriptManager2" runat="server">
</asp:ScriptManager>
<div id = "dvGrid" class="alert-dismissible">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" Width = "500px"
AutoGenerateColumns = "false" Font-Names = "Arial"
Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B"
HeaderStyle-BackColor = "#3c8dbc" AllowPaging ="true" HeaderStyle-
ForeColor="White"
OnPageIndexChanging = "OnPaging" onrowediting="EditCustomer"
onrowupdating="UpdateCustomer" onrowcancelingedit="CancelEdit"
PageSize = "10" class="table table-condensed">
<Columns>
<asp:TemplateField ItemStyle-Width = "100px" HeaderText = "S.No"
Visible="false">
<ItemTemplate>
<asp:Label ID="lblsn" runat="server" Text='<%# Eval("dept_id")
%>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-Width = "200px" HeaderText = "Department Name" >


<ItemTemplate>
<asp:Label ID="lblname" runat="server" Text='<%# Eval("dept_name")
%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtnamnew" runat="server" Text='<%# Eval("dept_name")
%>' onkeyup="upper(this)"></asp:TextBox>
</EditItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-Width = "200px">


<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" CommandArgument = '<%#
Eval("dept_id")%>'
OnClientClick = "return confirm('Do you want to delete?')"
Text = "Delete" OnClick = "DeleteCustomer"></asp:LinkButton>
</ItemTemplate>

Page 66 Submitted by: SONAL


BI for HRP (2018)

</asp:TemplateField>

<asp:CommandField ShowEditButton="True" />


</Columns>
<AlternatingRowStyle BackColor="#C2D69B" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID = "GridView1" />
</Triggers>
</asp:UpdatePanel>
</div>

<!-- /.tab-content -->


</div>
<!-- /.nav-tabs-custom -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->

</section>
<!-- /.content -->
</div>
</asp:Content>

 Adddepartment.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class pages_examples_Adddepartment : System.Web.UI.Page
{
private String strConnString =
ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

GETDATA();
department();

}
}
private void department()
{

Page 67 Submitted by: SONAL


BI for HRP (2018)

string qry = "select div_id, div_name from dbo.IDivisionMaster";


SqlDataAdapter da = new SqlDataAdapter(qry, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

DropDownList1.DataSource = dt;
DropDownList1.DataTextField = "div_name";
DropDownList1.DataValueField = "div_id";
DropDownList1.DataBind();
DropDownList1.Items.Insert(0,"--Select-Division--");

}
private void GETDATA()
{
string query = "select *from dbo.IDepartmentMaster";
SqlDataAdapter da = new SqlDataAdapter(query, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
GridView1.DataSource = dt;
GridView1.DataBind();

}
private DataTable GetData(SqlCommand cmd)
{
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection(strConnString);
SqlDataAdapter sda = new SqlDataAdapter();
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open();
sda.SelectCommand = cmd;
sda.Fill(dt);
return dt;
}
protected void OnPaging(object sender, GridViewPageEventArgs e)
{
GETDATA();
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}

protected void DeleteCustomer(object sender, EventArgs e)


{
LinkButton lnkRemove = (LinkButton)sender;

Page 68 Submitted by: SONAL


BI for HRP (2018)
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from dbo.IDepartmentMaster where " +
"dept_id=@id;" +
"select * from IDepartmentMaster";
cmd.Parameters.Add("@id", SqlDbType.VarChar).Value =
lnkRemove.CommandArgument;
GridView1.DataSource = GetData(cmd);
GridView1.DataBind();
}
protected void EditCustomer(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
GETDATA();
}
protected void CancelEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
GETDATA();
}
protected void UpdateCustomer(object sender, GridViewUpdateEventArgs e)
{
string ID = ((Label)GridView1.Rows[e.RowIndex].FindControl("lblsn")).Text;
string txtDate =
((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtnamnew")).Text;

SqlConnection con = new SqlConnection(strConnString);


SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;

cmd.CommandText = "update dbo.IDepartmentMaster set dept_name=@dept_name " +


"where dept_id='" + ID + "';" +
"select * from IDepartmentMaster";
cmd.Parameters.Add("@dept_name", SqlDbType.VarChar).Value = txtDate;

GridView1.EditIndex = -1;
GridView1.DataSource = GetData(cmd);
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{

SqlConnection con = new SqlConnection(strConnString);


SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into IDepartmentMaster(dept_name, div_id) " +
"values(@dept_name, @div_id);" +
"select * from IDepartmentMaster";
cmd.Parameters.Add("@dept_name", SqlDbType.VarChar).Value =
TextBox1.Text.Trim();
cmd.Parameters.Add("@div_id", SqlDbType.VarChar).Value =
DropDownList1.SelectedValue.ToString();
TextBox1.Text = "";

GridView1.DataSource = GetData(cmd);
GridView1.DataBind();

Page 69 Submitted by: SONAL


BI for HRP (2018)
}

Page 70 Submitted by: SONAL


BI for HRP (2018)

e) Designation Master:

 Designationmaster.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="Desginationmaster.aspx.cs"
Inherits="pages_examples_Desginationmaster" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content-wrapper" style="margin-top:-900px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Designation Master
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#"> Designation Master </a></li>
<li class="active">Add Designation </li>
</ol>
</section>

<!-- Main content -->


<section class="content">

<div class="row">
<div class="col-md-4">

<!-- Profile Image -->


<div class="box box-primary">
<div class="box-body box-profile">
<asp:TextBox ID="TextBox1" runat="server" class="form-control"
placeholder="Enter Designation Name" onkeyup="upper(this)"></asp:TextBox>
<br />

<asp:Button ID="Button1" runat="server" Text="Save" class="btn btn-primary btn-block"


onclick="Button1_Click"></asp:Button>

</div>
<!-- /.box-body -->
</div>
<!-- /.box -->

<!-- About Me Box -->

<!-- /.box -->


</div>
<!-- /.col -->
<div class="col-md-8">
<div class="well">

Page 71 Submitted by: SONAL


BI for HRP (2018)
<asp:ScriptManager
ID="ScriptManager2" runat="server">
</asp:ScriptManager>
<div id = "dvGrid" class="alert-dismissible">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" Width = "500px"
AutoGenerateColumns = "false" Font-Names = "Arial"
Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B"
HeaderStyle-BackColor = "#3c8dbc" AllowPaging ="true" HeaderStyle-
ForeColor="White"
OnPageIndexChanging = "OnPaging" onrowediting="EditCustomer"
onrowupdating="UpdateCustomer" onrowcancelingedit="CancelEdit"
PageSize = "10" class="table table-condensed">
<Columns>
<asp:TemplateField ItemStyle-Width = "100px" HeaderText = "S.No"
Visible="false">
<ItemTemplate>
<asp:Label ID="lblsn" runat="server" Text='<%# Eval("desig_id")
%>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-Width = "200px" HeaderText = "Designation Name"


>
<ItemTemplate>
<asp:Label ID="lblname" runat="server" Text='<%# Eval("desig_name")
%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtnamnew" runat="server" Text='<%#
Eval("desig_name")%>' onkeyup="upper(this)"></asp:TextBox>
</EditItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-Width = "200px">


<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" CommandArgument = '<%#
Eval("desig_id")%>'
OnClientClick = "return confirm('Do you want to delete?')"
Text = "Delete" OnClick = "DeleteCustomer"></asp:LinkButton>
</ItemTemplate>

</asp:TemplateField>

<asp:CommandField ShowEditButton="True" />


</Columns>
<AlternatingRowStyle BackColor="#C2D69B" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID = "GridView1" />
</Triggers>
</asp:UpdatePanel>
</div>

Page 72 Submitted by: SONAL


BI for HRP (2018)
<!-- /.tab-content -->
</div>
<!-- /.nav-tabs-custom -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->

</section>
<!-- /.content -->
</div>
</asp:Content>

 Designationmaster.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class pages_examples_Desginationmaster : System.Web.UI.Page


{
private String strConnString =
ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

GETDATA();

}
private void GETDATA()
{
string query = "select *from dbo.IDesignationMaster";
SqlDataAdapter da = new SqlDataAdapter(query,strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
GridView1.DataSource = dt;
GridView1.DataBind();

Page 73 Submitted by: SONAL


BI for HRP (2018)

}
private DataTable GetData(SqlCommand cmd)
{
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection(strConnString);
SqlDataAdapter sda = new SqlDataAdapter();
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open();
sda.SelectCommand = cmd;
sda.Fill(dt);
return dt;
}
protected void OnPaging(object sender, GridViewPageEventArgs e)
{
GETDATA();
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}

protected void DeleteCustomer(object sender, EventArgs e)


{
LinkButton lnkRemove = (LinkButton)sender;
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from dbo.IDesignationMaster where " +
"desig_id=@id;" +
"select * from IDesignationMaster";
cmd.Parameters.Add("@id", SqlDbType.VarChar).Value =
lnkRemove.CommandArgument;
GridView1.DataSource = GetData(cmd);
GridView1.DataBind();
}
protected void EditCustomer(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
GETDATA();
}
protected void CancelEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
GETDATA();
}
protected void UpdateCustomer(object sender, GridViewUpdateEventArgs e)
{
string ID = ((Label)GridView1.Rows[e.RowIndex].FindControl("lblsn")).Text;
string txtDate =
((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtnamnew")).Text;

SqlConnection con = new SqlConnection(strConnString);


SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;

cmd.CommandText = "update IDesignationMaster set desig_name=@desig_name " +


"where desig_id='" + ID + "';" +

Page 74 Submitted by: SONAL


BI for HRP (2018)
"select * from IDesignationMaster";
cmd.Parameters.Add("@desig_name", SqlDbType.VarChar).Value = txtDate;

GridView1.EditIndex = -1;
GridView1.DataSource = GetData(cmd);
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{

SqlConnection con = new SqlConnection(strConnString);


SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into dbo.IDesignationMaster(desig_name) " +
"values( @div_name);" +
"select * from IDesignationMaster";
cmd.Parameters.Add("@div_name", SqlDbType.VarChar).Value =
TextBox1.Text.Trim();
TextBox1.Text = "";

GridView1.DataSource = GetData(cmd);
GridView1.DataBind();

}
}

Page 75 Submitted by: SONAL


BI for HRP (2018)

f) Leave:

 Addleave.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="Addleave.aspx.cs" Inherits="pages_examples_Addleave"
%>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content-wrapper" style="margin-top:-900px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Leave Master
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#"> Leave Master </a></li>
<li class="active">Add Leave </li>
</ol>
</section>

<!-- Main content -->


<section class="content">

<div class="row">
<div class="col-md-4">

<!-- Profile Image -->


<div class="box box-primary">
<div class="box-body box-profile">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="Casual Leave ">Casual Leave </asp:ListItem>
<asp:ListItem Value="Sick Leave "> Sick Leave </asp:ListItem>

</asp:DropDownList>
<br />
<asp:TextBox ID="TextBox2" runat="server" class="form-control"
placeholder="Enter Total Day" onkeyup="upper(this)"></asp:TextBox>
<br />

<asp:Button ID="Button1" runat="server" Text="Save" class="btn btn-primary btn-block"


onclick="Button1_Click"></asp:Button>

</div>
<!-- /.box-body -->
</div>
<!-- /.box -->

<!-- About Me Box -->

Page 76 Submitted by: SONAL


BI for HRP (2018)

<!-- /.box -->


</div>
<!-- /.col -->
<div class="col-md-8">
<div class="well">
<asp:ScriptManager
ID="ScriptManager2" runat="server">
</asp:ScriptManager>
<div id = "dvGrid" class="alert-dismissible">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" Width = "500px"
AutoGenerateColumns = "false" Font-Names = "Arial"
Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B"
HeaderStyle-BackColor = "#3c8dbc" AllowPaging ="true" HeaderStyle-
ForeColor="White"
OnPageIndexChanging = "OnPaging" onrowediting="EditCustomer"
onrowupdating="UpdateCustomer" onrowcancelingedit="CancelEdit"
PageSize = "10" class="table table-condensed">
<Columns>
<asp:TemplateField ItemStyle-Width = "100px" HeaderText = "S.No"
Visible="false">
<ItemTemplate>
<asp:Label ID="lblsn" runat="server" Text='<%# Eval("lev_id")
%>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-Width = "200px" HeaderText = "Leave Name" >


<ItemTemplate>
<asp:Label ID="lblname" runat="server" Text='<%# Eval("lev_type")
%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtnamnew" runat="server" Text='<%# Eval("lev_type")
%>' onkeyup="upper(this)"></asp:TextBox>
</EditItemTemplate>

</asp:TemplateField>
<asp:TemplateField ItemStyle-Width = "200px" HeaderText = "No of Days" >
<ItemTemplate>
<asp:Label ID="lblday" runat="server" Text='<%# Eval("lev_day")
%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtday" runat="server" Text='<%# Eval("lev_day")%>'
onkeyup="upper(this)"></asp:TextBox>
</EditItemTemplate>

</asp:TemplateField>

<asp:TemplateField ItemStyle-Width = "200px">


<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" CommandArgument = '<%#
Eval("lev_id")%>'
OnClientClick = "return confirm('Do you want to delete?')"
Text = "Delete" OnClick = "DeleteCustomer"></asp:LinkButton>

Page 77 Submitted by: SONAL


BI for HRP (2018)
</ItemTemplate>

</asp:TemplateField>

<asp:CommandField ShowEditButton="True" />


</Columns>
<AlternatingRowStyle BackColor="#C2D69B" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID = "GridView1" />
</Triggers>
</asp:UpdatePanel>
</div>

<!-- /.tab-content -->


</div>
<!-- /.nav-tabs-custom -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->

</section>
<!-- /.content -->
</div>
</asp:Content>

 Addleave.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class pages_examples_Addleave : System.Web.UI.Page


{
private String strConnString =
ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

GETDATA();

}
private void GETDATA()

Page 78 Submitted by: SONAL


BI for HRP (2018)
{
string query = "select *from dbo.ILeaveMaster";
SqlDataAdapter da = new SqlDataAdapter(query, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
GridView1.DataSource = dt;
GridView1.DataBind();

}
private DataTable GetData(SqlCommand cmd)
{
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection(strConnString);
SqlDataAdapter sda = new SqlDataAdapter();
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open();
sda.SelectCommand = cmd;
sda.Fill(dt);
return dt;
}
protected void OnPaging(object sender, GridViewPageEventArgs e)
{
GETDATA();
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}

protected void DeleteCustomer(object sender, EventArgs e)


{
LinkButton lnkRemove = (LinkButton)sender;
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from dbo.ILeaveMaster where " +
"lev_id=@id;" +
"select * from IDesignationMaster";
cmd.Parameters.Add("@id", SqlDbType.VarChar).Value =
lnkRemove.CommandArgument;
GridView1.DataSource = GetData(cmd);
GridView1.DataBind();
}
protected void EditCustomer(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
GETDATA();
}
protected void CancelEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
GETDATA();
}

Page 79 Submitted by: SONAL


BI for HRP (2018)
protected void UpdateCustomer(object sender, GridViewUpdateEventArgs e)
{
string ID = ((Label)GridView1.Rows[e.RowIndex].FindControl("lblsn")).Text;
string txtDate =
((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtnamnew")).Text;
string txtdays =
((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtday")).Text;

SqlConnection con = new SqlConnection(strConnString);


SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;

cmd.CommandText = "update ILeaveMaster set lev_type=@lev_type,lev_day=@lev_day


" +
"where lev_id='" + ID + "';" +
"select * from ILeaveMaster";
cmd.Parameters.Add("@lev_type", SqlDbType.VarChar).Value = txtDate;
cmd.Parameters.Add("@lev_day", SqlDbType.VarChar).Value = txtdays;

GridView1.EditIndex = -1;
GridView1.DataSource = GetData(cmd);
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{

SqlConnection con = new SqlConnection(strConnString);


SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into dbo.ILeaveMaster( lev_type, lev_day) " +
"values(@lev_type, @lev_day);" +
"select * from ILeaveMaster";
cmd.Parameters.Add("@lev_type", SqlDbType.VarChar).Value =
DropDownList1.SelectedValue.ToString();
cmd.Parameters.Add("@lev_day", SqlDbType.VarChar).Value =
TextBox2.Text.Trim();

GridView1.DataSource = GetData(cmd);
GridView1.DataBind();

}
}

Page 80 Submitted by: SONAL


BI for HRP (2018)

g) Register New Employee:

 registration.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="registration.aspx.cs"
Inherits="pages_examples_registration" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div class="content-wrapper" style="margin-top:-900px">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Employee Registration Form

</h1>
<asp:Label ID="lblcasul" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="lblsick" runat="server" Text="" Visible="false"></asp:Label>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#">Employee Management</a></li>
<li class="active">Employee Registration Form</li>
</ol>
</section>
<script language=javascript>
function upper(ustr) {
var str = ustr.value;
ustr.value = str.toUpperCase();
}

function lower(ustr) {
var str = ustr.value;
ustr.value = str.toLowerCase();
}
</script>
<script type="text/javascript">
function validate(evt) {
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<script type="text/javascript">
function ValidateAlpha(evt) {
var keyCode = (evt.which) ? evt.which : evt.keyCode
if ((keyCode < 65 || keyCode > 90) && (keyCode < 97 || keyCode > 123)
&& (keyCode != 32))

return false;
return true;

Page 81 Submitted by: SONAL


BI for HRP (2018)
}

function noSpace(obj) {
obj.value = obj.value.replace(/\s/g, "");
}

</script>
<script type="text/javascript">
function GetDynamicTextBox(value) {
return '<input name = "DynamicTextBox" type="text" value = "' + value + '"
/>' +
'<input type="button" value="x" onclick = "RemoveTextBox(this)"
class="btn-danger" />'
}
function AddTextBox() {
var div = document.createElement('DIV');
div.innerHTML = GetDynamicTextBox("");
document.getElementById("TextBoxContainer").appendChild(div);
}

function RemoveTextBox(div) {
document.getElementById("TextBoxContainer").removeChild(div.parentNode);
}

function RecreateDynamicTextboxes() {
var values = eval('<%=Values%>');
if (values != null) {
var html = "";
for (var i = 0; i < values.length; i++) {
html += "<div>" + GetDynamicTextBox(values[i]) + "</div>";
}
document.getElementById("TextBoxContainer").innerHTML = html;
}
}
window.onload = RecreateDynamicTextboxes;
</script>
<!-- Main content -->
<section class="content">
<div class="row">
<!-- left column -->
<div class="col-md-6">
<!-- general form elements -->
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Personal Information</h3>
</div>
<!-- /.box-header -->
<!-- form start -->
<div role="form">
<div class="box-body">
<div class="form-group">
<label for="exampleInputEmail1">Title</label>
<asp:DropDownList ID="DropDownList1title" runat="server" class="form-control">

<asp:ListItem Text="Mr." Value="1"></asp:ListItem>


<asp:ListItem
Text="Mrs." Value="2"></asp:ListItem>
<asp:ListItem
Text="Miss" Value="3"></asp:ListItem>

</asp:DropDownList>

Page 82 Submitted by: SONAL


BI for HRP (2018)

</div>
<div class="form-group">
<label for="exampleInputEmail1">First Name</label>
<asp:TextBox ID="txt_fname" runat="server" class="form-control"
onkeyup="upper(this)"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" id="tstds"
controltovalidate="txt_fname" errormessage="Please enter your First name!"
ForeColor="Red" />
</div>
<div class="form-group">
<label for="exampleInputEmail1">Last Name</label>
<asp:TextBox ID="txt_lastname" runat="server" class="form-control"
onkeyup="upper(this)"></asp:TextBox>
<asp:RequiredFieldValidator runat="server"
id="RequiredFieldValidator1" controltovalidate="txt_lastname" errormessage="Please
enter your Last name!" ForeColor="Red"/>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Gender :</label>
<asp:RadioButtonList ID="RadioButtonList1gender" runat="server">
<asp:ListItem Value="Male">Male</asp:ListItem>
<asp:ListItem Value="Female">Female</asp:ListItem>
</asp:RadioButtonList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7"
runat="server" ControlToValidate="RadioButtonList1gender"
ErrorMessage="select Gender!"
ForeColor="Red"></asp:RequiredFieldValidator>
</div>
<div class="form-group">
<label for="exampleInputFile">DOB</label>
<asp:TextBox ID="txt_dob" runat="server" class="form-control"
type="date"></asp:TextBox>
<div class="form-group">
<label for="exampleInputPassword1">Marital Status :</label>
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Value="Single">Single

</asp:ListItem>
<asp:ListItem Value="Married">Married</asp:ListItem>
</asp:RadioButtonList>

</div>

</div>
<div class="form-group">
<label for="exampleInputFile">Nationality</label>
<asp:TextBox ID="txt_natinality" runat="server" class="form-control"
onkeyup="upper(this)"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6"
runat="server" ControlToValidate="txt_natinality"
ErrorMessage="Nationality can't be blank!"
ForeColor="Red"></asp:RequiredFieldValidator>

</div>
<div class="form-group">
<label for="exampleInputFile">Contact Number</label>
<asp:TextBox ID="txt_contact" runat="server" class="form-control"
onkeypress="return validate(event);" MaxLength="10"></asp:TextBox>

Page 83 Submitted by: SONAL


BI for HRP (2018)
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="txt_contact"
ErrorMessage="Contact Number can't be blank!"
ForeColor="Red"></asp:RequiredFieldValidator>

</div>
<div class="form-group">
<label for="exampleInputFile">Email</label>
<asp:TextBox ID="txt_email" runat="server" class="form-control"
></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"
runat="server" ControlToValidate="txt_email"
ErrorMessage="Email can't be blank!"
ForeColor="Red"></asp:RequiredFieldValidator>

</div>
<div class="form-group">
<label for="exampleInputFile">Division</label>
<asp:DropDownList ID="DropDownList2division" runat="server"
class="form-control"

onselectedindexchanged="DropDownList2division_SelectedIndexChanged"
AutoPostBack="true"></asp:DropDownList>

<asp:RequiredFieldValidator ID="RequiredFieldValidator5"
runat="server" ControlToValidate="DropDownList2division"
ErrorMessage="Please Select Division!" InitialValue="-Select
Division-" ForeColor="Red"></asp:RequiredFieldValidator>
</div>
<div class="form-group">
<label for="exampleInputFile">Department</label>
<asp:DropDownList ID="DropDownList4department" runat="server"
class="form-control"></asp:DropDownList>

</div>
<div class="form-group">
<label for="exampleInputFile">Designation</label>
<asp:DropDownList ID="DropDownList3designation" runat="server"
class="form-control"></asp:DropDownList>

</div>

</div>
<!-- /.box-body -->

</div>
</div>
<!-- /.box -->

<!-- Form Element sizes -->


<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Experience</h3>
</div>
<div class="box-body">
<label for="exampleInputFile">Work Experience</label>
<asp:RadioButton ID="RadioButton1workexperinace" runat="server"

Page 84 Submitted by: SONAL


BI for HRP (2018)
oncheckedchanged="RadioButton1workexperinace_CheckedChanged"
AutoPostBack="true"></asp:RadioButton>Fresher
<asp:RadioButton ID="RadioButton2" runat="server"
oncheckedchanged="RadioButton2_CheckedChanged"
AutoPostBack="true">
</asp:RadioButton>Experienced
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<br>
<label for="exampleInputFile">Previous Company's Name</label>
<asp:TextBox ID="txt_company" runat="server" class="form-control input-sm"
onkeyup="upper(this)"></asp:TextBox>
<br>
<label for="exampleInputFile">Profession</label>
<asp:TextBox ID="txt_profesion" runat="server" class="form-control input-sm"
onkeyup="upper(this)"></asp:TextBox>
<label for="exampleInputFile">Experience</label>
<asp:TextBox ID="txt_experiance" runat="server" class="form-control
input-sm" onkeyup="upper(this)" ></asp:TextBox>
<br />

</ContentTemplate>

</asp:UpdatePanel>

</div>

<!-- /.box-body -->


</div>
<!-- /.box -->

<!-- /.box -->

<!-- Input addon -->

<!-- /.box -->

</div>
<!--/.col (left) -->
<!-- right column -->
<div class="col-md-6">
<!-- Horizontal Form -->
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Address Information</h3>
</div>
<!-- /.box-header -->
<!-- form start -->
<div class="form-horizontal">
<div class="box-body">
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Address
Line1</label>

Page 85 Submitted by: SONAL


BI for HRP (2018)

<div class="col-sm-9">
<asp:TextBox ID="txt_lineone" runat="server" class="form-control"
onkeyup="upper(this)"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8"
runat="server" ControlToValidate="txt_lineone"
ErrorMessage="Can't be blank"
ForeColor="Red"></asp:RequiredFieldValidator>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Address
Line2</label>

<div class="col-sm-9">
<asp:TextBox ID="txt_line2" runat="server" class="form-control"
onkeyup="upper(this)"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9"
runat="server" ControlToValidate="txt_line2"
ErrorMessage="Can't be blank"
ForeColor="Red"></asp:RequiredFieldValidator>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Address
Line3</label>

<div class="col-sm-9">
<asp:TextBox ID="txt_line3" runat="server" class="form-control"
onkeyup="upper(this)"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10"
runat="server" ControlToValidate="txt_line3"
ErrorMessage="Can't be blank"
ForeColor="Red"></asp:RequiredFieldValidator>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">City</label>

<div class="col-sm-9">
<asp:TextBox ID="txt_city" runat="server" class="form-control"
onkeyup="upper(this)"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11"
runat="server" ControlToValidate="txt_city"
ErrorMessage="Can't be blank"
ForeColor="Red"></asp:RequiredFieldValidator>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-
label">District</label>

<div class="col-sm-9">
<asp:TextBox ID="txt_district" runat="server" class="form-control"
onkeyup="upper(this)"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12"
runat="server" ControlToValidate="txt_district"
ErrorMessage="Can't be blank"
ForeColor="Red"></asp:RequiredFieldValidator>
</div>
</div>

Page 86 Submitted by: SONAL


BI for HRP (2018)
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-
label">State</label>

<div class="col-sm-9">
<asp:TextBox ID="txt_state" runat="server" class="form-control"
onkeyup="upper(this)"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator13"
runat="server" ControlToValidate="txt_state"
ErrorMessage="Can't be blank"
ForeColor="Red"></asp:RequiredFieldValidator>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label"
>Pincode</label>

<div class="col-sm-9">
<asp:TextBox ID="txt_pin" runat="server" class="form-control"
onkeypress="return validate(event);" MaxLength="6" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator14"
runat="server" ControlToValidate="txt_pin"
ErrorMessage="Can't be blank"
ForeColor="Red"></asp:RequiredFieldValidator>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Address
Proof</label>

<div class="col-sm-9">
<asp:RadioButtonList ID="RadioButtonList2address" runat="server">
<asp:ListItem>Adhaar Card

</asp:ListItem>
<asp:ListItem>Voter ID</asp:ListItem>
<asp:ListItem>Passport</asp:ListItem>

</asp:RadioButtonList>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Upload
Proof</label>

<div class="col-sm-9">
<asp:FileUpload ID="memberimg" runat="server" />
<asp:RequiredFieldValidator runat="server" id="RequiredFieldValidator2"
controltovalidate="memberimg" errormessage="Upload Proof!" ForeColor="Red" />
</div>
</div>

</div>
<!-- /.box-body -->

<!-- /.box-footer -->


</div>
</div>

Page 87 Submitted by: SONAL


BI for HRP (2018)
<!-- /.box -->
<!-- general form elements disabled -->
<div class="box box-warning">
<div class="box-header with-border">
<h3 class="box-title">Qualification Information</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<div role="form">
<!-- text input -->
<div class="form-group">
<label>Qualification</label>
<asp:TextBox ID="txt_qulification" runat="server" class="form-
control" onkeyup="upper(this)"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator15"
runat="server" ControlToValidate="txt_qulification"
ErrorMessage="Can't be blank"
ForeColor="Red"></asp:RequiredFieldValidator>
</div>
<div class="form-group">
<label>Skill</label>
<input id="btnAdd" type="button" value="+" onclick="AddTextBox()"
class="btn btn-primary" onkeyup="upper(this)"/>

<div id="TextBoxContainer">
<!--Textboxes will be added here -->
</div>

<br />

</div>

<!-- input states -->

</div>
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title">Other Info</h3>
</div>
<div class="box-body">

<div class="row">
<div class="col-xs-3">
Date of Joining
</div>
<div class="col-xs-9">
<asp:TextBox ID="txt_dateofjoin" runat="server" class="form-control"
type="date"></asp:TextBox>
</div>

</div>
<asp:Button ID="Button1" runat="server" Text="Register" class="btn btn-
primary"

Page 88 Submitted by: SONAL


BI for HRP (2018)
onclick="Button1_Click"></asp:Button>
</div>
<!-- /.box-body -->
</div>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!--/.col (right) -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
</asp:Content>

 registration.aspx.cs code:
using System;

using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Web.Script.Serialization;

public partial class pages_examples_registration : System.Web.UI.Page


{
private String strConnString =
ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
string newsImage = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

devisiondetails();
designation();
UpdatePanel1.Visible = false;
sickleave();
Casualleave();

}
}

Page 89 Submitted by: SONAL


BI for HRP (2018)

private void designation()


{

string query = "select desig_id, desig_name from dbo.IDesignationMaster";


SqlDataAdapter da = new SqlDataAdapter(query, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

DropDownList3designation.DataSource = dt;
DropDownList3designation.DataTextField = "desig_name";
DropDownList3designation.DataValueField = "desig_id";
DropDownList3designation.DataBind();

private void devisiondetails()


{

string query = "select div_id, div_name from dbo.IDivisionMaster";


SqlDataAdapter da = new SqlDataAdapter(query, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

DropDownList2division.DataSource = dt;
DropDownList2division.DataTextField = "div_name";
DropDownList2division.DataValueField = "div_id";
DropDownList2division.DataBind();
DropDownList2division.Items.Insert(0, "-Select Division-");

}
private void Casualleave()
{

string query = "select lev_type,lev_day from dbo.ILeaveMaster where


lev_type='Casual Leave'";
SqlDataAdapter da = new SqlDataAdapter(query,strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

Page 90 Submitted by: SONAL


BI for HRP (2018)
lblcasul.Text = dt.Rows[0]["lev_day"].ToString();

}
private void sickleave()
{

string query = "select lev_type,lev_day from dbo.ILeaveMaster where


lev_type='Sick Leave'";
SqlDataAdapter da = new SqlDataAdapter(query, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

lblsick.Text = dt.Rows[0]["lev_day"].ToString();

}
public void Uploadimage()
{
string filename = "";

if (memberimg.HasFile)
{

filename = SaveFile(memberimg.PostedFile);
}
else
{

filename = "n/a";
}

if (filename != "n/a")
{
newsImage = filename;
}
}
public string SaveFile(HttpPostedFile file)
{
string fileName = "";

String savePath = Server.MapPath("images/");

fileName = memberimg.FileName;
byte[] fileSize = memberimg.FileBytes;
string fileType = memberimg.PostedFile.ContentType;

string pathToCheck = savePath + fileName;

string tempfileName = "";

Page 91 Submitted by: SONAL


BI for HRP (2018)

try
{
if (System.IO.File.Exists(pathToCheck))
{
int counter = 2;
while (System.IO.File.Exists(pathToCheck))
{

tempfileName = counter.ToString() + fileName;


pathToCheck = savePath + tempfileName;
counter++;
}

fileName = tempfileName;

}
else
{

savePath += fileName;

memberimg.SaveAs(savePath);
}
catch (Exception e)
{
string errmsg = e.Message;
}
return fileName;
}
protected string Values;
protected void Button1_Click(object sender, EventArgs e)
{
string filename = Path.GetFileName(memberimg.PostedFile.FileName);
memberimg.SaveAs(Server.MapPath("images/" + filename));

string[] textboxValues = Request.Form.GetValues("DynamicTextBox");

JavaScriptSerializer serializer = new JavaScriptSerializer();


this.Values = serializer.Serialize(textboxValues);
string message = "";
foreach (string textboxValue in textboxValues)
{
message += textboxValue + ",";
}
SqlConnection con = new SqlConnection(strConnString);

con.Open();
String qry = "insert into IEmpTable( title, f_name, l_name, gender, dob,
marital_status, nationality, contact, email, div_id, dept_id, desig_id, add1, add2,
add3, add_city, add_state, add_district, add_pin, add_proof, qualification,
certification, work_exp, prev_company, position, year_exp, status,to_date,
doj,Casual_Leave,sick_Leave) values('" + DropDownList1title.SelectedItem.ToString() +
"','" + txt_fname.Text.Trim() + "','" + txt_lastname.Text.Trim() + "','" +
RadioButtonList1gender.SelectedValue.ToString() + "','" + txt_dob.Text.Trim() + "','"
+ RadioButtonList1.SelectedValue.ToString() + "','" + txt_natinality.Text.Trim() +
"','" + txt_contact.Text.Trim() + "','" + txt_email.Text.Trim() + "','" +

Page 92 Submitted by: SONAL


BI for HRP (2018)
DropDownList2division.SelectedValue.ToString() + "','" +
DropDownList4department.SelectedValue.ToString() + "','" +
DropDownList3designation.SelectedValue.ToString() + "','" + txt_lineone.Text.Trim() +
"','" + txt_line2.Text.Trim() + "','" + txt_line3.Text.Trim() + "','" +
txt_city.Text.Trim() + "','" + txt_state.Text.Trim() + "','" +
txt_district.Text.Trim() + "','" + txt_pin.Text.Trim() + "','" + "images/" + filename
+ "','" + txt_qulification.Text.Trim() + "','" + message + "','" + workexperinace +
"','" + txt_company.Text.Trim() + "','" + txt_profesion.Text.Trim() + "','" +
txt_experiance.Text.Trim() + "','Active','" + System.DateTime.Now.ToString("dd-MMM-
yyyy") + "','" + txt_dateofjoin.Text.Trim() + "','" + lblcasul.Text + "','" +
lblsick.Text.Trim() + "')";
SqlCommand cmd = new SqlCommand(qry, con);
cmd.ExecuteNonQuery();
con.Close();

ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(),
"alert", "alert('registration sucessfully');", true);

}
protected void DropDownList2division_SelectedIndexChanged(object sender, EventArgs
e)
{
string query = "select dept_id, dept_name, div_id from dbo.IDepartmentMaster
where div_id='"+DropDownList2division.SelectedValue.ToString()+"' ";
SqlDataAdapter da = new SqlDataAdapter(query, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

DropDownList4department.DataSource = dt;
DropDownList4department.DataTextField = "dept_name";
DropDownList4department.DataValueField = "dept_id";
DropDownList4department.DataBind();

}
}
static string workexperinace;
protected void RadioButton1workexperinace_CheckedChanged(object sender, EventArgs
e)
{
if (RadioButton1workexperinace.Checked == true)
{
UpdatePanel1.Visible = false;
RadioButton2.Checked = false;
RadioButton1workexperinace.Checked = true;
workexperinace="Fresher";
}
}

protected void RadioButton2_CheckedChanged(object sender, EventArgs e)


{
if (RadioButton2.Checked == true)
{
RadioButton2.Checked = true;

Page 93 Submitted by: SONAL


BI for HRP (2018)
UpdatePanel1.Visible = true;
RadioButton1workexperinace.Checked = false;
workexperinace = "Experienced";
}
}
}

Page 94 Submitted by: SONAL


BI for HRP (2018)

h) Edit Employee Details:

 editemp.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="Editemp.aspx.cs" Inherits="pages_examples_Editemp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content-wrapper" style="margin-top:-900px;">
<!-- Content Header (Page header) -->
<section class="content-header" >
<h1>
Edit Employee Detail

</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#">Employee Management</a></li>
<li class="active">Edit Employee Detail</li>
</ol>
</section>

<!-- Main content -->


<section class="content">

<!-- Default box -->


<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Edit Employee Detail</h3>

<div class="box-tools pull-right">


<button type="button" class="btn btn-box-tool" data-widget="collapse"
data-toggle="tooltip"
title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-
toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">

Page 95 Submitted by: SONAL


BI for HRP (2018)
<asp:Label
ID="lbl_empid" runat="server" class="col-md-2 control-label" Text="Employee
ID"></asp:Label>
<div class="col-md-10">
<asp:DropDownList
ID="ddl_empid" runat="server" CssClass="form-control"

style="width:200px;border:groove;"

onselectedindexchanged="ddl_empid_SelectedIndexChanged" AutoPostBack="true">

</asp:DropDownList>

<asp:GridView ID="GridView1" runat="server"></asp:GridView>

<asp:Label ID="lblResult" runat="server"/>


<div style="overflow:scroll">
<asp:GridView runat="server" ID="gvImage" AutoGenerateColumns="false"
AllowPaging="True"
OnRowCancelingEdit="gvImage_RowCancelingEdit" DataKeyNames="emp_id"
CellPadding="2" OnPageIndexChanging = "OnPaging"
OnRowEditing="gvImage_RowEditing" OnRowUpdating="gvImage_RowUpdating"
OnRowDeleting="gvImage_RowDeleting" HeaderStyle-BackColor="#9cc7e0" class="table
table-hover" >
<Columns>
<asp:TemplateField HeaderText="Sr.No" HeaderStyle-Width="20px">
<ItemTemplate>
<asp:Label ID="lblImgId" runat="server" Text='<
%#Container.DataItemIndex+1%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="EID" HeaderStyle-Width="20px">
<ItemTemplate>
<asp:Label ID="lbleId" runat="server" Text='<%#
Eval("emp_id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title" >
<ItemTemplate>
<asp:Label ID="lblImageName" runat="server" Text='<%#
Eval("title") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="First Name" >
<ItemTemplate>
<asp:Label ID="lblFirstName" runat="server" Text='<%#
Eval("f_name") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_fname" runat="server" Text='<%#
Eval("f_name") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Last Name" >


<ItemTemplate>

Page 96 Submitted by: SONAL


BI for HRP (2018)
<asp:Label ID="lbllast" runat="server" Text='<%#
Eval("l_name") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_lastname" runat="server" Text='<%#
Eval("l_name") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Gender">
<ItemTemplate>
<asp:Label ID="lblgenderr" runat="server" Text='<%#
Eval("gender") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_gender" runat="server" Text='<%#
Eval("gender") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Marital Status" >
<ItemTemplate>
<asp:Label ID="lblmarital_status" runat="server" Text='<%#
Eval("marital_status") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_marital_status" runat="server"
Text='<%# Eval("marital_status") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Nationality" >
<ItemTemplate>
<asp:Label ID="lblnatonality" runat="server" Text='<%#
Eval("nationality") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_nationality" runat="server" Text='<%#
Eval("nationality") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Contact No" >
<ItemTemplate>
<asp:Label ID="lblcontact" runat="server" Text='<%#
Eval("contact") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_contact" runat="server" Text='<%#
Eval("contact") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Division" >
<ItemTemplate>
<asp:Label ID="lbldiv" runat="server" Text='<%#
Eval("div_name") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="Department" >
<ItemTemplate>
<asp:Label ID="lbldepartment" runat="server" Text='<%#
Eval("dept_name") %>'></asp:Label>
</ItemTemplate>

Page 97 Submitted by: SONAL


BI for HRP (2018)
</asp:TemplateField>

<asp:TemplateField HeaderText="Desigination" >


<ItemTemplate>
<asp:Label ID="lbldesgination" runat="server" Text='<%#
Eval("desig_name") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="Address Line1" >


<ItemTemplate>
<asp:Label ID="lbllineone" runat="server" Text='<%#
Eval("add1") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_one" runat="server" Text='<%#
Eval("add1") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Address Line2" >


<ItemTemplate>
<asp:Label ID="lbltwo" runat="server" Text='<%#
Eval("add2") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_two" runat="server" Text='<%#
Eval("add2") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address Line3" >
<ItemTemplate>
<asp:Label ID="lblthree" runat="server" Text='<%#
Eval("add3") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_three" runat="server" Text='<%#
Eval("add3") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="City" >
<ItemTemplate>
<asp:Label ID="lblcity" runat="server" Text='<%#
Eval("add_city") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_city" runat="server" Text='<%#
Eval("add_city") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="state" >


<ItemTemplate>
<asp:Label ID="lblstate" runat="server" Text='<%#
Eval("add_state") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>

Page 98 Submitted by: SONAL


BI for HRP (2018)
<asp:TextBox ID="txt_satate" runat="server" Text='<%#
Eval("add_state") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="District" >


<ItemTemplate>
<asp:Label ID="lblDistrict" runat="server" Text='<%#
Eval("add_district") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_district" runat="server" Text='<%#
Eval("add_district") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Pin" >


<ItemTemplate>
<asp:Label ID="lblpin" runat="server" Text='<%#
Eval("add_pin") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_pin" runat="server" Text='<%#
Eval("add_pin") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Address Proof" >


<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl='<%#
Eval("add_proof") %>'
Height="80px" Width="100px" />
</ItemTemplate>
<EditItemTemplate>
<asp:Image ID="img_user" runat="server" ImageUrl='<%#
Eval("add_proof") %>'
Height="80px" Width="100px" /><br />
<asp:FileUpload ID="FileUpload1" runat="server" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Qualification" >
<ItemTemplate>
<asp:Label ID="lblqualification" runat="server" Text='<%#
Eval("qualification") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_qualification" runat="server" Text='<
%# Eval("qualification") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="certification" >
<ItemTemplate>
<asp:Label ID="lblcertification" runat="server" Text='<%#
Eval("certification") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_certification" runat="server" Text='<
%# Eval("certification") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="work_exp" >

Page 99 Submitted by: SONAL


BI for HRP (2018)
<ItemTemplate>
<asp:Label ID="lblwork_exp" runat="server" Text='<%#
Eval("work_exp") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_work_exp" runat="server" Text='<%#
Eval("work_exp") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="prev_company" >
<ItemTemplate>
<asp:Label ID="lblprev_company" runat="server" Text='<%#
Eval("prev_company") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_prev_company" runat="server" Text='<
%# Eval("prev_company") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="position" >
<ItemTemplate>
<asp:Label ID="lblposition" runat="server" Text='<%#
Eval("position") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_position" runat="server" Text='<%#
Eval("position") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="year_exp" >
<ItemTemplate>
<asp:Label ID="lblyear_exp" runat="server" Text='<%#
Eval("year_exp") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_year_exp" runat="server" Text='<%#
Eval("year_exp") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="status" >
<ItemTemplate>
<asp:Label ID="lblstatus" runat="server" Text='<%#
Eval("status") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="Active">Active</asp:ListItem>
<asp:ListItem Value="Inactive">Inactive</asp:ListItem>

</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>

<%-- <asp:TemplateField HeaderText="Specify Inactive Type" >


<ItemTemplate>
<asp:Label ID="lblpermanet" runat="server" Text='<%#
Eval("per_reason") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>

<asp:DropDownList ID="DropDownList2" runat="server">

Page 100 Submitted by: SONAL


BI for HRP (2018)
<asp:ListItem Value="Permanent">Permanent</asp:ListItem>
<asp:ListItem Value="Temporary">Temporary</asp:ListItem>

</asp:DropDownList>
</EditItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="Specify Reason for Inactive" >
<ItemTemplate>
<asp:Label ID="lbfrmdate" runat="server" Text='<%#
Eval("temp_reason") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_temp" runat="server" Text='<%#
Eval("temp_reason") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>--%>

<asp:TemplateField HeaderText="Date of Registration" HeaderStyle-


Width="200px">
<ItemTemplate>
<asp:Label ID="lbltodate" runat="server" Text='<%#
Eval("to_date") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_todatenew" runat="server" Text='<%#
Eval("to_date") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DOJ" >
<ItemTemplate>
<asp:Label ID="lbldoj" runat="server" Text='<%#
Eval("doj") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_doj" runat="server" Text='<%#
Eval("doj") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Width="150px">
<ItemTemplate>
<asp:LinkButton ID="LkB1" runat="server"
CommandName="Edit">Edit</asp:LinkButton>
<asp:LinkButton ID="LkB11" runat="server"
CommandName="Delete" Visible="false">Delete</asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="LkB2" runat="server"
CommandName="Update">Update</asp:LinkButton>
<asp:LinkButton ID="LkB3" runat="server"
CommandName="Cancel">Cancel</asp:LinkButton>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

</div>
</div>

Page 101 Submitted by: SONAL


BI for HRP (2018)
<!-- /.box-body -->
<div class="box-footer">

</div>
<!-- /.box-footer-->
</div>
<!-- /.box -->

</section>
<!-- /.content -->
</div>
</asp:Content>

 editemp.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Configuration;

public partial class pages_examples_Editemp : System.Web.UI.Page


{
SqlConnection con;
SqlDataAdapter da;
DataSet ds;
SqlCommand cmd;
string connStr = ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ImageData();
empid();
}
}

private void empid()


{

string query = "select emp_id from dbo.IEmpTable";


SqlDataAdapter da = new SqlDataAdapter(query, connStr);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

ddl_empid.DataSource = dt;

Page 102 Submitted by: SONAL


BI for HRP (2018)

ddl_empid.DataTextField = "emp_id";
ddl_empid.DataValueField = "emp_id";
ddl_empid.DataBind();
ddl_empid.Items.Insert(0, "--Select-EmpID--");

}
protected void ddl_empid_SelectedIndexChanged(object sender, EventArgs e)
{
gvImage.DataSource = null;
string query = "select des.desig_name ,div.div_name ,dm.dept_name, et.emp_id,
et.title, et.f_name, et.l_name, et.gender, et.dob, et.marital_status, nationality,
contact, et.email, et.add1, et.add2, et.add3, et.add_city, et.add_state,
et.add_district, et.add_pin, et.add_proof, et.qualification, et.certification,
et.work_exp, et.prev_company, et.position, et.year_exp, et.status, et.s_inact,
et.per_reason, et.temp_reason, et.from_date, et.to_date, et.doj from IEmpTable as
et inner join dbo.IDepartmentMaster as dm on dm.dept_id=et.dept_id inner join
dbo.IDivisionMaster as div on div.div_id=et.div_id inner join dbo.IDesignationMaster
as des on des.desig_id=et.desig_id where et.emp_id='" +
ddl_empid.SelectedItem.ToString() + "'";
SqlDataAdapter da = new SqlDataAdapter(query, connStr);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

gvImage.DataSource = dt;
gvImage.DataBind();

}
protected void ImageData()
{
con = new SqlConnection(connStr);
con.Open();
da = new SqlDataAdapter("select des.desig_name ,div.div_name ,dm.dept_name,
et.emp_id, et.title, et.f_name, et.l_name, et.gender, et.dob, et.marital_status,
nationality, contact, et.email, et.add1, et.add2, et.add3, et.add_city,
et.add_state, et.add_district, et.add_pin, et.add_proof, et.qualification,
et.certification, et.work_exp, et.prev_company, et.position, et.year_exp,
et.status, et.s_inact, et.per_reason, et.temp_reason, et.from_date, et.to_date,
et.doj from IEmpTable as et inner join dbo.IDepartmentMaster as dm on
dm.dept_id=et.dept_id inner join dbo.IDivisionMaster as div on div.div_id=et.div_id
inner join dbo.IDesignationMaster as des on des.desig_id=et.desig_id", con);
ds = new DataSet();

Page 103 Submitted by: SONAL


BI for HRP (2018)
da.Fill(ds);
gvImage.DataSource = ds;
gvImage.DataBind();
}
// edit event

protected void gvImage_RowEditing(object sender, GridViewEditEventArgs e)


{
gvImage.EditIndex = e.NewEditIndex;
ImageData();

}
// update event
protected void gvImage_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//find image id of edit row
string imageId = gvImage.DataKeys[e.RowIndex].Value.ToString();
// find values for update
TextBox add1 = (TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_one");
TextBox add2 = (TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_two");
TextBox txt_three =
(TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_three");
TextBox txt_city = (TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_city");
TextBox txt_satate =
(TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_satate");
TextBox txt_district =
(TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_district");
TextBox txt_pin = (TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_pin");

TextBox txt_contact =
(TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_contact");
TextBox txt_qualification =
(TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_qualification");
TextBox txt_certification =
(TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_certification");
DropDownList ddlstatus =
(DropDownList)gvImage.Rows[e.RowIndex].FindControl("DropDownList1");
DropDownList reason =
(DropDownList)gvImage.Rows[e.RowIndex].FindControl("DropDownList2");

FileUpload FileUpload1 =
(FileUpload)gvImage.Rows[e.RowIndex].FindControl("FileUpload1");
con = new SqlConnection(connStr);
string path = "Images/";
if (FileUpload1.HasFile)
{
path += FileUpload1.FileName;
//save image in folder
FileUpload1.SaveAs(MapPath(path));
}
else
{
// use previous user image if new image is not changed
Image img = (Image)gvImage.Rows[e.RowIndex].FindControl("img_user");
path = img.ImageUrl;
}
SqlCommand cmd = new SqlCommand("update IEmpTable set add1='" + add1.Text +
"', add2='" + add2.Text + "',add3='" + txt_three.Text + "',add_city='" + txt_city.Text
+ "',add_state='" + txt_satate.Text + "',add_district='" + txt_district.Text.Trim() +
"',add_pin='" + txt_pin.Text + "',qualification='" + txt_qualification.Text +

Page 104 Submitted by: SONAL


BI for HRP (2018)
"',certification='" + txt_certification.Text + "',contact='" + txt_contact.Text +
"',status='" + ddlstatus.SelectedItem.ToString() + "', add_proof='" + path + "' where
emp_id=" + imageId + "", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
gvImage.EditIndex = -1;
ImageData();
}
// cancel edit event
protected void gvImage_RowCancelingEdit(object sender, GridViewCancelEditEventArgs
e)
{
gvImage.EditIndex = -1;
ImageData();
}
//delete event
protected void OnPaging(object sender, GridViewPageEventArgs e)
{
ImageData();
gvImage.PageIndex = e.NewPageIndex;
gvImage.DataBind();
}
protected void gvImage_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
GridViewRow row = (GridViewRow)gvImage.Rows[e.RowIndex];
Label lbldeleteid = (Label)row.FindControl("lblImgId");
Label lblDeleteImageName = (Label)row.FindControl("lblImageName");
con = new SqlConnection(connStr);
con.Open();
SqlCommand cmd = new SqlCommand("delete FROM dbo.IEmpTable where emp_id='" +
Convert.ToInt32(gvImage.DataKeys[e.RowIndex].Value.ToString()) + "'", con);
cmd.ExecuteNonQuery();
con.Close();
ImageDeleteFromFolder(lblDeleteImageName.Text);
ImageData();
}
protected void ImageDeleteFromFolder(string imagename)
{
string file_name = imagename;
string path = Server.MapPath(@"Images/" + imagename);
FileInfo file = new FileInfo(path);
if (file.Exists) //check file exsit or not
{
file.Delete();
lblResult.Text = file_name + " file deleted successfully";
lblResult.ForeColor = System.Drawing.Color.Green;
}
else
{
lblResult.Text = file_name + " This file does not exists ";
lblResult.ForeColor = System.Drawing.Color.Red;
}
}
}

Page 105 Submitted by: SONAL


BI for HRP (2018)

i) Salary Register:

 ASReg.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="ASReg.aspx.cs" Inherits="pages_examples_ASReg" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


<script type="text/javascript">
function validate(evt) {
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<script type="text/javascript">
function ValidateAlpha(evt) {
var keyCode = (evt.which) ? evt.which : evt.keyCode
if ((keyCode < 65 || keyCode > 90) && (keyCode < 97 || keyCode > 123)
&& (keyCode != 32))

return false;
return true;
}

function noSpace(obj) {
obj.value = obj.value.replace(/\s/g, "");
}

</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content-wrapper" style="margin-top:-900px;">

<div class="page-content-wrapper ">


<div class="row" >
<div class="col-sm-12">
<div class="panel panel-primary">
<div class="panel-body">
<h4 class="m-t-0 m-b-30">Salary Registration</h4>

<div class="row" >


<div class="col-sm-12">
<div class="panel panel-primary">
<div class="panel-body">

<div class="form-horizontal" >

<div class="form-group">
<table>

Page 106 Submitted by: SONAL


BI for HRP (2018)
<tr>
<td style="width :450px;">

<div class="form-group">
<asp:Label
ID="lbl_empid" runat="server" class="col-md-2 control-label" Text="Employee
ID"></asp:Label>
<div class="col-md-10">
<asp:DropDownList
ID="ddl_empid" runat="server" CssClass="form-control"

style="width:200px;border:groove;"

onselectedindexchanged="ddl_empid_SelectedIndexChanged" AutoPostBack="true">

</asp:DropDownList>
</div>
</div>

</td>

<td style="width :450px;">

<div class="form-group">
<asp:Label
ID="lbl_empname" runat="server" class="col-md-2 control-label" Text="Employee
Name"></asp:Label>
<div class="col-md-10">
<asp:TextBox
ID="txt_empname" runat="server" ReadOnly="true" class="form-control"
style="width:300px;border:groove;" >
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group"
style="width:600px;">
<asp:Label
ID="lbl_division" runat="server" Text="Division" class="col-md-2 control-
label"></asp:Label>

<div class="col-sm-
10">
<asp:TextBox
ID="txt_division" runat="server" ReadOnly="true" class="form-control"
placeholder="Division non-editable" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
<td>
<div class="form-group"
style="width:600px;">

Page 107 Submitted by: SONAL


BI for HRP (2018)
<asp:Label
ID="lbl_department" runat="server" Text="Department" class="col-md-2 control-
label"></asp:Label>

<div class="col-sm-7">
<asp:TextBox
ID="txt_department" runat="server" ReadOnly="true" class="form-control"
placeholder="Department non-editable" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group"
style="width:600px;">
<asp:Label
ID="lbl_designation" runat="server" Text="Designation" class="col-md-2 control-
label"></asp:Label>

<div class="col-sm-
10">
<asp:TextBox
ID="txt_designation" runat="server" ReadOnly="true" class="form-control"
placeholder="Designation non-editable" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>

<tr>
<td>
<div class="form-group"
style="width:600px;">
<asp:Label
ID="lbl_sal" runat="server" Text="Enter Monthly Salary" class="col-md-2 control-
label"></asp:Label>

<div class="col-sm-
10">
<asp:TextBox
ID="txt_sal" runat="server" required="required"
class="form-
control" placeholder="Monthly salary"

style="width:300px;border:groove;" ontextchanged="txt_sal_TextChanged"
AutoPostBack="true" onkeypress="return validate(event);">
</asp:TextBox>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
</div> <!-- panel-body -->

Page 108 Submitted by: SONAL


BI for HRP (2018)
</div> <!-- panel -->
</div> <!-- col -->
</div> <!-- End row -->

</div> <!-- panel -->


</div> <!-- col -->
</div> <!-- End row -->
<!-- Basic example -->
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-body">
<h4 class="m-t-0 m-b-30">Earning</h4>
<div class="form-horizontal">
<table>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_bp" runat="server"
Text="Basic Pay" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_bp" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_da" runat="server"
Text="Dearness Allowance" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_da" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_hra" runat="server"
Text="House Rent Allowance" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_hra"
runat="server" class="form-control" ReadOnly="true"
style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>

Page 109 Submitted by: SONAL


BI for HRP (2018)
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_ea" runat="server"
Text="Entertainment Allowance" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_ea" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_ca" runat="server"
Text="Conveyance Allowance" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_ca" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_ma" runat="server"
Text="Medical Allowance" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_ma" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_te" runat="server"
Text="Total Earning" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_te" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>

</table>
</div>
</div><!-- panel-body -->
</div> <!-- panel -->
</div> <!-- col-->

Page 110 Submitted by: SONAL


BI for HRP (2018)
<!-- Horizontal form -->
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-body">
<h4 class="m-t-0 m-b-30"> Deduction</h4>
<div class="form-horizontal" >
<table>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_pf" runat="server"
Text="Provident Fund" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_pf" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_ded" runat="server"
Text="Total Deduction" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_ded"
runat="server" class="form-control" ReadOnly="true"
style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
</table>
</div>
</div> <!-- panel-body -->
</div> <!-- panel -->
</div> <!-- col -->
</div>
</div> <!-- End row -->

<!-- Inline Form -->


<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-body">
<h4 class="m-t-0 m-b-30"> Net Pay</h4>
<div class="form-inline" >
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_np" runat="server" Text="Net
Pay" class="col-md-2 control-label"></asp:Label>(in <i class="fa fa-rupee"></i>)
<div class="col-sm-10">
<asp:TextBox ID="txt_np" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
<div class="col-sm-2">

Page 111 Submitted by: SONAL


BI for HRP (2018)

<asp:Button ID="Button1" runat="server"


Text="UPDATE"
onclick="Button1_Click" />

</div>

</div>
</div> <!-- panel-body -->
</div> <!-- panel -->
</div> <!-- col -->
</div> <!-- End row -->
</div>
</div>
</asp:Content>

 ASReg.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class pages_examples_ASReg : System.Web.UI.Page


{
private String strConnString =
ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

empid();

private void empid()


{

string query = "select emp_id from dbo.IEmpTable";


SqlDataAdapter da = new SqlDataAdapter(query, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);

Page 112 Submitted by: SONAL


BI for HRP (2018)
if (dt.Rows.Count > 0)
{

ddl_empid.DataSource = dt;

ddl_empid.DataTextField = "emp_id";
ddl_empid.DataValueField = "emp_id";
ddl_empid.DataBind();
ddl_empid.Items.Insert(0, "--Select-EmpID--");

}
protected void ddl_empid_SelectedIndexChanged(object sender, EventArgs e)
{

string query = "select des.desig_name ,div.div_name ,dm.dept_name,


et.emp_id, et.title, et.f_name, et.l_name, et.gender, et.dob, et.marital_status,
nationality, contact, et.email, et.add1, et.add2, et.add3, et.add_city,
et.add_state, et.add_district, et.add_pin, et.add_proof, et.qualification,
et.certification, et.work_exp, et.prev_company, et.position, et.year_exp,
et.status, et.s_inact, et.per_reason, et.temp_reason, et.from_date, et.to_date,
et.doj from IEmpTable as et inner join dbo.IDepartmentMaster as dm on
dm.dept_id=et.dept_id inner join dbo.IDivisionMaster as div on div.div_id=et.div_id
inner join dbo.IDesignationMaster as des on des.desig_id=et.desig_id where emp_id='" +
ddl_empid.SelectedItem.ToString() + "'";
SqlDataAdapter da = new SqlDataAdapter(query, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

txt_empname.Text = dt.Rows[0]["title"].ToString() + dt.Rows[0]


["f_name"].ToString() + dt.Rows[0]["l_name"].ToString();
txt_division.Text = dt.Rows[0]["div_name"].ToString();
txt_department.Text = dt.Rows[0]["dept_name"].ToString();
txt_designation.Text = dt.Rows[0]["desig_name"].ToString();

}
double salary, totalerning, netpay;
protected void txt_sal_TextChanged(object sender, EventArgs e)
{
salary = double.Parse(txt_sal.Text.Trim());
double bp = salary*0.50;
txt_bp.Text = bp.ToString();
double da = salary * 0.07;
txt_da.Text = da.ToString();
double hr = salary * 0.20;
txt_hra.Text = hr.ToString();
double ea = salary * 0.06;
txt_ea.Text = ea.ToString();

Page 113 Submitted by: SONAL


BI for HRP (2018)
double ca = salary * 0.06;
txt_ca.Text = ca.ToString();
double ma = salary * 0.11;
txt_ma.Text = ma.ToString();
totalerning = bp + da + hr + ea + ca + ma;
txt_te.Text = totalerning.ToString();
double pf = bp * 0.12;
txt_pf.Text = pf.ToString();
txt_ded.Text = pf.ToString();
netpay = totalerning - pf;
txt_np.Text = netpay.ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
string query1 = "select emp_id from dbo.ISalaryRegTable where emp_id='" +
ddl_empid.SelectedItem.ToString() + "'";
SqlDataAdapter da1 = new SqlDataAdapter(query1, strConnString);
DataTable dt1 = new DataTable();
da1.Fill(dt1);
if (dt1.Rows.Count > 0)
{
Response.Write("<script>alert('EmpID Already Registrated')</script>");
}
else
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
String qry = "insert into ISalaryRegTable( emp_id, monthly_salary, bp,
dr_allownc, hra_allownc, en_allownc, convy_allownc, med_allownc, pf, tot_earn,
tot_ded, net_pay, create_date, modified_date, modified_by) values('" +
ddl_empid.SelectedItem.ToString() + "','" + txt_sal.Text.Trim() + "','" +
txt_bp.Text.Trim() + "','" + txt_da.Text + "','" + txt_hra.Text.Trim() + "','" +
txt_ea.Text.Trim() + "','" + txt_ca.Text.Trim() + "','" + txt_ma.Text.Trim() + "','" +
txt_pf.Text.Trim() + "','" + txt_te.Text + "','" + txt_ded.Text + "','" + txt_np.Text
+ "','" + System.DateTime.Now.ToString("dd-MMM-yyyy") + "','" +
System.DateTime.Now.ToString("dd-MMM-yyyy") + "','Admin')";
SqlCommand cmd = new SqlCommand(qry, con);
cmd.ExecuteNonQuery();
con.Close();
string message = "Salary Registration sucessfully...";
string url = "ASReg.aspx";
string script = "window.onload = function(){ alert('";
script += message;
script += "');";
script += "window.location = '";
script += url;
script += "'; }";
ClientScript.RegisterStartupScript(this.GetType(), "Redirect", script,
true);

}
}
}

Page 114 Submitted by: SONAL


BI for HRP (2018)

Page 115 Submitted by: SONAL


BI for HRP (2018)

j) Revise Salary:

 Revisesalary.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="Revisesalary.aspx.cs"
Inherits="pages_examples_Revisesalary" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content-wrapper" style="margin-top:-900px;"

>

<div class="page-content-wrapper ">


<div class="row" >
<div class="col-sm-12">
<div class="panel panel-primary">
<div class="panel-body">
<h4 class="m-t-0 m-b-30">Salary Revise</h4>

<div class="row">
<div class="col-sm-12">
<div class="panel panel-primary">
<div class="panel-body">

<div class="form-horizontal" >

<div class="form-group">
<table>
<tr>
<td style="width :450px;">

<div class="form-group">
<asp:Label
ID="lbl_empid" runat="server" class="col-md-2 control-label" Text="Employee
ID"></asp:Label>
<div class="col-md-10">
<asp:DropDownList
ID="ddl_empid" runat="server" CssClass="form-control"

style="width:200px;border:groove;"

onselectedindexchanged="ddl_empid_SelectedIndexChanged" AutoPostBack="true">

</asp:DropDownList>
</div>
</div>

Page 116 Submitted by: SONAL


BI for HRP (2018)
</td>

<td style="width :450px;">

<div class="form-group">
<asp:Label
ID="lbl_empname" runat="server" class="col-md-2 control-label" Text="Employee
Name"></asp:Label>
<div class="col-md-10">
<asp:TextBox
ID="txt_empname" runat="server" ReadOnly="true" class="form-control"
style="width:300px;border:groove;" >
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group"
style="width:600px;">
<asp:Label
ID="lbl_division" runat="server" Text="Division" class="col-md-2 control-
label"></asp:Label>

<div class="col-sm-
10">
<asp:TextBox
ID="txt_division" runat="server" ReadOnly="true" class="form-control"
placeholder="Division non-editable" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
<td>
<div class="form-group"
style="width:600px;">
<asp:Label
ID="lbl_department" runat="server" Text="Department" class="col-md-2 control-
label"></asp:Label>

<div class="col-sm-7">
<asp:TextBox
ID="txt_department" runat="server" ReadOnly="true" class="form-control"
placeholder="Department non-editable" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group"
style="width:600px;">
<asp:Label
ID="lbl_designation" runat="server" Text="Designation" class="col-md-2 control-
label"></asp:Label>

Page 117 Submitted by: SONAL


BI for HRP (2018)

<div class="col-sm-
10">
<asp:TextBox
ID="txt_designation" runat="server" ReadOnly="true" class="form-control"
placeholder="Designation non-editable" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>

<tr>
<td>
<div class="form-group"
style="width:600px;">
<asp:Label
ID="lbl_sal" runat="server" Text="Enter Monthly Salary" class="col-md-2 control-
label"></asp:Label>

<div class="col-sm-
10">
<asp:TextBox
ID="txt_sal" runat="server" required="required"
class="form-
control" placeholder="Monthly salary"

style="width:300px;border:groove;" ontextchanged="txt_sal_TextChanged"
AutoPostBack="true">
</asp:TextBox>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
</div> <!-- panel-body -->
</div> <!-- panel -->
</div> <!-- col -->
</div> <!-- End row -->

</div> <!-- panel -->


</div> <!-- col -->
</div> <!-- End row -->
<!-- Basic example -->
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-body">
<h4 class="m-t-0 m-b-30">Earning</h4>
<div class="form-horizontal">
<table>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_bp" runat="server"
Text="Basic Pay" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">

Page 118 Submitted by: SONAL


BI for HRP (2018)
<asp:TextBox ID="txt_bp" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_da" runat="server"
Text="Dearness Allowance" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_da" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_hra" runat="server"
Text="House Rent Allowance" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_hra"
runat="server" class="form-control" ReadOnly="true"
style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_ea" runat="server"
Text="Entertainment Allowance" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_ea" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_ca" runat="server"
Text="Conveyance Allowance" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_ca" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

Page 119 Submitted by: SONAL


BI for HRP (2018)
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_ma" runat="server"
Text="Medical Allowance" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_ma" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_te" runat="server"
Text="Total Earning" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_te" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>

</table>
</div>
</div><!-- panel-body -->
</div> <!-- panel -->
</div> <!-- col-->

<!-- Horizontal form -->


<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-body">
<h4 class="m-t-0 m-b-30"> Deduction</h4>
<div class="form-horizontal" >
<table>
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_pf" runat="server"
Text="Provident Fund" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_pf" runat="server"
class="form-control" ReadOnly="true" style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>

Page 120 Submitted by: SONAL


BI for HRP (2018)
<tr>
<td>
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_ded" runat="server"
Text="Total Deduction" class="col-md-2 control-label"></asp:Label>
<div class="col-sm-10">
<asp:TextBox ID="txt_ded"
runat="server" class="form-control" ReadOnly="true"
style="width:300px;border:groove;">
</asp:TextBox>

</div>
</div>
</td>
</tr>
</table>
</div>
</div> <!-- panel-body -->
</div> <!-- panel -->
</div> <!-- col -->
</div>
</div> <!-- End row -->

<!-- Inline Form -->


<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-body">
<h4 class="m-t-0 m-b-30">Net Pay</h4>
<div class="form-inline" >
<div class="form-group" style="width:600px;">
<asp:Label ID="lbl_np" runat="server" Text="Net
Pay" class="col-md-2 control-label"></asp:Label>
<br />
<div class="col-md-6">
(in <i class="fa fa-rupee"></i>)
<asp:TextBox ID="txt_np" runat="server" class="form-control" ReadOnly="true"
style="width:300px;border:groove;">
</asp:TextBox>
<hr />
<asp:Button ID="Button1" runat="server"
Text="UPDATE" onclick="Button1_Click1" />
</div>
<div class="col-md-2">

</div>
<div class="col-md-4">

<div class="badge"> <asp:Label


ID="Label1" runat="server" Text="Modify Date" Font-Bold="true"></asp:Label>
<asp:Label ID="lblmodify"
runat="server" Text=""></asp:Label></div>
</div>

</div>
</div> <!-- panel-body -->
</div> <!-- panel -->

Page 121 Submitted by: SONAL


BI for HRP (2018)
</div> <!-- col -->
</div> <!-- End row -->
</div>
</div>
</asp:Content>

 Revisesalary.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class pages_examples_Revisesalary : System.Web.UI.Page


{
private String strConnString =
ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

empid();

}
}

private void empid()


{

string query = "select emp_id from dbo.IEmpTable";


SqlDataAdapter da = new SqlDataAdapter(query, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

ddl_empid.DataSource = dt;

ddl_empid.DataTextField = "emp_id";
ddl_empid.DataValueField = "emp_id";
ddl_empid.DataBind();

Page 122 Submitted by: SONAL


BI for HRP (2018)
ddl_empid.Items.Insert(0, "--Select-EmpID--");

}
protected void ddl_empid_SelectedIndexChanged(object sender, EventArgs e)
{
string query = "select sa.modified_date ,sa.monthly_salary,
sa.bp,sa.convy_allownc,sa.create_date,sa.dr_allownc,sa.en_allownc,sa.hra_allownc,sa.me
d_allownc,sa.monthly_salary,sa.net_pay,sa.pf,sa.tot_ded,sa.tot_earn,des.desig_name
,div.div_name ,dm.dept_name, et.emp_id, et.title, et.f_name, et.l_name, et.gender,
et.dob, et.marital_status, nationality, contact, et.email, et.add1, et.add2,
et.add3, et.add_city, et.add_state, et.add_district, et.add_pin, et.add_proof,
et.qualification, et.certification, et.work_exp, et.prev_company, et.position,
et.year_exp, et.status, et.s_inact, et.per_reason, et.temp_reason, et.from_date,
et.to_date, et.doj from IEmpTable as et inner join dbo.IDepartmentMaster as dm on
dm.dept_id=et.dept_id inner join dbo.IDivisionMaster as div on div.div_id=et.div_id
inner join dbo.IDesignationMaster as des on des.desig_id=et.desig_id inner join
ISalaryRegTable as sa on sa.emp_id=et.emp_id where et.emp_id='" +
ddl_empid.SelectedItem.ToString() + "'";
SqlDataAdapter da = new SqlDataAdapter(query, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

txt_empname.Text = dt.Rows[0]["title"].ToString() + dt.Rows[0]


["f_name"].ToString() + dt.Rows[0]["l_name"].ToString();
txt_division.Text = dt.Rows[0]["div_name"].ToString();
txt_department.Text = dt.Rows[0]["dept_name"].ToString();
txt_designation.Text = dt.Rows[0]["desig_name"].ToString();
txt_sal.Text = dt.Rows[0]["monthly_salary"].ToString();
txt_hra.Text = dt.Rows[0]["hra_allownc"].ToString();
txt_ea.Text = dt.Rows[0]["en_allownc"].ToString();
txt_ca.Text = dt.Rows[0]["convy_allownc"].ToString();
txt_ma.Text = dt.Rows[0]["med_allownc"].ToString();

txt_te.Text = dt.Rows[0]["tot_earn"].ToString();
txt_pf.Text = dt.Rows[0]["en_allownc"].ToString();
txt_ded.Text = dt.Rows[0]["pf"].ToString();
txt_np.Text = dt.Rows[0]["net_pay"].ToString();
txt_bp.Text = dt.Rows[0]["bp"].ToString();
txt_da.Text = dt.Rows[0]["dr_allownc"].ToString();
lblmodify.Text = dt.Rows[0]["modified_date"].ToString();

}
}
double salary, totalerning, netpay;
protected void txt_sal_TextChanged(object sender, EventArgs e)
{

Page 123 Submitted by: SONAL


BI for HRP (2018)
salary = double.Parse(txt_sal.Text.Trim());
double bp = salary*0.50;
txt_bp.Text = bp.ToString();
double da = salary * 0.07;
txt_da.Text = da.ToString();
double hr = salary * 0.20;
txt_hra.Text = hr.ToString();
double ea = salary * 0.06;
txt_ea.Text = ea.ToString();
double ca = salary * 0.06;
txt_ca.Text = ca.ToString();
double ma = salary * 0.11;
txt_ma.Text = ma.ToString();
totalerning = bp + da + hr + ea + ca + ma;
txt_te.Text = totalerning.ToString();
double pf = bp * 0.12;
txt_pf.Text = pf.ToString();
txt_ded.Text = pf.ToString();
netpay = totalerning - pf;
txt_np.Text = netpay.ToString();
}

protected void Button1_Click1(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
String qry = "update ISalaryRegTable set monthly_salary='" +
txt_sal.Text.Trim() + "', bp='" + txt_bp.Text.Trim() + "', dr_allownc='" + txt_da.Text
+ "', hra_allownc='" + txt_hra.Text.Trim() + "', en_allownc='" + txt_ea.Text.Trim() +
"', convy_allownc='" + txt_ca.Text.Trim() + "', med_allownc='" + txt_ma.Text.Trim() +
"', pf='" + txt_pf.Text.Trim() + "', tot_earn='" + txt_te.Text + "', tot_ded='" +
txt_ded.Text + "', net_pay='" + txt_np.Text + "', modified_date='" +
System.DateTime.Now.ToString("dd-MMM-yyyy") + "' where emp_id='" +
ddl_empid.SelectedItem.ToString() + "'";
SqlCommand cmd = new SqlCommand(qry, con);
cmd.ExecuteNonQuery();
con.Close();

string message = "Salary Modify sucessfully...";


string url = "Revisesalary.aspx";
string script = "window.onload = function(){ alert('";
script += message;
script += "');";
script += "window.location = '";
script += url;
script += "'; }";
ClientScript.RegisterStartupScript(this.GetType(), "Redirect", script, true);
}
}

Page 124 Submitted by: SONAL


BI for HRP (2018)

Page 125 Submitted by: SONAL


BI for HRP (2018)

k) Export to Excel:

 Export-to-Excel.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="Export-to-Excell .aspx.cs"
Inherits="pages_examples_Export_to_Excell_" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<div class="content-wrapper" style="margin-top:-900px" >

<div class="page-content-wrapper ">

<div class="row" >


<div class="col-sm-12">
<div class="panel panel-primary">
<div class="panel-body">
<h2>Export to Excell </h2>

<div class="row" >


<div class="col-sm-
12">
<div class="panel
panel-primary">
<div
class="panel-body">

<div
class="form-horizontal" >

<table>

<tr>

<td >

<div class="form-group">

Page 126 Submitted by: SONAL


BI for HRP (2018)

<asp:Label ID="lbl_year" runat="server" class="col-md-2 control-label" Text="Select


Year : "></asp:Label>

<div class="col-md-10">

<asp:DropDownList ID="ddlYear" runat="server" AutoPostBack="True"


onselectedindexchanged="ddlYear_SelectedIndexChanged" ></asp:DropDownList>

</div>

</div>

</td>

</tr>

<tr>

<td>

<div class="form-group">

<asp:Label ID="lbl_month" runat="server" class="col-md-2 control-label" Text="Select


Month : "></asp:Label>

<div class="col-md-10">

<asp:DropDownList ID="ddlMonth" runat="server" AutoPostBack="True"


onselectedindexchanged="ddlMonth_SelectedIndexChanged">
</asp:DropDownList>

</div>

</div>

</td>

</tr>

<tr>

<td>

<div class="form-group" style="width:600px;">

<asp:Label ID="lbl_day" runat="server" Text="Number of days in the particular month"


class="col-md-2 control-label"></asp:Label>

<div class="col-sm-10">

<asp:DropDownList ID="ddlDay" runat="server">


</asp:DropDownList>

</div>

Page 127 Submitted by: SONAL


BI for HRP (2018)

</div>

</td>

</tr>

<tr>

<td>

<div class="form-group">

<asp:Label ID="lbl_wday" runat="server" Text="Number of Working Days" class="col-md-2


control-label"></asp:Label>

<div class="col-sm-10">

<asp:TextBox ID="txt_wday" runat="server" class="form-control" placeholder="Working


days" style="width:300px;border:groove;">

</asp:TextBox>

</div>

</div>

</td>

</tr>

</table>

</div>

<asp:Button ID="Button1" runat="server" Text="Add" onclick="Button1_Click" />


</div>
</div> <!--
panel-body -->
</div> <!-- panel
-->
</div> <!-- col -->
</div> <!-- End row -->

<div class="row">
<div class="col-md-12 col-sm-12 col-
xs-12">
<div style="overflow:scroll">

<asp:GridView ID="GridView2"
runat="server">
</asp:GridView>

<asp:GridView ID="GridView1" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-


ForeColor="White"
RowStyle-BackColor="#A1DCF2" AlternatingRowStyle-BackColor="White"
AlternatingRowStyle-ForeColor="#000"

Page 128 Submitted by: SONAL


BI for HRP (2018)
runat="server" AutoGenerateColumns="false" AllowPaging="true"
OnPageIndexChanging="OnPageIndexChanging">
<Columns>
<asp:BoundField DataField="emp_id" HeaderText="empid" ItemStyle-Width="150px"
/>
<asp:BoundField DataField="title" HeaderText="Title" ItemStyle-Width="100px"
/>
<asp:BoundField DataField="f_name" HeaderText="Fnane" ItemStyle-Width="100px"
/>
<asp:BoundField DataField="l_name" HeaderText="Lname" ItemStyle-
Width="100px" />
<asp:BoundField DataField="div_name" HeaderText="Division" ItemStyle-
Width="100px" />
<asp:BoundField DataField="dept_name" HeaderText="Department" ItemStyle-
Width="100px" />
<asp:BoundField DataField="desig_name" HeaderText="Desgination"
ItemStyle-Width="100px" />

<asp:BoundField DataField="year" HeaderText="Year" ItemStyle-


Width="100px" />
<asp:BoundField DataField="month" HeaderText="Month" ItemStyle-
Width="100px" />
<asp:BoundField DataField="days" HeaderText="Total_Days" ItemStyle-
Width="100px" />
<asp:BoundField DataField="wdays" HeaderText="Working_Days" ItemStyle-
Width="100px" />

<asp:TemplateField HeaderText="Total_Number_Of_Days_Present" >


<ItemTemplate>
<asp:Label ID="lblpresent" runat="server"
Text=""></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="Casual_Leave_Taken" >
<ItemTemplate>
<asp:Label ID="lblcasultaken" runat="server"
Text=""></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="Available_casual_Leave" >
<ItemTemplate>
<asp:Label ID="casulleaveavl" runat="server" Text='<%#
Eval("Casual_Leave") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="Sick_Leave_Taken" >
<ItemTemplate>
<asp:Label ID="lblsickleave" runat="server"
Text=""></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="Available_Sick_Leave" >
<ItemTemplate>
<asp:Label ID="sickleaveavl" runat="server" Text='<%#
Eval("sick_Leave") %>'></asp:Label>

Page 129 Submitted by: SONAL


BI for HRP (2018)
</ItemTemplate>

</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:Button ID="btnExport" runat="server" Text="Export To Excel" OnClick =
"ExportToExcel" />

<%--<asp:GridView runat="server" ID="gvImage" AutoGenerateColumns="false"


class="table table-hover">
<Columns>
<asp:TemplateField HeaderText="Sr.No" HeaderStyle-Width="20px">
<ItemTemplate>
<asp:Label ID="lblImgId" runat="server" Text='<
%#Container.DataItemIndex+1%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Employee ID" >
<ItemTemplate>
<asp:Label ID="lbleId" runat="server" Text='<%#
Eval("emp_id") %>' Width="120px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title" >
<ItemTemplate>
<asp:Label ID="lblImageName" runat="server" Text='<%#
Eval("title") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_Name" runat="server" Text='<%#
Eval("title") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="First Name" >
<ItemTemplate>
<asp:Label ID="lblFirstName" runat="server" Text='<%#
Eval("f_name") %>' Width="180px"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_fname" runat="server" Text='<%#
Eval("f_name") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Last Name" >


<ItemTemplate>
<asp:Label ID="lbllast" runat="server" Text='<%#
Eval("l_name") %>' Width="180px"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_lastname" runat="server" Text='<%#
Eval("l_name") %>' Width="180px"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

Page 130 Submitted by: SONAL


BI for HRP (2018)

<asp:TemplateField HeaderText="Division" >


<ItemTemplate>
<asp:Label ID="lbldiv" runat="server" Text='<%#
Eval("div_name") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="Department" >
<ItemTemplate>
<asp:Label ID="lbldepartment" runat="server" Text='<%#
Eval("dept_name") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="Desigination" >


<ItemTemplate>
<asp:Label ID="lbldesgination" runat="server" Text='<%#
Eval("desig_name") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="year" >


<ItemTemplate>
<asp:Label ID="lblyr" runat="server" Text='<%#
Eval("year") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="month" >
<ItemTemplate>
<asp:Label ID="month" runat="server" Text='<%#
Eval("month") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="days" >
<ItemTemplate>
<asp:Label ID="lbldays" runat="server" Text='<%#
Eval("days") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="wdays" >
<ItemTemplate>
<asp:Label ID="wdays" runat="server" Text='<%#
Eval("wdays") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="Total Number Of Days Present" >
<ItemTemplate>
<asp:Label ID="totalworking" runat="server"
Text=""></asp:Label>
</ItemTemplate>

</asp:TemplateField>

Page 131 Submitted by: SONAL


BI for HRP (2018)

</Columns>
</asp:GridView>--%>

</div>

</div>
</div>
</div><!-- end col -->
</div>
<!-- end row -->

</div>
<!-- end row -->

</div><!-- container -->

</div> <!-- Page content Wrapper -->


</div>
</div>
</asp:Content>

 Export-to-Excel.aspx.cs code:

using System;

using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Globalization;
using System.Drawing;
using System.IO;

public partial class pages_examples_Export_to_Excell_ : System.Web.UI.Page


{
SqlConnection con;
SqlDataAdapter da;
DataSet ds;
SqlCommand cmd;
string connStr = ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)

Page 132 Submitted by: SONAL


BI for HRP (2018)
{
if (!IsPostBack)
{
empid();

ImageData();
GridView2.Visible = false;
for (int i = 2013; i <= 2020; i++)
{
ddlYear.Items.Add(i.ToString());

}
ddlYear.Items.FindByValue(System.DateTime.Now.Year.ToString()).Selected =
true; //set current year as selected

//Fill Months

for (int month = 1; month <= 12; month++)


{
string monthName = DateTimeFormatInfo.CurrentInfo.GetMonthName(month);
ddlMonth.Items.Add(new ListItem(monthName, month.ToString().PadLeft(2,
'0')));
}
// Set current month as selected
//Fill days
FillDays();
}

//private void leav()


//{

// string query = "select lev_id, lev_type, lev_day from dbo.ILeaveMaster";


// SqlDataAdapter da = new SqlDataAdapter(query, connStr);
// DataTable dt = new DataTable();
// da.Fill(dt);
// if (dt.Rows.Count > 0)
// {

// lstTech.DataSource = dt;

// lstTech.DataTextField = "lev_type";
// lstTech.DataValueField = "lev_day";
// lstTech.DataBind();

// }

//}
public void FillDays()

Page 133 Submitted by: SONAL


BI for HRP (2018)
{
ddlDay.Items.Clear();
//getting numbner of days in selected month & year
int noofdays = DateTime.DaysInMonth(Convert.ToInt32(ddlYear.SelectedValue),
Convert.ToInt32(ddlMonth.SelectedValue));

//Fill days

ddlDay.Items.Add(noofdays.ToString());

//ddlDay.Items.FindByValue(System.DateTime.Now.Day.ToString()).Selected =
true;// Set current date as selected
}
protected void ddlYear_SelectedIndexChanged(object sender, EventArgs e)
{
FillDays();
}
protected void ddlMonth_SelectedIndexChanged(object sender, EventArgs e)
{
FillDays();
}
private void empid()
{

string query = "select emp_id from dbo.IEmpTable where status='Active'";


SqlDataAdapter da = new SqlDataAdapter(query, connStr);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

GridView2.DataSource = dt;

GridView2.DataBind();

}
protected void Button1_Click(object sender, EventArgs e)
{
string qrys = "select month from dbo.tbl_attendance where month='" +
ddlMonth.SelectedItem.ToString() + "'";
SqlDataAdapter da = new SqlDataAdapter(qrys, connStr);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(),
"alert", "alert('Attendence Already Created...');", true);
ImageData();
}
else
{
foreach (GridViewRow row in GridView2.Rows)
{

Page 134 Submitted by: SONAL


BI for HRP (2018)
string someVariableName = row.Cells[0].Text;
SqlConnection con = new SqlConnection(connStr);
con.Open();

String qry = "insert into dbo.tbl_attendance(empid, year, month, days,


wdays) values('" + someVariableName + "','" + ddlYear.SelectedItem.ToString() + "','"
+ ddlMonth.SelectedItem.ToString() + "','" + ddlDay.SelectedItem.ToString() + "','" +
txt_wday.Text.Trim() + "')";
SqlCommand cmd = new SqlCommand(qry, con);
cmd.ExecuteNonQuery();
con.Close();
}

ImageData();

ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(),
"alert", "alert('Added sucessfully');", true);
}
}
protected void ImageData()
{
con = new SqlConnection(connStr);
con.Open();
da = new SqlDataAdapter("select et.Casual_Leave,et.sick_Leave,
tbl_attendance.year,tbl_attendance.month,dbo.tbl_attendance.days,tbl_attendance.wdays,
des.desig_name ,div.div_name ,dm.dept_name, et.emp_id, et.title, et.f_name, et.l_name,
et.gender, et.dob, et.marital_status, nationality, contact, et.email, et.add1,
et.add2, et.add3, et.add_city, et.add_state, et.add_district, et.add_pin,
et.add_proof, et.qualification, et.certification, et.work_exp, et.prev_company,
et.position, et.year_exp, et.status, et.s_inact, et.per_reason, et.temp_reason,
et.from_date, et.to_date, et.doj from IEmpTable as et inner join
dbo.IDepartmentMaster as dm on dm.dept_id=et.dept_id inner join dbo.IDivisionMaster as
div on div.div_id=et.div_id inner join dbo.IDesignationMaster as des on
des.desig_id=et.desig_id LEFT JOIN dbo.tbl_attendance on
dbo.tbl_attendance.empid=et.emp_id ", con);
ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}

protected void OnPageIndexChanging(object sender, GridViewPageEventArgs e)


{
GridView1.PageIndex = e.NewPageIndex;
this.ImageData();
}
protected void ExportToExcel(object sender, EventArgs e)
{
string constr =
ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("select et.emp_id, et.title,
et.f_name, et.l_name,div.div_name ,dm.dept_name,des.desig_name ,
tbl_attendance.year,tbl_attendance.month,dbo.tbl_attendance.days,tbl_attendance.wdays,
dbo.tbl_attendance.Total_Number_Of_Days_Present
,dbo.tbl_attendance.Casual_Leave_Taken,
et.Casual_Leave,tbl_attendance.Sick_Leave_Taken,et.sick_Leave from IEmpTable as et
inner join dbo.IDepartmentMaster as dm on dm.dept_id=et.dept_id inner join
dbo.IDivisionMaster as div on div.div_id=et.div_id inner join dbo.IDesignationMaster

Page 135 Submitted by: SONAL


BI for HRP (2018)
as des on des.desig_id=et.desig_id LEFT JOIN dbo.tbl_attendance on
dbo.tbl_attendance.empid=et.emp_id"))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
sda.Fill(dt);

//Build the CSV file data as a Comma separated string.


string csv = string.Empty;

foreach (DataColumn column in dt.Columns)


{
//Add the Header row for CSV file.
csv += column.ColumnName + ',';
}

//Add new line.


csv += "\r\n";

foreach (DataRow row in dt.Rows)


{
foreach (DataColumn column in dt.Columns)
{
//Add the Data rows.
csv += row[column.ColumnName].ToString().Replace(",",
";") + ',';
}

//Add new line.


csv += "\r\n";
}

//Download the CSV file.


Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition",
"attachment;filename=Emp.CSV");
Response.Charset = "";
Response.ContentType = "application/text";
Response.Output.Write(csv);
Response.Flush();
Response.End();
}
}
}
}
}
public override void VerifyRenderingInServerForm(Control control)
{
/* Verifies that the control is rendered */
}
}

Page 136 Submitted by: SONAL


BI for HRP (2018)

Page 137 Submitted by: SONAL


BI for HRP (2018)

l) Upload Attendance:

 Importexcelto.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="Importexcellto.aspx.cs"
Inherits="pages_examples_Importexcellto" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content-wrapper" style="margin-top:-900px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Upload Excell
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#"> Upload Excell</a></li>
<li class="active"> Upload Excell </li>
</ol>
</section>

<!-- Main content -->


<section class="content">

<div class="row">
<div class="col-md-4">

<!-- Profile Image -->


<div class="box box-primary">
<div class="box-body box-profile">
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" Text="Upload" OnClick = "Upload" runat="server" />

</div>
<!-- /.box-body -->
</div>
<!-- /.box -->

<!-- About Me Box -->

<!-- /.box -->


</div>
<!-- /.col -->

Page 138 Submitted by: SONAL


BI for HRP (2018)
<div class="col-md-8">

<!-- /.nav-tabs-custom -->


</div>
<!-- /.col -->
</div>
<!-- /.row -->

</section>
<!-- /.content -->
</div>
</asp:Content>

 Importexcelto.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Configuration;

public partial class pages_examples_Importexcellto : System.Web.UI.Page


{
protected void Upload(object sender, EventArgs e)
{
try
{

//Upload and save the file


string csvPath = Server.MapPath("Files/") +
Path.GetFileName(FileUpload1.PostedFile.FileName);
FileUpload1.SaveAs(csvPath);

DataTable dt = new DataTable();


dt.Columns.AddRange(new DataColumn[16] { new DataColumn("emp_id",
typeof(string)),
new DataColumn("title", typeof(string)),
new DataColumn("Fnane", typeof(string)),
new DataColumn("Lname", typeof(string)),
new DataColumn("Division", typeof(string)),
new DataColumn("Department", typeof(string)),
new DataColumn("Desgination", typeof(string)),
new DataColumn("Year", typeof(string)),
new DataColumn("Month", typeof(string)),

Page 139 Submitted by: SONAL


BI for HRP (2018)
new DataColumn("Total_Days", typeof(string)),
new DataColumn("Working_Days", typeof(string)),
new DataColumn("Total_Number_Of_Days_Present",
typeof(string)),
new DataColumn("Casual_Leave_Taken", typeof(string)),
new DataColumn("Casual_Leave", typeof(string)),
new DataColumn("Sick_Leave_Taken", typeof(string)),
new DataColumn("sick_Leave",typeof(string)) });

string csvData = File.ReadAllText(csvPath);


foreach (string row in csvData.Split('\n'))
{
if (!string.IsNullOrEmpty(row))
{
dt.Rows.Add();
int i = 0;
foreach (string cell in row.Split(','))
{
dt.Rows[dt.Rows.Count - 1][i] = cell;
i++;
}
}
}

string consString =
ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
using (SqlConnection con = new SqlConnection(consString))
{
using (SqlBulkCopy sqlBulkCopy = new SqlBulkCopy(con))
{
//Set the database table name
sqlBulkCopy.DestinationTableName = "dbo.Attendancupdate_master";
con.Open();
sqlBulkCopy.WriteToServer(dt);
con.Close();
Response.Write("<script>alert('Data Insert
Suseesfully')</script>");
}
}

}
catch (Exception ex)
{

Response.Write("<script>alert('excel file is not a valid


format')</script>");

Page 140 Submitted by: SONAL


BI for HRP (2018)

m) Edit Attendance:

 EditAttendance.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="EditAttendance.aspx.cs"
Inherits="pages_examples_Addloan" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content-wrapper" style="margin-top:-900px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Edit Data
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#"> Payroll Processing </a></li>
<li class="active"> Edit Data </li>
</ol>
</section>

<!-- Main content -->


<section class="content">

<div class="row">
<div class="col-md-4">

<!-- Profile Image -->


<div class="box box-primary">
<div class="box-body box-profile">
<asp:Label ID="Label5" runat="server" Text="Emp ID:-" ></asp:Label>
<asp:Label ID="lblempid" runat="server" Text="" class="badge"></asp:Label>
<asp:Label ID="Label4" runat="server" Text="Total No Of working
Days"></asp:Label>
<asp:TextBox ID="txt_workingdays" runat="server" class="form-control"
ReadOnly="true"></asp:TextBox>

<asp:Label ID="Label1" runat="server" Text="Total_Number_Of_Days_Present"></asp:Label>


<asp:TextBox ID="txtpresent" runat="server" class="form-control"></asp:TextBox>

<asp:Label ID="Label2" runat="server" Text="Casual_Leave_Taken"></asp:Label>


<asp:TextBox ID="txtcasul" runat="server" class="form-control"></asp:TextBox>
<asp:Label ID="Label3" runat="server" Text="Sick_Leave_Taken"></asp:Label>
<asp:TextBox ID="txtsick" runat="server" class="form-control"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="Modify"
onclick="Button1_Click"></asp:Button>
</div>
<!-- /.box-body -->

Page 141 Submitted by: SONAL


BI for HRP (2018)
</div>
<!-- /.box -->

<!-- About Me Box -->

<!-- /.box -->


</div>
<!-- /.col -->
<div class="col-md-8">
<div class="well">

<!-- /.tab-content -->


</div>
<!-- /.nav-tabs-custom -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->

</section>
<!-- /.content -->
</div>
</asp:Content>

 EditAttendance.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class pages_examples_Addloan : System.Web.UI.Page


{
private String strConnString =
ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
static string empid;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

empid = Request.QueryString["Codes"].ToString();
lblempid.Text = empid.ToString();
empattendance();

Page 142 Submitted by: SONAL


BI for HRP (2018)

private void empattendance()


{

string query = "select


Working_Days,Total_Number_Of_Days_Present,Casual_Leave_Taken,Sick_Leave_Taken from
dbo.Attendancupdate_master where empid='" + empid+ "'";
SqlDataAdapter da = new SqlDataAdapter(query, strConnString);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

txt_workingdays.Text = dt.Rows[0]["Working_Days"].ToString();
txtpresent.Text = dt.Rows[0]["Total_Number_Of_Days_Present"].ToString(); ;
txtcasul.Text = dt.Rows[0]["Casual_Leave_Taken"].ToString(); ;
txtsick.Text = dt.Rows[0]["Sick_Leave_Taken"].ToString(); ;

protected void Button1_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
String qry = "update dbo.Attendancupdate_master set
Total_Number_Of_Days_Present='" + txtpresent.Text.Trim() + "', Casual_Leave_Taken='" +
txtcasul.Text.Trim() + "', Sick_Leave_Taken='" + txtsick.Text.Trim() + "' where
empid='" + lblempid.Text + "'";
SqlCommand cmd = new SqlCommand(qry, con);
cmd.ExecuteNonQuery();
con.Close();

string message = " Modify sucessfully...";


string url = "Payrollprocessing.aspx";
string script = "window.onload = function(){ alert('";
script += message;
script += "');";
script += "window.location = '";
script += url;
script += "'; }";
ClientScript.RegisterStartupScript(this.GetType(), "Redirect", script, true);
}
}

Page 143 Submitted by: SONAL


BI for HRP (2018)

Page 144 Submitted by: SONAL


BI for HRP (2018)

n) Payroll processing:

 PayrollProcessing.aspx. code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="Payrollprocessing.aspx.cs"
Inherits="pages_examples_Payrollprocessing" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content-wrapper" style="margin-top:-900px;">
<!-- Content Header (Page header) -->
<section class="content-header" >
<h1>
Payroll Processing Panel

</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#">Payroll Processing</a></li>
<li class="active">Payroll Processing</li>
</ol>
</section>

<!-- Main content -->


<section class="content">

<!-- Default box -->


<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Payroll Processing</h3>

<div class="box-tools pull-right">


<button type="button" class="btn btn-box-tool" data-widget="collapse"
data-toggle="tooltip"
title="Collapse">
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-
toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<asp:Label ID="lblResult" runat="server"/>
<div style="overflow:scroll">
<asp:GridView runat="server" ID="gvImage" AutoGenerateColumns="false"
AllowPaging="True"
OnRowCancelingEdit="gvImage_RowCancelingEdit" DataKeyNames="empid"
CellPadding="2" OnPageIndexChanging = "OnPaging"
OnRowEditing="gvImage_RowEditing" OnRowUpdating="gvImage_RowUpdating"
OnRowDeleting="gvImage_RowDeleting" HeaderStyle-BackColor="Tomato" class="table table-
hover" OnRowDataBound ="OnRowDataBound">
<Columns>
<asp:TemplateField HeaderText="Sr.No" HeaderStyle-Width="20px">
<ItemTemplate>

Page 145 Submitted by: SONAL


BI for HRP (2018)
<asp:Label ID="lblImgId" runat="server" Text='<
%#Container.DataItemIndex+1%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="EID" HeaderStyle-Width="20px">
<ItemTemplate>

<a href="#" onclick='openWindow("<%# Eval("empid")


%>");'><asp:Label ID="lbltitle12" runat="server" Text='<%# Eval("empid")%>'
Width="200"></asp:Label></a>

</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title" >
<ItemTemplate>
<asp:Label ID="lblImageName" runat="server" Text='<%#
Eval("title") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_Name" runat="server" Text='<%#
Eval("title") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="First Name" >
<ItemTemplate>
<asp:Label ID="lblFirstName" runat="server" Text='<%#
Eval("Fnane") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_fname" runat="server" Text='<%#
Eval("Fnane") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Last Name">


<ItemTemplate>
<asp:Label ID="lblgenderr" runat="server" Text='<%#
Eval("Lname") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_gender" runat="server" Text='<%#
Eval("Lname") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Division" >


<ItemTemplate>
<asp:Label ID="lbldiv" runat="server" Text='<%#
Eval("Division") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="Department" >
<ItemTemplate>
<asp:Label ID="lbldepartment" runat="server" Text='<%#
Eval("Department") %>'></asp:Label>
</ItemTemplate>

Page 146 Submitted by: SONAL


BI for HRP (2018)
</asp:TemplateField>

<asp:TemplateField HeaderText="Desigination" >


<ItemTemplate>
<asp:Label ID="lbldesgination" runat="server" Text='<%#
Eval("Desgination") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="Year" >


<ItemTemplate>
<asp:Label ID="lbllineone" runat="server" Text='<%#
Eval("Year") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="Month" >


<ItemTemplate>
<asp:Label ID="lbltwo" runat="server" Text='<%#
Eval("Month") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="Total_Days" >
<ItemTemplate>
<asp:Label ID="lblthree" runat="server" Text='<%#
Eval("Total_Days") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderText="Working_Days" >
<ItemTemplate>
<asp:Label ID="lblworkingdays" runat="server" Text='<%#
Eval("Working_Days") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="Total_Number_Of_Days_Present" >


<ItemTemplate>
<asp:Label ID="lblpresentday" runat="server" Text='<%#
Eval("Total_Number_Of_Days_Present") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_presentday" runat="server" Text='<%#
Eval("Total_Number_Of_Days_Present") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Casual_Leave_Taken" >
<ItemTemplate>
<asp:Label ID="lblcasul" runat="server" Text='<%#
Eval("Casual_Leave_Taken") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_causul" runat="server" Text='<%#
Eval("Casual_Leave_Taken") %>'></asp:TextBox>
</EditItemTemplate>

Page 147 Submitted by: SONAL


BI for HRP (2018)
</asp:TemplateField>

<asp:TemplateField HeaderText="Available_casual_Leave" >


<ItemTemplate>
<asp:Label ID="lblpin" runat="server" Text='<%#
Eval("Available_casual_Leave") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="Sick_Leave_Taken" >


<ItemTemplate>
<asp:Label ID="lblsick" runat="server" Text='<%#
Eval("Sick_Leave_Taken") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_sick" runat="server" Text='<%#
Eval("Sick_Leave_Taken") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Available_Sick_Leave" >
<ItemTemplate>
<asp:Label ID="lblcertification" runat="server" Text='<%#
Eval("Available_Sick_Leave") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField HeaderStyle-Width="150px">
<ItemTemplate>

<a href="#" onclick='openWindows("<%# Eval("empid")


%>");'><asp:Label ID="LkB11" runat="server" Text="Edit"></asp:Label></a>

</ItemTemplate>

</asp:TemplateField>
</Columns>
</asp:GridView>

<script type="text/javascript">
function openWindow(code) {
window.open('payslip.aspx?Code=' + code, 'open_window', '
width=640, height=480, left=0, top=0');
}
</script>
<script type="text/javascript">
function openWindows(code1) {
window.open('EditAttendance.aspx?Codes=' + code1,
'open_window', ' width=640, height=480, left=0, top=0');
}
</script>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">

Page 148 Submitted by: SONAL


BI for HRP (2018)
</div>
<!-- /.box-footer-->
</div>
<!-- /.box -->

</section>
<!-- /.content -->
</div>
</asp:Content>

 PayrollProcessing.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Configuration;
using System.Drawing;

public partial class pages_examples_Payrollprocessing : System.Web.UI.Page


{
SqlConnection con;
SqlDataAdapter da;
DataSet ds;
SqlCommand cmd;
string connStr = ConfigurationManager.ConnectionStrings["hms"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ImageData();
}
}
protected void ImageData()
{
con = new SqlConnection(connStr);
con.Open();
da = new SqlDataAdapter("select *from Attendancupdate_master", con);
ds = new DataSet();
da.Fill(ds);
gvImage.DataSource = ds;
gvImage.DataBind();
}
// for color
protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

Label lblworkingdays = (e.Row.FindControl("lblworkingdays") as Label);


int wday = int.Parse(lblworkingdays.Text);

Page 149 Submitted by: SONAL


BI for HRP (2018)
Label lblpresentday = (e.Row.FindControl("lblpresentday") as Label);
int pday = int.Parse(lblpresentday.Text);
Label casulleave = (e.Row.FindControl("lblcasul") as Label);
int cauleave = int.Parse(casulleave.Text);
Label sickleave = (e.Row.FindControl("lblsick") as Label);
int sick = int.Parse(sickleave.Text);
int totaldaycount = pday + cauleave + sick;
if (wday == totaldaycount)
{

(e.Row.FindControl("lbltitle12") as Label).ForeColor = Color.Green;

(e.Row.FindControl("LkB11") as Label).Visible = false;

}
else
{
(e.Row.FindControl("lbltitle12") as Label).ForeColor = Color.Red;

(e.Row.FindControl("LkB11") as Label).Visible = true;

}
}
// edit event
protected void gvImage_RowEditing(object sender, GridViewEditEventArgs e)
{
gvImage.EditIndex = e.NewEditIndex;
ImageData();

}
protected void OnPaging(object sender, GridViewPageEventArgs e)
{
ImageData();
gvImage.PageIndex = e.NewPageIndex;
gvImage.DataBind();
}
// update event
protected void gvImage_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//find image id of edit row
string imageId = gvImage.DataKeys[e.RowIndex].Value.ToString();
// find values for update
TextBox txt_presentday =
(TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_presentday");
TextBox txt_causul =
(TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_causul");
TextBox txt_sick = (TextBox)gvImage.Rows[e.RowIndex].FindControl("txt_sick");

con = new SqlConnection(connStr);

SqlCommand cmd = new SqlCommand("update dbo.Attendancupdate_master set


Total_Number_Of_Days_Present='" + txt_presentday.Text + "', Casual_Leave_Taken='" +
txt_causul.Text + "', Sick_Leave_Taken='" + txt_sick.Text + "' where empid=" + imageId
+ "", con);
con.Open();
cmd.ExecuteNonQuery();

Page 150 Submitted by: SONAL


BI for HRP (2018)
con.Close();
gvImage.EditIndex = -1;
ImageData();

}
// cancel edit event
protected void gvImage_RowCancelingEdit(object sender, GridViewCancelEditEventArgs
e)
{
gvImage.EditIndex = -1;
ImageData();
}
//delete event
protected void gvImage_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
GridViewRow row = (GridViewRow)gvImage.Rows[e.RowIndex];

con = new SqlConnection(connStr);


con.Open();
SqlCommand cmd = new SqlCommand("delete FROM Attendancupdate_master where
empid='" + Convert.ToInt32(gvImage.DataKeys[e.RowIndex].Value.ToString()) + "'", con);
cmd.ExecuteNonQuery();
con.Close();

ImageData();
}

Page 151 Submitted by: SONAL


BI for HRP (2018)

o) Payslip:

 payslip.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/pages/examples/Admin.master"


AutoEventWireup="true" CodeFile="payslip.aspx.cs" Inherits="pages_payslip" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


<script type="text/javascript" language ="javascript" >

function CallPrint(strid) {
var prtContent = document.getElementById(strid);
var WinPrint = window.open('', '',
'left=0,top=0,width=1050,height=600,toolbar=1,scrollbars=1,status=0,menubar=1');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
document.getElementById('PlaceHolder1').visble = false;
// prtContent.innerHTML=strOldOne;
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content-wrapper" style="margin-top:-900px;">
<!-- Content Header (Page header) -->
<section class="content-header" >
<h1>
Payslip

</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#">Payslip</a></li>
<li class="active">Payslip</li>
</ol>
</section>

<!-- Main content -->


<section class="content">

<!-- Default box -->


<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Payslip</h3>

<div class="box-tools pull-right">


<button type="button" class="btn btn-box-tool" data-widget="collapse"
data-toggle="tooltip"
title="Collapse">

Page 152 Submitted by: SONAL


BI for HRP (2018)
<i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="remove" data-
toggle="tooltip" title="Remove">
<i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<div id="print_Grid">
<table border="1" width="400px" >
<tr>
<td colspan="2" valign="top">

<center> <h2><b>Payslip</b></h2></center>

</td>

</tr>

<tr>
<td>

<asp:Label ID="Employee" runat="server" Text="Employee ID:-" Font-Bold="true"


></asp:Label>

<asp:Label ID="lblid" runat="server" Text=""></asp:Label>


<br />
<asp:Label ID="Label1" runat="server" Text="Name:-" Font-
Bold="true"></asp:Label>

<asp:Label ID="lblname" runat="server" Text=""></asp:Label>


<br />
<asp:Label ID="Label2" runat="server" Text="Division:-" Font-
Bold="true"></asp:Label>

<asp:Label ID="lbldivision" runat="server" Text=""></asp:Label>

</td>
<td>

<asp:Label ID="Label3" runat="server" Text="Department:-" Font-


Bold="true"></asp:Label>

<asp:Label ID="lbldepartment" runat="server" Text=""></asp:Label>


<br />
<asp:Label ID="Label4" runat="server" Text="Desgination:-" Font-
Bold="true"></asp:Label>

<asp:Label ID="lbldesgination" runat="server" Text=""></asp:Label>

</td>

Page 153 Submitted by: SONAL


BI for HRP (2018)
</tr>
<tr>
<td>
<table border="0.5px" width="100%">
<tr>
<td colspan="2"><center><b>Earning</b></center></td>

</tr>
<tr>
<td>Basic Pay</td>
<td><asp:Label ID="lblbasic" runat="server" Text=""></asp:Label></td>
</tr>

<tr>
<td>Dearness Allowance</td>
<td><asp:Label ID="lblda" runat="server" Text=""></asp:Label></td>
</tr>

<tr>
<td>House Rent Allowance</td>
<td><asp:Label ID="lblha" runat="server" Text=""></asp:Label></td>
</tr>
<tr>
<td>Entertainment Allowance</td>
<td><asp:Label ID="lblea" runat="server" Text=""></asp:Label></td>
</tr>
<tr>
<td>Conveyance Allowance</td>
<td><asp:Label ID="lblca" runat="server" Text=""></asp:Label></td>
</tr>
<tr>
<td>Medical Allowance</td>
<td><asp:Label ID="lblma" runat="server" Text=""></asp:Label></td>
</tr>
</table>

</td>
<td valign="top">
<table border="1px" width="100%">
<tr>
<td colspan="2"><center><b>Deduction</b></center></td>

</tr>
<tr>
<td>Provident Fund</td>
<td><asp:Label ID="lblpf" runat="server" Text=""></asp:Label></td>
</tr>

</table>

</td>
</tr>
<tr>
<td colspan="2">

Page 154 Submitted by: SONAL


BI for HRP (2018)
<span style="float:right"> <b>Total Amount:-</b> <asp:Label ID="lbtoatl"
runat="server" Text=""></asp:Label></span>

</td>

</tr>
<tr> <td colspan="2">

<span style="float:right"><b>Payable Amount:-</b> <asp:Label ID="Label6"


runat="server" Text=""></asp:Label></span>

</td></tr>
</table>

</div>

</div>
<!-- /.box-body -->
<div class="box-footer">
<asp:Button class="btn btn-info" runat="server" Text="Print" ID="btnPrint"
OnClientClick="CallPrint('print_Grid')"/>
</div>
<!-- /.box-footer-->
</div>
<!-- /.box -->

</section>
<!-- /.content -->
</div>

</asp:Content>

 Payslip.aspx.cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class pages_payslip : System.Web.UI.Page


{
SqlConnection con = new
SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["hms"].Conne
ctionString);

Page 155 Submitted by: SONAL


BI for HRP (2018)
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

string id = Request.QueryString["Code"].ToString();
data();
}
}
private void data()
{

string qry = "select am.empid, am.Division,am.Department,am.Desgination,


am.Fnane,am.Total_Number_Of_Days_Present,am.empid, monthly_salary, bp, dr_allownc,
hra_allownc, en_allownc, convy_allownc, med_allownc, pf, tot_earn, tot_ded, net_pay
From ISalaryRegTable as st inner join Attendancupdate_master as am on
am.empid=st.emp_id where am.empid=" + Request.QueryString["Code"].ToString();
SqlDataAdapter da = new SqlDataAdapter(qry, con);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

lblid.Text = dt.Rows[0]["empid"].ToString();

lblname.Text = dt.Rows[0]["Fnane"].ToString();
lbldivision.Text = dt.Rows[0]["Desgination"].ToString();
lbldepartment.Text = dt.Rows[0]["Department"].ToString();

lbldesgination.Text = dt.Rows[0]["Desgination"].ToString();

lblbasic.Text = dt.Rows[0]["bp"].ToString();
lblda.Text = dt.Rows[0]["dr_allownc"].ToString();
lblha.Text = dt.Rows[0]["hra_allownc"].ToString();
lblea.Text = dt.Rows[0]["en_allownc"].ToString();
lblca.Text = dt.Rows[0]["convy_allownc"].ToString();
lblma.Text = dt.Rows[0]["med_allownc"].ToString();
lblpf.Text = dt.Rows[0]["pf"].ToString();
lbtoatl.Text = dt.Rows[0]["net_pay"].ToString();
double perday = double.Parse(dt.Rows[0]["net_pay"].ToString())/30;
double totalp = double.Parse(dt.Rows[0]
["Total_Number_Of_Days_Present"].ToString());
double totalpay = totalp*perday;

double value = Math.Round(totalpay);

Label6.Text = value.ToString();

}
}

Page 156 Submitted by: SONAL


BI for HRP (2018)

8. TESTING

Testing is defined as the process of exercising or evaluating a system


or system component by manual automated means to verify it satisfies
specified requirements.
It is said to be the process of making sure that the proposed software performs
the intended task.
System testing is quite expensive and time cosuming process. The common
view for testing held by user is that performed to prove that program is error
free.

All the modules that have been developed before are integrated or put together
in this phase, and tested as a complete system.

 UNIT TESTING: It is normally performed on individual module of the


proposed system which has been developed, the modules being tested.
During the implementation of the system, and each module was tested
separately to uncover the errors, within the boundaries.

 INTEGRATION TESTING: It is performed after unit testing for the


purpose to check the interaction between the different. Once this module
worked successfully it means the entire module will work successfully.

Page 157 Submitted by: SONAL


BI for HRP (2018)

1. Log in without Username and password:

2. Log in with valid Username and invalid password:

3. Log in with invalid Username and valid password:

Page 158 Submitted by: SONAL


BI for HRP (2018)

4. Log in with valid Username and valid password:

5. Log in with invalid Username and invalid password:

6. Register without filling details:

Page 159 Submitted by: SONAL


BI for HRP (2018)

7. Register Employee Salary without entering monthly


salary:

Page 160 Submitted by: SONAL


BI for HRP (2018)

9. IMPLEMENTING BI

Page 161 Submitted by: SONAL


BI for HRP (2018)

9.1. BI for HR PLANNING

With the help of the project BI for HR Planning we allow the organisation
to have a brief analysis about the minimum requirements to supply the
resources to run the project going on within the organisation.

We can analyse:

 Resources available in the organisation.


 How many resources are free who could be allocated to different
projects?
 How many resources are engaged?
 What are the projects the organisation has completed?
 What are the ongoing projects?
 What are the resource requirements according to the project?

In simple words, managing the resources with the projects to drive the
organisation , but this need to go with several other projects as such that
could be providing most of the benefits for the organisation.

We have to revise the trend as and when possible so that the business
group could easily look into the revenue generation.

To work with BI there are some primary BI components: Integration


Services, Analysis Services OLAP, Analysis Services Data Mining, and
Reporting Services. The BI functionality in Microsoft Office will evolve
with the Office product release cycle.

The Business Intelligence toolset delivers end-to-end BI application


integration:

Page 162 Submitted by: SONAL


BI for HRP (2018)

 Design: Business Intelligence Development Studio is the first


integrated development environment designed for the business
intelligence system developer.

 Integrate: Integration Services has been rewritten to perform


complex data integration, transformation, and synthesis at high
speed for very large data volumes. The Business Intelligence
Development Studio makes building and debugging packages
positively fun.

 Store: It blurs the lines between relational and multidimensional


databases. We can store data in the relational database, in the
multidimensional database, or use the new Proactive Cache feature
to get the best of both worlds.

 Analyze: Data Mining has always been easy to use. Now it's even
better with the addition of important new algorithms, including
Association Rules, Time Series, Regression Trees, Sequence
Clustering, Neural Nets, and Naïve Bayes.

 Report: Reporting Services extends the Microsoft Business


Intelligence platform to reach the business user who needs to
consume the analysis.

 Manage:  BI platform components gain enhanced scalability,


reliability, availability, and programmability. These enhancements
provide significant benefits to the business intelligence
practitioner.

Page 163 Submitted by: SONAL


BI for HRP (2018)

9.2. WORKING WITH BI (MS-SQL AND


FLAT FILES)

In order to use Business Intelligence into the HR Planning system we


need to have few databases in Microsoft sql server or flatfiles from
where we can access data.

For this project due to lack of time it is supposed to work with flatfile
data that will be fed into the the Power BI where filterations are done, a
kind of datawarehousing is performed to summerize the entile data as a
whole and the attractive BI Reports are generated.

The flatfiles required for this projects are as follows:

 ProjectInformation: This flatfile will hold information regarding the


projects available for the organization with necessary details such
as Year, Month, Project Name,Project ID, etc.

 ResourceInformation: This flatfile will hold information regarding


theresources available (employees) in the organization with
necessary details such as Year,Month,Employee Status,Employee
ID, etc.

 EmpData: This flatfile will hold information regarding the


employees in the organization with functional respect such as
Employee ID, Employee Name, Designation, Department,
Communication status, Teamwork status etc.

Page 164 Submitted by: SONAL


BI for HRP (2018)

9.3. BI DASHBOARD, REPORTS AND


MODELS

 Dashboard: With the business


intelligence dashboard we can displays
the current status of metrics and
performance indicators for the
organisation to analyze the availability
of resources and their requirement and
success rate of the organisation. Dashboards consolidate and
arrange numbers, metrics and sometimes performance
scorecards on a single screen. They may be tailored for a specific
role and display metrics targeted for a single point of view or
department.

 Report: Reporting means collecting


and presenting data so that it can be
analyzed.

With the reporting feature of Power BI


we can collect data from various data
sources and present it to end-users in a way that is understandable
and ready to be analyzed. In the second sense, allowing end-users
to both see and understand the data, as well as act on it.

 Model: With the modelling capabilities


in Power BI, we can connect to multiple data
sources, and then combine them in ways
that create a unique model of data that suits
our needs.

Page 165 Submitted by: SONAL


BI for HRP (2018)

9.4. WORKING WITH POWER BI


DESKTOP

Page 166 Submitted by: SONAL


BI for HRP (2018)

Page 167 Submitted by: SONAL


BI for HRP (2018)

Page 168 Submitted by: SONAL


BI for HRP (2018)

Page 169 Submitted by: SONAL


BI for HRP (2018)

Page 170 Submitted by: SONAL


BI for HRP (2018)

Page 171 Submitted by: SONAL


BI for HRP (2018)

Page 172 Submitted by: SONAL


BI for HRP (2018)

Page 173 Submitted by: SONAL


BI for HRP (2018)

Page 174 Submitted by: SONAL


BI for HRP (2018)

Page 175 Submitted by: SONAL


BI for HRP (2018)

Page 176 Submitted by: SONAL


BI for HRP (2018)

Page 177 Submitted by: SONAL


BI for HRP (2018)

Page 178 Submitted by: SONAL


BI for HRP (2018)

Page 179 Submitted by: SONAL


BI for HRP (2018)

Page 180 Submitted by: SONAL


BI for HRP (2018)

Page 181 Submitted by: SONAL


BI for HRP (2018)

Page 182 Submitted by: SONAL


BI for HRP (2018)

Page 183 Submitted by: SONAL


BI for HRP (2018)

Page 184 Submitted by: SONAL


BI for HRP (2018)

Page 185 Submitted by: SONAL


BI for HRP (2018)

Page 186 Submitted by: SONAL


BI for HRP (2018)

Page 187 Submitted by: SONAL


BI for HRP (2018)

Page 188 Submitted by: SONAL


BI for HRP (2018)

Page 189 Submitted by: SONAL


BI for HRP (2018)

Page 190 Submitted by: SONAL


BI for HRP (2018)

Page 191 Submitted by: SONAL


BI for HRP (2018)

Page 192 Submitted by: SONAL


BI for HRP (2018)

Page 193 Submitted by: SONAL


BI for HRP (2018)

Page 194 Submitted by: SONAL


BI for HRP (2018)

Page 195 Submitted by: SONAL


BI for HRP (2018)

Page 196 Submitted by: SONAL


BI for HRP (2018)

Page 197 Submitted by: SONAL


BI for HRP (2018)

Page 198 Submitted by: SONAL


BI for HRP (2018)

Page 199 Submitted by: SONAL


BI for HRP (2018)

Page 200 Submitted by: SONAL


BI for HRP (2018)

Page 201 Submitted by: SONAL


BI for HRP (2018)

Page 202 Submitted by: SONAL


BI for HRP (2018)

Page 203 Submitted by: SONAL


BI for HRP (2018)

Page 204 Submitted by: SONAL


BI for HRP (2018)

10. REPORTS

 Report for Analyzing Employee Details:

Page 205 Submitted by: SONAL


BI for HRP (2018)

a) Analyza the details of the emlpoyess who are Fresher:

b) Analyza the fresher employee’s detail for checking their their


availability:

Page 206 Submitted by: SONAL


BI for HRP (2018)

 Report for Analyzing Project Details:

Page 207 Submitted by: SONAL


BI for HRP (2018)

a) Analyza the details of the Projects:

b) Analyza the details of the Projects for checking their


complete status:

Page 208 Submitted by: SONAL


BI for HRP (2018)

 Report for Analyzing Employee Performance:

 Report for Analyzing Employee’s Availability:

Page 209 Submitted by: SONAL


BI for HRP (2018)

11. SYSTEM MAINTENANCE

System maintenance is a very broad activity that includes error


correction, enhancements of capabilities, deletion of obsolete
capabilities, and optimization.

Because change is inevitable, mechanisms must be developed for


evaluation, controlling and making modifications.

This phase includes various activities, these are given below:--


 Providing new functional capabilities.
 Improving user displays and mode of interaction, upgrading
external documents and internal documentation or upgrading
the performance characteristics of a system.
 Adaptation of software to new environments may involve
moving the software to a different machine, or for instance,
modifying the software to accommodate a new environments.
 The fourth maintainance activity occurs when software is
changed to improve future maintainability or reliability, or to
provide a better basis for future enhancements. Often called
preventive maintainance, these activities is characterized by
reverse engineering and re-engineering techniques.

Maintainability, like all high-level quality attributes, can be expressed in


terms of attributes that are built into the product. The primary product
attributes that contributes to software maintainability are clarity,
modularity, and good internal documentation of the source, as well as
appropriate supporting documents.

Page 210 Submitted by: SONAL


BI for HRP (2018)

12. FUTURE SCOPE


With the available infrastructure resources, this application presently
functions at an intranet scale access to users. With more of additional
support towards IT infrastructure, this solutioncould be extended to
cloud computing, that will offer higher level, access, services, for users in
an organization.

This project will be complimented with few more ongoing projects that
will be centralized at the cloud and colud be used withnadvance
features.

Later on once the data will be fed into the fully developed centralized
system then the data will be taken directly from MS SQL Server
databases and few from available flatfiles (if required). Then data
warehousing will be performed with the use of Power BI with more
advanced filters to allow the Amin to have broader view of the entire
organization.

Page 211 Submitted by: SONAL


BI for HRP (2018)

13. PROJECT LIMITATION AND FURTHER


DEVELPOMENT

There are some limitations for the current system to which solutions can
be provided as a future development.

This system needs to be combined with further on going system that will
together allow the organization to earn benefits at large scale.

All the data are controlled by Admin only, but it is expected that with
advancement in the entire system various roles will be identified unded
Admin group with special permission rights for handling businesss data.

The system is limited just till the insertion of data and few functions but more
advanced features will be added to it , once all the modules are finalized and
combined with each other.

Page 212 Submitted by: SONAL


BI for HRP (2018)

14. CONCLUSION

This project is a rewarding experience in many ways.

Firstly I have gained a full idea about working in a profession


environment. The organization provided knowledge about interacting to
professionals and expertise.

Not only they helped to gain knowledge about project but also to
analyze the problems and try to find solutions for that.

Secondly, in order to generate the final report, all the steps of database
designing and system analysis were meticously followed. This
strengthened my ideas on the topic. The objective of the project is to
enable the paperless communication and also make the entire working
of Jean Martin Systems India Pvt. Ltd. fully automated. I got practical
experience of working on a large project and it has given me a chance to
put into practice of the website development and many more concepts
that I have only been studied in theories.

It was a great opportunity for me to work under the proper guidance of


Jean Martin Systems India Pvt. Ltd. employees.

This on-job training will prove beneficial for me in the future.

Last but not the least I would like to thank all those who gave this
opportunity to accomplish this project.

Page 213 Submitted by: SONAL


BI for HRP (2018)

15. REFERENCES
 https://en.wikipedia.org/wiki/Business_intelligence

 http://www.d2demand.com/mfhblog/4-key-functions-of-business-intelligence

 https://yourbusiness.azcentral.com/role-human-resource-planning-
organizational-success-14220.html

 https://bizfluent.com/info-7750696-functions-human-resource-planning.html

 https://www.tutorialspoint.com/asp.net/index.htm

 https://www.w3schools.com/asp/default.asp

 https://code.visualstudio.com/docs/languages/csharp

 https://www.tutorialspoint.com/csharp/index.htm

Page 214 Submitted by: SONAL

You might also like