Exemplo n.º 1
0
 @Command
 public void login() {
   if (validationService.isUser(login, password)) {
     Executions.sendRedirect("/parts/main.zul");
   } else {
     Executions.sendRedirect("/index.zul");
   }
 }
Exemplo n.º 2
0
  @Override
  public void doInit(Page page, Map<String, Object> map) throws Exception {
    super.doInit(page, map);

    if (evaluationSessonService.isEvalutionRunning()) {
      Executions.sendRedirect("/engine.zul");
    } else if (!evaluationSessonService.isEvalutionFinished()) {
      Executions.sendRedirect("/index.zul");
    }
  }
Exemplo n.º 3
0
  /// Save Sell Data
  @Listen("onClick = #btncheckout")
  public void btncheckou_Click() {
    Date datem = new Date();
    java.text.SimpleDateFormat dfm = new java.text.SimpleDateFormat();
    dfm.applyPattern("MMMM");

    java.text.SimpleDateFormat dfy = new java.text.SimpleDateFormat();
    dfy.applyPattern("yyyy");

    String strdatem = String.format(dfm.format(datem));
    String strdatey = String.format(dfy.format(datem));

    for (int i = 0; i < pointcount; i++) {
      Sell selldata = new Sell();
      selldata.setDateselly(strdatey);
      selldata.setDatesellm(strdatem);
      selldata.setDatesell(datem);
      selldata.setNameproduct(nameproduct.get(i));
      selldata.setIdp(idpro.get(i));
      selldata.setIdqty(qty.get(i));
      selldata.setUnitprice(unitprice.get(i));
      selldata.setSellprice(price.get(i));
      selldata.setCusname(namecus.get(i));
      selldata.persist();
    }
    Sessions.getCurrent().setAttribute("name", null);
    Executions.sendRedirect("sellid.zul");
  }
  /**
   * Método que captura o texto que será estudado pelo usuário
   *
   * @param id , do texto
   */
  public void studyText(String id) {
    Text text = getControl().getTextById(Long.parseLong(id));
    setStudy(checksExistenceStudy(text));

    if (study != null) {
      if (study.getLastElementStop() != null) {
        showActionConfirmationYesOrNo(
            "Deseja continuar o estudo de onde parou?", "continueStudy", "noContinueStudy");
      } else {
        putValuesInSession(getStudy(), getContinueStudy(), false);
        Executions.sendRedirect("/pages/user/study.zul");
      }
    } else {
      setStudy(createStudy(text));
      putValuesInSession(getStudy(), getContinueStudy(), false);
      Executions.sendRedirect("/pages/user/study.zul");
    }
  }
 public static void showException(OptimisticLockingFailureException exception, String backURL) {
   LOG.info("an OptimistLockingFailureException caused a disruption to an user", exception);
   if (Executions.getCurrent() != null) {
     ConfirmCloseUtil.resetConfirmClose();
     Executions.sendRedirect("/common/concurrent_modification.zul?back=" + backURL);
   } else {
     LOG.warn(
         "Impossible to do redirect due to OptimisticLockingFailureException because of Executions.getCurrent() is null");
   }
 }
Exemplo n.º 6
0
  public void onClick$btnSave(Event e) {
    checkR();
    PersonaDTO persona = new PersonaDTO();
    persona.setFirst(txtChangeName.getText());
    persona.setPassword(txtChangePassword.getText());
    persona.setEmail(txtChangeEmail.getText());
    persona.setId(usuario.getId());

    try {
      Executions.getCurrent().setAttribute("lang", lenguaje);
      signupNgc.updatePersona(persona);
      logger.info("Se actualizó una persona");
      Executions.sendRedirect("");
    } catch (NumberFormatException e2) {
      e2.printStackTrace();
    } catch (ExceptionPet e1) {
      Messagebox.show(e1.getMensajeUsuario());
      e1.pintarErrorLog(e1.getMensajeTecnico());
    }
  }
Exemplo n.º 7
0
  public void onCreate$div(Event event) {
    user = (Usuario) execution.getSession().getAttribute("usuario");

    if (user != null) {
      if (user.getPessoa() != null) {
        nomeUsuario.setValue("SEJA BEM VINDO(A) " + user.getPessoa().getNome().toUpperCase());
      } else {
        nomeUsuario.setValue("SEJA BEM VINDO(A) ADMINISTRADOR");
      }

      if (user.getPrivilegio() == 3) {
        turma.setVisible(false);
        matricularAluno.setVisible(false);
        alocarProfessor.setVisible(false);

        cadastroPessoa.setVisible(true);
        cadastrarAluno.setVisible(false);

        cadastroAcademico.setVisible(false);
        prof = (Professor) user.getPessoa();
      } else if (user.getPrivilegio() == 4) {
        pauta.setVisible(false);
        cadastroAcademico.setVisible(false);
        turma.setVisible(false);
        alocarProfessor.setVisible(false);

        cadastroPessoa.setVisible(true);
        professor.setVisible(false);

        resultado.setVisible(false);
        visualizarTurmas.setVisible(false);
        aluno = (Aluno) user.getPessoa();
      }
    } else {
      // if feito para verificar se existe algum usuario logado, se nao existir eh redirecionado
      // para o login
      Executions.sendRedirect("/");
      div.detach();
    }
  }
 public void onClick$btn_add() throws InterruptedException {
   Executions.sendRedirect(globalUtils.getGlobalPropValue(Commons.URL_ADD_USER_ORG));
 }
 @Command
 public void doLogout() {
   authService.logout();
   Executions.sendRedirect("/login.zul");
 }
  public void onEventEdit(CalendarsEvent event) throws InterruptedException, RemoteException {
    try {
      StorageComponentProxy proxy = SystemDictionary.getSCProxy();
      Session ses = Sessions.getCurrent();
      String userid = (String) ses.getAttribute("userid");
      bookEventWin = (Window) Executions.createComponents("bookEvent.zul", self.getParent(), null);
      bookEventWin.setAttribute("calendars", cal);
      bookEventWin.setAttribute("calevent", event);
      Date setting = event.getCalendarEvent().getBeginDate();
      SimpleCalendarEvent scevent = (SimpleCalendarEvent) event.getCalendarEvent();
      bookEventWin.getFellow("cancelbutton").setVisible(true);
      ((Datebox) bookEventWin.getFellow("datetask")).setValue(setting);
      ((Datebox) bookEventWin.getFellow("datetask")).setReadonly(true);
      ((Datebox) bookEventWin.getFellow("datetask")).setButtonVisible(false);
      ((Timebox) bookEventWin.getFellow("timetask")).setValue(setting);
      ((Timebox) bookEventWin.getFellow("timetask")).setReadonly(true);
      ((Timebox) bookEventWin.getFellow("timetask")).setButtonVisible(false);
      ((Textbox) bookEventWin.getFellow("taskidfield"))
          .setValue((String) scevent.getParams().get("task"));
      ((Textbox) bookEventWin.getFellow("taskstatusfield"))
          .setValue(
              SystemDictionary.getTaskStatusLabel((String) scevent.getParams().get("status")));
      bookEventWin.getFellow("rowtaskstatus").setVisible(true);
      if (scevent.getParams().get("status").equals(SystemDictionary.TASK_STATUS_COMPLETED)) {
        bookEventWin.getFellow("cancelbutton").setVisible(false);
        String tasktype = (String) scevent.getParams().get("type");
        if (tasktype.equals(SystemDictionary.TASK_TYPE_CARERQS)
            || tasktype.equals(SystemDictionary.TASK_TYPE_PATIENTQS)) {
          // TODO retrieve Questionnaire answers and show in the task window
          Questionnaire q = (Questionnaire) scevent.getParams().get("questionnaire");
          QuestionnaireAnswers qa =
              proxy.getQuestionnaireAnswersByTask((String) scevent.getParams().get("task"), userid);
          SystemDictionary.webguiLog(
              "INFO", "task id: " + (String) scevent.getParams().get("task"));
          // SystemDictionary.webguiLog("INFO", "ANSWERS LENGTH: "+ qa.getAnswer().length);
          // SystemDictionary.webguiLog("INFO", "getQuestion: "+ q.getQuestion().length);
          ArrayList<QuestionnaireAnswer> qalist = new ArrayList<QuestionnaireAnswer>();
          if (qa.getAnswer() != null)
            for (int i = 0; i < qa.getAnswer().length; i++) {
              qalist.add(i, qa.getAnswer(i));
            }

          String responses = provideQuestionnaireResponse(toPlainList(q.getQuestion()), qalist);
          SystemDictionary.webguiLog("DEBUG", "RESPONSES: " + responses);
          bookEventWin.getFellow("qsanswersrow").setVisible(true);
          ((Label) bookEventWin.getFellow("qsanswersfield")).setValue(responses);

        } else if (tasktype.equals(SystemDictionary.TASK_TYPE_BLOODPRESSURE_MEASUREMENT)
            || tasktype.equals(SystemDictionary.TASK_TYPE_WEIGHT_MEASUREMENT)
            || tasktype.equals(SystemDictionary.TASK_TYPE_ACTMONITOR)) {
          String resultfieldvalue = "";
          SearchCriteria searchc =
              new SearchCriteria(
                  "task",
                  new SystemParameter(SystemDictionary.COMPARE_EQ, ""),
                  (String) scevent.getParams().get("task"),
                  "");
          Measurement[] results = proxy.getMeasurement(new SearchCriteria[] {searchc}, userid);
          if (results.length <= 0) {
            resultfieldvalue = "No measurement could be retrieved";
          } else {
            resultfieldvalue = "Use 'Monitor Measurements' button for viewing the measurements";
            /*SystemDictionary.webguiLog("DEBUG", "RESULTS LENGHT: "+results.length);
            for(int ii = 0 ; ii < results.length ; ii++){
            	resultfieldvalue += results[ii].getValue()+""+results[ii].getUnits()+"\n";
            }*/
          }
          bookEventWin.getFellow("mresultrow").setVisible(true);
          ((Label) bookEventWin.getFellow("mresultrowfield")).setValue(resultfieldvalue);
        }
      }
      User addressed = proxy.getUser((String) scevent.getParams().get("objid"));
      Patient patient = proxy.getPatient(addressed.getPersonID(), userid);
      ((Textbox) bookEventWin.getFellow("addressedid"))
          .setValue((String) scevent.getParams().get("objid"));
      ((Textbox) bookEventWin.getFellow("addressedstr")).setValue(patient.toString());
      User object = proxy.getUser((String) scevent.getParams().get("exec"));
      Carer executor = proxy.getCarer(object.getPersonID(), userid);
      ((Textbox) bookEventWin.getFellow("objid"))
          .setValue((String) scevent.getParams().get("exec"));
      ((Textbox) bookEventWin.getFellow("objstr")).setValue(executor.toString());
      User assigner = proxy.getUser((String) scevent.getParams().get("assign"));
      Clinician assg = proxy.getClinician(assigner.getPersonID(), userid);
      ((Textbox) bookEventWin.getFellow("userid"))
          .setValue((String) scevent.getParams().get("assign"));
      ((Textbox) bookEventWin.getFellow("userstr")).setValue(assg.toString());
      ((Textbox) bookEventWin.getFellow("tasktypetext")).setValue(scevent.getContent());
      bookEventWin.getFellow("tasktypetext").setVisible(true);
      // ((Combobox)bookEventWin.getFellow("addressedtext")).setVisible(false);
      int tasktype2 = Integer.parseInt((String) scevent.getParams().get("type"));
      this.showCustomFields(tasktype2);
      bookEventWin.getFellow("tasktypesel").setVisible(false);
      @SuppressWarnings("rawtypes")
      List items = ((Listbox) bookEventWin.getFellow("urlfield")).getItems();
      @SuppressWarnings("rawtypes")
      Iterator it = items.iterator();
      while (it.hasNext()) {
        Listitem currentitem = (Listitem) it.next();
        if (currentitem.getValue().equals((String) scevent.getParams().get("url"))) {
          ((Listbox) bookEventWin.getFellow("urlfield")).setSelectedItem(currentitem);
          break;
        }
      }
      ((Listbox) bookEventWin.getFellow("urlfield")).setDisabled(true);
      if (scevent.getParams().get("questionnaire") != null) {
        items = ((Listbox) bookEventWin.getFellow("questnamefield")).getItems();
        it = items.iterator();
        while (it.hasNext()) {
          Listitem currentitem = (Listitem) it.next();
          if (currentitem
              .getValue()
              .equals(((Questionnaire) scevent.getParams().get("questionnaire")).getID())) {
            ((Listbox) bookEventWin.getFellow("questnamefield")).setSelectedItem(currentitem);
            break;
          }
        }
      }
      ((Listbox) bookEventWin.getFellow("questnamefield")).setDisabled(true);
      // ((Textbox)bookEventWin.getFellow("urlfield")).setValue((String)scevent.getParams().get("url"));
      ((Textbox) bookEventWin.getFellow("textfield"))
          .setValue((String) scevent.getParams().get("text"));

      bookEventWin.setTitle("View Task");
      bookEventWin.setVisible(true);
      bookEventWin.doModal();
    } catch (Exception e) {
      e.printStackTrace();
      Executions.sendRedirect("");
    }
  }
 /**
  * Ação que será executada caso o usuário opte por não continuar o estudo de onde parou
  *
  * @return
  */
 public Return noContinueStudy() {
   setContinueStudy(false);
   putValuesInSession(getStudy(), getContinueStudy(), false);
   Executions.sendRedirect("/pages/user/study.zul");
   return new Return(true);
 }
  @Listen("onClick = #btnrttok")
  public void btnrtok_Clicked(Event event) {

    Radiogroup tt1 = (Radiogroup) find(this.getPage(), "#tstatusthai1").get(0);
    String ty1 = "";
    if (tt1.getSelectedIndex() == 0) {
      ty1 = "นาย";
    } else if (tt1.getSelectedIndex() == 1) {
      ty1 = "นางสาว";
    } else if (tt1.getSelectedIndex() == 2) {
      ty1 = "นาง";
    }

    Radiogroup ttt1 = (Radiogroup) find(this.getPage(), "#tsex1").get(0);
    String tyy1 = "";
    if (ttt1.getSelectedIndex() == 0) {
      tyy1 = "ผู้ชาย";
    } else if (ttt1.getSelectedIndex() == 1) {
      tyy1 = "ผู้หญิง";
    }

    Radiogroup tttt1 = (Radiogroup) find(this.getPage(), "#country1").get(0);
    String tyyy1 = "";
    if (tttt1.getSelectedIndex() == 0) {
      tyyy1 = "ไทย";
    } else if (tttt1.getSelectedIndex() == 1) {
      tyyy1 = "บรูไน";
    } else if (tttt1.getSelectedIndex() == 2) {
      tyyy1 = "กัมพูชา";
    } else if (tttt1.getSelectedIndex() == 3) {
      tyyy1 = "อินโดนีเซีย";
    } else if (tttt1.getSelectedIndex() == 4) {
      tyyy1 = "ลาว";
    } else if (tttt1.getSelectedIndex() == 5) {
      tyyy1 = "มาเลเซีย";
    } else if (tttt1.getSelectedIndex() == 6) {
      tyyy1 = "พม่า";
    } else if (tttt1.getSelectedIndex() == 7) {
      tyyy1 = "ฟิลิปปินส์";
    } else if (tttt1.getSelectedIndex() == 8) {
      tyyy1 = "สิงคโปร์";
    } else if (tttt1.getSelectedIndex() == 9) {
      tyyy1 = "เวียดนาม";
    }

    Radiogroup ttttt1 = (Radiogroup) find(this.getPage(), "#currency1").get(0);
    String tyyyy1 = "";
    if (ttttt1.getSelectedIndex() == 0) {
      tyyyy1 = "บาท";
    } else if (ttttt1.getSelectedIndex() == 1) {
      tyyyy1 = "ดอลล่าร์บรูไน";
    } else if (ttttt1.getSelectedIndex() == 2) {
      tyyyy1 = "เรียล";
    } else if (ttttt1.getSelectedIndex() == 3) {
      tyyyy1 = "รูเปียห์";
    } else if (ttttt1.getSelectedIndex() == 4) {
      tyyyy1 = "กีบ";
    } else if (ttttt1.getSelectedIndex() == 5) {
      tyyyy1 = "ริงกิต";
    } else if (ttttt1.getSelectedIndex() == 6) {
      tyyyy1 = "จ๊าด";
    } else if (ttttt1.getSelectedIndex() == 7) {
      tyyyy1 = "เปโซ";
    } else if (ttttt1.getSelectedIndex() == 8) {
      tyyyy1 = "ดอลล่าร์สิงค์โปร์";
    } else if (ttttt1.getSelectedIndex() == 9) {
      tyyyy1 = "ด่ง";
    }

    Radiogroup tttttt1 = (Radiogroup) find(this.getPage(), "#tax1").get(0);
    String tyyyyy1 = "";
    if (tttttt1.getSelectedIndex() == 0) {
      tyyyyy1 = "6.6";
    } else if (tttttt1.getSelectedIndex() == 1) {
      tyyyyy1 = "3.6";
    } else if (tttttt1.getSelectedIndex() == 2) {
      tyyyyy1 = "9.7";
    } else if (tttttt1.getSelectedIndex() == 3) {
      tyyyyy1 = "4.7";
    } else if (tttttt1.getSelectedIndex() == 4) {
      tyyyyy1 = "8.5";
    } else if (tttttt1.getSelectedIndex() == 5) {
      tyyyyy1 = "5.0";
    } else if (tttttt1.getSelectedIndex() == 6) {
      tyyyyy1 = "3.9";
    } else if (tttttt1.getSelectedIndex() == 7) {
      tyyyyy1 = "3.6";
    } else if (tttttt1.getSelectedIndex() == 8) {
      tyyyyy1 = "0.2";
    } else if (tttttt1.getSelectedIndex() == 9) {
      tyyyyy1 = "8.0";
    }

    Customerthai ht = new Customerthai();

    ht.setTstatusthai1("" + ty1);

    ht.setTthai1(tthai1.getValue());
    ht.setTsurenamethai1(tsurenamethai1.getValue());

    ht.setTsex1("" + tyy1);

    ht.setDd1(Integer.parseInt(dd1.getValue()));
    ht.setMm1(Integer.parseInt(mm1.getValue()));

    ht.setYy1(Integer.parseInt(yy1.getValue()));
    ht.setTage1(Integer.parseInt(tage1.getValue()));

    ht.setTiduser1(tiduser1.getValue());

    ht.setTtell1(Integer.parseInt(ttell1.getValue()));

    ht.setTpass1(tpass1.getValue());
    ht.setTrepass1(trepass1.getValue());
    ht.setTemail1(temail1.getValue());
    ht.setTreemail1(treemail1.getValue());

    ht.setCountry1("" + tyyy1);

    ht.setTaddress1(taddress1.getValue());

    ht.setCurrency1("" + tyyyy1);
    ht.setTax1("" + tyyyyy1);

    ht.persist();
    alert("การลงทะเบียนเรียบร้อย");
    Executions.sendRedirect("regthai.zul");
  }
Exemplo n.º 13
0
 public void onClick$logout(Event event) {
   Executions.getCurrent().getSession().removeAttribute("usuario");
   Executions.sendRedirect("/");
 }
Exemplo n.º 14
0
 /// Check sessions
 public void afterCompose(Component comp) {
   if ((String) Sessions.getCurrent().getAttribute("name") == null) {
     Executions.sendRedirect("sellid.zul");
   }
 }
 public void onClick$continue() {
   Executions.sendRedirect(backURL);
 }
Exemplo n.º 16
0
  public ListModelList<InvoiceCheck> getInvoices() throws Exception {
    if (user != null) {
      auditLogger.log(INVOICE_OVERVIEW, user);
      FiscalPeriod period = DateHelper.getPeriodTillDate(balanceDate);
      List<Cost> sentAndPaidInvoicesInPeriod = costDao.getInvoicesSentAndPaid(period);
      invoices = new ListModelList<>();

      int currentYear = DateHelper.getYear(new Date());

      for (Cost cost : sentAndPaidInvoicesInPeriod) {
        InvoiceCheck invoiceCheck = new InvoiceCheck();
        if (cost.getCostType().equals(INVOICE_SENT)) {
          invoiceCheck.setDateSent(cost.getDate());
          invoiceCheck.setInvoiceNumber(getInvoiceNumber(cost.getDescription()));
          invoiceCheck.setNetAmount(cost.getAmount());
          invoiceCheck.setVatAmount(cost.getVat());
          totalIncome = totalIncome.add(cost.getAmount());
          invoices.add(invoiceCheck);
        } else {
          if (!invoiceCheck.isPaymentFromPreviousYear()) {}
        }
      }
      for (Cost cost : sentAndPaidInvoicesInPeriod) {
        if (cost.getCostType().equals(INVOICE_PAID)) {

          Iterator<InvoiceCheck> sentInvoices = invoices.iterator();
          boolean hasMatchingInvoice = false;
          while (sentInvoices.hasNext()) {
            InvoiceCheck invoiceCheck = sentInvoices.next();
            if (cost.getDescription().contains(invoiceCheck.getInvoiceNumber())) {
              invoiceCheck.setDateReceived(cost.getDate());
              invoiceCheck.setDescriptionReceived(cost.getDescription());
              invoiceCheck.setGrossAmount(cost.getAmount());
              if (cost.getAmount()
                  .equals(invoiceCheck.getNetAmount().add(invoiceCheck.getVatAmount()))) {
                invoiceCheck.setInvoiceNumber(invoiceCheck.getInvoiceNumber() + " ok");
              }
              hasMatchingInvoice = true;
              break;
            } else {

            }
          }
          if (!hasMatchingInvoice) {
            paidInvoicesWithoutMatch = paidInvoicesWithoutMatch.add(cost.getAmount());
          }
        }
      }
      Iterator<InvoiceCheck> sentInvoices = invoices.iterator();
      while (sentInvoices.hasNext()) {
        InvoiceCheck invoiceCheck = sentInvoices.next();
        if (invoiceCheck.getDateReceived() == null) {
          unpaidInvoicesFromThisYear =
              unpaidInvoicesFromThisYear.add(
                  invoiceCheck.getNetAmount().add(invoiceCheck.getVatAmount()));
        }
      }
      BookValue bookValuePreviousYear =
          bookValueDao.getBookValue(BalanceType.INVOICES_TO_BE_PAID, currentYear - 1);
      if (bookValuePreviousYear != null) {
        unpaidInvoicesFromPreviousYear = bookValuePreviousYear.getSaldo();
      }
    } else {
      Executions.sendRedirect("login.zul");
    }
    return invoices;
  }