Ejemplo n.º 1
0
        public static void Vesement(Compte A)
        {
            SqlCommand comm2 = new SqlCommand();

            comm2.Connection  = conan;
            comm2.CommandText = "UPDATE [dbo].[Compte] SET [Montant]=" + A.getMont() + " WHERE [NumCompte]=" + A.getNum() + "";
            comm2.ExecuteScalar();
        }
Ejemplo n.º 2
0
        public static void Ajouter(Compte C, Client C1)
        {
            SqlCommand comm  = new SqlCommand();
            SqlCommand comm2 = new SqlCommand();

            comm.Connection   = conan;
            comm2.Connection  = conan;
            comm.CommandText  = "INSERT INTO[dbo].[Compte]([NumCompte], [Montant], [TypeCompt], [Numclient]) VALUES(" + C.getNum() + ", " + C.getMont() + ",'" + C.gettype() + "'," + C1.getNum() + ")";
            comm2.CommandText = "INSERT INTO[dbo].[Client]([NumClient], [Nom], [Prenom], [Gsm], [E_mail]) VALUES(" + C1.getNum() + ",'" + C1.getNom() + "','" + C1.getPrenom() + "','" + C1.getGsm() + "','" + C1.getE_mail() + "')";


            //comm.CommandText = "INSERT INTO `compte`(`NumCompte`, `Montant`, `TypeCompt`, `Numclient`) VALUES ("C.getNum+","C.getMont ","C.gettype","C1.getNum")";

            comm.ExecuteNonQuery();
            comm2.ExecuteNonQuery();
        }
Ejemplo n.º 3
0
        public static void saerchcompte(Compte V, int b)
        {
            V.setNum(b);
            //UPDATE `compte` SET `Montant`=1234,`TypeCompt`='hello',`Numclient`=123 WHERE `NumCompte`=1
            SqlCommand comm2 = new SqlCommand();

            comm2.Connection  = conan;
            comm2.CommandText = "SELECT [Montant] FROM[dbo].[Compte] WHERE[NumCompte] = " + V.getNum() + "";
            //comm2.CommandText = "SELECT * FROM[dbo].[Compte] WHERE[NumCompte] = 432879";
            //V=(Compte)comm2.ExecuteScalar();

            V.setMont((double)comm2.ExecuteScalar());

            Console.WriteLine(V.getMont());
        }
Ejemplo n.º 4
0
        public static void deeuMenu()
        {
            Console.Clear();
            int b = 0;

            Console.WriteLine("entrer le numero de compte(taper 0 pour annuller) :");
            b = int.Parse(Console.ReadLine());
            if (b == 0)
            {
            }
            else if (b != 0)
            {
                DeeuMenu(b);

                int p = 0;
                //Console.WriteLine("");
                OperMenu();
                p = int.Parse(Console.ReadLine());


                if (p == 1)
                {
                    Console.WriteLine("entrer  un solde pour verser :");
                    double S1 = double.Parse(Console.ReadLine());

                    S1 += AjCmp.getMont();
                    AjCmp.setMont(S1);
                    //Console.WriteLine(AjCmp.getNum()+"    "+AjCmp.getMont());
                    ConnectionDb.Vesement(AjCmp);
                    ConnectionDb.insertOper(AjCmp.getNum(), "versement");
                    AjCmp = new Compte();
                }
                else if (p == 2)
                {
                    Console.Clear();
                    int b1 = 0;
                    Console.WriteLine(" entrer le numero de compte de reception ");
                    b1 = int.Parse(Console.ReadLine());
                    ConnectionDb.saerchcompte(Cmp, b1);

                    Console.WriteLine("entrer un solde : ");
                    double S2 = double.Parse(Console.ReadLine());
                    if (S2 <= AjCmp.getMont() + 100)
                    {
                        AjCmp.setMont(AjCmp.getMont() - S2);
                        Cmp.setMont(Cmp.getMont() + S2);
                        ConnectionDb.Vesement(AjCmp);
                        ConnectionDb.Vesement(Cmp);
                        ConnectionDb.insertOper(AjCmp.getNum(), "Trensfaire");

                        AjCmp = new Compte();
                        Cmp   = new Compte();
                    }
                    else
                    {
                        AjCmp = new Compte();
                        imposible();
                        //Console.WriteLine("imposiple de faire cette operation");
                    }
                }
                else if (p == 3)
                {
                    Console.WriteLine("entrer  un solde pour retrer :");
                    double S3 = double.Parse(Console.ReadLine());
                    if (S3 <= AjCmp.getMont())
                    {
                        S3 = AjCmp.getMont() - S3;
                        AjCmp.setMont(S3);
                        ConnectionDb.Vesement(AjCmp);
                        ConnectionDb.insertOper(AjCmp.getNum(), "retretement");
                        AjCmp = new Compte();
                    }

                    else
                    {
                        AjCmp = new Compte();
                        imposible();
                    }
                }
            }
        }