0% found this document useful (0 votes)
10 views4 pages

Employee Management System Code

The document contains code for an employee management system (EMS) that allows users to perform CRUD (create, read, update, delete) operations on employee records stored in a list. It includes classes for the employee entity, custom exceptions, and data access logic. The Program class contains the main logic and menu to call the data access methods for adding, updating, deleting, and getting all employees.

Uploaded by

yeshwanth kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Employee Management System Code

The document contains code for an employee management system (EMS) that allows users to perform CRUD (create, read, update, delete) operations on employee records stored in a list. It includes classes for the employee entity, custom exceptions, and data access logic. The Program class contains the main logic and menu to call the data access methods for adding, updating, deleting, and getting all employees.

Uploaded by

yeshwanth kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Programs.

cs

using [Link];
using System;
using [Link];
using [Link];
using [Link];
using [Link];

namespace EMS
{
class Program
{
EMPDataAccess eMPDataAccess = new EMPDataAccess();
public static void GetMENU()
{
[Link] = [Link];
[Link]("welcome to EMS");
[Link]("Please select the below options");
[Link]("**********************************************");
[Link]("**********Menu List*********************");
[Link]("**********************************************");
[Link]("[Link] Employee");
[Link]("[Link] Employee");
[Link]("[Link] Employee");
[Link]("[Link] List of Employee");
}
public static void Add()
{
[Link]("Id");
int id = [Link]([Link]());
[Link]("Name");
String Name = [Link]();
[Link]("Loc");
String Loc = [Link]();
[Link]("Sal");
int Sal = [Link]([Link]());
[Link]("DeptId");
int DeptId = [Link]([Link]());
[Link](id, Name, Loc, Sal, DeptId);
}
private static void Update()
{

}
private static void Delete()
{

}
private static void GetAll()
{

}
static void Main(string[] args)
{
GetMENU();
[Link] = [Link];
[Link]("Please enter your option");
int option = [Link]([Link]());
switch (option)
{

case 1:
Add();
break;
case 2:
Update();
break;
case 3:
Delete();
break;
case 4:
GetAll();
break;
default:
[Link]("option is invalid");
break;
}
}

}
}

[Link]
using System;
using [Link];
using [Link];
using [Link];
using [Link];

nnamespace [Link]
{
public class Employee
{
public int ID { get; set; }
public int Name { get; set; }
public int Location { get; set; }
public int Salary { get; set; }
public int DeptID { get; set; }
}
}

[Link]
using System;
using [Link];
using [Link];
using [Link];
using [Link];

namespace [Link]
{
public class EMPExceptions : Exception
{
public EMPExceptions() : base()
{

}
public EMPExceptions(string msg) : base(msg)
{

}
}
}

[Link]
using [Link];
using [Link];
using System;
using [Link];
using [Link];
using [Link];
using [Link];

namespace [Link]
{
public class EMPDataAccess
{
private List<Employee> employeeslist;

//public static List<Employee> employeeslist=new List<Employee>();


public List<Employee> GetAllEmployees()
{
return employeeslist;
}
public static bool AddEmp(int id, string name, string loc, int sal, int
deptid)
{
try
{
//[Link](new Employee()
{ID=id,Name=name,Location=loc,Salary=sal,DeptID=deptid});
return true;
}
catch (ApplicationException e)
{
throw new EMPExceptions();
}
}
public void UpdateEmp(int id, string name, string loc, int sal, int deptid)
{

}
public bool DeleteEmp(int id)
{
try
{

Employee deleteemployee = [Link](x => [Link] == id);


[Link](deleteemployee);
return true;
}
catch
{
return false;
}
}
}
}

You might also like