Ejemplo n.º 1
0
        //method to transer fund
        public TransferFunds GetCreditingAccountBalance(int accountNumber)
        {
            TransferFunds transferFunds = new TransferFunds();
            SqlCommand    cmd           = new SqlCommand("SELECT * from Accounts WHERE AccountNumber = @an", OpenCon());

            cmd.Parameters.AddWithValue("@an", accountNumber.ToString());
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                transferFunds.Balance = decimal.Parse(dr["InitialBalance"].ToString());
            }
            CloseCon();
            return(transferFunds);
        }
Ejemplo n.º 2
0
        //method to get account dettail to transfer fund
        public TransferFunds GetAccountDetails(int accountId)
        {
            TransferFunds trans = new TransferFunds();
            SqlCommand    cmd   = new SqlCommand("SELECT * from Accounts WHERE AccountId = @id", OpenCon());

            cmd.Parameters.AddWithValue("@id", accountId);
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                trans.AccountNumber = int.Parse(dr["AccountNumber"].ToString());
                trans.Balance       = decimal.Parse(dr["InitialBalance"].ToString());
                trans.Overdraft     = decimal.Parse(dr["Overdraft"].ToString());
            }
            CloseCon();
            return(trans);
        }