Example #1
0
        public static Employee login()
        {
            //TODO : add try catch
            Employee E;

            while (true)
            {
                Console.WriteLine("Enter the Employee ID or q to quit: ");
                var input = Console.ReadLine();
                if (input == "q")
                {
                    Environment.Exit(0);
                }
                try
                {
                    var id = Int32.Parse(input);
                    E = EmployeeManager.GetEmployeeFromCsv(id);
                    if (E.valid())
                    {
                        break;
                    }
                }
                catch (ArgumentException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                Console.WriteLine("The ID is Invalid");
            }
            return(E);
        }
Example #2
0
        public Leave GetLeaveObjectFromUser(Employee e)
        {
            var l = new Leave();

            l.Index   = leavecount + 1;
            l.ID      = e.ID;
            l.Creator = e.Name;
            l.Manager = EmployeeManager.GetEmployeeFromCsv(e.ManID).Name;
            Console.WriteLine("Enter the title for the Leave: ");
            l.Title = Console.ReadLine();
            Console.WriteLine("Enter Description For the Leave: ");
            l.Description = Console.ReadLine();
            Console.WriteLine("Enter Start Date (DD-MM-YYYY): ");
            l.StartDate = DateTime.Parse(Console.ReadLine());
            Console.WriteLine("Enter End Date (DD-MM-YYYY): ");
            l.EndDate = DateTime.Parse(Console.ReadLine());
            l.Status  = LeaveStatus.Pending;
            return(l);
        }