public void DeleteDepartment()
        {
            int id;

            while (true)
            {
                de_control.PrintListDepartments(true);
                for (int i = 0; i < 150; i++)
                {
                    Console.Write("-");
                }
                Console.Write("\nNhập ID bộ phận muốn xóa: ");
                id = Int32.Parse(Console.ReadLine());
                if (de_control.FindDepartment(id).idDepartment == 0)
                {
                    Console.WriteLine("ID sai. Mời nhập lại");
                    continue;
                }

                PrintDepartment(de_control.FindDepartment(id));
                Console.WriteLine("\nNhấn enter để xóa.....");
                ConsoleKeyInfo key = Console.ReadKey(true);
                if (key.Key == ConsoleKey.Enter)
                {
                    Console.WriteLine("Đã xóa thành công...");
                    System.Threading.Thread.Sleep(500);
                    break;
                }
            }
            de_control.DeleteDepartmentInfo(id);
        }
Exemplo n.º 2
0
        public void CreateStaffInfo(string name, DateTime birthday, GenderType gender, int idDepartment, string CMND, int salary)
        {
            if (listStaff.Count == 0)
            {
                StaffModel.ID = 0;
            }
            else
            {
                StaffModel.ID = listStaff[listStaff.Count - 1].idNumber;
            }
            StaffModel staff = new StaffModel(name, birthday, gender, departmentcontrol.FindDepartment(idDepartment), CMND, salary);

            IOMethod.Instance.WriteData <StaffModel>(path, staff);
            listStaff.Add(staff);
        }