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;
}
}
}
}