Search in sources :

Example 1 with DesligamentoDTO

use of com.tomasio.projects.trainning.dto.DesligamentoDTO in project trainning by fernandotomasio.

the class TurmasEfetivasController method saveDesligamento.

@RequestMapping("/save_desligamento")
public String saveDesligamento(Model model, @Valid DesligamentoForm form, BindingResult bindingResult, WebRequest request, final RedirectAttributes redirectAttributes) {
    if (bindingResult.hasErrors()) {
        model.addAttribute("pessoa", organizationalService.findPessoa(Long.parseLong(request.getParameter("pessoaId"))));
        model.addAttribute(Long.parseLong(request.getParameter("matriculaId")));
        return "turmas_efetivas/form_desligamento";
    }
    MatriculaDTO matricula = atividadesEnsinoService.findMatricula(form.getMatriculaId());
    DesligamentoDTO dto = new DesligamentoDTO();
    dto.setMatricula(matricula);
    dto.setObservacoes(form.getObservacao());
    dto.setMotivo(form.getMotivo());
    dto.setData(new Date());
    try {
        atividadesEnsinoService.createDesligamento(dto);
        redirectAttributes.addFlashAttribute("successMessage", "Aluno desligado com sucesso.");
    // model.addAttribute("successMessage", "Matricula cancelada com sucesso.");
    } catch (CoreException e) {
        redirectAttributes.addFlashAttribute("errorMessage", e.getMessage());
    // model.addAttribute("errorMessage", e.getMessage());
    }
    return "redirect:detail/matriculas";
}
Also used : PreMatriculaDTO(com.tomasio.projects.trainning.dto.PreMatriculaDTO) NotificacaoMatriculaDTO(com.tomasio.projects.trainning.dto.NotificacaoMatriculaDTO) MatriculaDTO(com.tomasio.projects.trainning.dto.MatriculaDTO) CancelamentoMatriculaDTO(com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DesligamentoDTO(com.tomasio.projects.trainning.dto.DesligamentoDTO) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with DesligamentoDTO

use of com.tomasio.projects.trainning.dto.DesligamentoDTO in project trainning by fernandotomasio.

the class Desligamento method createDTO.

public DesligamentoDTO createDTO() {
    DesligamentoDTO dto = new DesligamentoDTO();
    dto.setId(id);
    dto.setMotivo(motivo);
    dto.setObservacoes(observacoes);
    dto.setData(data);
    if (matricula != null) {
        dto.setMatricula(matricula.createDTOMinimal());
    }
    return dto;
}
Also used : DesligamentoDTO(com.tomasio.projects.trainning.dto.DesligamentoDTO)

Aggregations

DesligamentoDTO (com.tomasio.projects.trainning.dto.DesligamentoDTO)2 CancelamentoMatriculaDTO (com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO)1 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)1 NotificacaoMatriculaDTO (com.tomasio.projects.trainning.dto.NotificacaoMatriculaDTO)1 PreMatriculaDTO (com.tomasio.projects.trainning.dto.PreMatriculaDTO)1 CoreException (com.tomasio.projects.trainning.exeption.CoreException)1 Date (java.util.Date)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1