Exemple #1
0
        static void Main(string[] args)
        {
            ConnectionDb nnn = new ConnectionDb();

            try
            {
                nnn.connection_todo();
                Console.WriteLine("opened");
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + e.Message);
            }

            /*
             * Console.WriteLine("Getting Connection ...");
             * conn = DBUtils.GetDBConnection();
             * try
             * {
             *   Console.WriteLine("Openning Connection ...");
             *   conn.Open();
             *   Console.WriteLine("Connection successful!");
             * }
             * catch (Exception e)
             * {
             *   Console.WriteLine("Error: " + e.Message);
             * } */
            Operation Opre = new Operation();
            //MySqlCommand comm = new MySqlCommand();
            //comm.Connection =conn;
            //comm.CommandText = "INSERT INTO `test`(`test`) VALUES('help2')";
            //comm.ExecuteNonQuery();
            string point = "10";

            while (point != "0")
            {
                Operation.preMenu(point);
                point = Console.ReadLine();
                if (point == "1")
                {
                    Operation.Ajouter();
                }
                else if (point == "2")
                {
                    Operation.deeuMenu();
                }
            }
        }
Exemple #2
0
 public static void Ajouter()
 {
     Console.Clear();
     Console.WriteLine("==> entrer le numero de client ");
     AjCli.setNum(int.Parse(Console.ReadLine()));
     AjCmp.setNumclient(AjCli.getNum());
     Console.WriteLine("==> entrer le nom ");
     AjCli.setNom(Console.ReadLine());
     Console.WriteLine("==> entrer le prenom ");
     AjCli.setPrenom(Console.ReadLine());
     Console.WriteLine("==> entrer le numero de GSM ");
     AjCli.setGsm(Console.ReadLine());
     Console.WriteLine("==> entrer E_mail ");
     AjCli.setE_mail(Console.ReadLine());
     Console.WriteLine("==> entrer le numero de compte ");
     AjCmp.setNum(int.Parse(Console.ReadLine()));
     Console.WriteLine("==> entrer le solde");
     AjCmp.setMont(float.Parse(Console.ReadLine()));
     Console.WriteLine("==> entrer le type ( courant/epargne)");
     AjCmp.setType(Console.ReadLine());
     ConnectionDb.Ajouter(AjCmp, AjCli);
     AjCmp = new Compte();
     AjCli = new Client();
 }
Exemple #3
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();
                    }
                }
            }
        }
Exemple #4
0
 public static void DeeuMenu(int b)
 {
     ConnectionDb.saerchcompte(AjCmp, b);
 }