use of fr.univlorraine.ecandidat.views.windows.CandidatAdminDeleteWindow in project esup-ecandidat by EsupPortail.
the class CandidatController method deleteCandidatCnil.
/**
* Supprime un candidat
* @param cptMin
* @param listener
*/
public void deleteCandidatCnil(final CompteMinima cptMin, final CandidatAdminListener listener) {
final CandidatAdminDeleteWindow win = new CandidatAdminDeleteWindow();
win.setWidth(850, Unit.PIXELS);
String message = applicationContext.getMessage("candidat.delete.window", null, UI.getCurrent().getLocale());
if (cptMin.getCandidat() != null) {
message = message + "<br/><br/>";
if (cptMin.getCandidat().getCandidatures().size() > 0) {
message = message + applicationContext.getMessage("candidat.delete.cnil.hascand", null, UI.getCurrent().getLocale());
message = message + "<ul>";
for (final Candidature cand : cptMin.getCandidat().getCandidatures()) {
// définition du statut
String statut = cand.getTypeStatut().getLibTypStatut();
if (cand.getDatAnnulCand() != null) {
statut = applicationContext.getMessage("cancel.label", null, UI.getCurrent().getLocale());
}
// definition du libellé opi
String opi = applicationContext.getMessage("candidat.delete.cnil.cand.noopi", null, UI.getCurrent().getLocale());
if (cand.getOpi() != null && cand.getOpi().getDatPassageOpi() != null) {
opi = applicationContext.getMessage("candidat.delete.cnil.cand.hasopi", new Object[] { formatterDate.format(cand.getOpi().getDatPassageOpi()) }, UI.getCurrent().getLocale());
}
message = message + applicationContext.getMessage("candidat.delete.cnil.cand", new Object[] { cand.getFormation().getLibForm(), statut, opi }, UI.getCurrent().getLocale());
}
message = message + "</ul>";
} else {
message = message + applicationContext.getMessage("candidat.delete.cnil.nocand", null, UI.getCurrent().getLocale());
}
}
win.setMessage(message);
win.addDeleteCandidatWindowListener(sendMail -> {
try {
if (cptMin.getCandidat() != null) {
for (final Candidature candidature : cptMin.getCandidat().getCandidatures()) {
for (final PjCand pjCand : candidature.getPjCands()) {
candidaturePieceController.removeFileToPj(pjCand);
}
}
}
compteMinimaRepository.delete(cptMin);
if (sendMail) {
final CptMinMailBean mailBean = new CptMinMailBean(cptMin.getPrenomCptMin(), cptMin.getNomCptMin(), cptMin.getNumDossierOpiCptMin(), null, null, campagneController.getLibelleCampagne(cptMin.getCampagne(), getCodLangueCptMin(cptMin)), null);
mailController.sendMailByCod(cptMin.getMailPersoCptMin(), NomenclatureUtils.MAIL_CPT_MIN_DELETE, mailBean, null, getCodLangueCptMin(cptMin));
}
userController.setNoDossierNomCandidat(null);
Notification.show(applicationContext.getMessage("candidat.delete.ok", null, UI.getCurrent().getLocale()), Type.TRAY_NOTIFICATION);
MainUI.getCurrent().buildMenuGestCand(false);
} catch (final Exception ex) {
logger.error(applicationContext.getMessage("candidat.delete.error", null, UI.getCurrent().getLocale()), ex);
Notification.show(applicationContext.getMessage("candidat.delete.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
return;
}
});
UI.getCurrent().addWindow(win);
}
use of fr.univlorraine.ecandidat.views.windows.CandidatAdminDeleteWindow in project esup-ecandidat by EsupPortail.
the class CandidatController method deleteCandidat.
/**
* Supprime un candidat
* @param cptMin
* @param listener
*/
public void deleteCandidat(final CompteMinima cptMin, final CandidatAdminListener listener) {
if (cptMin.getCandidat() != null && cptMin.getCandidat().getCandidatures().size() > 0) {
Notification.show(applicationContext.getMessage("candidat.delete.has.candidature", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
return;
}
final CandidatAdminDeleteWindow win = new CandidatAdminDeleteWindow(applicationContext.getMessage("candidat.delete.window", null, UI.getCurrent().getLocale()));
win.addDeleteCandidatWindowListener(sendMail -> {
try {
deleteCandidatBase(cptMin);
if (sendMail) {
final CptMinMailBean mailBean = new CptMinMailBean(cptMin.getPrenomCptMin(), cptMin.getNomCptMin(), cptMin.getNumDossierOpiCptMin(), null, null, campagneController.getLibelleCampagne(cptMin.getCampagne(), getCodLangueCptMin(cptMin)), null);
mailController.sendMailByCod(cptMin.getMailPersoCptMin(), NomenclatureUtils.MAIL_CPT_MIN_DELETE, mailBean, null, getCodLangueCptMin(cptMin));
}
userController.setNoDossierNomCandidat(null);
Notification.show(applicationContext.getMessage("candidat.delete.ok", null, UI.getCurrent().getLocale()), Type.TRAY_NOTIFICATION);
MainUI.getCurrent().buildMenuGestCand(false);
} catch (final Exception ex) {
logger.error(applicationContext.getMessage("candidat.delete.error", null, UI.getCurrent().getLocale()), ex);
Notification.show(applicationContext.getMessage("candidat.delete.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
return;
}
});
UI.getCurrent().addWindow(win);
}
Aggregations