Exemple #1
0
        public CMatchs Lire_ID(int matchId)
        {
            CreerCommande("SelectionnerMatchs_ID");
            Commande.Parameters.AddWithValue("@MatchId", matchId);
            Commande.Connection.Open();
            SqlDataReader dr  = Commande.ExecuteReader();
            CMatchs       res = new CMatchs();

            while (dr.Read())
            {
                res.MatchId        = matchId;
                res.NumMatch       = dr["NumMatch"].ToString();
                res.Date           = DateTime.Parse(dr["Date"].ToString());
                res.Heure          = DateTime.Parse(dr["HeureDebut"].ToString());
                res.Serie          = int.Parse(dr["Serie"].ToString());
                res.Division       = dr["Division"].ToString();
                res.EquipeVisiteur = int.Parse(dr["EquipeVisiteur"].ToString());
                res.EquipeVisite   = int.Parse(dr["EquipeVisite"].ToString());
            }
            if (dr["Score"] != DBNull.Value)
            {
                res.Score = dr["Score"].ToString();
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Exemple #2
0
        public List <CMatchs> Lire(string index)
        {
            CreerCommande("SelectionnerMatchs");
            Commande.Parameters.Add("Index", SqlDbType.VarChar);
            Commande.Parameters.AddWithValue("@Index", index);
            Commande.Connection.Open();
            SqlDataReader  dr  = Commande.ExecuteReader();
            List <CMatchs> res = new List <CMatchs>();

            while (dr.Read())
            {
                CMatchs tmp = new CMatchs
                {
                    MatchId        = int.Parse(dr["MatchId"].ToString()),
                    NumMatch       = dr["NumMatch"].ToString(),
                    Date           = DateTime.Parse(dr["Date"].ToString()),
                    Heure          = DateTime.Parse(dr["Heure"].ToString()),
                    Serie          = int.Parse(dr["Serie"].ToString()),
                    Division       = dr["Division"].ToString(),
                    EquipeVisiteur = int.Parse(dr["EquipeVisiteur"].ToString()),
                    EquipeVisite   = int.Parse(dr["EquipeVisite"].ToString()),
                };
                if (dr["Score"] != DBNull.Value)
                {
                    tmp.Score = dr["Score"].ToString();
                }
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }