Booking confirmation and e-mail service added. Some bugs to be solved.
[RRRRHHHH_Code] / ruralHouses / src / businessLogic / AccountManager.java
1 package businessLogic;
2
3 import javax.mail.MessagingException;
4
5 import dataAccess.DB4oManager;
6 import domain.Account;
7
8 public class AccountManager {
9         
10         private DB4oManager dbMngr;
11         
12         
13         public AccountManager() {
14                 try {
15                         dbMngr = DB4oManager.getInstance();
16                 } catch (Exception e) {
17
18                         e.printStackTrace();
19                 }
20         }
21         
22         public boolean addAccount(Account ac){
23                 if(this.dbMngr.addAccount(ac)){
24                         try {
25                                 MailManager.getInstance().Send(ac.getOwner().getMailAccount(), "Entered into the system", "Congratulations");
26                         } catch (MessagingException e) {
27                                 // TODO Auto-generated catch block
28                                 e.printStackTrace();
29                         }
30                         return true;
31                         }
32                 return false;
33                 
34         }
35         
36         public boolean removeAccount(Account ac){
37                 if(this.dbMngr.removeAccount(ac))
38                         return true;
39                 return false;
40                 
41         }
42 }