Esempio n. 1
0
 private void checkLogin() {
   // 对输入进行基本的合法非法判断
   String id = idTxt.getText();
   String passwd = String.valueOf(passwordTxt.getPassword());
   ResultMessage idResult = Utility.checkInputValid(id, 4, 14, false);
   ResultMessage passwdResult = Utility.checkInputValid(passwd, 5, 14, false);
   if (idResult != ResultMessage.SUCCESS) {
     MyOptionPane.showMessageDialog(null, "输入的用户名" + idResult.toFriendlyString() + "!");
     return;
   } else if (passwdResult != ResultMessage.SUCCESS) {
     MyOptionPane.showMessageDialog(null, "输入的密码" + passwdResult.toFriendlyString() + "!");
     return;
   }
   // 登录验证
   ResultMessage loginresult = loginController.login(usertype.getSelectedIndex(), id, passwd);
   if (loginresult == ResultMessage.SUCCESS) {
     new HomeUI(loginController);
     frame.dispose();
   } else {
     if (loginresult == ResultMessage.WRONG_ID) {
       MyOptionPane.showMessageDialog(null, "用户名错误!");
       idTxt.setText("");
       passwordTxt.setText("");
     } else if (loginresult == ResultMessage.WRONG_PASSWD) {
       MyOptionPane.showMessageDialog(null, "密码错误!");
       passwordTxt.setText("");
     } else {
       MyOptionPane.showMessageDialog(null, "服务器未开启!");
     }
   }
 }
Esempio n. 2
0
  private void processPay(PayBillVO payBillVO) {
    ResultMessage msg = financeController.createPayBill(payBillVO);

    if (MoneyNotEnough(msg)) {
      new WarningDialog(ui, "该账户没有足够的余额");
    } else if (IDNotFound(msg)) {
      new WarningDialog(ui, "未找到该用户");
    } else {
      payBillVO.id = (String) msg.getValue();
      List<PayBillVO> payBillVOList = new ArrayList<>();
      payBillVOList.add(payBillVO);
      PayPanel payPanel = new PayPanel(payBillVOList);
      ui.paintdata(payPanel);
      this.setVisible(false);
    }
  }
Esempio n. 3
0
 private boolean IDNotFound(ResultMessage message) {
   return message.getKey().equals("id not found");
 }
Esempio n. 4
0
 private boolean MoneyNotEnough(ResultMessage message) {
   return message.getKey().equals("money not enough");
 }