minor changes
[RRRRHHHH_Code] / ruralHouses / src / businessLogic / AccountManager.java
index 3f0bc5b..ab418c9 100644 (file)
@@ -6,8 +6,10 @@ import java.rmi.server.UnicastRemoteObject;
 import javax.mail.MessagingException;
 
 import common.AccountInterface;
+
 import dataAccess.DB4oManager;
 import domain.Account;
+import domain.Administrator;
 
 public class AccountManager extends UnicastRemoteObject implements AccountInterface {
        
@@ -27,7 +29,8 @@ public class AccountManager extends UnicastRemoteObject implements AccountInterf
                }
        }
        
-       public boolean addAccount(Account ac) throws RemoteException {
+       public boolean addAccount(int index) throws RemoteException {
+               Account ac = Administrator.getInstance().getNewOwnerRequest().get(index);
                if(this.dbMngr.addAccount(ac)){
                        try {
                                MailManager.getInstance().Send(ac.getOwner().getMailAccount(), "Entered into the system", "Congratulations");
@@ -40,9 +43,14 @@ public class AccountManager extends UnicastRemoteObject implements AccountInterf
                
        }
        
-       public boolean removeAccount(Account ac)throws RemoteException {
-               if(this.dbMngr.removeAccount(ac))
-                       return true;
+       public boolean removeAccount(int index)throws RemoteException {
+               OwnerManager own = new OwnerManager();
+               try {
+                       if(this.dbMngr.removeAccount(own.getOwners().get(index)))
+                               return true;
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
                return false;
                
        }