Examples of YFRestaurant


Examples of com.supinfo.youfood.entity.YFRestaurant

            } else {
                employee.setPassword(employeeService.hash(req.getParameter("password")));
            }
        }

        YFRestaurant restaurant = null;
        if (req.getParameter("restaurant") != null && !req.getParameter("restaurant").isEmpty()) {
            try {
                long restaurantId = Long.parseLong(req.getParameter("restaurant"));
                // On dit qu'un ID de restaurant à 0 normal. C'est pour permettre la différenciation
                // entre les administrateur à l'échelle d'un restaurant et les administrateurs
View Full Code Here

Examples of com.supinfo.youfood.entity.YFRestaurant

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        YFRestaurant restaurant = new YFRestaurant();
        boolean isOk = true;

        if (req.getParameter("id") != null && !req.getParameter("id").isEmpty()) {
            try {
                restaurant = restaurantService.getRestaurant(Long.parseLong(req.getParameter("id")));
                req.setAttribute("isRestaurantEdition", true);
            } catch (Exception e) {
                System.out.println("ID en chaine de caractères.");
                req.setAttribute("idError", "Une erreur est survenue lors de la mise à jour du restaurant");
                isOk = false;
            }
        }

        if (req.getParameter("name") == null || req.getParameter("name").isEmpty()) {
            req.setAttribute("nameError", "Ne doit pas être vide.");
            isOk = false;
        } else if ((restaurant.getId() == null || restaurant.getId() <= 0) && restaurantService.getRestaurant(req.getParameter("name")) != null) {
            req.setAttribute("nameError", "Le nom du restaurant est déjà pris.");
            isOk = false;
        }

        // Si le restaurant existe et que nous voulons changer le mdp
       /* if (restaurant.getId() != null && restaurant.getId() > 0) {
            if (req.getParameter("changePassword") != null && req.getParameter("changePassword").equals("on")) {
                req.setAttribute("changePasswordIsSelected", "checked");
                if (req.getParameter("password") == null || req.getParameter("password").isEmpty()) {
                    req.setAttribute("passwordError", "Ne doit pas être vide.");
                    isOk = false;
                }
            }
        } else {
            // Si le restaurant est nouveau, nous devons obligatoirement mettre un mdp
            if (req.getParameter("password") == null || req.getParameter("password").isEmpty()) {
                req.setAttribute("passwordError", "Ne doit pas être vide.");
                isOk = false;
            }
        }*/

        restaurant.setAddress(req.getParameter("address").toString());
        restaurant.setName(req.getParameter("name").toString());
        //restaurant.setPassword(req.getParameter("password").toString());

        if (isOk) {

            if (restaurant.getId() == null || restaurant.getId() == 0) {
                restaurantService.createRestaurant(restaurant);
            } else {
                restaurantService.updateRestaurant(restaurant);
            }

View Full Code Here

Examples of com.supinfo.youfood.entity.YFRestaurant

    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        YFEmployee user = (YFEmployee) req.getSession().getAttribute("user");

        List<YFRestaurant> restaurants = restaurantService.getRestaurants();

        YFRestaurant restaurant = user.getRestaurant();
        if (restaurant == null) {
            if (req.getParameter("restaurant") != null) {
                // Récupération du restaurant demandé.
                try {
                    restaurant = restaurantService.getRestaurant(Long.parseLong(req.getParameter("restaurant")));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.