private void PayButton_Click(object sender, EventArgs e)
        {
            string accNum = AccountLoginForm.accNum;
            string pw     = AccountLoginForm.pw;

            if (Accountant.L_FO.CheckFind(accNum))
            {
                Loan paiedforLoan = Accountant.L_FO.Findloan(accNum);
                paiedforLoan.LoanPayment(AmountOfMoneyTextBox.Text);
                Accountant.L_FO.SaveAtFile();

                DateTime     time = DateTime.Now;
                FileStream   fs   = new FileStream("BankLogFile.txt", FileMode.Append);
                StreamWriter Sr   = new StreamWriter(fs);
                Sr.WriteLine(time + " Client With Account Number  " + AccountLoginForm.accNum + " has paied his Installment's loan ");
                Sr.Close();
                fs.Close();
            }
            else
            {
                MessageBox.Show("You already havn't a loan");
            }

            AccountOperationsForm accountOperations = new AccountOperationsForm();

            this.Hide();
            accountOperations.ShowDialog();
            // hshsof law daf3 aktr aw a2l mn installment amout h2olo message box en la2 adf3le only el installment
            // w b3d ma ydf3 byzwd 3ala loan balance w kol da 3mleno b el functions ele f loan
            // arg3 ll (AccountOperations)
        }
        private void AccountLoginButton_Click(object sender, EventArgs e)
        {
            try
            {
                BankSystem bank = new BankSystem();
                // Check if he Filling all the Information
                if (ClientAccountNumberTextBox.Text == "" && AccountPasswordTextBox.Text == "")
                {
                    MessageBox.Show("Please Enter Your Information !!!! ");
                }
                else if (ClientAccountNumberTextBox.Text == "")
                {
                    MessageBox.Show("Please Enter Your Account Number!!!! ");
                }
                else if (AccountPasswordTextBox.Text == "")
                {
                    MessageBox.Show("Please Enter Your PassWord !!!! ");
                }
                else
                {
                    // Check if the acc is Found Or not
                    if (BankSystem.FO_client.CheckFind(ClientAccountNumberTextBox.Text))
                    {
                        // login
                        if (BankSystem.FO_client.Login(ClientAccountNumberTextBox.Text, AccountPasswordTextBox.Text))
                        {
                            AccountOperationsForm accountOperations = new AccountOperationsForm();

                            // Save Change 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" + ClientAccountNumberTextBox.Text + " has logged in");
                            Sr.Close();
                            fs.Close();


                            //Open ( accountOperations ) && Hide this Form (AccountLoginForm)
                            this.Hide();
                            // save the satatic accnumber to use it at the following Forms
                            accNum = ClientAccountNumberTextBox.Text;
                            pw     = AccountPasswordTextBox.Text;
                            accountOperations.ShowDialog();
                        }
                        else
                        {
                            MessageBox.Show(" The password that you've entered is incorrect");
                        }
                    }
                    else
                    {
                        MessageBox.Show("The ID that you've entered doesn't match any Profile ");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void RefuseButton_Click(object sender, EventArgs e)
        {
            AccountOperationsForm returnForm = new AccountOperationsForm();

            this.Hide();
            returnForm.ShowDialog();

            // hytl3lo message box en el loan mt5dsh 5alas :D
            // yrg3 l ( AccountOperations Form )
        }
Ejemplo n.º 4
0
        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)
        }
Ejemplo n.º 5
0
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            try
            {
                string AccNum    = AccountLoginForm.accNum;
                Client NewClient = BankSystem.FO_client.FindClient(AccNum);
                NewClient.FirstName            = ClientFirstNameTextBox.Text;
                NewClient.LastName             = ClientLastNameTextBox.Text;
                NewClient.Address              = ClientAddressTextBox.Text;
                NewClient.PhoneNumber          = ClientPhoneNumberTextBox.Text;
                NewClient.SSN                  = ClientSSNTextBox.Text;
                NewClient.ClientAccount.AccNum = AccNum;
                NewClient.BirthDate            = ClientBirthDateTextBox.Text;
                NewClient.Mail                 = ClientMailTextBox.Text;
                if (FemaleRadioButton.Checked)
                {
                    NewClient.Gender = FemaleRadioButton.Text;
                }
                else if (MaleRadioButton.Checked)
                {
                    NewClient.Gender = MaleRadioButton.Text;
                }

                DialogResult result = MessageBox.Show("Are you want to Updata?", "Caution", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if (result == DialogResult.OK)
                {
                    BankSystem.FO_client.Update(AccNum, NewClient);


                    // 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 " + AccountLoginForm.accNum + " has been Updated ");
                    Sr.Close();
                    fs.Close();



                    // Return To the (AccountOperationsForm ) Hide this Form (Withdraw Form)
                    AccountOperationsForm form = new AccountOperationsForm();
                    this.Hide();
                    form.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        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 TakeLoanButton_Click(object sender, EventArgs e)
        {
            Loan acceptedLoan = new Loan();

            // LoanFileOperation Loanoperation = new LoanFileOperation();

            acceptedLoan.AccNumber          = RequestLoanForm.Takedloan.AccNumber;
            acceptedLoan.loanvalue          = RequestLoanForm.Takedloan.loanvalue;
            acceptedLoan.warrenty           = RequestLoanForm.Takedloan.warrenty;
            acceptedLoan.warrentyValue      = RequestLoanForm.Takedloan.warrentyValue;
            acceptedLoan.PaymentAmount      = RequestLoanForm.Takedloan.PaymentAmount;
            acceptedLoan.installmentValue   = RequestLoanForm.Takedloan.installmentValue;
            acceptedLoan.installmentPerioud = RequestLoanForm.Takedloan.installmentPerioud;
            acceptedLoan.LoanTime           = RequestLoanForm.Takedloan.LoanTime;
            acceptedLoan.payloanCheck       = false;
            acceptedLoan.blacklist          = false;

            Accountant.L_FO.AddLoan(acceptedLoan, acceptedLoan.AccNumber);



            DateTime     time = DateTime.Now;
            FileStream   fs   = new FileStream("BankLogFile.txt", FileMode.Append);
            StreamWriter Sr   = new StreamWriter(fs);

            Sr.WriteLine(time + " Client With Account Number  " + AccountLoginForm.accNum + " has taked a loan ");
            Sr.Close();
            fs.Close();



            string accNum = AccountLoginForm.accNum;
            Client c      = BankSystem.FO_client.FindClient(accNum);

            c.LoanFlag = true;
            BankSystem.FO_client.Update(accNum, c);
            AccountOperationsForm returnForm = new AccountOperationsForm();

            this.Hide();
            returnForm.ShowDialog();

            // azwd loan da 3nde f file w list bt3te
            // kda hwa wsh a5d loan htl3lo message en loan ata5d successfuly
            // Yrg3 b2a l ( Account operations )
        }
Ejemplo n.º 8
0
        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)
        }