Package classes

Examples of classes.Profile


            }
            else {

                DAO dao = DAO.getInstance();
                /*We find the corresponding user profile*/
                Profile profile = (Profile) dao.get(2, username);

                /*we modify the profile accordingly*/
                profile.setFirstName(firstName);
                profile.setLastName(lastName);
                profile.setEmail(email);
                profile.setPhone(phone);

                if (!street.isEmpty())
                    profile.setStreet(street);
                if (!city.isEmpty())
                    profile.setCity(city);
                if (!department.isEmpty())
                    profile.setDepartment(department);

                /*we overwrite the profile in the database*/
                dao.put(profile);

                request.setAttribute("errorMessage", "<font size=\"3\" "
View Full Code Here


        User admin = new User("admin", "admin", "Admin");
        dao.put(admin);


        //User Profile
        Profile profile = new Profile("ion.morozan", "test", "ion", "morozan",
                "ion.morozan@gmail.com", "0745342231", "Kolej Strahov", "Prague", "6");
        dao.put(profile);
        profile = new Profile("andreea.sandu", "test", "andreea", "sandu",
                "andreea.sandu@cti.cz", "0745343453", "Kolej Strahov", "Prague", "6");
        dao.put(profile);
        profile = new Profile("milan", "test", "milan", "milan",
                "milan@milan.com", "0745111111", "Devijka", "Prague", "6");
        dao.put(profile);

         //Company Profile
        CompanyProfile companyProfile = new CompanyProfile("KLM", "test", "KLM",
View Full Code Here

        String city = request.getParameter("city");
        String department = request.getParameter("department");
        String passwordAgain = request.getParameter("passwordAgain");

        /* create new user */
        Profile profile = new Profile(username, password, firstName, lastName,
                email, phone, street, city, department);
        /* instance of database */
        DAO dao = DAO.getInstance();

        /* all fields must be filled */
        if (username.isEmpty() || password.isEmpty() || firstName.isEmpty()
                || lastName.isEmpty() || email.isEmpty() || phone.isEmpty()) {
            request.setAttribute("fillAllFields", "<font size=\"3\" "
                    + "face=\"arial\" color=\"red\">"
                    + "You must fill all the fields! </font>");
            RequestDispatcher rd = request.getRequestDispatcher("register.jsp");
            rd.forward(request, response);
            /* wrong phone format*/
        } else if (!phone.matches("[0-9]+")) {
            request.setAttribute("wrongPhoneFormat", "<font size=\"3\" "
                    + "face=\"arial\" color=\"red\">"
                    + "Wrong Phone Format! Must contains only numbers </font>");
            RequestDispatcher rd = request.getRequestDispatcher("register.jsp");
            rd.forward(request, response);
            /* username already exists */
        } else if (dao.exists(profile.getId(), username)) {
            request.setAttribute("userAlreadyExists", "<font size=\"3\" "
                    + "face=\"arial\" color=\"red\">"
                    + "Username already exists! Choose another one!</font>");
            RequestDispatcher rd = request.getRequestDispatcher("register.jsp");
            rd.forward(request, response);
View Full Code Here

TOP

Related Classes of classes.Profile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.