Package dao

Examples of dao.AdminDao


            EntityManagerFactory emf = Persistence.createEntityManagerFactory("SisInfPengambilanCutiPU");
            EntityManager em = emf.createEntityManager();
            Tbladmin loginAdmin = new Tbladmin();
            loginAdmin.setUsername(username);
            loginAdmin.setPassword(password);
            AdminDAO adminDao = new AdminDAOImpl(em);
            if (adminDao.loginAdmin(loginAdmin)) {
                //LOGIN AS ADMIN
                HttpSession session = request.getSession(true);
                session.setAttribute("loginAdmin", "Administrator");
                response.sendRedirect("administrator/home.jsp");
            } else {
View Full Code Here


    public Resolution submit() {
        if (parola == null || utilizator == null) {
            getContext().getRequest().getSession(true).setAttribute("user", -3);
            return new ForwardResolution("/WEB-INF/jsp/home.jsp");
        }
        IAdminDao adminDao = new AdminDao();
        Admin admin = adminDao.adminExistent(utilizator, parola);
        if (admin != null) {
            getContext().getRequest().getSession(true).setAttribute("admin", admin.getIdAdmin());
            return new ForwardResolution(GeologiActionBean.class, "validareConturi");
        }
        IGeologDao geo = new GeologDao();
View Full Code Here

        getContext().getRequest().getSession(true).setAttribute("admin", 0);
        return new ForwardResolution("/WEB-INF/jsp/home.jsp");
    }

    public Resolution datePersonale() {
        IAdminDao adminDao = new AdminDao();
        int idAdmin = Integer.parseInt(getContext().getRequest().getSession(true).getAttribute("admin").toString());
        Admin adminC = adminDao.getAdminByID(idAdmin);
        parolaVeche = adminC.getParola();
        setAdmin(adminC);
        return new ForwardResolution("/WEB-INF/jsp/adminDatePersonale.jsp");
    }
View Full Code Here

        setAdmin(adminC);
        return new ForwardResolution("/WEB-INF/jsp/adminDatePersonale.jsp");
    }

    public Resolution submitDatePersonale() {
        IAdminDao adminDao = new AdminDao();
        Admin adminC = getAdmin();
        if (adminC.getParola().equals(getParolaVeche())) {
            adminDao.saveOrUpdate(adminC);
        } else {
            byte[] parolaB = adminC.getParola().getBytes();
            try {
                MessageDigest algorithm = MessageDigest.getInstance("MD5");
                algorithm.reset();
                algorithm.update(parolaB);
                byte messageDigest[] = algorithm.digest();

                StringBuffer hexString = new StringBuffer();
                for (int i = 0; i < messageDigest.length; i++) {
                    hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
                }
                adminC.setParola(hexString + "");

                adminDao.saveOrUpdate(adminC);
            } catch (Exception e) {
            }
        }
        return new ForwardResolution("/WEB-INF/jsp/adminDatePersonale.jsp");
    }
View Full Code Here

TOP

Related Classes of dao.AdminDao

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.