Beispiel #1
0
        public void delete()
        {
            Console.WriteLine("\n\t╔════════════════════════════╗");
            Console.WriteLine("\t║       DELETING A JOB       ║");
            Console.WriteLine("\t╚════════════════════════════╝");
            Console.WriteLine("\n\tWhich one would you like to delete? (type the id)");
            Console.Write("\n\t>>");
            int idToDelete   = Convert.ToInt32(Console.ReadLine());
            Job itemToRemove = jobList.SingleOrDefault(r => r.IdJob == idToDelete);

            if (itemToRemove != null)
            {
                jobList.Remove(itemToRemove);
                Seerializer.serializeJobs(jobList, "Jobs.xml");
                Console.WriteLine("\n\t╔════════════════════════════════════╗");
                Console.WriteLine("\t║       JOB DELETED SUCCESSFULLY     ║");
                Console.WriteLine("\t╚════════════════════════════════════╝");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("\n\t╔═══════════════════════════════════════════════════╗");
                Console.WriteLine("\t║        THE JOB YOU WANT TO DROP WAS NOT FOUND     ║");
                Console.WriteLine("\t╚═══════════════════════════════════════════════════╝");
                Console.ReadKey();
            }
        }
Beispiel #2
0
        public void delete()
        {
            Console.WriteLine("\n\t╔══════════════════════════════════╗");
            Console.WriteLine("\t║       DELETING AN EMPLOYEE       ║");
            Console.WriteLine("\t╚══════════════════════════════════╝");

            Console.WriteLine("\n\tWhich one would you like to delete? (type the id)");
            Console.Write("\n\t>>");
            int idToDelete = Convert.ToInt32(Console.ReadLine());

            Employee itemToRemove = employeeList.SingleOrDefault(r => r.IdEmployee == idToDelete);

            if (itemToRemove != null)
            {
                employeeList.Remove(itemToRemove);
                Seerializer.serializeEmployees(employeeList, "Employees.xml");
                Console.WriteLine("\n\t╔═════════════════════════════════════════╗");
                Console.WriteLine("\t║       EMPLOYEE DELETED SUCCESSFULLY     ║");
                Console.WriteLine("\t╚═════════════════════════════════════════╝");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("\n\t╔════════════════════════════════════════════════════════╗");
                Console.WriteLine("\t║        THE EMPLOYEE YOU WANT TO DROP WAS NOT FOUND     ║");
                Console.WriteLine("\t╚════════════════════════════════════════════════════════╝");
                Console.ReadKey();
            }
        }
Beispiel #3
0
        public void delete()
        {
            Console.WriteLine("\n\t╔═══════════════════════════════════╗");
            Console.WriteLine("\t║       DELETING A DEPARTMENT       ║");
            Console.WriteLine("\t╚═══════════════════════════════════╝");

            Console.WriteLine("\n\tWhich one would you like to delete? (type the id)");
            Console.Write("\n\t>>");
            int idToDelete = Convert.ToInt32(Console.ReadLine());

            Department itemToRemove = departmentList.SingleOrDefault(r => r.IdDepartament == idToDelete);

            if (itemToRemove != null)
            {
                departmentList.Remove(itemToRemove);
                Seerializer.serializeDepartments(departmentList, "Departments.xml");
                Console.WriteLine("\n\t╔═══════════════════════════════════════════╗");
                Console.WriteLine("\t║       DEPARTMENT DELETED SUCCESSFULLY     ║");
                Console.WriteLine("\t╚═══════════════════════════════════════════╝");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("\n\t╔══════════════════════════════════════════════════════════╗");
                Console.WriteLine("\t║        THE DEPARTMENT YOU WANT TO DROP WAS NOT FOUND     ║");
                Console.WriteLine("\t╚══════════════════════════════════════════════════════════╝");
                Console.ReadKey();
            }
        }
Beispiel #4
0
        public void edit()
        {
            Console.WriteLine("\n\t╔══════════════════════════════╗");
            Console.WriteLine("\t║         EDITING A JOB        ║");
            Console.WriteLine("\t╚══════════════════════════════╝");
            Console.WriteLine("\n\tWhich one would you like to edit? (type the id)");
            Console.Write("\n\t>>");
            int idToEdit = Convert.ToInt32(Console.ReadLine());
            Job specific = searchById(idToEdit);

            if (specific != null)
            {
                Console.WriteLine("{0}{1}", "\n\tID: ", specific.IdJob);
                Console.WriteLine("{0}{1}", "\tName: ", specific.JobName);
                Console.Write("\n\tNew job name: ");
                specific.JobName = Console.ReadLine();
                Seerializer.serializeJobs(jobList, "Jobs.xml");
                Console.WriteLine("\n\t╔════════════════════════════════════╗");
                Console.WriteLine("\t║        JOB EDITED SUCCESSFULLY     ║");
                Console.WriteLine("\t╚════════════════════════════════════╝");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("\n\t╔═══════════════════════════════════════════════════╗");
                Console.WriteLine("\t║        THE JOB YOU WANT TO EDIT WAS NOT FOUND     ║");
                Console.WriteLine("\t╚═══════════════════════════════════════════════════╝");
                Console.ReadKey();
            }
        }
Beispiel #5
0
        public void edit()
        {
            Console.WriteLine("\n\t╔═════════════════════════════════════╗");
            Console.WriteLine("\t║         EDITING A DEPARTMENT        ║");
            Console.WriteLine("\t╚═════════════════════════════════════╝");

            Console.WriteLine("\n\tWhich one would you like to edit? (type the id)");
            Console.Write("\n\t>>");
            int idToEdit = Convert.ToInt32(Console.ReadLine());

            Department specific = searchById(idToEdit);

            if (specific != null)
            {
                Console.WriteLine("{0}{1}", "\n\tID: ", specific.IdDepartament);
                Console.WriteLine("{0}{1}", "\tName: ", specific.DepartmentName);

                Console.Write("\n\tNew department name: ");
                specific.DepartmentName = Console.ReadLine();
                Seerializer.serializeDepartments(departmentList, "Departments.xml");
                Console.WriteLine("\n\t╔═══════════════════════════════════════════╗");
                Console.WriteLine("\t║        DEPARTMENT EDITED SUCCESSFULLY     ║");
                Console.WriteLine("\t╚═══════════════════════════════════════════╝");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("\n\t╔══════════════════════════════════════════════════════════╗");
                Console.WriteLine("\t║        THE DEPARTMENT YOU WANT TO EDIT WAS NOT FOUND     ║");
                Console.WriteLine("\t╚══════════════════════════════════════════════════════════╝");
                Console.ReadKey();
            }
        }
Beispiel #6
0
        public void edit()
        {
            Console.WriteLine("\n\t╔════════════════════════════════════╗");
            Console.WriteLine("\t║         EDITING AN EMPLOYEE        ║");
            Console.WriteLine("\t╚════════════════════════════════════╝");

            Console.WriteLine("\n\tWhich one would you like to edit? (type the id)");
            Console.Write("\n\t>>");
            int idToEdit = Convert.ToInt32(Console.ReadLine());

            Employee specific = searchById(idToEdit);

            if (specific != null)
            {
                Console.WriteLine("{0}{1}", "\n\tID: ", specific.IdEmployee);
                Console.WriteLine("{0}{1}", "\tName: ", specific.Name);
                Console.WriteLine("{0}{1}", "\tLast name: ", specific.LastName);
                Console.WriteLine("{0}{1}", "\tAddress: ", specific.Address);
                Console.WriteLine("{0}{1}", "\tPhone number: (+502) ", specific.PhoneNumber);
                Console.WriteLine("{0}{1}", "\tSalary: Q ", specific.Salary);
                Console.WriteLine("{0}{1}", "\tJob: ", specific.WorkStation.JobName);
                Console.WriteLine("{0}{1}", "\tDepartment: ", specific.Section.DepartmentName);

                Console.Write("\n\tNew name: ");
                employee.Name = Console.ReadLine();
                Console.Write("\tNew last name: ");
                employee.LastName = Console.ReadLine();
                Console.Write("\tNew address: ");
                employee.Address = Console.ReadLine();
                Console.Write("\tNew phone number: ");
                employee.PhoneNumber = Console.ReadLine();
                Console.Write("\tNew salary: ");
                employee.Salary = Convert.ToDouble(Console.ReadLine());

                JobController.Instance.show();
                Console.WriteLine("\n\tWhich job would you like to assign to this new employee? (type the id)");
                Console.Write("\tNew workstation: ");
                int workStation = Convert.ToInt32(Console.ReadLine());
                employee.WorkStation = JobController.Instance.searchByIdToAddAnEmployee(workStation);

                DepartmentController.Instance.show();
                Console.WriteLine("\n\tWhich department would you like to assign to this new employee? (type the id)");
                Console.Write("\tNew department: ");
                int dept = Convert.ToInt32(Console.ReadLine());
                employee.Section = DepartmentController.Instance.searchByIdToAddAnEmployee(dept);
                Seerializer.serializeEmployees(employeeList, "Employees.xml");
                Console.WriteLine("\n\t╔═════════════════════════════════════════╗");
                Console.WriteLine("\t║        EMPLOYEE EDITED SUCCESSFULLY     ║");
                Console.WriteLine("\t╚═════════════════════════════════════════╝");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("\n\t╔════════════════════════════════════════════════════════╗");
                Console.WriteLine("\t║        THE EMPLOYEE YOU WANT TO EDIT WAS NOT FOUND     ║");
                Console.WriteLine("\t╚════════════════════════════════════════════════════════╝");
                Console.ReadKey();
            }
        }
Beispiel #7
0
 public JobController()
 {
     jobList = new List <Job>();
     Seerializer.desserializeJobs(jobList, "Jobs.xml");
     if (jobList.Count == 0)
     {
         idJob = 0;
     }
     else
     {
         int item = (jobList.Count - 1);
         idJob = item;
     }
 }
Beispiel #8
0
 public DepartmentController()
 {
     departmentList = new List <Department>();
     Seerializer.desserializeDepartments(departmentList, "Departments.xml");
     if (departmentList.Count == 0)
     {
         idDepartment = 0;
     }
     else
     {
         int item = (departmentList.Count - 1);
         idDepartment = item;
     }
 }
Beispiel #9
0
 public EmployeeController()
 {
     employeeList = new List <Employee>();
     le           = new List <Employee>();
     specific     = new List <Employee>();
     Seerializer.desserializeEmployees(employeeList, "Employees.xml");
     if (employeeList.Count == 0)
     {
         idEmployee = 0;
     }
     else
     {
         int item = (employeeList.Count - 1);
         idEmployee = item;
     }
 }
Beispiel #10
0
        public void add()
        {
            Console.WriteLine("\n\t╔══════════════════════════════╗");
            Console.WriteLine("\t║       ADDING A NEW JOB       ║");
            Console.WriteLine("\t╚══════════════════════════════╝");

            idJob++;
            job       = new Job();
            job.IdJob = idJob;
            Console.Write("\n\tJob name: ");
            job.JobName = Console.ReadLine();
            jobList.Add(job);
            Seerializer.serializeJobs(jobList, "Jobs.xml");
            Console.WriteLine("\n\t╔════════════════════════════════════╗");
            Console.WriteLine("\t║     NEW JOB ADDED SUCCESSFULLY     ║");
            Console.WriteLine("\t╚════════════════════════════════════╝");
            Console.ReadKey();
        }
Beispiel #11
0
        public void add()
        {
            Console.WriteLine("\n\t╔═════════════════════════════════════╗");
            Console.WriteLine("\t║       ADDING A NEW DEPARTMENT       ║");
            Console.WriteLine("\t╚═════════════════════════════════════╝");

            idDepartment++;
            departmet = new Department();
            departmet.IdDepartament = idDepartment;
            Console.Write("\n\tDepartment name: ");
            departmet.DepartmentName = Console.ReadLine();
            departmentList.Add(departmet);
            Seerializer.serializeDepartments(departmentList, "Departments.xml");
            Console.WriteLine("\n\t╔═══════════════════════════════════════════╗");
            Console.WriteLine("\t║     NEW DEPARTMENT ADDED SUCCESSFULLY     ║");
            Console.WriteLine("\t╚═══════════════════════════════════════════╝");
            Console.ReadKey();
        }
Beispiel #12
0
        public void add()
        {
            Console.WriteLine("\n\t╔═══════════════════════════════════╗");
            Console.WriteLine("\t║       ADDING A NEW EMPLOYEE       ║");
            Console.WriteLine("\t╚═══════════════════════════════════╝");

            idEmployee++;
            employee            = new Employee();
            employee.IdEmployee = idEmployee;
            Console.Write("\n\tName: ");
            employee.Name = Console.ReadLine();
            Console.Write("\tLast name: ");
            employee.LastName = Console.ReadLine();
            Console.Write("\tAddress: ");
            employee.Address = Console.ReadLine();
            Console.Write("\tPhone number: ");
            employee.PhoneNumber = Console.ReadLine();
            Console.Write("\tSalary: ");
            employee.Salary = Convert.ToDouble(Console.ReadLine());

            JobController.Instance.show();
            Console.WriteLine("\n\tWhich job would you like to assign to this new employee? (type the id)");
            Console.Write("\tWorkstation: ");
            int workStation = Convert.ToInt32(Console.ReadLine());

            employee.WorkStation = JobController.Instance.searchByIdToAddAnEmployee(workStation);

            DepartmentController.Instance.show();
            Console.WriteLine("\n\tWhich department would you like to assign to this new employee? (type the id)");
            Console.Write("\tDepartment: ");
            int dept = Convert.ToInt32(Console.ReadLine());

            employee.Section = DepartmentController.Instance.searchByIdToAddAnEmployee(dept);
            this.employeeList.Add(employee);
            Seerializer.serializeEmployees(employeeList, "Employees.xml");
            Console.WriteLine("\n\t╔═════════════════════════════════════════╗");
            Console.WriteLine("\t║     NEW EMPLOYEE ADDED SUCCESSFULLY     ║");
            Console.WriteLine("\t╚═════════════════════════════════════════╝");
            Console.ReadKey();
        }