예제 #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
        private Json.Stat ExecuteSelectOneStat(SqlCommand cmd)
        {
            Json.Stat result = null;

            using (SqlDataReader reader = cmd.ExecuteReader()) {
                if (reader.Read())
                {
                    result = this.MapStat(reader);
                }
            } return(result);
        }
예제 #3
0
        public Json.Stat SelectOneStat(String partie, String action, String equipe1, String equipe2)
        {
            Json.Stat result = null;

            if (connexion.State == ConnectionState.Open)
            {
                connexion = new SqlConnection(connexion.ConnectionString + "Password=itu");
            }
            connexion.Open();
            using (SqlCommand cmd = connexion.CreateCommand()) {
                cmd.CommandText = "SELECT dbo.GetDetail('" + partie + "', '" + equipe1 + "', '" + action + "') as equipe1, dbo.GetDetail('" + partie + "', '" + equipe2 + "', '" + action + "') as equipe2;";
                result          = this.ExecuteSelectOneStat(cmd);
            } connexion.Close();

            return(result);
        }
예제 #4
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);
     }
 }