/*public void AddJoueurToPartie(Joueur j, Partie p) * { * Dictionary<string, dynamic> val = new Dictionary<string, dynamic>(); * val.Add("joueur", j.Id); * val.Add("partie", p.Id); * _dbal.Insert("joueur_partie", val); * } * public List<Joueur> GetJoueurToPartie(Partie p) * { * List<Joueur> lst = new List<Joueur>(); * DataTable tab = _dbal.Select("joueur_partie", "partie = " + p.Id); * foreach (DataRow row in tab.Rows) * { * lst.Add(new Joueur(row, _daoAvis.GetByJoueurId((int)row["id"]))); * } * return lst; * } * * * public Joueur GetJoueurById(int id) * { * DataRow row = _dbal.SelectById("joueur", id); * return new Joueur(row, _daoAvis.GetByJoueurId((int)row["id"])); * }*/ public List <Joueur> GetAllJoueur() { List <Joueur> lst = new List <Joueur>(); DataTable tab = _dbal.Select("joueur"); foreach (DataRow row in tab.Rows) { lst.Add(new Joueur(row, _daoAvis.GetByJoueurId((int)row["id"]))); } return(lst); }
/// <returns> /// Retourne un dictionnaire avec comme clé un horraire et comme valeur /// sois une Partie (qui correspond à l'horraire) /// sois null si l'horraire n'est pas réserver /// </returns> /* public Dictionary<Horaire, Partie> GetPlanning(DateTime jour, Salle salle) * { * Dictionary<Horaire, Partie> dic = new Dictionary<Horaire, Partie>(); * DataTable tab = _dbal.SelectOrderBy("horaire", "heure"); // Il faut sélectionnée par site (de la salle) * foreach (DataRow row in tab.Rows) * { * Horaire horaire = new Horaire(row); * dic.Add(horaire, _daoPartie.GetPartieForHoraire(horaire,jour,salle)); * } * return dic; * }*/ public List <Partie> GetPlanning(DateTime jour, Salle salle, Site site) { List <Partie> plann = new List <Partie>(); DataTable tab = _dbal.Select("site_horaire", "site = " + site.Id); foreach (DataRow row in tab.Rows) { plann.Add(_daoPartie.GetPartieForHoraire(GetById((int)row["horaire"]), jour, salle)); } return(plann); }
public List <Theme> GetAllTheme() { DataTable tab = _dbal.Select("theme"); List <Theme> lstT = new List <Theme>(); foreach (DataRow row in tab.Rows) { lstT.Add(new Theme(row)); } return(lstT); }
public List <Salle> GetBySite(Site site) { DataTable tab = _dbal.Select("salle", "site = " + site.Id); List <Salle> lst = new List <Salle>(); foreach (DataRow row in tab.Rows) { Salle s = new Salle(row); s.Site = site; s.Theme = _daoTheme.GetThemeActuel(s); lst.Add(s); } return(lst); }
public Client SearchClient(string prenom, string nom, string email) { try { return(new Client(_dbal.Select("client", "prenom = '" + prenom + "' AND " + "nom = '" + nom + "' AND " + "email = '" + email + "'" ).Rows[0])); } catch (Exception e) { Console.WriteLine(e); return(new Client()); } }
/*public List<Partie> GetPartiesDuJour(Salle salle, DateTime date) * { * DataTable tab = _dbal.Select("Partie", * "date > '" + date.ToString("yyyy-MM-dd H:m:s") + "' AND " + * "date < '" + date.AddDays(1).ToString("yyyy-MM-dd") + "' AND " + * "salle = " + salle.Id * ); * List<Partie> lstP = new List<Partie>(); * foreach (DataRow row in tab.Rows) * { * lstP.Add(new Partie(row, _daoSalle.GetSalle((int)row["salle"]))); * } * return lstP; * }*/ /// <summary> /// Attention, la date doit déja être attribué /// </summary> /*public void Create(Partie p) * { * _dbal.Insert("partie", p.ToArray()); * DataRow dbP = _dbal.Select("partie","date = '" + p.Date.ToString("yyyy-MM-dd") + "'").Rows[0]; * p.Id = (int)dbP["id"]; * foreach (Joueur j in p.LstJoueur) * { * _daoJoueur.AddJoueurToPartie(j, p); * } * for (int i = 0; i < p.LstObstacle.Count; i++) * { * _daoObstacle.AddObstacleToPartie(p.LstObstacle[i], p, i); * } * } * public void Edit(Partie p) * { * * }*/ // public Partie GetPartie(int id) // { // DataRow rowP = _dbal.SelectById("partie", id); // Partie partie = new Partie(rowP, _daoSalle.GetSalle((int)rowP["salle"])); // partie.LstJoueur = _daoJoueur.GetJoueurToPartie(partie); // return partie; // } public Partie GetPartieForHoraire(Horaire horaire, DateTime jour, Salle salle) { try { return(new Partie(_dbal.Select("partie", "salle = " + salle.Id + " and date = '" + jour.ToString("yyyy-M-d") + "' and " + "horaire = " + horaire.Id ).Rows[0], horaire)); } catch (Exception e) { return(new Partie(salle, horaire, jour)); } }
/*public void Insert(Avis avis) * { * _dbal.Insert("avis", avis.ToArray()); * } * public void Update(Avis avis) * { * _dbal.Update("avis", avis.ToArray(), "id = " + avis.Id); * } * public void Delete(Avis avis) * { * _dbal.Delete("Avis", "id = " + avis.Id); * } * public List<Avis> GetAll() * { * DataTable tab = _dbal.Select("avis"); * List<Avis> lst = new List<Avis>(); * foreach (DataRow row in tab.Rows) * { * lst.Add(new Avis(row, _daoJoueur.GetJoueurById((int)row["joueur"]))); * } * return lst; * } * public List<Avis> GetForJoueur(Joueur joueur) * { * DataTable tab = _dbal.Select("avis","joueur = " + joueur.Id); * List<Avis> lst = new List<Avis>(); * foreach (DataRow row in tab.Rows) * { * lst.Add(new Avis(row, joueur)); * } * return lst; * }*/ public List <Avis> GetByJoueurId(int id) { DataTable tab = _dbal.Select("avis", "joueur = " + id); List <Avis> lst = new List <Avis>(); foreach (DataRow row in tab.Rows) { lst.Add(new Avis(row)); } return(lst); }
public List <Obstacle> GetAllObstacle() { List <Obstacle> lst = new List <Obstacle>(); DataTable tab = _dbal.Select("obstacle"); foreach (DataRow row in tab.Rows) { lst.Add(new Obstacle(row)); } return(lst); }