private void CalendrierMatchs_FormClosing(object sender, FormClosingEventArgs e) { if (!estSave) { try { MessageBox.Show("Pour information : en sortant sans sauvegarder, le championnat crée est effacé"); ChampionnatService cs = new ChampionnatService(); QuartersService qs = new QuartersService(); IntersaisonsService intS = new IntersaisonsService(); EquipesParticipationService es = new EquipesParticipationService(); Guid championnatId = cs.getChampionnat(annee).championnatId; qs.Delete(championnatId); intS.Delete(championnatId); es.Delete(championnatId); cs.Delete(championnatId); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private Boolean enregistrerNewDivison(List <string> lEquipe) { Boolean _return = false; try { // enregistre le nouveau championnat ChampionnatService cs = new ChampionnatService(); Guid championnatId; EquipesParticipationService eps = new EquipesParticipationService(); EquipesService es = new EquipesService(); //vérifie qu'il n'y ait pas de transfert dans l'année pour une des équipes if (eps.checkPasTransfertAvantParticipation(es.ListeEquipeParticipants(lEquipe), Convert.ToInt32(tb_Annee.Text))) { //vérifie si le championnat a pu être créé et si oui lance la création de quarters et d'intersaison if (cs.enregistrerNewChampionnat(Convert.ToInt32(tb_Annee.Text), out championnatId)) { //enregistre la nouvelle intersaison IntersaisonsService interS = new IntersaisonsService(); interS.enregistrerNewIntersaison(dateDebutInt, dateFinInt, championnatId); //enregistre les nouveaux quarters QuartersService qs = new QuartersService(); qs.enregistrerNewQuarter(dateDebut, dateFinQ1, championnatId); qs.enregistrerNewQuarter(dateDebutQ2, dateFinQ2, championnatId); //enregistre les équipes enregistrerEquipes(lEquipe, championnatId); _return = true; } } return(_return); } catch (Exception ex) { MessageBox.Show(ex.Message); return(_return); } }