Пример #1
0
        public static FullTime AddFTEmployee()
        {
            FullTime AddFullTime = null;

            Console.WriteLine("What is your name?");
            string employeeName = Console.ReadLine();

            employeeName = UserValidation.IsNullOrWhiteSpace(employeeName);
            Console.WriteLine("What is your address?");
            string employeeAddress = Console.ReadLine();

            employeeAddress = UserValidation.IsNullOrWhiteSpace(employeeAddress);
            Console.WriteLine("What is your current pay?");
            decimal employeePay = UserValidation.GetDecimal();

            AddFullTime = new FullTime(employeeName, employeeAddress, employeePay);

            return(AddFullTime);
        }
Пример #2
0
        //Metho to add an employee to salary.
        public static Salaried AddSalariedEmployee()
        {
            Salaried AddSalaryEmployee = null;

            Console.WriteLine("What is your name?");
            string employeeName = Console.ReadLine();

            employeeName = UserValidation.IsNullOrWhiteSpace(employeeName);
            Console.WriteLine("What is your address?");
            string employeeAddress = Console.ReadLine();

            employeeAddress = UserValidation.IsNullOrWhiteSpace(employeeAddress);
            Console.WriteLine("What is the employee's salary?");
            decimal employeePay = UserValidation.GetDecimal();

            AddSalaryEmployee = new Salaried(employeeName, employeeAddress, employeePay);

            return(AddSalaryEmployee);
        }
Пример #3
0
        public static Manager AddManager()
        {
            Manager AddManager = null;

            Console.WriteLine("What is employee name?");
            string employeeName = Console.ReadLine();

            employeeName = UserValidation.IsNullOrWhiteSpace(employeeName);
            Console.WriteLine("What is the employee address?");
            string employeeAddress = Console.ReadLine();

            employeeAddress = UserValidation.IsNullOrWhiteSpace(employeeAddress);
            Console.WriteLine("What is the annual salary?");
            decimal employeePay = UserValidation.GetDecimal();

            Console.WriteLine("What is the annual bonus?");
            decimal employeeBonus = UserValidation.GetDecimal();

            AddManager = new Manager(employeeName, employeeAddress, employeePay, employeeBonus);

            return(AddManager);
        }
Пример #4
0
        public static PartTime AddPTEmployee()
        {
            PartTime AddPartTime = null;

            Console.WriteLine("What is your name?");
            string employeeName = Console.ReadLine();

            employeeName = UserValidation.IsNullOrWhiteSpace(employeeName);
            Console.WriteLine("What is your address?");
            string employeeAddress = Console.ReadLine();

            employeeAddress = UserValidation.IsNullOrWhiteSpace(employeeAddress);
            Console.WriteLine("What is your current pay?");
            decimal employeePay = UserValidation.GetDecimal();

            Console.WriteLine("How many hours per week are you working?");
            decimal hoursPerWeek = UserValidation.GetDecimal();

            AddPartTime = new PartTime(employeeName, employeeAddress, employeePay, hoursPerWeek);

            return(AddPartTime);
        }
Пример #5
0
        public static Contractor AddContractorEmployee()
        {
            Contractor AddContractor = null;

            Console.WriteLine("What is your name?");
            string employeeName = Console.ReadLine();

            employeeName = UserValidation.IsNullOrWhiteSpace(employeeName);
            Console.WriteLine("What is your address?");
            string employeeAddress = Console.ReadLine();

            employeeAddress = UserValidation.IsNullOrWhiteSpace(employeeAddress);
            Console.WriteLine("What is your current pay?");
            decimal employeePay = UserValidation.GetDecimal();

            Console.WriteLine("How many hours per week are you working?");
            decimal hoursPerWeek    = UserValidation.GetDecimal();
            decimal noBenefitsBonus = 10;

            AddContractor = new Contractor(employeeName, employeeAddress, noBenefitsBonus, employeePay, hoursPerWeek);

            return(AddContractor);
        }
Пример #6
0
        static void Main(string[] args)
        {
            List <Employee> EmployeeList = new List <Employee>();

            //Bool to keep the program running
            bool ProgramIsRunning = true;

            while (ProgramIsRunning)
            {
                //Menu
                Console.WriteLine("List of Employee");
                Console.WriteLine("1. Add Employee");
                Console.WriteLine("2. Remove Employee");
                Console.WriteLine("3. Display Payroll");
                Console.WriteLine("4. Exit");
                string userInput = Console.ReadLine();
                userInput = UserValidation.IsNullOrWhiteSpace(userInput.ToLower());

                //utilize swith to valid the users response.
                switch (userInput)
                {
                case "1":
                case "1.":
                case "add employee":
                {
                    //Add employee - lets the user to choose to create an employee of type
                    //(FullTime, PartTime, Contractor, Salaried, or Manager) prompts the user for the appropriate values,
                    //and adds them to the list.
                    Console.WriteLine("Please choose one of the following options to add an Employee: ");
                    Console.WriteLine("1. Full Time");
                    Console.WriteLine("2. Part Time");
                    Console.WriteLine("3. Contractor");
                    Console.WriteLine("4. Salaried");
                    Console.WriteLine("5. Manager");
                    string addEmployee = Console.ReadLine();
                    addEmployee = UserValidation.IsNullOrWhiteSpace(addEmployee);
                }
                break;

                case "2":
                case "2.":
                case "remove employee":
                {
                }
                break;

                case "3":
                case "3.":
                case "display payroll":
                {
                }
                break;

                case "4":
                case "4.":
                case "exit":
                {
                    Console.WriteLine("You have chosen to exit you are now exiting the program.");
                    ProgramIsRunning = false;
                    Utility.PauseBeforeContinuing();
                }
                break;

                default:
                {
                    Console.WriteLine("You have not chosen a valid response.");
                    Utility.PauseBeforeContinuing();
                }
                break;
                }
            }
        }
Пример #7
0
        static void Main(string[] args)
        {
            List <Employee> EmployeeList = new List <Employee>();



            //Bool to keep the program running
            bool ProgramIsRunning = true;

            while (ProgramIsRunning)
            {
                Console.Clear();
                //Menu

                Console.WriteLine("---------------------Menu--------------------- \n ");
                Console.WriteLine("1. Add Employee");
                Console.WriteLine("2. Remove Employee");
                Console.WriteLine("3. Display Payroll");
                Console.WriteLine("4. Exit");
                Console.Write("\n Please select one of the following options from the menu above: ");
                string userInput = Console.ReadLine();
                userInput = UserValidation.IsNullOrWhiteSpace(userInput.ToLower());

                //utilize swith to valid the users response.
                switch (userInput)
                {
                case "1":
                case "1.":
                case "add employee":
                {
                    Console.Clear();
                    //Add employee - lets the user to choose to create an employee of type
                    //(FullTime, PartTime, Contractor, Salaried, or Manager) prompts the user for the appropriate values,
                    //and adds them to the list.
                    Console.WriteLine("---------Menu--------- \n");

                    Console.WriteLine("1. Full Time");
                    Console.WriteLine("2. Part Time");
                    Console.WriteLine("3. Contractor");
                    Console.WriteLine("4. Salaried");
                    Console.WriteLine("5. Manager \n");
                    Console.Write("Please choose one of the following options to add an Employee: ");
                    string addEmployee = Console.ReadLine();
                    addEmployee = UserValidation.IsNullOrWhiteSpace(addEmployee.ToLower());
                    if ((addEmployee == "full time" || addEmployee == "1") || (addEmployee == "1." || addEmployee == "fulltime"))
                    {
                        Console.Clear();
                        EmployeeList.Add(FullTime.AddFTEmployee());
                    }
                    if ((addEmployee == "part time" || addEmployee == "2") || (addEmployee == "2." || addEmployee == "parttime"))
                    {
                        Console.Clear();
                        EmployeeList.Add(PartTime.AddPTEmployee());
                    }
                    if ((addEmployee == "contractor" || addEmployee == "3") || addEmployee == "3.")
                    {
                        Console.Clear();
                        EmployeeList.Add(Contractor.AddContractorEmployee());
                    }
                    if ((addEmployee == "salaried" || addEmployee == "4") || addEmployee == "4.")
                    {
                        Console.Clear();
                        EmployeeList.Add(Salaried.AddSalariedEmployee());
                    }
                    if ((addEmployee == "manager" || addEmployee == "5") || addEmployee == "5.")
                    {
                        Console.Clear();
                        EmployeeList.Add(Manager.AddManager());
                    }
                    else
                    {
                        Console.WriteLine("You did not enter a valid response. Please enter one of the menu options above.");
                        Utility.PauseBeforeContinuing();
                    }
                }
                break;

                case "2":
                case "2.":
                case "remove employee":
                {
                    Console.Clear();
                    DisplayList(EmployeeList);
                    Console.WriteLine("Please select the number next to the Employees that you wish to remove:");
                    RemoveEmployee(EmployeeList);
                    Utility.PauseBeforeContinuing();
                }
                break;

                case "3":
                case "3.":
                case "display payroll":
                {
                    Console.Clear();
                    DisplayPayroll(EmployeeList);
                    Utility.PauseBeforeContinuing();
                }
                break;

                case "4":
                case "4.":
                case "exit":
                {
                    Console.WriteLine("You have chosen to exit you are now exiting the program.");
                    ProgramIsRunning = false;
                    Utility.PauseBeforeContinuing();
                }
                break;

                default:
                {
                    Console.WriteLine("You have not chosen a valid response.");
                    Utility.PauseBeforeContinuing();
                }
                break;
                }
            }
        }