Example #1
0
        private Pret Map(SqlDataReader reader)
        {
            ClientDAO cldao = new ClientDAO(connexion);

            String id        = reader["id"].ToString();
            Client client    = cldao.SelectOne("WHERE id='" + reader["client"] + "'");
            float  montant   = float.Parse(reader["montant"].ToString());
            String datePret  = Convert.ToDateTime(reader["datePret"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
            int    rembourse = int.Parse(reader["rembourse"].ToString());

            return(new Pret(id, client, montant, datePret, rembourse));
        }
Example #2
0
        private Pari Map(SqlDataReader reader)
        {
            String          id       = reader["id"].ToString();
            Client          client   = new ClientDAO(connexion).SelectOne("WHERE id='" + reader["client"] + "'");
            ProchainePartie partie   = new ProchainePartieDAO(connexion).Select("WHERE id='" + reader["partie"] + "'").First();
            int             typePari = int.Parse(reader["typePari"].ToString());

            Models.Action action       = new ActionDAO(connexion).Select("WHERE id='" + reader["action"] + "'").First();
            int           equilibre    = int.Parse(reader["equilibre"].ToString());
            int           regleEgalite = int.Parse(reader["regleEgalite"].ToString());

            return(new Pari(id, client, partie, typePari, action, equilibre, regleEgalite));
        }
Example #3
0
        private void Egalite(Jonction jonct, Pari pari, PariDetail pd1, PariDetail pd2)
        {
            Client    cl1 = pd1.Pari.Client, cl2 = pd2.Pari.Client;
            ClientDAO cldao = new ClientDAO(connection);

            if (pari.RegleEgalite == 0)
            {
                cl1.Solde += jonct.Montant; cl2.Solde += jonct.Montant;
                cldao.Update(cl1); cldao.Update(cl2);
            }
            else if (pari.RegleEgalite == 1)
            {
                cl1.Solde += (jonct.Montant * 2);
                cldao.Update(cl1);
            }
            else
            {
                cl2.Solde += (jonct.Montant * 2);
                cldao.Update(cl2);
            }
        }