Exemple #1
0
        private void BtnCreerMouv_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Txtnum.Text) || string.IsNullOrEmpty(Txttitulaire.Text) || string.IsNullOrEmpty(TxtSolde.Text) || string.IsNullOrEmpty(TxtMt.Text))
            {
                MessageBox.Show("Champ vide");
            }
            else
            {
                if (!Rdb_Ret.Checked && !Rdb_Vers.Checked)
                {
                    MessageBox.Show("Choisir type d'operation svp !!");
                }
                else
                {
                    Compte c = lc.rechercher(Txtnum.Text);
                    if (Rdb_Vers.Checked)
                    {
                        Mouvement m = new Mouvement(Datm.Value.Date, Convert.ToDouble(TxtMt.Text), "Retrait");
                        c.NouveauMouv(m);
                        c.verser(Convert.ToDouble(TxtMt.Text));
                        DgMouv.Rows.Add(m.dateop.Date, m.typeop, m.montant);
                    }
                    else if (Rdb_Ret.Checked)
                    {
                        if (Convert.ToDouble(TxtMt.Text) < Convert.ToDouble(TxtSolde.Text))
                        {
                            Mouvement m = new Mouvement(Datm.Value.Date, Convert.ToDouble(TxtMt.Text), "Versement");
                            c.NouveauMouv(m);
                            c.retirer(Convert.ToDouble(TxtMt.Text));
                            DgMouv.Rows.Add(m.dateop.Date, m.typeop, m.montant);
                        }
                        else
                        {
                            MessageBox.Show("solde insuffisant !!!");
                        }
                    }

                    TxtSolde.Text = c.solde.ToString();
                    Txt_Sld.Text  = c.solde.ToString();
                    Txt_Slde.Text = c.solde.ToString();
                }
            }
        }
Exemple #2
0
 public void NouveauMouv(Mouvement m)
 {
     list_mouv.Add(m);
 }