private void emailUser(QuoteRequest quoteRequest) throws Exception { UserInterface user = UserEntityFactory.getInstance().getUser(quoteRequest.getUserName()); String userEmailSubject = "Quote Request Receipt"; StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("This is just a verification email. "); stringBuffer.append("We usually respond to quote request within 24 hours."); stringBuffer.append("\n\nThank You For Your Business."); String userEmailTextBody = stringBuffer.toString(); BasicEmailInfo basicEmailInfo = (BasicEmailInfo) new StoreEmailInfo(this.storeFrontInterface, userEmailSubject, userEmailTextBody); EmailInfo emailInfo = new EmailInfo(basicEmailInfo); // Send response to customer UserEmailEventHandler userEmailEventHandler = UserEmailEventHandlerSingletons.getInstance(UserEmailEventNameData.QUOTEREQUEST, user); userEmailEventHandler.receiveEmailInfo(UserEmailEventNameData.QUOTEREQUEST, emailInfo); }
private void emailAdmins(QuoteRequest quoteRequest) throws Exception { String adminEmailSubject = "Quote Request"; StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("\nUserName: "******"\nProject Info: \n"); stringBuffer.append(quoteRequest.getProjectInfo()); stringBuffer.append("\nUser Comments: \n"); stringBuffer.append(quoteRequest.getUserComments()); stringBuffer.append("\nBudget: \n"); stringBuffer.append(quoteRequest.getBudget()); stringBuffer.append("\nTime Frame: \n"); stringBuffer.append(quoteRequest.getTimeFrame()); stringBuffer.append("\nComments: \n"); stringBuffer.append(quoteRequest.getComments()); String adminEmailTextBody = stringBuffer.toString(); BasicEmailInfo basicEmailInfo = (BasicEmailInfo) new StoreEmailInfo(this.storeFrontInterface, adminEmailSubject, adminEmailTextBody); EmailInfo emailInfo = new EmailInfo(basicEmailInfo); // send request to store admins if subscribed to handler name for review and response UserEmailEventHandler storeAdminUserEmailEventHandler = AdminUserEmailEventHandlerSingletons.getInstance(UserEmailEventNameData.QUOTEREQUEST); UserEmailEventHandler adminUserEmailEventHandler = StoreAdminUserEmailEventHandlerSingletons.getInstance( UserEmailEventNameData.QUOTEREQUEST, this.storeFrontInterface); storeAdminUserEmailEventHandler.receiveEmailInfo( UserEmailEventNameData.QUOTEREQUEST, emailInfo); adminUserEmailEventHandler.receiveEmailInfo(UserEmailEventNameData.QUOTEREQUEST, emailInfo); }