Package club.beans

Examples of club.beans.AdministratorBean


        String acc = txtAccount.getText();
        String pass = txtPassword.getText();
        if (acc == null || pass == null) {
            JOptionPane.showMessageDialog(rootPane, "Please input account and password!", "Error!", JOptionPane.ERROR_MESSAGE);
        } else {
            AdministratorBean auth = DataAdmin.getAuthentication(acc);
            if (auth != null && pass.equals(auth.getPassword())) {
                String name = auth.getFullname();
                //JOptionPane.showMessageDialog(rootPane, "Hello "+name, "Error!", JOptionPane.ERROR_MESSAGE);
                DataConfig dataConfig = new DataConfig();
                ConfigBean config = dataConfig.readConfigFile();
                config.setAdminAccount(acc);
                config.setAdminID(auth.getAdminID());
                if (dataConfig.writeConfigFile(config)){
                    new MainFrame();
                } else{
                    JOptionPane.showMessageDialog(rootPane, "Error! Click OK to exit application", "Error!", JOptionPane.ERROR_MESSAGE);
                    System.exit(0);
View Full Code Here


        try {
            conn = ConnectDB.connectMSDB();
            stmt = conn.createStatement();
            rs = stmt.executeQuery(query);
            while (rs.next()) {
                AdministratorBean bean = new AdministratorBean();
                bean.setAccount(rs.getString("Account"));
                bean.setPassword(rs.getString("Password"));
                bean.setFullname(rs.getString("Fullname"));
                bean.setAdminID(rs.getInt("AdminID"));
                bean.setStatus(rs.getInt("Status"));
                list.add(bean);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
View Full Code Here

        }
        return list;
    }
    
    public static AdministratorBean getAuthentication(String account) {
        AdministratorBean admin = null;
        String query = "SELECT * FROM Administrator WHERE Account='" + account+"'";
        try {
            conn = ConnectDB.connectMSDB();
            stmt = conn.createStatement();
            rs = stmt.executeQuery(query);
            if (rs.next()) {
                admin = new AdministratorBean();
                admin.setAccount(rs.getString("Account"));
                admin.setAdminID(rs.getInt("AdminID"));
                admin.setFullname(rs.getNString("Fullname"));
                admin.setPassword(rs.getString("Password"));
                admin.setStatus(rs.getInt("Status"));
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
View Full Code Here

        }
        return flag;
    }
   
     public static AdministratorBean getAdminByID(int id) { // find a member by ID and return as Bean
        AdministratorBean bean = null;
        String query = "SELECT * FROM Administrator WHERE AdminID=" + id;
        try {
            conn = ConnectDB.connectMSDB();
            stmt = conn.createStatement();
            rs = stmt.executeQuery(query);
            if (rs.next()) {
                bean = new AdministratorBean();
                bean.setAccount(rs.getString("Account"));
                bean.setPassword(rs.getString("Password"));
                bean.setFullname(rs.getString("Fullname"));
                bean.setAdminID(rs.getInt("AdminID"));
                bean.setStatus(rs.getInt("Status"));
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
View Full Code Here

        return DataAdmin.isExistID(admin, adminID);
    }
    public boolean isFullControlAdmin(){
        try{
            ConfigBean config = readConfigFile();
            AdministratorBean admin = DataAdmin.getAdminByID(config.getAdminID());
            return (admin.getStatus()== 2) ? true: false;
        } catch (Exception e){
            e.printStackTrace();
            return false;
        }
    }
View Full Code Here

        int selectedRow = tblAdmin.getSelectedRow();
        if (selectedRow == -1) {
            JOptionPane.showMessageDialog(rootPane, "You must chose one admin first!", "Error!", JOptionPane.ERROR_MESSAGE);
        } else {
            int id = (int) tblAdmin.getModel().getValueAt(selectedRow, 0);
            AdministratorBean bean = DataAdmin.getAdminByID(id);
            lbAccount.setVisible(false);
            tfAccount.setVisible(false);
            tfAdminName.setText(bean.getFullname());
            txtHiddenID.setText(bean.getAdminID() + "");
            tfNewpassword.setText("");
            tfConfirmPassword.setText("");
            lbLine2.setText("New password");
            lbLine3.setText("Confirm new password");
            btn_ApplyName.setVisible(true);
            btn_ApplyPassword.setVisible(true);
            btn_ApplyStatus.setVisible(true);
            btn_Submit.setVisible(false);
            cbbStatus.setSelectedIndex(bean.getStatus());
            panelForm.setVisible(true);
            this.setSize(this.getWidth(), 580);
        }
    }//GEN-LAST:event_btn_UpdateActionPerformed
View Full Code Here

        int selectedRow = tblAdmin.getSelectedRow();
        if (selectedRow == -1) {
            JOptionPane.showMessageDialog(rootPane, "You must chose one admin first!", "Error!", JOptionPane.ERROR_MESSAGE);
        } else {
            int id = (int) tblAdmin.getModel().getValueAt(selectedRow, 0);
            AdministratorBean bean = DataAdmin.getAdminByID(id);
           
        }
    }//GEN-LAST:event_btn_DeleteActionPerformed
View Full Code Here

TOP

Related Classes of club.beans.AdministratorBean

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.