Professional Documents
Culture Documents
cs
using EMP.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EMS
{
class Program
{
EMPDataAccess eMPDataAccess = new EMPDataAccess();
public static void GetMENU()
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("welcome to EMS");
Console.WriteLine("Please select the below options");
Console.WriteLine("**********************************************");
Console.WriteLine("**********Menu List*********************");
Console.WriteLine("**********************************************");
Console.WriteLine("1.Add Employee");
Console.WriteLine("2.Update Employee");
Console.WriteLine("3.Delete Employee");
Console.WriteLine("4.Get List of Employee");
}
public static void Add()
{
Console.WriteLine("Id");
int id = int.Parse(Console.ReadLine());
Console.WriteLine("Name");
String Name = Console.ReadLine();
Console.WriteLine("Loc");
String Loc = Console.ReadLine();
Console.WriteLine("Sal");
int Sal = int.Parse(Console.ReadLine());
Console.WriteLine("DeptId");
int DeptId = int.Parse(Console.ReadLine());
EMPDataAccess.AddEmp(id, Name, Loc, Sal, DeptId);
}
private static void Update()
{
}
private static void Delete()
{
}
private static void GetAll()
{
}
static void Main(string[] args)
{
GetMENU();
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Please enter your option");
int option = int.Parse(Console.ReadLine());
switch (option)
{
case 1:
Add();
break;
case 2:
Update();
break;
case 3:
Delete();
break;
case 4:
GetAll();
break;
default:
Console.WriteLine("option is invalid");
break;
}
}
}
}
Employee.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
nnamespace EMP.Entities
{
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; }
}
}
Emp.Exceptions.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EMP.Exceptions
{
public class EMPExceptions : Exception
{
public EMPExceptions() : base()
{
}
public EMPExceptions(string msg) : base(msg)
{
}
}
}
EMPDAL.cs
using EMP.Entities;
using EMP.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EMP.DAL
{
public class EMPDataAccess
{
private List<Employee> employeeslist;
}
public bool DeleteEmp(int id)
{
try
{