public BettingManager(BusinessManager businessManager, int nbJoueur) { this.businessManager = businessManager; rand = new Random(); joueurs = new List<Joueur>(); for (int i = 0; i < nbJoueur; i++) { joueurs.Add(new Joueur("player" + i, 0)); } List<Jedi> allJedis = businessManager.getJedis(); List<Jedi> jedis_to_pool = new List<Jedi>(); //Creation de la liste a mettre dans la pool for (int i = 0; i < 16; i++) { int index = rand.Next() % allJedis.Count; jedis_to_pool.Add(allJedis[index]); allJedis.Remove(allJedis[index]); } jedis = jedis_to_pool; pool = new Tournoi(jedis_to_pool, businessManager.getStades()); }
public ChooseJedi() { InitializeComponent(); BusinessManager manager = new BusinessManager(); JedisListModel jedis = new JedisListModel(manager.getJedis()); SelectorJedi.DataContext = jedis; SelectorJedi.ItemsSource = jedis.Jedis; }
public EventsByLieu() { InitializeComponent(); BusinessManager bm = new BusinessManager(); foreach(Lieu l in bm.getLieux()) { comboLieu.Items.Add(l); } stackPanel.Children.Add(new TextBlock()); }
public AddArtist() { bm = new BusinessManager(); InitializeComponent(); _currentArtiste = new Artiste(); foreach (string str in bm.getArtistesSortByName()) { this.ListArtist.Items.Add(str.ToString()); } }
public MainWindow() { instance = this; InitializeComponent(); mBusinessManager = new BusinessManager(); this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing); mLogin.Closed += login_Closed; mLogin.Show(); this.Hide(); }
public IList<Business.ArtistWS> GetAllArtistes(String login, String passwd) { IList<Business.ArtistWS> ret = null; if (CheckUser(login, passwd)) { IList<Artiste> artistes = new BusinessManager().getArtistesTypeSortByName(); ret = new List<Business.ArtistWS>(); foreach (Artiste a in artistes) { ret.Add(Business.ArtistWS.Convert(a)); } } return ret; }
public IList<Business.EvenementWS> GetAllEvents(String login, String passwd) { IList<Business.EvenementWS> ret = null; if (CheckUser(login, passwd)) { IList<Evenement> events = new BusinessManager().getEvenements(); ret = new List<Business.EvenementWS>(); foreach (Evenement e in events) { ret.Add(Business.EvenementWS.Convert(e)); } } return ret; }
public IList<Business.EvenementWS> GetAllEventsByArtiste(String login, String passwd, System.Guid guidArtiste) { IList<Business.EvenementWS> ret = null; if (CheckUser(login, passwd)) { IList<Evenement> pe = new BusinessManager().getEvenements().Where(e => e.Artistes.Select(a => a.Giud).Contains(guidArtiste)).ToList(); ret = new List<Business.EvenementWS>(); foreach (Evenement p in pe) { ret.Add(Business.EvenementWS.Convert(p)); } } return ret; }
private void comboLieu_SelectionChanged(object sender, SelectionChangedEventArgs e) { BusinessManager bm = new BusinessManager(); stackPanel.Children.RemoveRange(2, stackPanel.Children.Count - 2); IList<String> events = bm.getEvenementsSortByDate((Lieu)comboLieu.SelectedItem); foreach (String s in events) { TextBlock tb = new TextBlock(); tb.Text = s; stackPanel.Children.Add(tb); } window.MaxHeight = 165 + 18 * events.Count; window.Height = 165 + 18 * events.Count; }
public Lieux() { InitializeComponent(); BusinessManager bm = new BusinessManager(); IList<string> list=bm.getLieuxWithEvents(); stackPanel.Children.Add(new TextBlock()); foreach (string s in list) { TextBlock tb = new TextBlock(); tb.Text = s; stackPanel.Children.Add(tb); } window.Height = 120 + 18 * list.Count; window.MaxHeight = 120 + 18 * list.Count; }
public Artistes() { InitializeComponent(); BusinessManager bm = new BusinessManager(); IList<String> events = bm.getArtistesSortByName(); stackPanel.Children.Add(new TextBlock()); foreach (String s in events) { TextBlock tb = new TextBlock(); tb.Text = s; stackPanel.Children.Add(tb); } window.Height = 120 + 18 * events.Count; window.MaxHeight = 120 + 18 * events.Count; }
//EN metod som skapar en bokning public Bokning skapaBokning(int MedlemsNr, List <Bok> böcker, int anstNr, BusinessManager bm) { Medlem M = bm.MedRepo.GetMedlem(MedlemsNr); Anställd A = bm.GetAnställd(anstNr); DateTime start = DateTime.Today; DateTime end = start.AddDays(7); int BokningsNr = bm.BoknRepo.Bokningar.Count + 1; Bokning B = new Bokning(M, A, BokningsNr, start, end, böcker); A.bokningar.Add(B); M.bokningar.Add(B); //Bokningar.Add(B); foreach (Bok bok in B.böcker) { bok.bokning = B; } return(B); }
/// <summary> /// Main /// </summary> /// <param name="args">Arguments du programme</param> static void Main(string[] args) { BusinessManager businessManager = new BusinessManager(); string choise; string loc; bool run = true; do { displayMenu(); Console.Write("Votre choix : "); choise = Console.ReadLine(); Console.WriteLine(); switch (choise) { case "0": businessManager.EvenementsClassesDate().ToList().ForEach(value => Console.WriteLine(value.MonEvenement.Titre)); break; case "1": businessManager.ArtistesAssocies().ToList().ForEach(value => Console.WriteLine(value)); break; case "2": businessManager.LieuxUtilises().ToList().ForEach(value => Console.WriteLine(value)); break; case "3": Console.Write("Le lieu : "); loc = Console.ReadLine(); businessManager.EvenementsPourLieu(loc).ToList().ForEach(value => Console.WriteLine(value)); break; case "4": run = false; break; } } while (run); }
public ListElevesVM() { _bm = BusinessLayer.BusinessManager.GetInstance(); _eleves = new ObservableCollection <DetailEtudiantVM>(); foreach (Eleve eleve in _bm.GetEleves()) { DetailEtudiantVM detailEtudiant = new DetailEtudiantVM { Nom = eleve.Nom, Prenom = eleve.Prenom }; ICollection <Note> notes = _bm.GetNotesByEleve(eleve.EleveId); detailEtudiant.Moyenne = 10; _eleves.Add(detailEtudiant); } if (_eleves != null && _eleves.Count > 0) { _detail = _eleves.ElementAt(0); } }
public BettingManager(BusinessManager businessManager) { this.businessManager = businessManager; rand = new Random(); joueur1 = new Joueur("player1", 0); joueur2 = new Joueur("player2", 0); List <Jedi> allJedis = businessManager.getJedis(); List <Jedi> jedis_to_pool = new List <Jedi>(); //Creation de la liste a mettre dans la pool for (int i = 0; i < 16; i++) { int index = rand.Next() % allJedis.Count; jedis_to_pool.Add(allJedis[index]); allJedis.Remove(allJedis[index]); } jedis = jedis_to_pool; pool = new Pool(jedis_to_pool, businessManager.getStades()); }
public BettingManager(BusinessManager businessManager) { this.businessManager = businessManager; rand = new Random(); joueur1 = new Joueur("player1", 0); joueur2 = new Joueur("player2", 0); List<Jedi> allJedis = businessManager.getJedis(); List<Jedi> jedis_to_pool = new List<Jedi>(); //Creation de la liste a mettre dans la pool for (int i = 0; i < 16; i++) { int index = rand.Next() % allJedis.Count; jedis_to_pool.Add(allJedis[index]); allJedis.Remove(allJedis[index]); } jedis = jedis_to_pool; pool = new Pool(jedis_to_pool, businessManager.getStades()); }
static void Main(string[] args) { BusinessManager bm = new BusinessManager(); int choix = 0; while (choix != 5) { Console.Clear(); Console.WriteLine("1) Afficher la liste des évenements classés par date."); Console.WriteLine("2) Afficher la liste des artistes par ordre alphabétiques."); Console.WriteLine("3) Afficher la liste des lieux pour lesquels au moins un evenements est programmé."); Console.WriteLine("4) Pour un lieu donné, afficher la liste associés triés par date."); Console.WriteLine("5) Quitter."); Console.WriteLine(); Console.WriteLine("Que voulez vous faire ?"); int.TryParse(Console.ReadLine(), out choix); Console.Clear(); IList<string> str; switch (choix) { case 1: str = bm.getEvenementsSortByDate(); break; case 2: str = bm.getArtistesSortByName(); break; case 3: str = bm.getLieuxWithEvents(); break; case 4: int lieuChoisi = -1; while(lieuChoisi < 0 || lieuChoisi >= bm.getLieux().Count) { int i = 0; Console.Clear(); foreach(Lieu l in bm.getLieux()) { Console.WriteLine(i++.ToString() + "\\ " + l.ToString()); Console.WriteLine(); } Console.WriteLine(); Console.WriteLine("Que voulez vous faire ?"); int.TryParse(Console.ReadLine(), out lieuChoisi); } str = bm.getEvenementsSortByDate(bm.getLieux().ElementAt(lieuChoisi)); break; case 5: str = new List<string>(); break; default: str = new List<string>(); str.Add("Votre choix ne correspond à aucun numéro du menu."); break; } foreach(string s in str) { Console.WriteLine(s); Console.WriteLine(); } if (choix != 5) { Console.WriteLine("Press any key to continue."); Console.ReadKey(); } } }
public PlayingManager(BusinessManager businessManager) { this.businessManager = businessManager; }
public Login() { InitializeComponent(); manager = new BusinessManager(); }
public EventByPlaceWindow() { _bl = BusinessManager.Instance; InitializeComponent(); lieux.SelectionChanged += lieux_SelectionChanged; }
public ServiceJedi() { bm = new BusinessManager(); }
public IList<Business.UtilisateurWS> GetAllUsers(String login, String passwd) { IList<Business.UtilisateurWS> ret = null; if(CheckUser(login,passwd)) { IList<Utilisateur> users = new BusinessManager().GetUsers(); ret = new List<Business.UtilisateurWS>(); foreach (Utilisateur u in users) { ret.Add(Business.UtilisateurWS.Convert(u)); } } return ret; }
static void Main(string[] args) { BusinessManager businessManager = new BusinessManager(); int input; bool end = false; IEnumerable<string> res; List<Jedi> jedis = businessManager.getJedis(); while (!end) { Console.Out.WriteLine("Menu"); Console.Out.WriteLine("1 - All matches"); Console.Out.WriteLine("2 - All stades"); Console.Out.WriteLine("3 - All siths"); Console.Out.WriteLine("4 - Jedi 3 F 50 HP"); Console.Out.WriteLine("5 - Match 200 places siths"); Console.Out.WriteLine("6 - Play !"); Console.Out.WriteLine("7 - Bet !"); Console.Out.WriteLine("8 - Exit"); input = int.Parse(Console.In.ReadLine()); switch (input) { case 1: List<Match> matches = businessManager.getMatches(); foreach (Match match in matches) { Console.Out.Write(match.ToString()); } break; case 2: res = businessManager.getStringStades(); foreach (String el in res) { Console.Out.WriteLine(el); } break; case 3: res = businessManager.getStringObscurJedis(); //Ce sont des Sith pas des jedis obscurs !! foreach (String el in res) { Console.Out.WriteLine(el); } break; case 4: res = businessManager.getStringJedis(3, 50); foreach (String el in res) { Console.Out.WriteLine(el); } break; case 5: res = businessManager.getStringSithMatchesOver200(); foreach (String el in res) { Console.Out.WriteLine(el); } break; case 6: Jedi choosenJedi = null; PlayingManager pm = new PlayingManager(businessManager); while (choosenJedi == null) { Console.Out.WriteLine("Choose your jedi ! (put id) "); foreach (Jedi jedi in jedis) { Console.Out.WriteLine(jedi.Id + "\t: " + jedi.Nom); } int choixJedi = int.Parse(Console.In.ReadLine()); choosenJedi = jedis.Find(x => x.Id == choixJedi); } pm.LancerMatch(choosenJedi,8); while (pm.End != true) { bool cont = false; while(!cont){ cont = true; pm.title(); Console.Out.WriteLine("Choose your attack :"); Console.Out.WriteLine("\t1 - Force"); Console.Out.WriteLine("\t2 - Chance"); Console.Out.WriteLine("\t3 - Defense !"); int choixAttack = int.Parse(Console.In.ReadLine()); switch (choixAttack) { case 1: pm.utiliserForce(); break; case 2: pm.utiliserChance(); break; case 3: pm.utiliserDefense(); break; default: cont = false; break; } } Console.Out.WriteLine(pm.StatLastTurn); } if (pm.Win) { Console.Out.WriteLine("Vous avez gagne !"); } else { Console.Out.WriteLine("Vous avez perdu !"); } break; case 7: BettingManager bettingManager = new BettingManager(businessManager,2); Console.Out.WriteLine("List Jedi :"); foreach (Match match in bettingManager.Pool.Matches) { Console.Out.WriteLine(match.Jedi1.Id + "\t: " + match.Jedi1.Nom); Console.Out.WriteLine(match.Jedi2.Id + "\t: " + match.Jedi2.Nom); } while (!bettingManager.End) { int choixJedi1; int bet1; Jedi choosenJediBet1=null; int choixJedi2; int bet2; Jedi choosenJediBet2=null; while (choosenJediBet1 == null) { Console.Out.WriteLine("Player 1 your jedi ! (put id) "); choixJedi1 = int.Parse(Console.In.ReadLine()); choosenJediBet1 = jedis.Find(x => x.Id == choixJedi1); } Console.Out.WriteLine("Player 1 choose your bet : "); bet1 = int.Parse(Console.In.ReadLine()); while (choosenJediBet1 == null) { Console.Out.WriteLine("Player 2 your jedi ! (put id) "); choixJedi2 = int.Parse(Console.In.ReadLine()); choosenJediBet2 = jedis.Find(x => x.Id == choixJedi2); } Console.Out.WriteLine("Player 2 choose your bet : "); bet2 = int.Parse(Console.In.ReadLine()); bettingManager.lancerPhaseTournoi(new List<int> { bet1, bet2 }, new List<Jedi> { choosenJediBet1, choosenJediBet2 }); Console.Out.WriteLine(bettingManager.toString()); } break; case 8: end = true; break; default: Console.Out.WriteLine("Bad input"); break; } } }
public IList<Business.LieuWS> GetAllLieux(String login, String passwd) { IList<Business.LieuWS> ret = null; if (CheckUser(login, passwd)) { IList<Lieu> lieux = new BusinessManager().getLieux(); ret = new List<Business.LieuWS>(); foreach (Lieu l in lieux) { ret.Add(Business.LieuWS.Convert(l)); } } return ret; }
public IList<Business.PlanningElementWS> GetAllPlanningElements(String login, String passwd) { IList<Business.PlanningElementWS> ret = null; if(CheckUser(login,passwd)) { IList<PlanningElement> pe = new BusinessManager().getPlanningElements(); ret = new List<Business.PlanningElementWS>(); foreach (PlanningElement p in pe) { ret.Add(Business.PlanningElementWS.Convert(p)); } } return ret; }
static void Main(string[] args) { BusinessManager businessManager = new BusinessManager(); int input; bool end = false; IEnumerable<string> res; /*Console.Out.WriteLine("Test connection"); Jedi jedi = businessManager.testBDD(); Console.Out.WriteLine(jedi.ToString()); // TEST CARACTERISTIQUE List<Caracteristique> caracts = businessManager.getCaracteristique(); List<Caracteristique> cj = new List<Caracteristique>(); cj.Add(new Caracteristique( EDefCaracteristique.Sante, "TEST JEDI 1", ETypeCaracteristique.Jedi, 90)); List<Caracteristique> cs = new List<Caracteristique>(); cs.Add(new Caracteristique( EDefCaracteristique.Chance, "TEST STADE 1", ETypeCaracteristique.Stade, 10)); //Test ajout caracts.Add(new Caracteristique(EDefCaracteristique.Chance,"TEST CARACT 1",ETypeCaracteristique.Jedi,0)); caracts.Add(cj[0]); caracts.Add(cs[0]); //Test suppression caracts.Remove(caracts[2]); //Test update caracts[2].Nom = "toto"; businessManager.updateCaracteristique(caracts); // TEST UTILISATEUR List<Utilisateur> users = businessManager.getUtilisateur(); //Test ajout users.Add(new Utilisateur("jean", "jaque", "j", "j")); //Test suppression users.Remove(users[2]); //Test update users[0].Prenom = "toto"; businessManager.updateUtilisateur(users); // TEST JEDI List<Jedi> jedis = businessManager.getJedis(); //Test ajout jedi jedis.Add(new Jedi("Michel", false, cj)); //Test suppression Jedi jedis.Remove(jedis[1]); //Test update Jedi jedis[2].Nom = "Stan Smith"; //Test suppression Caract jedis[2].Caracteristiques.Remove(jedis[2].Caracteristiques[0]); //Test ajout Caract jedis[2].Caracteristiques.Add(cj[0]); //Test update Caract jedis[2].Caracteristiques[1].Nom = "TEST JEDI 3"; businessManager.updateJedi(jedis); // TEST STADES List<Stade> stades = businessManager.getStades(); //Test ajout stade stades.Add(new Stade(300, "Jakku", cs)); //Test suppression stade stades.Remove(stades[1]); //Test update stade stades[2].Planete = "Ta maman"; //Test suppression Caract stades[2].Caracteristiques.Remove(jedis[2].Caracteristiques[0]); //Test ajout Caract stades[2].Caracteristiques.Add(cs[0]); //Test update Caract stades[2].Caracteristiques[1].Nom = "TEST STADE 3"; businessManager.updateStades(stades); // TEST MATCH List<Match> matches = businessManager.getMatches(); //Test ajout matches.Add(new Match(jedis[0], jedis[2], EPhaseTournoi.Finale, stades[0])); matches.Add(new Match(jedis[0], jedis[2], EPhaseTournoi.Finale, stades[0])); //Test suppression matches.Remove(matches[0]); //Test update matches[0].Jedi1 = jedis[1]; businessManager.updateMatch(matches);*/ List<Jedi> jedis = businessManager.getJedis(); while (!end) { Console.Out.WriteLine("Menu"); Console.Out.WriteLine("1 - All matches"); Console.Out.WriteLine("2 - All stades"); Console.Out.WriteLine("3 - All siths"); Console.Out.WriteLine("4 - Jedi 3 F 50 HP"); Console.Out.WriteLine("5 - Match 200 places siths"); Console.Out.WriteLine("6 - Play !"); Console.Out.WriteLine("7 - Bet !"); Console.Out.WriteLine("8 - Exit"); input = int.Parse(Console.In.ReadLine()); switch (input) { case 1: List<Match> matches = businessManager.getMatches(); foreach (Match match in matches) { Console.Out.Write(match.ToString()); } break; case 2: res = businessManager.getStringStades(); foreach (String el in res) { Console.Out.WriteLine(el); } break; case 3: res = businessManager.getStringObscurJedis(); //Ce sont des Sith pas des jedis obscurs !! foreach (String el in res) { Console.Out.WriteLine(el); } break; case 4: res = businessManager.getStringJedis(3, 50); foreach (String el in res) { Console.Out.WriteLine(el); } break; case 5: res = businessManager.getStringSithMatchesOver200(); foreach (String el in res) { Console.Out.WriteLine(el); } break; case 6: Jedi choosenJedi = null; PlayingManager pm = new PlayingManager(businessManager); while (choosenJedi == null) { Console.Out.WriteLine("Choose your jedi ! (put id) "); foreach (Jedi jedi in jedis) { Console.Out.WriteLine(jedi.Id + "\t: " + jedi.Nom); } int choixJedi = int.Parse(Console.In.ReadLine()); choosenJedi = jedis.Find(x => x.Id == choixJedi); } pm.LancerMatch(choosenJedi,8); while (pm.End != true) { bool cont = false; while(!cont){ cont = true; pm.title(); Console.Out.WriteLine("Choose your attack :"); Console.Out.WriteLine("\t1 - Force"); Console.Out.WriteLine("\t2 - Chance"); Console.Out.WriteLine("\t3 - Defense !"); int choixAttack = int.Parse(Console.In.ReadLine()); switch (choixAttack) { case 1: pm.utiliserForce(); break; case 2: pm.utiliserChance(); break; case 3: pm.utiliserDefense(); break; default: cont = false; break; } } Console.Out.WriteLine(pm.StatLastTurn); } if (pm.Win) { Console.Out.WriteLine("Vous avez gagne !"); } else { Console.Out.WriteLine("Vous avez perdu !"); } break; case 7: BettingManager bettingManager = new BettingManager(businessManager); Console.Out.WriteLine("List Jedi :"); foreach (Match match in bettingManager.Pool.Matches) { Console.Out.WriteLine(match.Jedi1.Id + "\t: " + match.Jedi1.Nom); Console.Out.WriteLine(match.Jedi2.Id + "\t: " + match.Jedi2.Nom); } while (!bettingManager.End) { int choixJedi1; int bet1; Jedi choosenJediBet1=null; int choixJedi2; int bet2; Jedi choosenJediBet2=null; while (choosenJediBet1 == null) { Console.Out.WriteLine("Player 1 your jedi ! (put id) "); choixJedi1 = int.Parse(Console.In.ReadLine()); choosenJediBet1 = jedis.Find(x => x.Id == choixJedi1); } Console.Out.WriteLine("Player 1 choose your bet : "); bet1 = int.Parse(Console.In.ReadLine()); while (choosenJediBet1 == null) { Console.Out.WriteLine("Player 2 your jedi ! (put id) "); choixJedi2 = int.Parse(Console.In.ReadLine()); choosenJediBet2 = jedis.Find(x => x.Id == choixJedi2); } Console.Out.WriteLine("Player 2 choose your bet : "); bet2 = int.Parse(Console.In.ReadLine()); bettingManager.lancerPhaseTournoi(bet1, choosenJediBet1, bet2, choosenJediBet2); Console.Out.WriteLine(bettingManager.toString()); } break; case 8: end = true; break; default: Console.Out.WriteLine("Bad input"); break; } } }
private Boolean CheckUser(String login, String passwd) { Boolean ret = false; Utilisateur user = new BusinessManager().GetUserByLogin(login); if (user != null) { ret = passwd.Equals(user.Password); } return ret; }
public IList<Business.PlanningElementWS> GetAllPlanningElementsByEvent(String login, String passwd, System.Guid guidEvent) { IList<Business.PlanningElementWS> ret = null; if (CheckUser(login, passwd)) { IList<PlanningElement> pe = new BusinessManager().getPlanningElements().Where(a => a.MonEvement.Guid == guidEvent).ToList(); ret = new List<Business.PlanningElementWS>(); foreach (PlanningElement p in pe) { ret.Add(Business.PlanningElementWS.Convert(p)); } } return ret; }