コード例 #1
0
 private void isDoctor() {
   tempDoctor.setName(manageEdit.getTxtFieldName().getText());
   tempDoctor.setLastName(manageEdit.getTxtFieldLastName().getText());
   tempDoctor.setCedula(manageEdit.getTxtFieldCedula().getText());
   tempDoctor.setTelephone(manageEdit.getTxtFieldPhone().getText());
   tempDoctor.setCellphone(manageEdit.getTxtFieldCellPhone().getText());
   tempDoctor.setPosition(manageEdit.getTxtFieldJobPosition().getText());
   tempDoctor.setSpeciality(manageEdit.getTxtFieldSpeciality().getText());
 }
コード例 #2
0
  @Override
  public void btnSave() {
    if (manageEdit.getjRadioButtonNormal().isSelected()) {
      manageEdit.getTxtFieldSpeciality().setText("Sorry 4 Wait");
    }
    if (isEmptyFields()) {
      JOptionPane.showMessageDialog(
          manageEdit,
          "Existen Campos En Blancos Por Favor Completar",
          "Error",
          JOptionPane.ERROR_MESSAGE);
      return;
    }
    if (edicion != 0) {
      if (mdlEmployees.checkIsDoctor(edicion)) {
        if (manageEdit.getjRadioButtonDoctor().isSelected()) {
          isDoctor();
          if (mdlEmployees.checkDuplicateCedula(manageEdit.getTxtFieldCedula().getText())) {
            if (tempDoctor.getCedula().equalsIgnoreCase(manageEdit.getTxtFieldCedula().getText())) {
              update(true);
            } else {
              JOptionPane.showMessageDialog(
                  manageEdit,
                  "Existe Otro Usuario Con El Mismo Numero de Cedula",
                  "Error GRAVE",
                  JOptionPane.ERROR_MESSAGE);
            }
          } else {
            tempDoctor.setCedula(manageEdit.getTxtFieldCedula().getText());
            update(true);
          }

        } else {
          mdlEmployees.deleteObject(tempDoctor);
          tempEmployee = new Employees();
          tempEmployee.setPersonId(edicion);
          isEmployee();
          if (mdlEmployees.checkDuplicateCedula(manageEdit.getTxtFieldCedula().getText())) {
            if (tempEmployee
                .getCedula()
                .equalsIgnoreCase(manageEdit.getTxtFieldCedula().getText())) {
              update(false);
            } else {
              JOptionPane.showMessageDialog(
                  manageEdit,
                  "Existe Otro Usuario Con El Mismo Numero de Cedula",
                  "Error GRAVE",
                  JOptionPane.ERROR_MESSAGE);
            }
          } else {
            tempEmployee.setCedula(manageEdit.getTxtFieldCedula().getText());
            update(false);
          }
        }

      } else {
        if (manageEdit.getjRadioButtonNormal().isSelected()) {
          isEmployee();
          if (mdlEmployees.checkDuplicateCedula(manageEdit.getTxtFieldCedula().getText())) {
            if (tempEmployee
                .getCedula()
                .equalsIgnoreCase(manageEdit.getTxtFieldCedula().getText())) {
              update(true);
            } else {
              JOptionPane.showMessageDialog(
                  manageEdit,
                  "Existe Otro Usuario Con El Mismo Numero de Cedula",
                  "Error GRAVE",
                  JOptionPane.ERROR_MESSAGE);
            }
          } else {
            tempEmployee.setCedula(manageEdit.getTxtFieldCedula().getText());
            update(true);
          }
        } else {
          mdlEmployees.deleteObject(tempEmployee);
          tempDoctor = new Doctor();
          tempDoctor.setPersonId(edicion);
          isDoctor();
          if (mdlEmployees.checkDuplicateCedula(manageEdit.getTxtFieldCedula().getText())) {
            if (tempDoctor.getCedula().equalsIgnoreCase(manageEdit.getTxtFieldCedula().getText())) {
              update(true);
            } else {
              JOptionPane.showMessageDialog(
                  manageEdit,
                  "Existe Otro Usuario Con El Mismo Numero de Cedula",
                  "Error GRAVE",
                  JOptionPane.ERROR_MESSAGE);
            }
          } else {
            tempDoctor.setCedula(manageEdit.getTxtFieldCedula().getText());
            update(true);
          }
        }
      }
    } else {
      if (mdlEmployees.checkDuplicateCedula(manageEdit.getTxtFieldCedula().getText())) {
        JOptionPane.showMessageDialog(
            manageEdit,
            "Existe Otro Cliente Con El Mismo Numero de Cedula",
            "Error GRAVE",
            JOptionPane.ERROR_MESSAGE);
        return;
      }
      insert();
    }
  }