?? datamodel.java
字號:
if (frame.mi.getText() .length() > 1) { frame.messlab4.setText(messages.getString("MILimitException")); j = 1; } else { j = 0; } if (frame.state.getText() .length() > 2) { frame.messlab3.setText(messages.getString("StateLimitException")); k = 1; } else { k = 0; } if ((i == 0) && (j == 0) && (k == 0)) { int success = writeData(); return success; } else { 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(new CustomerDetails(last, first, mid, str, cty, st, zp, tel, mail)); return 0; } catch (InvalidParameterException ex) { frame.messlab.setText(messages.getString( "InvalidParameterException")); return 1; } catch (RemoteException ex) { frame.messlab.setText(messages.getString("RemoteException")); return 1; } } if (currentFunction == 5) { //Create New Account try { timestamp = new Date(); actID = account.createAccount(new AccountDetails(type, descrip, balance, creditline, beginbalance, timestamp), custID); System.out.println(actID); return 0; } catch (InvalidParameterException ex) { frame.messlab.setText(messages.getString( "InvalidParameterException")); return 1; } catch (CustomerNotFoundException ex) { frame.messlab2.setText(messages.getString("CustomerException") + " " + custID + " " + messages.getString("NotFoundException")); return 1; } catch (IllegalAccountTypeException ex) { frame.messlab.setText(messages.getString( "IllegalAccountTypeException")); return 1; } catch (RemoteException ex) { frame.messlab.setText(messages.getString("RemoteException") + ex.getMessage()); return 1; } } if (currentFunction == 6) { //Add Customer to Account try { account.addCustomerToAccount(custID, actID); return 0; } catch (CustomerNotFoundException ex) { frame.messlab2.setText(messages.getString("CustomerException") + " " + custID + " " + messages.getString("NotFoundException")); return 1; } catch (AccountNotFoundException ex) { frame.messlab2.setText(messages.getString("AccountException") + " " + actID + " " + messages.getString("NotFoundException")); return 1; } catch (InvalidParameterException ex) { frame.messlab.setText(messages.getString( "InvalidParameterException")); return 1; } catch (RemoteException ex) { frame.messlab.setText(messages.getString("RemoteException")); 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 (InvalidParameterException ex) { frame.messlab.setText(messages.getString( "InvalidParameterException")); } catch (RemoteException ex) { frame.messlab.setText(messages.getString("RemoteException") + ex.getMessage()); } } 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 (InvalidParameterException ex) { frame.messlab.setText("InvalidParameterException"); } catch (RemoteException ex) { frame.messlab.setText("RemoteException" + ex.getMessage()); } } 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 = account.getCustomerIds(returned); frame.createActFields(readonly, details.getType(), details.getBalance(), details.getCreditLine(), details.getBeginBalance(), alist, details.getBeginBalanceTimeStamp()); } catch (InvalidParameterException ex) { frame.messlab.setText(messages.getString( "InvalidParameterException")); } catch (AccountNotFoundException ex) { frame.resetPanelTwo(); frame.messlab2.setText(messages.getString("AccountException") + " " + returned + " " + messages.getString("NotFoundException")); } catch (RemoteException ex) { frame.messlab.setText("Remote Exception" + ex.getMessage()); } } //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 (InvalidParameterException ex) { frame.messlab.setText("InvalidParameterException"); } catch (CustomerNotFoundException ex) { frame.resetPanelTwo(); frame.messlab2.setText(messages.getString("CustomerException") + " " + returned + " " + messages.getString("NotFoundException")); } catch (RemoteException ex) { frame.messlab.setText("Remote Exception" + ex.getMessage()); } } //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 + -