Пример #1
0
 public ProchainePartie(string id, Equipe equipe1, Equipe equipe2, Partie partie)
 {
     this.Id      = id;
     this.Equipe1 = equipe1;
     this.Equipe2 = equipe2;
     this.Partie  = partie;
 }
Пример #2
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;
        }
Пример #3
0
        public void DoIt(Partie partie)
        {
            List <ProchainePartie> pps = ppdao.Select("WHERE partie='" + partie + "'");

            if (pps.Count() > 0)
            {
                ProchainePartie   pp      = pps.First();
                Pari              pari    = padao.SelectOne("WHERE partie='" + pp + "'");
                List <PariDetail> details = paddao.Select("WHERE pari='" + pari + "'");
                this.JustDoIt(details);
            }
            else
            {
                throw new Exception("Partie introuvable !");
            }
        }
Пример #4
0
        private void Regler(Jonction jonction)
        {
            PariDetail pd1 = jonction.Pari, pd2 = jonction.ContrePari;
            Pari       pari   = pd1.Pari;
            Partie     partie = pari.Partie.Partie;
            Action     action = pari.Action;

            Json.Stat stat = new OtherDAO(connection).SelectOneStat(partie.Id, action.Id, pd1.Equipe.Id, pd2.Equipe.Id);
            if (pari.TypePari == 0)
            {
                this.ReglerTotal(jonction, pari, stat, pd1, pd2);
            }
            else
            {
                this.ReglerQte(jonction, pari, stat, pd1, pd2);
            }
        }
Пример #5
0
        // METHODES :

        public List <ProchainePartie> Select(string cond)
        {
            List <ProchainePartie> 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, equipe1, equipe2, partie FROM ProchainePartie" + condition;
                    using (SqlDataReader reader = cmd.ExecuteReader()) {
                        parties = new List <ProchainePartie>();
                        ProchainePartie p;

                        EquipeDAO eqdao = new EquipeDAO(connexion);
                        PartieDAO pdao  = new PartieDAO(connexion);
                        while (reader.Read())
                        {
                            Partie partie = null;
                            if (reader["partie"].ToString() != "")
                            {
                                partie = pdao.Select("WHERE id='" + reader["partie"].ToString() + "'").First();
                            }

                            Equipe eq1 = eqdao.Select("WHERE id='" + reader["equipe1"].ToString() + "'").First();
                            Equipe eq2 = eqdao.Select("WHERE id='" + reader["equipe2"].ToString() + "'").First();

                            p = new ProchainePartie(reader["id"].ToString(), eq1, eq2, partie);
                            parties.Add(p);
                        }
                    }
                } connexion.Close();
            } catch (Exception ex) {
                throw ex;
            } return(parties);
        }
Пример #6
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);
        }
Пример #7
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);
        }
Пример #8
0
        // METHODS :

        public bool Equals(Partie partie)
        {
            return(id == partie.Id && datePartie.Equals(partie.DatePartie) && equipe1.Equals(partie.Equipe1) && equipe2.Equals(partie.Equipe2) && dureeMitemps.Equals(partie.DureeMitemps) && fini == partie.Fini);
        }