private void chargeOpHistory(string idAccount) { DataTable dtOpHistories = new DataTable(); dtOpHistories.Columns.Add("Date", typeof(string)); dtOpHistories.Columns.Add("Type", typeof(string)); dtOpHistories.Columns.Add("Montant", typeof(string)); dtOpHistories.Columns.Add("Solde", typeof(string)); dtgOpHist.DataSource = dtOpHistories; rwFile = new ReadWriteFileAccount(idAccount, TypesOperation.HISTORIQUE.ToString()); rwFile.readFileAccount(dtOpHistories); }
public void printStatement() { StringBuilder sb = new StringBuilder(); sb.Append(operation.getDateOperation()); sb.Append(";"); sb.Append(operation.getTypeOperation()); sb.Append(";"); sb.Append(currentStatement); sb.Append(";"); sb.Append(operation.getAmountOperation()); ReadWriteFileAccount rwFileAccount = new ReadWriteFileAccount(operation.IdAccount); rwFileAccount.ecrireFichierAccount(sb); }
private void btCredit_Click(object sender, EventArgs e) { double resultMontant; if (!string.IsNullOrEmpty(tbIdAccount.Text.ToString().Trim())) { if (double.TryParse(tbMontant.Text.Trim(), out resultMontant)) { rwAcc = new ReadWriteFileAccount(tbIdAccount.Text.ToString().Trim(), opTypeForm); if (rwAcc.AccountIsExist) { if (opTypeForm == TypesOperation.DEPOT.ToString()) { getSolde(tbIdAccount.Text.Trim()).ToString(); depositAccount(tbIdAccount.Text.Trim(), opTypeForm, resultMontant); tbSolde.Text = solde.ToString(); if (OperationOK) { MessageBox.Show("Le dépot d'une somme de " + resultMontant + "€ a bien été effectué", "DEPOT", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { getSolde(tbIdAccount.Text.Trim()).ToString(); withdrawAccount(tbIdAccount.Text.Trim(), opTypeForm, resultMontant); tbSolde.Text = solde.ToString(); if (OperationOK) { MessageBox.Show("Le retrait d'une somme de " + resultMontant + "€ a bien été effectué", "RETRAIT", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } else { MessageBox.Show("Merci de saisir le montant en chiffre ", "ERROR AMOUNT", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Merci de saisir le numéro de compte ", "ERROR ID_ACCOUNT EMPTY", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Methode pour charger les historiques des opérations /// </summary> public bool getStatementHistories(string idAccount) { rwFile = new ReadWriteFileAccount(idAccount, TypesOperation.HISTORIQUE.ToString()); if (!string.IsNullOrEmpty(idAccount)) { if (rwFile.AccountIsExist) { chargeOpHistory(idAccount); lbSoldeValue.Text = rwFile.SoldeTot.ToString() + "€"; opHist = true; } else { opHist = false; } } else { opHist = false; MessageBox.Show("Merci de saisir le numéro du compte", "ERROR ID_ACCOUNT EMPTY", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(opHist); }
public double getSolde(string idAccount) { rwAcc = new ReadWriteFileAccount(idAccount, opTypeForm); rwAcc.getSoldeTotalFromFileAccount(); return(solde = rwAcc.SoldeTot); }