Ejemplo n.º 1
0
        // method to add employees employees
        public void addEmployee(List <Employee> emp, List <Vacation> vacation)
        {
            // sorting list
            Employee empAdd      = new Employee();
            Vacation objVacation = new Vacation();
            var      id          = from objemp in emp
                                   orderby objemp.empID descending
                                   select objemp;

            empAdd.empID = id.First().empID + 1;
            try
            {
                Console.Write("Enter Employee Name:");
                empAdd.empName = Console.ReadLine();
                Console.Write("Enter Employee Address:");
                empAdd.empAddress = Console.ReadLine();
                Console.Write("Enter Employee Email:");
                empAdd.empEmail = Console.ReadLine();
                Console.Write("Enter Employee phone:");
                empAdd.empPhone = Console.ReadLine();
                Console.Write("Enter Employee role:");
                empAdd.empRole = Console.ReadLine();

                emp.Add(empAdd);
                objVacation.addVacation(vacation, empAdd.empID);

                Console.WriteLine("\n ########## Employee Deatil Added Successfull. ########## ");
            }
            catch (Exception)
            {
                Console.WriteLine("\n ########## Sorry! Something went wrong. Please try again.##########");
            }
        }
Ejemplo n.º 2
0
        // method to add payroll employees employees
        public void addPayroll(List <Payroll> payroll, List <Vacation> vacation)
        {
            // sorting list
            Payroll  payAdd      = new Payroll();
            Vacation objVacation = new Vacation();
            var      payid       = from objemp in payroll
                                   orderby objemp.PayrollID descending
                                   select objemp;

            try
            {
                payAdd.PayrollID = payid.First().payrollID + 1;
                Console.Write("Enter Employee ID:");
                payAdd.empID = int.Parse(Console.ReadLine());
                Console.Write("Enter hours employee worked:");
                payAdd.hoursWorked = double.Parse(Console.ReadLine());
                Console.Write("Enter hourly rate:");
                payAdd.rate = double.Parse(Console.ReadLine());
                Console.Write("Enter date(MM-DD-YYYY):");
                payAdd.date = Console.ReadLine();


                payroll.Add(payAdd);
                objVacation.addVacation(vacation, payAdd.empID);
                Console.WriteLine("\n ########## Employee Payroll Deatil Added Successfull. ########## ");
            }
            catch (Exception)
            {
                Console.WriteLine("\n ########## Sorry! Something went wrong. Please try again.##########");
            }
        }