Exemplo n.º 1
0
 public Pari(String id, Client client, ProchainePartie partie, int typePari, Action action, int equilibre, int regleEgalite)
 {
     this.Id           = id;
     this.Client       = client;
     this.Partie       = partie;
     this.TypePari     = typePari;
     this.Action       = action;
     this.Equilibre    = equilibre;
     this.RegleEgalite = regleEgalite;
 }
Exemplo n.º 2
0
        // METHODS :

        public bool Equals(ProchainePartie partie)
        {
            bool tof = false;

            if (this.partie != null && partie.Partie != null)
            {
                tof = this.partie.Equals(partie.Partie);
            }

            return(id == partie.Id && equipe1.Equals(partie.Equipe1) && equipe2.Equals(partie.Equipe2) && tof);
        }
Exemplo n.º 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 !");
            }
        }
Exemplo n.º 4
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);
        }