Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
etudiants:2014:bertrand:scrumtool3 [2014/05/28 10:13] – jordi | etudiants:2014:bertrand:scrumtool3 [2019/08/31 14:21] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 15: | Ligne 15: | ||
{{ : | {{ : | ||
+ | |||
+ | ==== 3 - Contrôleurs ==== | ||
+ | |||
+ | === 3.1 Ccollaborators - Add Collaborator === | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <sxh php; | ||
+ | view.getBtnCollaborators().addSelectionListener(new SelectionListener() { | ||
+ | |||
+ | @Override | ||
+ | public void widgetSelected(SelectionEvent arg0) { | ||
+ | if (view.getBtnCollaborators().getText() == "Add this collaborator" | ||
+ | if (view.getTxtFirstnameCollaborators().getText() == "" | ||
+ | Utils.MsgBox(view.getShell(), | ||
+ | } else { | ||
+ | boolean nomUtilise = false; | ||
+ | for (Collaborator collaborator : DAO.getCollaborators()) { | ||
+ | if (collaborator.getEmail().equals(view.getTxtEmailCollaborators().getText())) { | ||
+ | nomUtilise = true; | ||
+ | } | ||
+ | } | ||
+ | if (nomUtilise == true) { | ||
+ | Utils.MsgBox(view.getShell(), | ||
+ | } else { | ||
+ | if (!view.getTxtPasswordCollaborators().getText().equals(view.getTxtConfirmPasswordCollaborators().getText())) { | ||
+ | Utils.MsgBox(view.getShell(), | ||
+ | } else { | ||
+ | if(view.getCheckButtonCollaborator().getSelection()){ | ||
+ | admin=true; | ||
+ | }else{ | ||
+ | admin=false; | ||
+ | } | ||
+ | Collaborator collaborator = new Collaborator(view.getTxtFirstnameCollaborators().getText(), | ||
+ | DAO.SQLCollaborator(collaborator, | ||
+ | view.getTableViewerCollaborators().add(collaborator); | ||
+ | Utils.MsgBox(view.getShell(), | ||
+ | init(); | ||
+ | |||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } else { | ||
+ | // Code update collaborator | ||
+ | } | ||
+ | }); | ||
+ | </ | ||
+ | |||
+ | === 3.2 Ccollaborators - Edit Collaborator === | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <sxh php; | ||
+ | view.getBtnCollaborators().addSelectionListener(new SelectionListener() { | ||
+ | |||
+ | @Override | ||
+ | public void widgetSelected(SelectionEvent arg0) { | ||
+ | if (view.getBtnCollaborators().getText() == "Add this collaborator" | ||
+ | // Code add collaborator | ||
+ | } else { | ||
+ | if (view.getTxtFirstnameCollaborators().getText() == "" | ||
+ | Utils.MsgBox(view.getShell(), | ||
+ | } else { | ||
+ | Boolean email = false; | ||
+ | java.util.List< | ||
+ | for (Collaborator emailV : verifEmail) { | ||
+ | if (view.getTxtEmailCollaborators().getText().equals(emailV.getEmail())) { | ||
+ | if (emailV.getEmail().equals(collaboratorActif.getEmail())) { | ||
+ | email = false; | ||
+ | } else { | ||
+ | email = true; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if (email == true) { | ||
+ | Utils.MsgBox(view.getShell(), | ||
+ | } else { | ||
+ | if (!view.getTxtPasswordCollaborators().getText().equals(view.getTxtConfirmPasswordCollaborators().getText())) { | ||
+ | if (view.getTxtConfirmPasswordCollaborators().getText() == "" | ||
+ | if (view.getTxtPasswordCollaborators().getText().equals(collaboratorActif.getPassword())) { | ||
+ | if(view.getCheckButtonCollaborator().getSelection()){ | ||
+ | admin=true; | ||
+ | }else{ | ||
+ | admin=false; | ||
+ | } | ||
+ | collaboratorActif.setAdministrator(admin); | ||
+ | collaboratorActif.setFirstname(view.getTxtFirstnameCollaborators().getText()); | ||
+ | collaboratorActif.setLastname(view.getTxtLastNameCollaborators().getText()); | ||
+ | collaboratorActif.setEmail(view.getTxtEmailCollaborators().getText()); | ||
+ | collaboratorActif.setPassword(view.getTxtPasswordCollaborators().getText()); | ||
+ | DAO.SQLCollaborator(collaboratorActif, | ||
+ | view.getTableViewerCollaborators().refresh(); | ||
+ | Utils.MsgBox(view.getShell(), | ||
+ | } else { | ||
+ | Utils.MsgBox(view.getShell(), | ||
+ | } | ||
+ | } else { | ||
+ | Utils.MsgBox(view.getShell(), | ||
+ | } | ||
+ | } else { | ||
+ | if(view.getCheckButtonCollaborator().getSelection()){ | ||
+ | admin=true; | ||
+ | }else{ | ||
+ | admin=false; | ||
+ | } | ||
+ | collaboratorActif.setAdministrator(admin); | ||
+ | collaboratorActif.setFirstname(view.getTxtFirstnameCollaborators().getText()); | ||
+ | collaboratorActif.setLastname(view.getTxtLastNameCollaborators().getText()); | ||
+ | collaboratorActif.setEmail(view.getTxtEmailCollaborators().getText()); | ||
+ | collaboratorActif.setPassword(view.getTxtPasswordCollaborators().getText()); | ||
+ | DAO.SQLCollaborator(collaboratorActif, | ||
+ | view.getTableViewerCollaborators().refresh(); | ||
+ | Utils.MsgBox(view.getShell(), | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | </ | ||
+ | |||
+ | === 3.3 Ccollaborator - Delete Collaborator === | ||
+ | |||
+ | <sxh php; | ||
+ | view.getTltmDelCollaborator().addSelectionListener(new SelectionListener() { | ||
+ | |||
+ | @Override | ||
+ | public void widgetSelected(SelectionEvent arg0) { | ||
+ | |||
+ | MessageBox messageBoxCollaborator = new MessageBox(view.getShell(), | ||
+ | messageBoxCollaborator.setText(" | ||
+ | messageBoxCollaborator.setMessage(" | ||
+ | int responseCollaborator = messageBoxCollaborator.open(); | ||
+ | if (responseCollaborator == SWT.YES) { | ||
+ | DAO.SQLCollaborator(collaboratorActif, | ||
+ | view.getTableViewerCollaborators().remove(collaboratorActif); | ||
+ | view.getGrpCollaborators().setVisible(false); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | }); | ||
+ | </ |