コード例 #1
0
 private void ReglerQte(Jonction jonct, Pari pari, Json.Stat stat, PariDetail pd1, PariDetail pd2)
 {
     if (stat.equipe1 > (stat.equipe2 + pd1.Compensation))
     {
         int ecart = stat.equipe1 - (stat.equipe2 + pd1.Compensation);
         if (ecart > pd1.Ecart)
         {
             int   ecart2  = ecart / (int)pd1.Ecart;
             float montant = ecart2 * pd1.MontantEcart;
             if (montant > jonct.Montant)
             {
                 montant = jonct.Montant;
             }
             Client cl1 = pd1.Pari.Client, cl2 = pd2.Pari.Client;
             cl1.Solde += (jonct.Montant + montant);
             cl2.Solde += (jonct.Montant - montant);
             new ClientDAO(connection).Update(cl1);
             new ClientDAO(connection).Update(cl2);
         }
         else
         {
             Client client = pd1.Pari.Client;
             client.Solde += jonct.Montant;
             new ClientDAO(connection).Update(client);
         }
     }
     else if (stat.equipe1 < (stat.equipe2 + pd1.Compensation))
     {
         int ecart = (stat.equipe2 + pd1.Compensation) - stat.equipe1;
         if (ecart > pd2.Ecart)
         {
             int   ecart2  = ecart / (int)pd2.Ecart;
             float montant = ecart2 * pd2.MontantEcart;
             if (montant > jonct.Montant)
             {
                 montant = jonct.Montant;
             }
             Client cl1 = pd1.Pari.Client, cl2 = pd2.Pari.Client;
             cl1.Solde += (jonct.Montant - montant);
             cl2.Solde += (jonct.Montant + montant);
             new ClientDAO(connection).Update(cl1);
             new ClientDAO(connection).Update(cl2);
         }
         else
         {
             Client client = pd2.Pari.Client;
             client.Solde += jonct.Montant;
             new ClientDAO(connection).Update(client);
         }
     }
     else
     {
         this.Egalite(jonct, pari, pd1, pd2);
     }
 }
コード例 #2
0
 public PariDetail(String id, Pari pari, Equipe equipe, int compensation, float montant, float ecartMax, float ecart, float montantEcart)
 {
     this.Id           = id;
     this.Pari         = pari;
     this.Equipe       = equipe;
     this.Compensation = compensation;
     this.Montant      = montant;
     this.EcartMax     = ecartMax;
     this.Ecart        = ecart;
     this.MontantEcart = montantEcart;
 }
コード例 #3
0
ファイル: PariDAO.cs プロジェクト: GimmyR/footage
        public Pari SelectOne(String condition)
        {
            Pari result = null;

            if (connexion.State == ConnectionState.Open)
            {
                connexion = new SqlConnection(connexion.ConnectionString + "Password=itu");
            }
            connexion.Open();
            using (SqlCommand cmd = connexion.CreateCommand()) {
                result = this.ExecuteSelectOne(cmd, condition);
            } connexion.Close();

            return(result);
        }
コード例 #4
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 !");
            }
        }
コード例 #5
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);
            }
        }
コード例 #6
0
ファイル: PariDAO.cs プロジェクト: GimmyR/footage
        private Pari ExecuteSelectOne(SqlCommand cmd, String condition)
        {
            Pari result = null;

            string cond = "";

            if (condition != null)
            {
                cond = " " + condition;
            }
            cmd.CommandText = "SELECT * FROM Pari" + cond;
            using (SqlDataReader reader = cmd.ExecuteReader()) {
                if (reader.Read())
                {
                    result = this.Map(reader);
                }
            } return(result);
        }
コード例 #7
0
 private void ReglerTotal(Jonction jonct, Pari pari, Json.Stat stat, PariDetail pd1, PariDetail pd2)
 {
     if (stat.equipe1 > (stat.equipe2 + pd1.Compensation))
     {
         Client client = pd1.Pari.Client;
         client.Solde += (jonct.Montant * 2);
         new ClientDAO(connection).Update(client);
     }
     else if (stat.equipe1 < (stat.equipe2 + pd1.Compensation))
     {
         Client client = pd2.Pari.Client;
         client.Solde += (jonct.Montant * 2);
         new ClientDAO(connection).Update(client);
     }
     else
     {
         this.Egalite(jonct, pari, pd1, pd2);
     }
 }
コード例 #8
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);
            }
        }
コード例 #9
0
        // METHODS :

        public bool Equals(Pari pari)
        {
            return(pari.Id == this.id);
        }