public double getTotal(Int32 pMois, Int32 pNumLigue)
        {
            Form_adherant Application = new Form_adherant();
            string connStr = "Data Source = WIN-921C8FKTGAE; Initial Catalog=m2lCK ;User ID=sio2slam;Password="******"SELECT Adherant.nom, TypeService.libelle, TypeService.prix, Service.quantiteService, Service.date, Service.numType, Service.numEtat, Service.numAdherant, Service.numero, Adherant.numLigue, TypeService.libelle, Ligue.nom FROM Service INNER JOIN Adherant ON Service.numAdherant = Adherant.numero INNER JOIN TypeService ON Service.numType = TypeService.numero INNER JOIN Etat ON Service.numEtat = Etat.numero INNER JOIN Ligue ON Adherant.numLigue = Ligue.numero WHERE(Service.numEtat = 2) AND (MONTH(Service.date) = "+pMois+") And Adherant.numLigue = "+pNumLigue+"";

            try
            {
                maConnexion = new SqlConnection();
                maConnexion.ConnectionString = connStr;
                maConnexion.Open(); maCommande = new SqlCommand(sqlStr, maConnexion);
                maCommande.CommandType = CommandType.Text;
                SqlDataReader unJeuResultat = maCommande.ExecuteReader();
                while (unJeuResultat.Read())
                {
                    total = total + ((Double)unJeuResultat["prix"] * (Int32)unJeuResultat["quantiteService"]);
                }
            }

            catch (Exception e)
            {

            }
            return (total);
        }
Exemple #2
0
        private void btn_se_connecter_Click(object sender, EventArgs e)
        {
            // Si verifUtilisateur retourne 2 alors il a planté
            //Ouvre un autre formulaire

            String nom = txt_nom_utilisateur.Text;
            string mdp = txt_mdp.Text;
            Int32 numUtil = verif.getNum(nom);
            Form_admin frm = new Form_admin(numUtil);
            Form_adherant frma = new Form_adherant(numUtil);
            Int32 Droit = verif.verifUtilisateur(nom, mdp);//stockage de la valeur de droit du gars qui se co
            if (Droit == 1)
            {
                frm.Show();
            }

            else if (Droit == 0)
            {
                frma.Show();
            }

            else
            {
                MessageBox.Show("Connection impossible");
            }
        }
        public void ajouterDemande(Int32 pQtte, Int32 pType, Int32 pNumAdherant)
        {
            Form_adherant Application = new Form_adherant();
            string connStr = "Data Source = WIN-921C8FKTGAE; Initial Catalog=m2lCK ;User ID=sio2slam;Password="******"INSERT INTO Service (date, quantiteService, numType, numAdherant, numEtat) VALUES (GETDATE(), " + pQtte + ", " + pType + ", " + pNumAdherant + ", 1)";

            try
            {
                maConnexion = new SqlConnection();
                maConnexion.ConnectionString = connStr;
                maConnexion.Open(); maCommande = new SqlCommand(sqlStr, maConnexion);
                maCommande.ExecuteNonQuery();
            }
            catch (Exception e)
            {

            }
        }
        public void setFacturer(Int32 pMois, Int32 pNumLigue)
        {
            Form_adherant Application = new Form_adherant();
            string connStr = "Data Source = WIN-921C8FKTGAE; Initial Catalog=m2lCK ;User ID=sio2slam;Password="******"UPDATE Service set numEtat = 3  WHERE(Service.numEtat = 2) AND (MONTH(Service.date) = "+pMois+") AND numLigue = "+pNumLigue+"";

            try
            {
                maConnexion = new SqlConnection();
                maConnexion.ConnectionString = connStr;
                maConnexion.Open(); maCommande = new SqlCommand(sqlStr, maConnexion);
                maCommande.ExecuteNonQuery();
            }

            catch (Exception e)
            {

            }
        }