Examples of YFPlanning


Examples of com.supinfo.youfood.entity.YFPlanning

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

        if (user.getRestaurant() != null) {
            // récupération du secteur dans lequel est actuellement le serveur
            YFPlanning planning = planningService.getEmployeeCurrentPlanning(new Date(), user);
            req.setAttribute("currentPlanning", planning);
           
            Calendar cal = Calendar.getInstance();
            cal.setTime(new Date());
            cal.setFirstDayOfWeek(Calendar.MONDAY);
View Full Code Here

Examples of com.supinfo.youfood.entity.YFPlanning

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

        if (user.getRestaurant() != null) {
            // récupération du secteur dans lequel est actuellement le serveur
            YFPlanning planning = planningService.getEmployeeCurrentPlanning(new Date(), user);
            req.setAttribute("currentPlanning", planning);

            if (planning != null) {
                ArrayList<YFTable> freeTables = (ArrayList<YFTable>) tableService.getFreeTables(planning.getArea());
                req.setAttribute("tables", freeTables);
                req.setAttribute("content", "/waiter/table/list.jsp");

            } else {
                req.setAttribute("content", "/waiter/error.jsp");
View Full Code Here

Examples of com.supinfo.youfood.entity.YFPlanning

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

        if (user.getRestaurant() != null) {
            // récupération du secteur dans lequel est actuellement le serveur
            YFPlanning planning = planningService.getEmployeeCurrentPlanning(new Date(), user);
            req.setAttribute("currentPlanning", planning);

            if (planning != null) {
                // TODO: Récupérer toutes les notifications dans son secteur. Donc, dont les tables sont dans son secteur.
                // TODO: Afficher tous les orders qui sont prêt à être servit.
                req.setAttribute("events", eventService.getAreaEvents(planning.getArea()));
                req.setAttribute("content", "/waiter/notification/list.jsp");

            } else {
                req.setAttribute("content", "/waiter/error.jsp");
            }
View Full Code Here

Examples of com.supinfo.youfood.entity.YFPlanning

        YFEmployee user = (YFEmployee) req.getSession().getAttribute("user");
       
        boolean isOk = true;
       
        if (user != null) {
            YFPlanning planning = new YFPlanning();
            if (req.getParameter("planningId") != null && !req.getParameter("planningId").isEmpty()) {
                try {
                    planning = planningService.getPlanning(Long.parseLong(req.getParameter("planningId")));
                } catch (Exception e) {
                    isOk = false;
                    req.setAttribute("planningError", "Il y a une erreur lors de la mise à jour de la tranche horaire");
                   
                }
            }
           
            YFArea area = null;
            if (req.getParameter("areaId") != null && !req.getParameter("areaId").isEmpty()) {
                try {
                    area = areaService.getArea(Long.parseLong(req.getParameter("areaId")), user.getRestaurant().getId());
                    if (area == null) {
                        isOk = false;
                        req.setAttribute("areaError", "Il y a une erreur lors de la récupération du secteur");
                    }
                } catch (Exception e) {
                    isOk = false;
                    req.setAttribute("areaError", "Il y a une erreur lors de la récupération du secteur");
                }
            } else {
                isOk = false;
                req.setAttribute("areaError", "Il y a une erreur lors de la récupération du secteur");
            }
           
            YFEmployee employee = null;
            if (req.getParameter("employee") != null && !req.getParameter("employee").isEmpty()) {
                try {
                    employee = employeeService.getEmployee(Long.parseLong(req.getParameter("employee")));
                    if (employee == null) {
                        isOk = false;
                        req.setAttribute("employeeError", "Il y a une erreur lors de la récupération de l'employé");
                    }
                } catch (Exception e) {
                    isOk = false;
                    req.setAttribute("employeeError", "Il y a une erreur lors de la récupération de l'employé");
                }
            }
           
            Date startDate = null;
            Date endDate = null;
            if (req.getParameter("day") != null && !req.getParameter("day").isEmpty() && req.getParameter("startHour") != null && !req.getParameter("startHour").isEmpty()
                    && req.getParameter("endHour") != null && !req.getParameter("endHour").isEmpty()) {
               
                SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm");
                try {
                    startDate = sdf.parse(req.getParameter("day") + " " + req.getParameter("startHour"));
                    endDate = sdf.parse(req.getParameter("day") + " " + req.getParameter("endHour"));
                   
                    if (startDate.after(endDate)) {
                        isOk = false;
                        req.setAttribute("dateError", "Il y a une erreur dans les horaires");
                       
                    } else if (employee != null) {
                        ArrayList<YFPlanning> employeePlanning = (ArrayList<YFPlanning>) planningService.getEmployeePlanning(startDate, endDate, employee);
                        if (!employeePlanning.isEmpty()) {
                            isOk = false;
                            req.setAttribute("employeeDateError", "L'employé est déjà pris ailleurs lors de cette tranche horaire");
                        }
                    }
                   
                } catch (Exception e) {
                    isOk = false;
                    e.printStackTrace();
                }
            } else {
                System.out.println("Problème");
                isOk = false;
            }
           
            ArrayList<YFArea> areas = (ArrayList<YFArea>) areaService.getAreas(user.getRestaurant().getId());
            if (isOk) {
               
                planning.setEmployee(employee);
                planning.setEndDate(endDate);
                planning.setStartDate(startDate);
                planning.setArea(area);
                if (planning.getId() != null && planning.getId() > 0) {
                    planningService.updatePlanning(planning);
                } else {
                    planningService.createPlanning(planning);
                }
                req.setAttribute("selectedArea", area);
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.