Esempio n. 1
0
 public FormOperation(string type, CompteCourant compte, LivretA livret, Client cli)
 {
     InitializeComponent();
     compteclient  = compte;
     livretclient  = livret;
     client        = cli;
     typeoperation = type;
 }
        private void delete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Etes-vous sûr de couloir supprimer le client ? Cette action est irréversible !", "Attention !", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                CompteCourant toDel = null;
                foreach (CompteCourant compte in listecomptes)
                {
                    if (clientactuel.getId() == compte.IdCompte)
                    {
                        toDel = compte;
                    }
                }
                if (toDel != null)
                {
                    listecomptes.Remove(toDel);
                }


                LivretA toDele = null;
                foreach (LivretA livret in listelivrets)
                {
                    if (clientactuel.getId() == livret.IdCompte)
                    {
                        toDele = livret;
                    }
                }
                if (toDele != null)
                {
                    listelivrets.Remove(toDele);
                }


                Client toDelet = null;
                foreach (Client clicli in listeclients)
                {
                    if (clicli == clientactuel)
                    {
                        toDelet = clicli;
                    }
                }
                if (toDelet != null)
                {
                    listeclients.Remove(toDelet);
                }
            }
            this.DialogResult = DialogResult.None;
            this.Close();
        }
Esempio n. 3
0
        private void ask_Click(object sender, EventArgs e)
        {
            FormOperation operation = new FormOperation("ask", comptecourantactuel, livretactuel, clientactuel);

            switch (operation.ShowDialog())
            {
            case DialogResult.Yes:
                comptecourantactuel = operation.GetCompte();
                soldecompte_Write(comptecourantactuel.Solde);
                break;

            case DialogResult.OK:
                livretactuel = operation.GetLivret();
                soldelivret_Write(livretactuel.Solde);
                break;
            }
        }
Esempio n. 4
0
        public FormAccueil()
        {
            datetest = new DateTime(2000, 04, 20);
            admin    = new Client(0, "admin", "admin");
            listeClients.Add(admin);
            test1       = new Client(1, "test", "ostérone", datetest, "852 Avenue de test", "34000", "Montpellier", "0671973276", "*****@*****.**", "abcd");
            test1livret = new LivretA(1, false, test1.getNom(), test1.getPrenom());
            test1compte = new CompteCourant(1, false, test1.getNom(), test1.getNom());
            listeClients.Add(test1);

            Client        test2       = new Client(2, "amphé", "tamine", datetest, "48 rue de l'essai", "34000", "Montpellier", "0659086850", "*****@*****.**", "password");
            LivretA       test2livret = new LivretA(1, false, test2.getNom(), test2.getPrenom());
            CompteCourant test2compte = new CompteCourant(1, false, test2.getNom(), test2.getNom());

            Client        test3       = new Client(3, "damn", "boy", datetest, "73 boulevard des tests", "34000", "Montpellier", "0649634829", "*****@*****.**", "password");
            LivretA       test3livret = new LivretA(1, false, test3.getNom(), test3.getPrenom());
            CompteCourant test3compte = new CompteCourant(1, false, test3.getNom(), test3.getNom());

            Client        test4       = new Client(2, "whatthefuck", "bro", datetest, "95 Impasse des Cons", "34000", "Montpellier", "0659364852", "*****@*****.**", "password");
            LivretA       test4livret = new LivretA(1, false, test4.getNom(), test4.getPrenom());
            CompteCourant test4compte = new CompteCourant(1, false, test4.getNom(), test4.getNom());

            listeClients.Add(test2);
            listeClients.Add(test3);
            listeClients.Add(test4);

            listeComptes.Add(test1compte);
            listeLivrets.Add(test1livret);

            listeComptes.Add(test2compte);
            listeLivrets.Add(test2livret);

            listeComptes.Add(test3compte);
            listeLivrets.Add(test3livret);

            listeComptes.Add(test4compte);
            listeLivrets.Add(test4livret);

            InitializeComponent();
        }
 private void btnInscript_Click(object sender, EventArgs e)
 {
     if (VerifInscription())
     {
         Client c = Inscription();
         livret = new LivretA(c.getId(), false, c.getNom(), c.getPrenom());
         listeLivrets.Add(livret);
         compte = new CompteCourant(c.getId(), false, c.getNom(), c.getPrenom());
         listeComptes.Add(compte);
         if (c != null)
         {
             client = c;
             listeClients.Add(c);
             this.DialogResult = DialogResult.Yes;
             this.Close();
         }
     }
     else
     {
         ErrorMsg_Write();
     }
 }
        private void FormGestionDuClient_Load(object sender, EventArgs e)
        {
            this.label1.Text = "Gestion du client: " + clientactuel.getNom() + " " + clientactuel.getPrenom();
            foreach (CompteCourant damn in listecomptes)
            {
                if (damn.IdCompte == clientactuel.getId())
                {
                    comptecli           = damn;
                    this.argcompte.Text = comptecli.Solde.ToString();
                }
            }

            foreach (LivretA damn in listelivrets)
            {
                if (damn.IdCompte == clientactuel.getId())
                {
                    livretcli           = damn;
                    this.arglivret.Text = livretcli.Solde.ToString();
                }
            }

            argcomptedepart = comptecli.Solde;
            arglivretdepart = livretcli.Solde;
        }
Esempio n. 7
0
        private void FormAccueil_Load(object sender, EventArgs e)
        {
            FormConnexion formclient = new FormConnexion(listeClients, listeComptes, listeLivrets, this);

            switch (formclient.ShowDialog())
            {
            case DialogResult.OK:
                clientactuel = formclient.GetClient();
                if (clientactuel.getTelephone() == "admin")
                {
                    Formgestion formgest = new Formgestion(listeClients, listeComptes, listeLivrets);
                    formgest.ShowDialog();
                    message_accueil_Write("admin", "admin");
                    double soldetotal = 0;
                    foreach (CompteCourant compte in listeComptes)
                    {
                        soldetotal = soldetotal + compte.Solde;
                    }
                    soldecompte_Write(soldetotal);
                    soldetotal = 0;
                    foreach (LivretA livret in listeLivrets)
                    {
                        soldetotal = soldetotal + livret.Solde;
                    }
                    soldelivret_Write(soldetotal);
                    this.soldecomptemsg.Text = "Voici la somme présente sur tous \n les comptes en euros";
                    this.soldelivretmsg.Text = "Voici la somme présente sur tous \n les livrets en euros";
                    this.send.Hide();
                    this.ask.Hide();
                    this.gestion.Show();
                    break;
                }
                else if (clientactuel == null)
                {
                    break;
                }
                else
                {
                    foreach (CompteCourant compte in listeComptes)
                    {
                        if (compte.IdCompte == clientactuel.getId())
                        {
                            soldecompte_Write(compte.Solde);
                            comptecourantactuel = compte;
                        }
                    }
                    foreach (LivretA livret in listeLivrets)
                    {
                        if (livret.IdCompte == clientactuel.getId())
                        {
                            soldelivret_Write(livret.Solde);
                            livretactuel = livret;
                        }
                    }
                    message_accueil_Write(clientactuel.getNom(), clientactuel.getPrenom());
                    this.gestion.Hide();
                    this.ask.Show();
                    this.send.Show();
                    break;
                }

            case DialogResult.Yes:
                clientactuel = formclient.GetClient();
                if (clientactuel == null)
                {
                    break;
                }
                listeComptes = formclient.GetlisteCompteCourant();
                listeLivrets = formclient.GetListeLivrets();

                foreach (CompteCourant compte in listeComptes)
                {
                    if (compte.IdCompte == clientactuel.getId())
                    {
                        soldecompte_Write(compte.Solde);
                        comptecourantactuel = compte;
                    }
                }
                foreach (LivretA livret in listeLivrets)
                {
                    if (livret.IdCompte == clientactuel.getId())
                    {
                        soldelivret_Write(livret.Solde);
                        livretactuel = livret;
                    }
                }
                message_accueil_Write(clientactuel.getNom(), clientactuel.getPrenom());
                this.gestion.Hide();
                this.send.Show();
                this.ask.Show();
                break;
            }
        }
        private void valide_Click(object sender, EventArgs e)
        {
            int    ok      = 0;
            double soldeco = 0;
            double soldeli = 0;

            foreach (string str in tabalphabet)
            {
                foreach (string stri in tabcarspeciaux)
                {
                    if (argcompte.Text.Contains(str) || arglivret.Text.Contains(stri) || arglivret.Text.Contains(str) || argcompte.Text.Contains(stri))
                    {
                        ok = 1;
                    }
                    else
                    {
                        if (ok == 1)
                        {
                        }
                        else
                        {
                            ok = 0;
                        }
                    }
                }
            }
            if (ok == 0)
            {
                soldeco = Convert.ToDouble(this.argcompte.Text);
                soldeli = Convert.ToDouble(this.arglivret.Text);
            }

            double diffco = soldeco - argcomptedepart;
            double diffli = soldeli - arglivretdepart;

            if (MessageBox.Show("La différence avec l'ancien montant du compte est de :" + diffco + " et la différence avec l'ancien montant du livret est de :" + diffli, "Attention !", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                comptecli.Solde = soldeco;
                livretcli.Solde = soldeli;


                CompteCourant toDel = null;
                foreach (CompteCourant compte in listecomptes)
                {
                    if (compte.IdCompte == comptecli.IdCompte)
                    {
                        toDel = compte;
                    }
                }
                if (toDel != null)
                {
                    listecomptes.Remove(toDel);
                    listecomptes.Add(comptecli);
                }

                LivretA toDele = null;
                foreach (LivretA livret in listelivrets)
                {
                    if (livret.IdCompte == livretcli.IdCompte)
                    {
                        toDele = livret;
                    }
                }
                if (toDele != null)
                {
                    listelivrets.Remove(toDele);
                    listelivrets.Add(livretcli);
                }
            }
            this.DialogResult = DialogResult.Yes;
            this.Close();
        }