Exemplo n.º 1
0
        // Methode pour get les parametres du taux

        public List <TauxRistourne> GetListeTauxRistourne()
        {
            using (SqlConnection Conn = new SqlConnection(ClassVariableGlobal.SetConnexion()))

                try
                {
                    Conn.Open();
                    List <TauxRistourne> _listeTauxRistourne = new List <TauxRistourne>();

                    if (Conn.State != System.Data.ConnectionState.Open)
                    {
                        Conn.Open();
                    }

                    string s = "SELECT  * FROM tParametreTaux";

                    SqlCommand objCommand = new SqlCommand(s, Conn);

                    SqlDataReader _Reader = objCommand.ExecuteReader();

                    while (_Reader.Read())
                    {
                        TauxRistourne objCust = new TauxRistourne();

                        objCust.IdTaux          = Convert.ToInt32(_Reader["IdParametre"]);
                        objCust.TauxSurMontant  = Convert.ToDouble(_Reader["TauxRistourneMontant"]);
                        objCust.TauxSurQuantite = Convert.ToDouble(_Reader["TauxRistourneQuantite"]);
                        objCust.CompteRistourne = Convert.ToInt32(_Reader["CompteRistourne"]);

                        _listeTauxRistourne.Add(objCust);
                    }

                    return(_listeTauxRistourne);
                }
                catch
                {
                    throw;
                }
                finally
                {
                    if (Conn != null)
                    {
                        if (Conn.State == ConnectionState.Open)
                        {
                            Conn.Close();
                            Conn.Dispose();
                        }
                    }
                }
        }
Exemplo n.º 2
0
        public int ModifierParametreTaux(TauxRistourne taux)
        {
            using (SqlConnection connection = new SqlConnection(ClassVariableGlobal.SetConnexion()))
            {
                connection.Open();

                string query = "UPDATE       tParametreTaux " +
                               " SET TauxRistourneMontant = @TauxRistourneMontant, TauxRistourneQuantite = @TauxRistourneQuantite, CompteRistourne = @CompteRistourne " +
                               " WHERE(IdParametre = 1)";

                SqlCommand commande = new SqlCommand(query, connection);

                commande.Parameters.AddWithValue("@TauxRistourneMontant", taux.TauxSurMontant);
                commande.Parameters.AddWithValue("@TauxRistourneQuantite", taux.TauxSurQuantite);
                commande.Parameters.AddWithValue("@CompteRistourne", taux.CompteRistourne);

                return(commande.ExecuteNonQuery());
            }
        }
Exemplo n.º 3
0
        // Methode pour enregistrer le taux sur le systeme

        public int InsertTauxRistourne(TauxRistourne taux)
        {
            using (SqlConnection connection = new SqlConnection(ClassVariableGlobal.SetConnexion()))
            {
                connection.Open();

                string query = "INSERT INTO tParametreTaux" +
                               " (TauxRistourneMontant, TauxRistourneQuantite,CompteRistourne)" +
                               " VALUES(@TauxRistourneMontant, @TauxRistourneQuantite,@CompteRistourne)";

                SqlCommand commande = new SqlCommand(query, connection);

                commande.Parameters.AddWithValue("@TauxRistourneMontant", taux.TauxSurMontant);
                commande.Parameters.AddWithValue("@TauxRistourneQuantite", taux.TauxSurQuantite);
                commande.Parameters.AddWithValue("@CompteRistourne", taux.CompteRistourne);

                return(commande.ExecuteNonQuery());
            }
        }