oop project report

36
EMPLOYE MANAGEMENT SYSTEM Group Members: Abdul Rehman Israr Ahmed Farhan Khan Waqar Hassan

Upload: abdulrehman-qadeer

Post on 12-Jan-2017

46 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: OOP project REPORT

employe management system

Group Members:

Abdul RehmanIsrar Ahmed

Farhan KhanWaqar Hassan

Page 2: OOP project REPORT

PROJECT ANALYSIS:Analysis of two sample projects along with our project:

1. Employee Management2. GEA Process Engineering(India)

EMPLOYEE MANAGEMENT:

Employee management makes it easy to check and track human resources department at the press of a button. It makes the system easy to monitor and manage employees from different location. This system helps in supervising employees work report and productivity. Our employee management system includes a time tracking system that saves both time and money. These all features help at the time of employee appraisals.

KEY FEATURES:1 Add manage employee

2 Manage employees personal details, family details, Company details

3 Add manage employee designations

4 Check employee system backup facility and hardware details

Page 3: OOP project REPORT

5 View and edit employee Insurance details

6 Add view employee task status

7 Add or check employee work report daily / monthly

8 Monitor employee call register list

9 Track employee related to projects / clients

10 View, approve / decline employee leave request

11 Give employee administrative permissions

12 Monitor employee log details

13 Add announcements / holidays / Birthdays / notes

14 Communicate with internal messaging center

15 View, edit employee payroll system

16 Search employee with name, designation or place of work

17 Suspend or inactivate an employee from the application

18 User can edit and view employee details

19 Use instant messaging system through email or SMS

20 All employee details can be managed as Active and In-Active

BENEFITS:1 Easy to use

2 Fully customizable

3 Fully scalable

4 Tracks up to date work status

5 Reduces TCO and increases ROI

6 Ability to add employees, easily and flexibly

7 Reduces HR daily work, increases productivity, employee satisfaction, and a significant cost savings

8 Eliminate paper work. Go green

Page 4: OOP project REPORT

GEA Process Engineering (India):

Form 1:

Form 2:

Page 5: OOP project REPORT

Form 3:

Form 4:

Form 5:

Page 6: OOP project REPORT

Form 6:

Form 7:

Form 8:

Page 7: OOP project REPORT

Form 9:

Form 10:

Form 11:

Page 8: OOP project REPORT

Form 12:

Page 9: OOP project REPORT

EMPLOYEE MANGEMENT SYSTEMOUR PROJECT ANALYSIS:

Form1:-

Username and password page

Form2:-

Form will have options Add Employee and search employ.

Form3:-

Add Employ

Having employee id, name, father name, CNIC number, Address, designation, status, salary details.

Form 4:-

Will have details of the employee with edit option.

Form 5:-

Search employ

Will have a search in which you will insert employ id which will open another form having concern employee details.

Form 6:-

Form will have concern employee details along with edit option.

Page 10: OOP project REPORT

While getting information from account officer,

Page 11: OOP project REPORT

Design:

Flowchart:

Page 12: OOP project REPORT

Program Flow:

Implementation:

Code:

LoginForm.cs:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Configuration;using System.Data.SqlClient;using Project_2.Properties;

namespace Project_2{ public partial class LoginForm : Form { public LoginForm() { InitializeComponent();

Page 13: OOP project REPORT

}

private void Form1_Load(object sender, EventArgs e) { LoadAllRoles(); }

private void LoadAllRoles() { try { string connectionString = ConfigurationManager.ConnectionStrings["loginprodb"].ConnectionString; // SqlConnection SqlConnection conn = new SqlConnection(connectionString);

conn.Open(); conn.Close(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } }

private void ExitButton_Click(object sender, EventArgs e) { Application.Exit(); }

private void SignInButton_Click(object sender, EventArgs e) { bool isCredentialsCorrect = false, isUserNameCorrect = false, isPasswordCorrect = false; Authenticated(UserNameTextBox.Text, PasswordTextBox.Text, ref isCredentialsCorrect, ref isUserNameCorrect, ref isPasswordCorrect); if (isCredentialsCorrect) { MessageBox.Show("Your are logged in successfully", "Login Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information); EMSForm f = new EMSForm(); f.ShowDialog(); this.Hide(); } else { if (!isUserNameCorrect) { MessageBox.Show("No Such User Exists", "No User Found", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (!isPasswordCorrect)

Page 14: OOP project REPORT

{ MessageBox.Show("Password is wrong", "Wrong Password", MessageBoxButtons.OK, MessageBoxIcon.Error);

} } }

private void Authenticated(string _UserName, string _Password, ref bool _IsCredentialsCorrect, ref bool _IsUserNameCorrect, ref bool _IsPasswordCorrect) { try { //SqlConnection String connectionString = ConfigurationManager.ConnectionStrings["loginprodb"].ConnectionString; SqlConnection conn = new SqlConnection(connectionString);

//SqlCommand SqlCommand cmd = new SqlCommand("usp_CheckIsUserCredentialCorrect6", conn); cmd.CommandType = CommandType.StoredProcedure;

// Parameters cmd.Parameters.Add("@UserName", SqlDbType.NVarChar, 50).Value = _UserName; cmd.Parameters.Add("@Password", SqlDbType.NVarChar, 50).Value = _Password; //Open the connection conn.Open();

SqlDataReader reader = cmd.ExecuteReader();

reader.Read();

_IsCredentialsCorrect = (bool)reader["@IsCredentialsCorrect"]; _IsUserNameCorrect = (bool)reader["@IsUserNameCorrect"]; _IsPasswordCorrect = (bool)reader["@IsPasswordCorrect"];

//Close the connection conn.Close();

} catch (Exception ex) { MessageBox.Show("Error: ", ex.Message); } }

private void DeletePictureBox_Click(object sender, EventArgs e) {

Application.Exit(); }

private void DeletePictureBox_MouseHover(object sender, EventArgs e) { DeletePictureBox.Image = Resources.Delete_remove_close_exit_trash; }

Page 15: OOP project REPORT

private void DeletePictureBox_MouseLeave(object sender, EventArgs e) { DeletePictureBox.Image = Resources.Delete; }

private void groupBox1_Enter(object sender, EventArgs e) {

}

private void label1_Click(object sender, EventArgs e) {

}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { PassFinder pf = new PassFinder(); pf.ShowDialog(); this.Close(); } }}

EMSForm.cs:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using Project_2.Properties;

namespace Project_2{ public partial class EMSForm : Form { public EMSForm() { InitializeComponent(); }

private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); }

Page 16: OOP project REPORT

private void menuToolStripMenuItem_Click(object sender, EventArgs e) { new EMSForm().Show();

}

private void logOutToolStripMenuItem_Click(object sender, EventArgs e) { new LoginForm().Show();

}

private void EMSForm_Load(object sender, EventArgs e) {

}

private void button4_Click(object sender, EventArgs e) { Salary f3 = new Salary(); f3.ShowDialog(); this.Close(); }

private void button3_Click(object sender, EventArgs e) {

}

private void pictureBox6_Click(object sender, EventArgs e) {

}

private void pictureBox5_Click(object sender, EventArgs e) {

}

private void pictureBox1_Click(object sender, EventArgs e) {

}

private void pictureBox2_Click(object sender, EventArgs e) {

}

private void pictureBox3_Click(object sender, EventArgs e) {

}

private void pictureBox4_Click(object sender, EventArgs e) {

}

private void ExitpictureBox1_Click(object sender, EventArgs e) { Application.Exit(); }

Page 17: OOP project REPORT

private void ExitpictureBox1_MouseHover(object sender, EventArgs e) { ExitpictureBox1.Image = Resources.Delete_remove_close_exit_trash; }

private void ExitpictureBox1_MouseLeave(object sender, EventArgs e) { ExitpictureBox1.Image = Resources.Delete; }

private void EnterEmployeePicBox_MouseHover(object sender, EventArgs e) { EnterEmployeePicBox.Image = Resources.Enter; }

private void EnterEmployeePicBox_MouseLeave(object sender, EventArgs e) { EnterEmployeePicBox.Image = Resources.EMS; }

private void EnterEmployeePicBox_Click(object sender, EventArgs e) { AddEmployeeForm ems = new AddEmployeeForm(); ems.ShowDialog(); this.Close(); }

private void SalaryPicBox_MouseHover(object sender, EventArgs e) { SalaryPicBox.Image = Resources.Enter; }

private void SalaryPicBox_MouseLeave(object sender, EventArgs e) { SalaryPicBox.Image = Resources.salary; }

private void SalaryPicBox_Click(object sender, EventArgs e) { Salary s = new Salary(); s.ShowDialog(); this.Close(); } } }

AddEmployeeForm.cs:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;

Page 18: OOP project REPORT

using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;using System.Configuration;using EmployeeBusiness;using EmployeeModel;using Project_2.Properties;

namespace Project_2{ public partial class AddEmployeeForm : Form { public AddEmployeeForm() { InitializeComponent(); load_table(); }

private void AddEmployeeButton_Click(object sender, EventArgs e) {

if (EmployeeIdTextBox.Text == "" || FirstNameTextBox.Text == "" || LastNameTextBox.Text == "" || ContactNoTextBox.Text == "" || CNICNoTextBox.Text == "" || ReligionTextBox.Text == "" || NationalityTextBox.Text == "" || EmailTextBox.Text == "" || FacultyComboBox.Text == "" || GradeLevelComboBox.Text == "" || BasicSalaryTextBox.Text == "") { if (EmployeeIdTextBox.Text == "") { errorProviderEId.SetError(EmployeeIdTextBox, "Please Enter Employee ID First !"); } else errorProviderEId.Clear(); if (FirstNameTextBox.Text == "") { errorProviderFName.SetError(FirstNameTextBox, "Please Enter First Name First !"); } else errorProviderFName.Clear(); if (LastNameTextBox.Text == "") { errorProviderLName.SetError(LastNameTextBox, "Please Enter Last Name First !"); } else errorProviderLName.Clear(); if (ContactNoTextBox.Text == "") { errorProviderCNo.SetError(ContactNoTextBox, "Please Enter Contact Number First !"); } else errorProviderCNo.Clear(); if (CNICNoTextBox.Text.Length < 15) {

Page 19: OOP project REPORT

errorProviderCNICNo.SetError(CNICNoTextBox, "Please Enter CNIC Number First !"); } else errorProviderCNICNo.Clear(); if (ReligionTextBox.Text == "") { errorProviderReligion.SetError(ReligionTextBox, "Please Enter Religion First !"); } else errorProviderReligion.Clear(); if (NationalityTextBox.Text == "") { errorProviderNation.SetError(NationalityTextBox, "Please Enter Nationality First !"); } else errorProviderNation.Clear(); if (EmailTextBox.Text == "") { errorProviderEmail.SetError(EmailTextBox, "Please Enter Email First !"); } else errorProviderEmail.Clear(); if (FacultyComboBox.Text == "") { errorProviderFaculty.SetError(FacultyComboBox, "Please Select Faculty First !"); } else errorProviderFaculty.Clear(); if (GradeLevelComboBox.Text == "") { errorProviderGLevel.SetError(GradeLevelComboBox, "Please Select Grade Level First !"); } else errorProviderGLevel.Clear(); if (BasicSalaryTextBox.Text == "") { errorProviderBSalary.SetError(BasicSalaryTextBox, "Please Enter Basic Salary First !"); } else errorProviderBSalary.Clear(); } else { Employee emp = EmployeeDetails(); EmployeeService.AddEmployee(emp);

MessageBox.Show("New Employee is Added successfully! "); }

load_table(); UpdateEmployeeButton.Enabled = true; DeleteEmployeeButton.Enabled = true;

}

Page 20: OOP project REPORT

private Employee EmployeeDetails() { Employee emp = new Employee() { EmployeeId = EmployeeIdTextBox.Text, FirstName = FirstNameTextBox.Text, LastName = LastNameTextBox.Text, ContactNo = ContactNoTextBox.Text, CNICNo = CNICNoTextBox.Text, Religion = ReligionTextBox.Text, Nationality = NationalityTextBox.Text, Email = EmailTextBox.Text, Faculty=FacultyComboBox.Text, GradeLevel=GradeLevelComboBox.Text, BasicSalary=BasicSalaryTextBox.Text }; return emp; } void load_table() { string connString = ConfigurationManager.ConnectionStrings ["loginprodb"].ConnectionString; SqlConnection conn = new SqlConnection(connString);

SqlCommand cmd = new SqlCommand("select EmployeeId, FirstName, LastName, GradeLevel, BasicSalary from dbo.employee ;", conn);

try { SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bSource = new BindingSource();

bSource.DataSource = dbdataset; AddEmployeeDataGridView.DataSource = bSource; sda.Update(dbdataset);

} catch (Exception ex) { MessageBox.Show(ex.Message); } } private void LoadTableButton_Click(object sender, EventArgs e) { }

private void UpdateEmployeeButton_Click(object sender, EventArgs e) { if (EmployeeIdTextBox.Text == "" || FirstNameTextBox.Text == "" || LastNameTextBox.Text == "" || ContactNoTextBox.Text == "" || CNICNoTextBox.Text == "" || ReligionTextBox.Text == "" || NationalityTextBox.Text == "" || EmailTextBox.Text == "" || FacultyComboBox.Text == "" || GradeLevelComboBox.Text == "" || BasicSalaryTextBox.Text == "") {

Page 21: OOP project REPORT

if (EmployeeIdTextBox.Text == "") { errorProviderEId.SetError(EmployeeIdTextBox, "Please Enter Employee ID First !"); } else errorProviderEId.Clear(); if (FirstNameTextBox.Text == "") { errorProviderFName.SetError(FirstNameTextBox, "Please Enter First Name First !"); } else errorProviderFName.Clear(); if (LastNameTextBox.Text == "") { errorProviderLName.SetError(LastNameTextBox, "Please Enter Last Name First !"); } else errorProviderLName.Clear(); if (ContactNoTextBox.Text == "") { errorProviderCNo.SetError(ContactNoTextBox, "Please Enter Contact Number First !"); } else errorProviderCNo.Clear(); if (CNICNoTextBox.Text == "") { errorProviderCNICNo.SetError(CNICNoTextBox, "Please Enter CNIC Number First !"); } else errorProviderCNICNo.Clear(); if (ReligionTextBox.Text == "") { errorProviderReligion.SetError(ReligionTextBox, "Please Enter Religion First !"); } else errorProviderReligion.Clear(); if (NationalityTextBox.Text == "") { errorProviderNation.SetError(NationalityTextBox, "Please Enter Nationality First !"); } else errorProviderNation.Clear(); if (EmailTextBox.Text == "") { errorProviderEmail.SetError(EmailTextBox, "Please Enter Email First !"); } else errorProviderEmail.Clear(); if (FacultyComboBox.Text == "") { errorProviderFaculty.SetError(FacultyComboBox, "Please Select Faculty First !"); } else

Page 22: OOP project REPORT

errorProviderFaculty.Clear(); if (GradeLevelComboBox.Text == "") { errorProviderGLevel.SetError(GradeLevelComboBox, "Please Select Grade Level First !"); } else errorProviderGLevel.Clear(); if (BasicSalaryTextBox.Text == "") { errorProviderBSalary.SetError(BasicSalaryTextBox, "Please Enter Basic Salary First !"); } else errorProviderBSalary.Clear(); } else { Employee emp = EmployeeDetails(); EmployeeService.UpdateEmployeeRecord(emp);

MessageBox.Show("Employee is Updated successfully! "); }

load_table(); }

private void FindEmployeeButton_Click(object sender, EventArgs e) {

string employeeId = EmployeeIdTextBox.Text; Employee emp = EmployeeService.GetEmployeeByEmployeeId(employeeId);

FirstNameTextBox.Text = emp.FirstName.ToString(); LastNameTextBox.Text = emp.LastName.ToString(); ContactNoTextBox.Text = emp.ContactNo.ToString(); CNICNoTextBox.Text = emp.CNICNo.ToString(); ReligionTextBox.Text = emp.Religion.ToString(); NationalityTextBox.Text = emp.Nationality.ToString(); EmailTextBox.Text = emp.Email.ToString(); FacultyComboBox.Text = emp.Faculty.ToString(); GradeLevelComboBox.Text = emp.GradeLevel.ToString(); BasicSalaryTextBox.Text = emp.BasicSalary.ToString(); UpdateEmployeeButton.Enabled = true; DeleteEmployeeButton.Enabled = true;

}

private void DeleteEmployeeButton_Click(object sender, EventArgs e) {

if (EmployeeIdTextBox.Text == "" || FirstNameTextBox.Text == "" || LastNameTextBox.Text == "" || ContactNoTextBox.Text == "" || CNICNoTextBox.Text == "" || ReligionTextBox.Text == "" || NationalityTextBox.Text == "" || EmailTextBox.Text == "" || FacultyComboBox.Text == "" || GradeLevelComboBox.Text == "" ||

Page 23: OOP project REPORT

BasicSalaryTextBox.Text == "") { if (EmployeeIdTextBox.Text == "") { errorProviderEId.SetError(EmployeeIdTextBox, "Please Enter Employee ID First !"); } else errorProviderEId.Clear(); if (FirstNameTextBox.Text == "") { errorProviderFName.SetError(FirstNameTextBox, "Please Enter First Name First !"); } else errorProviderFName.Clear(); if (LastNameTextBox.Text == "") { errorProviderLName.SetError(LastNameTextBox, "Please Enter Last Name First !"); } else errorProviderLName.Clear(); if (ContactNoTextBox.Text == "") { errorProviderCNo.SetError(ContactNoTextBox, "Please Enter Contact Number First !"); } else errorProviderCNo.Clear(); if (CNICNoTextBox.Text == "") { errorProviderCNICNo.SetError(CNICNoTextBox, "Please Enter CNIC Number First !"); } else errorProviderCNICNo.Clear(); if (ReligionTextBox.Text == "") { errorProviderReligion.SetError(ReligionTextBox, "Please Enter Religion First !"); } else errorProviderReligion.Clear(); if (NationalityTextBox.Text == "") { errorProviderNation.SetError(NationalityTextBox, "Please Enter Nationality First !"); } else errorProviderNation.Clear(); if (EmailTextBox.Text == "") { errorProviderEmail.SetError(EmailTextBox, "Please Enter Email First !"); } else errorProviderEmail.Clear(); if (FacultyComboBox.Text == "") { errorProviderFaculty.SetError(FacultyComboBox, "Please Select Faculty First !"); }

Page 24: OOP project REPORT

else errorProviderFaculty.Clear(); if (GradeLevelComboBox.Text == "") { errorProviderGLevel.SetError(GradeLevelComboBox, "Please Select Grade Level First !"); } else errorProviderGLevel.Clear(); if (BasicSalaryTextBox.Text == "") { errorProviderBSalary.SetError(BasicSalaryTextBox, "Please Enter Basic Salary First !"); } else errorProviderBSalary.Clear(); } else { Employee emp = EmployeeDetails(); EmployeeService.DeleteEmployeeRecord(emp);

MessageBox.Show("Employee is Deleted successfully! "); }

load_table(); }

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) {

}

private void LoadTableButton_Click_1(object sender, EventArgs e) {

}

private void AddEmployeeDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) {

}

private void label9_Click(object sender, EventArgs e) {

}

private void AddEmployeeForm_Load(object sender, EventArgs e) {

}

private void GradeLevelComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (GradeLevelComboBox.Text == "Programmer") { BasicSalaryTextBox.Text = "15000".ToString(); } if (GradeLevelComboBox.Text == "Project Manager")

Page 25: OOP project REPORT

{ BasicSalaryTextBox.Text = "20000".ToString(); } if (GradeLevelComboBox.Text == "Director") { BasicSalaryTextBox.Text = "30000".ToString(); } }

private void DeletePictureBox_MouseHover(object sender, EventArgs e) { DeletePictureBox.Image = Resources.Delete_remove_close_exit_trash; }

private void DeletePictureBox_MouseLeave(object sender, EventArgs e) { DeletePictureBox.Image = Resources.Delete; }

private void DeletePictureBox_Click(object sender, EventArgs e) { EMSForm ems = new EMSForm(); ems.ShowDialog(); this.Hide(); }

private void CNICNoTextBox_MaskInputRejected(object sender, MaskInputRejectedEventArgs e) { }

}}

Salary.cs:

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using Project_2.Properties;

namespace Project_2{ public partial class Salary : Form { public Salary() { InitializeComponent(); }

private void label2_Click(object sender, EventArgs e) {

}

Page 26: OOP project REPORT

private void CalculateButton_Click(object sender, EventArgs e) { Employee4 emp = new Employee4(); emp.BasicSalary = Convert.ToSingle(BasicSalaryTextBox.Text); emp.calculateSalary(); HouseRentTextBox.Text = emp.HRA.ToString(); TravellingAllowanceTextBox.Text = emp.TA.ToString(); DearnessAllowanceTextBox.Text = emp.DA.ToString(); PFTextBox.Text = emp.PF.ToString(); TDSTextBox.Text = emp.TDS.ToString(); GrossSalaryTextBox.Text = emp.GrossSalary.ToString(); NetSalaryTextBox.Text = emp.NetSalary.ToString(); }

private void ExitButton_Click(object sender, EventArgs e) { Application.Exit(); }

private void GradeLevelComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (GradeLevelComboBox.Text == "Programmer") { BasicSalaryTextBox.Text = "15000".ToString(); } if (GradeLevelComboBox.Text == "Project Manager") { BasicSalaryTextBox.Text = "20000".ToString(); } if (GradeLevelComboBox.Text == "Director") { BasicSalaryTextBox.Text = "30000".ToString(); } }

private void DeletePictureBox_MouseHover_1(object sender, EventArgs e) { DeletePictureBox.Image = Resources.Delete_remove_close_exit_trash; }

private void DeletePictureBox_MouseLeave(object sender, EventArgs e) { DeletePictureBox.Image = Resources.Delete; }

private void DeletePictureBox_Click(object sender, EventArgs e) { EMSForm ems = new EMSForm(); ems.ShowDialog(); this.Close(); }

private void Salary_Load(object sender, EventArgs e) {

}

Page 27: OOP project REPORT

}}

Output:

LoginForm.cs:

EMSForm.cs:

Page 28: OOP project REPORT

AddEmployeeForm.cs:

Salary.cs:

Page 29: OOP project REPORT
Page 30: OOP project REPORT

Testing:

Errors:

If we enter wrong user name and password then it will not transfer the flow to next form.

If we leave any field empty it will show error as you bring your cursor

on the symbol .

Page 31: OOP project REPORT

As we have taken CNIC No as integer data type in SQL data base thus it will not allow you to enter any character accept 0-9 numeric characters.