public string Deposit(double amount, Customer customer)
        {
            customer.Balance += amount;
            TransactionServices NewTransaction = new TransactionServices(customer);
            string TransactionID = NewTransaction.GenerateTransactionID(Bank);

            NewTransaction.AddTransaction(amount, TransactionID, "deposit", "success", DateTime.Now.ToString("yyyymmdd"));
            return(TransactionID);
        }
 public bool Withdraw(double amount, Customer customer)
 {
     if (customer.Balance > amount)
     {
         customer.Balance -= amount;
         TransactionServices NewTransaction = new TransactionServices(customer);
         string TransactionID = NewTransaction.GenerateTransactionID(Bank);
         NewTransaction.AddTransaction(amount, TransactionID, "Withdraw", "success", DateTime.Now.ToString("yyyymmdd"));
         return(true);
     }
     else
     {
         TransactionServices NewTransaction = new TransactionServices(customer);
         string TransactionID = NewTransaction.GenerateTransactionID(Bank);
         NewTransaction.AddTransaction(amount, TransactionID, "Withdraw", "Failed", DateTime.Now.ToString("yyyymmdd"));
         return(false);
     }
 }
        public bool Transfer(double amount, string toAccountID, Bank toBank, string currencyId, Customer customer, int modeOfTransacation)
        {
            double          RateOfExchange    = 0;
            TransactionMode ModeOfTransaction = (TransactionMode)modeOfTransacation;

            foreach (var currency in Bank.Currencies)
            {
                if (currency.Id.Equals(currencyId))
                {
                    RateOfExchange = currency.ExchangeRate;
                }
            }
            if (RateOfExchange == 0)
            {
                return(false);
            }
            double ConvertedAmount = amount * RateOfExchange;
            double ServiceCharges  = 0;

            if (toBank != null)
            {
                CustomerServices NewService = new CustomerServices(Bank);
                Customer         ToCustomer = NewService.GetCustomer(toBank, toAccountID);
                if (ToCustomer != null)
                {
                    switch (ModeOfTransaction)
                    {
                    case TransactionMode.RTGS:
                    {
                        if (toBank.BankID.Equals(Bank.BankID))
                        {
                            ServiceCharges = amount * (Bank.same.rtgs * 0.01);
                        }
                        else
                        {
                            ServiceCharges = amount * (Bank.different.rtgs * 0.01);
                        }
                        break;
                    }

                    case TransactionMode.IMPS:
                    {
                        if (toBank.BankID.Equals(Bank.BankID))
                        {
                            ServiceCharges = amount * (Bank.same.imps * 0.01);
                        }
                        else
                        {
                            ServiceCharges = amount * (Bank.different.imps * 0.01);
                        }
                        break;
                    }
                    }
                    if (customer.Balance > amount + ServiceCharges)
                    {
                        customer.Balance   -= (amount + ServiceCharges);
                        ToCustomer.Balance += ConvertedAmount;
                        TransactionServices NewTransaction = new TransactionServices(customer);
                        string TransactionID = NewTransaction.GenerateTransactionID(Bank);
                        NewTransaction.AddTransaction(amount, TransactionID, "Transfer", "success", DateTime.Now.ToString("yyyymmdd"));
                        return(true);
                    }
                    else
                    {
                        TransactionServices NewTransaction = new TransactionServices(customer);
                        string TransactionID = NewTransaction.GenerateTransactionID(Bank);
                        NewTransaction.AddTransaction(amount, TransactionID, "Transfer", "Failed", DateTime.Now.ToString("yyyymmdd"));
                        return(false);
                    }
                }
            }
            return(false);
        }