Exemplo n.º 1
0
        internal static void RunEmployeeQueries(Employee employee, string updated)
        {
            HumaneSocietyDataContext db = new HumaneSocietyDataContext();
            Employee findEmployee;

            switch (updated)
            {
            case "create":
                db.Employees.InsertOnSubmit(employee);
                break;

            case "delete":
                db.Employees.DeleteOnSubmit(db.Employees.Where(e => e.EmployeeNumber == employee.EmployeeNumber && e.LastName == employee.LastName).Single());
                break;

            case "read":
                findEmployee = db.Employees.Where(e => e.EmployeeNumber == employee.EmployeeNumber).Single();
                UserInterface.DisplayEmployee(findEmployee);
                break;

            case "update":
                findEmployee = db.Employees.Where(e => e.EmployeeNumber == employee.EmployeeNumber).Single();
                findEmployee = employee;
                break;

            default:
                break;
            }

            db.SubmitChanges();
        }
Exemplo n.º 2
0
        internal static void UpdateEmployee(int employeeNumber)
        {
            Employee target = db.Employees.Where(e => e.EmployeeNumber == employeeNumber).Single();

            UserInterface.DisplayEmployee(target);
            UserInterface.DisplayUserOptions("Which field would you like to change?");
            UserInterface.UpdateEmployee_MenuSelection(target);
        }
Exemplo n.º 3
0
        internal static void ReadEmployee(int?employeeId)
        {
            Employee employee = db.Employees.Where(e => e.EmployeeNumber == employeeId).Single();

            UserInterface.DisplayEmployee(employee);
            UserInterface.DisplayUserOptions("Press any key to continue.");
            Console.ReadKey();
        }
Exemplo n.º 4
0
 internal static void EmployeeDisplayInfo(int?employeeNumber)
 {
     UserInterface.DisplayEmployee(db.Employees.Where(e => e.EmployeeNumber == employeeNumber).FirstOrDefault());
 }