示例#1
0
        // METHODES :

        public List <PartieDetails> Select(string cond)
        {
            List <PartieDetails> partiedetailss = 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 partie, mitemps, temps, equipe, details, action, remarque FROM PartieDetails" + condition;
                    using (SqlDataReader reader = cmd.ExecuteReader()) {
                        partiedetailss = new List <PartieDetails>();
                        PartieDetails p;

                        PartieDAO        ptdao  = new PartieDAO(connexion);
                        EquipeDAO        eqdao  = new EquipeDAO(connexion);
                        ActionDAO        actdao = new ActionDAO(connexion);
                        EquipeDetailsDAO eddao  = new EquipeDetailsDAO(connexion);
                        while (reader.Read())
                        {
                            Partie        pt      = ptdao.Select("WHERE id='" + reader["partie"].ToString() + "'").ElementAt(0);
                            Equipe        eq      = eqdao.Select("WHERE id='" + reader["equipe"].ToString() + "'").ElementAt(0);
                            EquipeDetails details = eddao.Select("WHERE id='" + reader["details"].ToString() + "'").ElementAt(0);
                            Action        act     = actdao.Select("WHERE id='" + reader["action"].ToString() + "'").ElementAt(0);

                            p = new PartieDetails(pt, int.Parse(reader["mitemps"].ToString()), Convert.ToDateTime(reader["temps"].ToString()), eq, details, act, reader["remarque"].ToString());
                            partiedetailss.Add(p);
                        }
                    }
                } connexion.Close();
            } catch (Exception ex) {
                throw ex;
                //Console.Error.WriteLine(ex.Message + " in : " + ex.StackTrace);
            } return(partiedetailss);
        }
示例#2
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);
        }
示例#3
0
        // METHODS :

        public bool Equals(EquipeDetails equipedetails)
        {
            return(id == equipedetails.Id && equipe.Equals(equipedetails.Equipe) && joueur.Equals(equipedetails.Joueur) && numero == equipedetails.Numero);
        }
示例#4
0
        // CONSTRUCTOR :

        public PartieDetails(Partie partie, int mitemps, DateTime temps, Equipe equipe, EquipeDetails details, Action action, string remarque)
        {
            this.Partie   = partie;
            this.Mitemps  = mitemps;
            this.Temps    = temps;
            this.Equipe   = equipe;
            this.Details  = details;
            this.Action   = action;
            this.Remarque = remarque;
        }