private void AccountLoginButton_Click(object sender, EventArgs e) { // Open ( AccountLoginForm) && Hide this Form (EmployeeOperation Form ) AccountLoginForm accountLogin = new AccountLoginForm(); this.Hide(); accountLogin.ShowDialog(); }
private void DepositeButton_Click(object sender, EventArgs e) { // Function ->> Deposite amount of money the account balance try { AccountLoginForm frm = new AccountLoginForm(); // Take the AccNum of the account string AccNum = AccountLoginForm.accNum; string PW = AccountLoginForm.pw; // Find the Client with this account Number Client c = BankSystem.FO_client.FindClient(AccNum); Accountant emp = new Accountant(); // emp.SetOperation(new Deposite()); double amount = Convert.ToDouble(AmountOfMoneyTextBox.Text); double flag = 0.0; double balance = c.ClientAccount.getBalance(); // Deposite Function emp.operation.DoOperation(ref balance, ref amount, ref flag); // set new balance of the Client After Deposite c.ClientAccount.setBalance(balance); BankSystem.FO_client.Update(AccNum, c); MessageBox.Show("Your account balance is " + c.ClientAccount.getBalance()); // Save Change To the TotalBankBalance double b = Convert.ToDouble(BankSystem.TotalBalanceOfBank.GetBankBalance()) + Convert.ToDouble(AmountOfMoneyTextBox.Text); BankSystem.TotalBalanceOfBank.SetBalance(Convert.ToDouble(b)); BankSystem.TotalBalanceOfBank.save(); // Save Action to the LogFile DateTime time = DateTime.Now; FileStream fs = new FileStream("BankLogFile.txt", FileMode.Append); StreamWriter Sr = new StreamWriter(fs); Sr.WriteLine(time + "Client With Account Number" + AccNum + " deposite" + AmountOfMoneyTextBox.Text + "L.E"); Sr.Close(); fs.Close(); // Return To the (AccountOperationsForm ) Hide this Form (Deposite Form) AccountOperationsForm form = new AccountOperationsForm(); this.Hide(); form.ShowDialog(); } catch (Exception ec) { MessageBox.Show(ec.Message); } //// hnade 3ala func deposite /// //arg3 ll form ( AccountForm) }
private void WithdrawButton_Click(object sender, EventArgs e) { try { AccountLoginForm frm = new AccountLoginForm(); string AccNum = AccountLoginForm.accNum; //frm.ClientAccountNumberTextBox.Text.ToString(); string PW = AccountLoginForm.pw; //frm.AccountPasswordTextBox.Text.ToString(); Client c = BankSystem.FO_client.FindClient(AccNum); Accountant emp = new Accountant(); emp.SetOperation(new Withdraw()); double amount = Convert.ToDouble(AmountOfMoneyTextBox.Text); double flag = 0.0; double balance = c.ClientAccount.getBalance(); if (balance > amount) { emp.operation.DoOperation(ref balance, ref amount, ref flag); c.ClientAccount.setBalance(balance); BankSystem.FO_client.Update(AccNum, c); MessageBox.Show("Your account balance is " + c.ClientAccount.getBalance()); double b = Convert.ToDouble(BankSystem.TotalBalanceOfBank.GetBankBalance()) - Convert.ToDouble(AmountOfMoneyTextBox.Text); BankSystem.TotalBalanceOfBank.SetBalance(Convert.ToDouble(b)); BankSystem.TotalBalanceOfBank.save(); // Save Action to the LogFile DateTime time = DateTime.Now; FileStream fs = new FileStream("BankLogFile.txt", FileMode.Append); StreamWriter Sr = new StreamWriter(fs); Sr.WriteLine(time + "Client With Account Number" + AccNum + " withdraw" + AmountOfMoneyTextBox.Text + "L.E"); Sr.Close(); fs.Close(); // Return To the (AccountOperationsForm ) Hide this Form (Withdraw Form) AccountOperationsForm form = new AccountOperationsForm(); this.Hide(); form.ShowDialog(); } else { MessageBox.Show("We are sorry your account is under the minimum allowed."); } } catch (Exception ec) { MessageBox.Show(ec.Message); } // hnade 3ala func with draw . //arg3 ll form ( AccountForm) }
private void TransferButton_Click(object sender, EventArgs e) { try { AccountLoginForm frm = new AccountLoginForm(); string AccNumfrom = AccountLoginForm.accNum; //frm.ClientAccountNumberTextBox.Text.ToString(); string PW = AccountLoginForm.pw; //frm.AccountPasswordTextBox.Text.ToString(); Client cfrom = BankSystem.FO_client.FindClient(AccNumfrom); if (AccNumfrom != AccountNumberTextBox.Text) { Accountant emp = new Accountant(); double amount = Convert.ToDouble(AmountOfMoneyTextBox.Text); double balancefrom = cfrom.ClientAccount.getBalance(); if (balancefrom > amount) { DialogResult result = MessageBox.Show( "Are you sure from transfere " + amount + " from " + AccNumfrom + " to " + AccountNumberTextBox.Text, "Caution", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { emp.SetOperation(new Transfere()); Client cto = BankSystem.FO_client.FindClient(AccountNumberTextBox.Text); double balanceto = cto.ClientAccount.getBalance(); emp.operation.DoOperation(ref balanceto, ref amount, ref balancefrom); cfrom.ClientAccount.setBalance(balancefrom); cto.ClientAccount.setBalance(balanceto); BankSystem.FO_client.Update(AccNumfrom, cfrom); BankSystem.FO_client.Update(AccountNumberTextBox.Text, cto); MessageBox.Show("Your balance is " + cfrom.ClientAccount.getBalance()); // Save Action to the LogFile DateTime time = DateTime.Now; FileStream fs = new FileStream("BankLogFile.txt", FileMode.Append); StreamWriter Sr = new StreamWriter(fs); Sr.WriteLine(time + "Client With Account Number" + AccNumfrom + " transfer " + AmountOfMoneyTextBox.Text + "L.E To " + "Client With Account Number" + AccountNumberTextBox.Text); Sr.Close(); fs.Close(); AccountOperationsForm form = new AccountOperationsForm(); this.Hide(); form.ShowDialog(); } } else { MessageBox.Show("We are sorry your account is under the minimum allowed."); } } else { MessageBox.Show(" UnAcceptable , You transfer to same account !!!!"); AccountOperationsForm form = new AccountOperationsForm(); this.Hide(); form.ShowDialog(); } } catch (Exception ec) { MessageBox.Show(ec.Message); } // hnade func Transfer w arg3 ll form ( AccountForm) }