📄 datamodel.java
字号:
return 1; } } private int writeData() { if(currentFunction == 2){ //Update customer information try { customer.setName(last, first, mid, returned); customer.setAddress(str, cty, st, zp, tel, mail, returned); return 0; } catch (RemoteException ex) { frame.messlab.setText(messages.getString("RemoteException") + ex.getMessage()); return 1; } catch (InvalidParameterException ex) { frame.messlab.setText(messages.getString("InvalidParameterException")); return 1; } catch (CustomerNotFoundException ex) { frame.messlab2.setText(messages.getString("CustomerException") + " " + returned + " " + messages.getString("NotFoundException")); return 1; } } if(currentFunction == 1) { //Add new customer information try { custID = customer.createCustomer(last, first, mid, str, cty, st, zp, tel, mail); return 0; } catch (RemoteException ex) { frame.messlab.setText(messages.getString("RemoteException")); return 1; } catch (InvalidParameterException ex) { frame.messlab.setText(messages.getString("InvalidParameterException")); return 1; } } if(currentFunction == 5) { //Create New Account try { timestamp = new Date(); actID = account.createAccount(custID, type, descrip, balance, creditline, beginbalance, timestamp); System.out.println(actID); return 0; } catch (CustomerNotFoundException ex) { frame.messlab2.setText(messages.getString("CustomerException") + " " + this.custID + " " + messages.getString("NotFoundException")); return 1; } catch (RemoteException ex) { frame.messlab.setText(messages.getString("RemoteException") + ex.getMessage()); return 1; } catch (InvalidParameterException ex) { frame.messlab.setText(messages.getString("InvalidParameterException")); return 1; } catch (IllegalAccountTypeException ex) { frame.messlab3.setText(messages.getString("IllegalAccountTypeException")); return 1; } } if(currentFunction == 6) { //Add Customer to Account try { account.addCustomerToAccount(custID, actID); return 0; } catch (RemoteException ex) { frame.messlab.setText(messages.getString("RemoteException")); return 1; } catch (InvalidParameterException ex) { frame.messlab.setText(messages.getString("InvalidParameterException")); return 1; } catch (CustomerNotFoundException ex) { frame.messlab2.setText(messages.getString("CustomerException") + " " + this.custID + " " + messages.getString("NotFoundException")); return 1; } catch (AccountNotFoundException ex) { frame.messlab2.setText(messages.getString("AccountException") + " " + this.actID + " " + messages.getString("NotFoundException")); return 1; } catch (CustomerInAccountException ex) { frame.messlab4.setText(messages.getString("CustomerException") + " " + this.custID + " " + messages.getString("CustomerInAccountException") + " " + this.actID); return 1; } } return 0; } protected void removeAccount(String returned) { try { account.removeAccount(returned); frame.messlab2.setText(messages.getString("AccountException") + " " + returned + " " + messages.getString("Removed")); } catch (AccountNotFoundException ex) { frame.messlab2.setText(messages.getString("AccountException") + " " + returned + " " + messages.getString("NotFoundException")); } catch (RemoteException ex) { frame.messlab.setText(messages.getString("RemoteException") + ex.getMessage()); } catch (InvalidParameterException ex) { frame.messlab.setText(messages.getString("InvalidParameterException")); } } protected void searchByLastName(String returned) { try { ArrayList list = customer.getCustomersOfLastName(returned); if(!list.isEmpty()){ String custID = ((CustomerDetails)list.get(0)).getCustomerId(); JOptionPane.showMessageDialog(frame, custID, "Customer ID is:", JOptionPane.PLAIN_MESSAGE); } else { frame.messlab.setText(returned + " " + messages.getString("NotFoundException")); } } catch (RemoteException ex) { frame.messlab.setText("RemoteException" + ex.getMessage()); } catch (InvalidParameterException ex) { frame.messlab.setText("InvalidParameterException"); } } protected void createActInf(int currentFunction, String returned) { AccountDetails details = null; //View Account Information if((currentFunction == 4) && (returned.length() > 0)) { try { details = account.getDetails(returned); boolean readonly = true; frame.setDescription(details.getDescription()); ArrayList alist = new ArrayList(); alist = details.getCustomerIds(); frame.createActFields(readonly, details.getType(), details.getBalance(), details.getCreditLine(), details.getBeginBalance(), alist, details.getBeginBalanceTimeStamp()); } catch (AccountNotFoundException ex) { frame.resetPanelTwo(); frame.messlab3.setText(messages.getString("AccountException") + " " + returned + " " + messages.getString("NotFoundException")); } catch (RemoteException ex) { frame.messlab.setText("Remote Exception" + ex.getMessage()); } catch (InvalidParameterException ex) { frame.messlab.setText("InvalidParameterException"); } } //Create Account Information if(currentFunction == 5) { timestamp = new Date(); frame.setDescription(null); boolean readonly = false; ArrayList alist = new ArrayList(); frame.createActFields(readonly, null, bigzero, bigzero, bigzero, alist, timestamp); } } protected void createCustInf(int currentFunction, String returned) { CustomerDetails details = null; //View Customer Information if((currentFunction == 3) && (returned.length() > 0)) { try { details = customer.getDetails(returned); boolean readonly = true; frame.createCustFields(true, details.getFirstName(), details.getLastName(), details.getMiddleInitial(), details.getStreet(), details.getCity(), details.getState(), details.getZip(), details.getPhone(), details.getEmail()); } catch (RemoteException ex) { frame.messlab.setText("Remote Exception" + ex.getMessage()); } catch (InvalidParameterException ex) { frame.messlab.setText("InvalidParameterException"); } catch (CustomerNotFoundException ex) { frame.resetPanelTwo(); frame.messlab2.setText(messages.getString("CustomerException") + " " + returned + " " + messages.getString("NotFoundException")); } } //Update Customer Information if((currentFunction == 2) && (returned.length() > 0)) { try { details = customer.getDetails(returned); boolean readonly = false; frame.createCustFields(false, details.getFirstName(), details.getLastName(), details.getMiddleInitial(), details.getStreet(), details.getCity(), details.getState(), details.getZip(), details.getPhone(), details.getEmail()); } catch (RemoteException ex) { frame.messlab.setText("Remote Exception" + ex.getMessage()); } catch (InvalidParameterException ex) { frame.messlab.setText("InvalidParameterException"); } catch (CustomerNotFoundException ex) { frame.resetPanelTwo(); frame.messlab2.setText(messages.getString("CustomerException") + " " + returned + " " + messages.getString("NotFoundException")); } } //Create Customer Information if(currentFunction == 1) { boolean readonly = false; frame.createCustFields(false, null, null, null, null, null, null, null, null, null); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -