Пример #1
0
        public void Depot_WithValideNumber_UpdateSolde()
        {
            compte.Depot(145);
            double actual   = compte.Solde;
            double expected = 145;

            Assert.AreEqual(expected, actual, " Quantite not credited correctly");
        }
Пример #2
0
        private void Valider_Click(object sender, RoutedEventArgs e)
        {
            decimal montant;

            if (decimal.TryParse(Montant.Text, out montant))
            {
                Operation o = new Operation(montant);
                if (cTmp.GetType() == typeof(ComptePayant))
                {
                    ComptePayant compte = (ComptePayant)cTmp;
                    compte.Depot(o);
                }
                else
                {
                    cTmp.Depot(o);
                }
                MessageBox.Show($"Le Dépot de {montant} € à été effectué ", "Retrait Effectué", MessageBoxButton.OK, MessageBoxImage.Information);
                w.ActualiserCompte(cTmp.Id);
                Close();
            }
            else
            {
                MessageBox.Show("Erreur de saisie du montant", "Erreur de saisie", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Пример #3
0
        public void ConfirmOperation(object sender, RoutedEventArgs e)
        {
            decimal montant = Convert.ToDecimal(montantTextBox.Text);

            if (_typeOperation == 1)
            {
                Operation o = new Operation(montant);
                if (_compte.Depot(o))
                {
                    MessageBox.Show("Dépôt effectué");
                }
                else
                {
                    MessageBox.Show("erreur dépôt");
                }
            }
            else if (_typeOperation == 0)
            {
                Operation o = new Operation(montant * -1);
                if (_compte.Retrait(o))
                {
                    MessageBox.Show("Retrait effectué");
                }
                else
                {
                    MessageBox.Show("erreur retrait");
                }
            }
            _listeOperations.ItemsSource = new List <Operation>(_compte.Operations);
            Close();
        }
Пример #4
0
        private void ActionDepot()
        {
            Compte compte = ActionRechercheCompte();

            if (compte != null)
            {
                Console.Write("Merci de saisir le montant du dépôt : ");
                decimal montant;
                bool    succes = false;
                do
                {
                    succes = decimal.TryParse(Console.ReadLine(), out montant);
                    if (!succes)
                    {
                        Console.WriteLine("Veuillez saisir un nombre !");
                    }
                }while (!succes);
                Operation operation = new Operation(montant);
                if (compte.Depot(operation))
                {
                    Console.WriteLine("Dépôt efféctué");
                }
                else
                {
                    Console.WriteLine("Erreur dépôt");
                }
            }
        }
Пример #5
0
        private void ActionDepot()
        {
            Compte compte = ActionRechercheCompte();

            if (compte != null)
            {
                Console.Write("Merci de saisir le montant du dépôt : ");
                decimal   montant   = Convert.ToDecimal(Console.ReadLine());
                Operation operation = new Operation(montant);
                if (compte.Depot(operation))
                {
                    Console.WriteLine("Dépôt efféctué");
                }
                else
                {
                    Console.WriteLine("Erreur dépôt");
                }
            }
        }
Пример #6
0
        public IActionResult SubmitOperation(int numero, decimal montant, string type)
        {
            Compte compte = Compte.GetCompteById(numero);

            if (compte != null)
            {
                if (type == "depot")
                {
                    compte.Depot(montant);
                }
                else if (type == "retrait")
                {
                    compte.Retrait(montant);
                }
                return(RedirectToAction("Search", new { numero = compte.Numero }));
            }

            return(RedirectToAction("Index"));
        }
Пример #7
0
        public IActionResult SubmitOperation(int numero, string type, decimal montant)
        {
            ViewBag.Numero = numero;
            ViewBag.Type   = type;
            Banque banque = new Banque("banquedefrance");
            Compte compte = banque.RechercherCompteEtOperation(numero);

            if (compte != null)
            {
                bool error = true;
                if (type == "depot")
                {
                    Operation o = new Operation(montant);
                    if (compte.Depot(o))
                    {
                        error = false;
                    }
                }
                else if (type == "retrait")
                {
                    Operation o = new Operation(montant * -1);
                    if (compte.Retrait(o))
                    {
                        error = false;
                    }
                }
                if (!error)
                {
                    return(RedirectToAction("DetailCompte", new { id = numero }));
                }
                else
                {
                    ViewBag.ErrorMessage = "Opération impossible";
                    return(View("FormOperation"));
                }
            }
            ViewBag.ErrorMessage = "Aucun compte avec ce numéro";
            return(View("FormOperation"));
        }