示例#1
0
        // METHODES :

        public List <EquipeDetails> Select(string cond)
        {
            List <EquipeDetails> equipedetailss = null;

            try {
                if (connexion.State == ConnectionState.Open)
                {
                    connexion = new SqlConnection(connexion.ConnectionString + "Password=itu");
                }
                connexion.Open();
                using (SqlCommand cmd = connexion.CreateCommand()) {
                    string condition = "";
                    if (cond != null)
                    {
                        condition = " " + cond;
                    }
                    cmd.CommandText = "SELECT id, equipe, joueur, numero FROM EquipeDetails" + condition;
                    using (SqlDataReader reader = cmd.ExecuteReader()) {
                        equipedetailss = new List <EquipeDetails>();
                        EquipeDetails p;

                        EquipeDAO eqdao = new EquipeDAO(connexion);
                        JoueurDAO jdao  = new JoueurDAO(connexion);
                        while (reader.Read())
                        {
                            Equipe eq = eqdao.Select("WHERE id='" + reader["equipe"].ToString() + "'").ElementAt(0);
                            Joueur jr = jdao.Select("WHERE id='" + reader["joueur"].ToString() + "'").ElementAt(0);


                            p = new EquipeDetails(reader["id"].ToString(), eq, jr, int.Parse(reader["numero"].ToString()));
                            equipedetailss.Add(p);
                        }
                    }
                } connexion.Close();
            } catch (Exception ex) {
                throw ex;
            } return(equipedetailss);
        }
示例#2
0
        // METHODES :

        public List <Partie> Select(string cond)
        {
            List <Partie> parties = null;

            try {
                if (connexion.State == ConnectionState.Open)
                {
                    connexion = new SqlConnection(connexion.ConnectionString + "Password=itu");
                }
                connexion.Open();
                using (SqlCommand cmd = connexion.CreateCommand()) {
                    string condition = "";
                    if (cond != null)
                    {
                        condition = " " + cond;
                    }
                    cmd.CommandText = "SELECT id, datePartie, equipe1, equipe2, dureeMitemps, fini FROM Partie" + condition;
                    using (SqlDataReader reader = cmd.ExecuteReader()) {
                        parties = new List <Partie>();
                        Partie p;

                        EquipeDAO eqdao = new EquipeDAO(connexion);
                        while (reader.Read())
                        {
                            Equipe eq1  = eqdao.Select("WHERE id='" + reader["equipe1"].ToString() + "'").ElementAt(0);
                            Equipe eq2  = eqdao.Select("WHERE id='" + reader["equipe2"].ToString() + "'").ElementAt(0);
                            int    fini = int.Parse(reader["fini"].ToString());

                            p = new Partie(reader["id"].ToString(), Convert.ToDateTime(reader["datePartie"].ToString()), eq1, eq2, Convert.ToDateTime(reader["dureeMitemps"].ToString()), fini);
                            parties.Add(p);
                        }
                    }
                } connexion.Close();
            } catch (Exception ex) {
                throw ex;
                //Console.Error.WriteLine(ex.Message + " in : " + ex.StackTrace);
            } return(parties);
        }
示例#3
0
文件: Equipe.cs 项目: GimmyR/footage
        // METHODS :

        public bool Equals(Equipe equipe)
        {
            return(id == equipe.Id && nom == equipe.Nom);
        }