public void ValiderTransactionCompteCourant(Transaction transaction, Employe employe) { operationBLO = new OperationBLO(); compteClientBLO = new CompteClientBLO(); fondBLO = new FondBLO(); int index = transactionBLO.IndexOf(transaction); transaction.StatutTransaction = StatutTransaction.Validé; transaction.EmployeValideur = employe; transactionBLO[index] = transaction; if (transaction.TypeTransaction == TypeTransaction.Dépot) { compteClientBLO.CrediterCompteClient(transaction.CompteClientEmetteur, transaction.Montant, employe); fondBLO.MettreArgentEnFond(employe, transaction.CompteClientDestinataire, transaction.Montant, "toto tata"); operationBLO.AjouterOperation(TypeOperation.Dépot, employe, transaction.CompteClientEmetteur.Client, transaction.CompteClientEmetteur, transaction.Montant, "toto tata"); } else if (transaction.TypeTransaction == TypeTransaction.Retrait) { compteClientBLO.DebiterCompteClient(transaction.CompteClientEmetteur, transaction.Montant, employe); fondBLO.SortirArgentEnFond(employe, transaction.CompteClientDestinataire, transaction.Montant, "toto tata"); operationBLO.AjouterOperation(TypeOperation.Retrait, employe, transaction.CompteClientEmetteur.Client, transaction.CompteClientEmetteur, transaction.Montant, "toto tata"); } else { compteClientBLO.CrediterUnAutreCompte(transaction.CompteClientEmetteur, transaction.CompteClientDestinataire, transaction.Montant, employe); operationBLO.AjouterOperation(TypeOperation.Transfert_inter_compte, employe, transaction.CompteClientEmetteur.Client, transaction.CompteClientEmetteur, transaction.Montant, "toto tata"); } }
public void ValiderTransactionCompteEpargne(Transaction transaction, Employe employe) { parametreGeneralBLO = new ParametreGeneralBLO(); operationBLO = new OperationBLO(); compteClientBLO = new CompteClientBLO(); fondBLO = new FondBLO(); epargneBLO = new EpargneBLO(); Transaction oldTransaction = transaction; int index = transactionBLO.IndexOf(transaction); transaction.StatutTransaction = StatutTransaction.Validé; transaction.EmployeValideur = employe; transactionBLO[index] = transaction; if (transaction.TypeTransaction == TypeTransaction.Dépot) { compteClientBLO.CrediterCompteClient(transaction.CompteClientEmetteur, transaction.Montant, employe); fondBLO.MettreArgentEnFond(employe, transaction.CompteClientDestinataire, transaction.Montant, "toto tata"); operationBLO.AjouterOperation(TypeOperation.Dépot, employe, transaction.CompteClientEmetteur.Client, transaction.CompteClientEmetteur, transaction.Montant, "toto tata"); epargneBLO.AugmenterMontantEpargner(transaction.Epargne, transaction.Montant, employe); } else if (transaction.TypeTransaction == TypeTransaction.Retrait && oldTransaction.StatutTransaction == StatutTransaction.Avisé && (DateTime.Compare(oldTransaction.DateTransaction.AddDays(oldTransaction.NombreJourAttente), DateTime.Now)) >= 0) { compteClientBLO.DebiterCompteClient(transaction.CompteClientEmetteur, transaction.Montant, employe); fondBLO.SortirArgentEnFond(employe, transaction.CompteClientDestinataire, transaction.Montant, "toto tata"); operationBLO.AjouterOperation(TypeOperation.Retrait, employe, transaction.CompteClientEmetteur.Client, transaction.CompteClientEmetteur, transaction.Montant, "toto tata"); epargneBLO.ReduireMontantEpargner(transaction.Epargne, transaction.Montant, employe); } else if (transaction.TypeTransaction == TypeTransaction.Retrait && !VerifierSiAvis(transaction)) { double montant = (transaction.Montant + ((parametreGeneralBLO.TousParametreGenerals[0].PourcentageRetraitEpargneSansAvis * transaction.Montant) / 100)); compteClientBLO.DebiterCompteClient(transaction.CompteClientEmetteur, montant, employe); fondBLO.SortirArgentEnFond(employe, transaction.CompteClientDestinataire, transaction.Montant, "toto tata"); operationBLO.AjouterOperation(TypeOperation.Retrait, employe, transaction.CompteClientEmetteur.Client, transaction.CompteClientEmetteur, montant, "toto tata"); epargneBLO.ReduireMontantEpargner(transaction.Epargne, montant, employe); } }