Exemplo n.º 1
0
        void addUsers()
        {
            Console.WriteLine();
            Console.WriteLine("ADDING USERS...");

            try
            {
                // public User(DateTime birthDate, String dni, String email, String name, int telephon, int cvv, DateTime expirationDate, string login, int number, string password)
                User u1 = new User(Convert.ToDateTime("01/01/2001"), "11111111A", "*****@*****.**", "First User", 606123123, 123, Convert.ToDateTime("01/01/2025"), "user1", 12345678, "user1");
                service.registerUser(u1);
            }
            catch (Exception e)
            {
                printError(e);
            }

            try
            {
                // public User(DateTime birthDate, String dni, String email, String name, int telephon, int cvv, DateTime expirationDate, string login, int number, string password)
                User u1 = new User(Convert.ToDateTime("01/01/2010"), "22222222B", "*****@*****.**", "Second User", 605321321, 321, Convert.ToDateTime("01/01/2025"), "user2", 12345679, "user2");
                service.registerUser(u1);
            }
            catch (Exception e)
            {
                printError(e);
            }

            try
            {
                // public User(DateTime birthDate, String dni, String email, String name, int telephon, int cvv, DateTime expirationDate, string login, int number, string password)
                User u1 = new User(Convert.ToDateTime("01/01/2000"), "33333333B", "*****@*****.**", "Third User", 604321321, 321, Convert.ToDateTime("01/01/2025"), "user1", 12345670, "user3");
                service.registerUser(u1);
            }
            catch (Exception e)
            {
                printError(e);
            }

            try
            {
                // public User(DateTime birthDate, String dni, String email, String name, int telephon, int cvv, DateTime expirationDate, string login, int number, string password)
                User u1 = new User(Convert.ToDateTime("01/01/2001"), "44444444A", "*****@*****.**", "Fourth User", 606456123, 133, Convert.ToDateTime("31/10/2019"), "user4", 15345678, "user4");
                service.registerUser(u1);
            }
            catch (Exception e)
            {
                printError(e);
            }

            try
            {
                // public User(DateTime birthDate, String dni, String email, String name, int telephon, int cvv, DateTime expirationDate, string login, int number, string password)
                User u1 = new User(Convert.ToDateTime("01/01/1989"), "55555555A", "*****@*****.**", "Fifth User", 608123888, 123, Convert.ToDateTime("01/01/2025"), "user5", 12435678, "user5");
                service.registerUser(u1);
            }
            catch (Exception e)
            {
                printError(e);
            }

            try
            {
                // public User(DateTime birthDate, String dni, String email, String name, int telephon, int cvv, DateTime expirationDate, string login, int number, string password)
                User u1 = new User(Convert.ToDateTime("01/01/1989"), "66666666A", "*****@*****.**", "Sixth User", 606666888, 623, Convert.ToDateTime("01/01/2024"), "user6", 12466676, "user6");
                service.registerUser(u1);
            }
            catch (Exception e)
            {
                printError(e);
            }

            try
            {
                // public User(DateTime birthDate, String dni, String email, String name, int telephon, int cvv, DateTime expirationDate, string login, int number, string password)
                User u1 = new User(Convert.ToDateTime("01/01/1988"), "77777777G", "*****@*****.**", "Seventh User", 606677888, 627, Convert.ToDateTime("01/01/2023"), "user7", 17467676, "user7");
                service.registerUser(u1);
            }
            catch (Exception e)
            {
                printError(e);
            }

            foreach (User u in service.getAllUsers())
            {
                Console.WriteLine(userToString(u));
            }
        }