Exemplo n.º 1
0
        public void Withdraw(double amount,int accID)
        {
            UserDAO dao=new UserDAO();
            DataTable dt=new DataTable();
            string connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            BankGeneralAccount bg = new BankGeneralAccount();
            dt=dao.GetData("Select AccountBalance from Account where AccountID="+accID,connectionstring);
            Balance=Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            Balance = Balance - amount;
            if (Balance > 0)
            {
                string myQuery = "Update Account set AccountBalance=" + Balance + " where AccountID="+accID;

                //UserDAO dao = new UserDAO();
                bg.BgaWithdraw(amount);
                dao.UpdateData(myQuery, connectionstring);
                AccountActivityLedger Ledger = new AccountActivityLedger();
                Ledger.AddAccountActivity(accID, "Withdraw",amount, DateTime.Now);
                MessageBox.Show("Amount withdraw Successful!");

            }
            //string myQuery="up
            else
                MessageBox.Show("Your balance is too low!");
        }
Exemplo n.º 2
0
        public override void Deposit(double amount, int accID)
        {
            UserDAO            dao = new UserDAO();
            DataTable          dt  = new DataTable();
            string             connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            BankGeneralAccount bg = new BankGeneralAccount();

            dt      = dao.GetData("Select AccountBalance from Account where AccountID=" + accID, connectionstring);
            Balance = Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            if ((Balance + amount) <= 5000)
            {
                Balance = Balance + amount;
                string myQuery = "Update Account set AccountBalance=" + Balance + " where AccountID=" + accID;

                //UserDAO dao = new UserDAO();
                dao.UpdateData(myQuery, connectionstring);
                bg.BgaDeposit(amount);
                AccountActivityLedger Ledger = new AccountActivityLedger();
                Ledger.AddAccountActivity(accID, "Deposit", amount, DateTime.Now);
                MessageBox.Show("Amount deposited successfully!");
            }

            else
            {
                MessageBox.Show("Balance greater than limit!");
            }
        }
Exemplo n.º 3
0
        public void Withdraw(double amount, int accID)
        {
            UserDAO            dao = new UserDAO();
            DataTable          dt  = new DataTable();
            string             connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            BankGeneralAccount bg = new BankGeneralAccount();

            dt      = dao.GetData("Select AccountBalance from Account where AccountID=" + accID, connectionstring);
            Balance = Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            Balance = Balance - amount;
            if (Balance > 0)
            {
                string myQuery = "Update Account set AccountBalance=" + Balance + " where AccountID=" + accID;

                //UserDAO dao = new UserDAO();
                bg.BgaWithdraw(amount);
                dao.UpdateData(myQuery, connectionstring);
                AccountActivityLedger Ledger = new AccountActivityLedger();
                Ledger.AddAccountActivity(accID, "Withdraw", amount, DateTime.Now);
                MessageBox.Show("Amount withdraw Successful!");
            }
            //string myQuery="up
            else
            {
                MessageBox.Show("Your balance is too low!");
            }
        }
        //methods
        public void BgaDeposit( double amt)
        {
            UserDAO dao = new UserDAO();
            DataTable dt = new DataTable();
            string connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            dt = dao.GetData("Select AccountBalance from BankGeneralAccount where AccountID=1000", connectionstring);
            bgaBalance = Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            bgaBalance = bgaBalance + amt;
            string myQuery = "Update BankGeneralAccount set AccountBalance=" + bgaBalance + " where AccountID= 1000";

            //UserDAO dao = new UserDAO();
            dao.UpdateData(myQuery, connectionstring);
        }
Exemplo n.º 5
0
        //methods

        public void BgaDeposit(double amt)
        {
            UserDAO   dao = new UserDAO();
            DataTable dt  = new DataTable();
            string    connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";

            dt         = dao.GetData("Select AccountBalance from BankGeneralAccount where AccountID=1000", connectionstring);
            bgaBalance = Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            bgaBalance = bgaBalance + amt;
            string myQuery = "Update BankGeneralAccount set AccountBalance=" + bgaBalance + " where AccountID= 1000";

            //UserDAO dao = new UserDAO();
            dao.UpdateData(myQuery, connectionstring);
        }
Exemplo n.º 6
0
        public override void Deposit(double amount, int accId)
        {
            UserDAO            dao = new UserDAO();
            DataTable          dt  = new DataTable();
            string             connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            BankGeneralAccount bg = new BankGeneralAccount();

            dt      = dao.GetData("Select AccountBalance from Account where AccountID=" + accId, connectionstring);
            Balance = Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            Balance = Balance + amount;
            string myQuery = "Update Account set AccountBalance=" + Balance + " where AccountID=" + accId;

            //UserDAO dao = new UserDAO();
            dao.UpdateData(myQuery, connectionstring);
            bg.BgaDeposit(amount);
            AccountActivityLedger Ledger = new AccountActivityLedger();

            Ledger.AddAccountActivity(accId, "Deposit", amount, DateTime.Now);
        }
Exemplo n.º 7
0
 public static void Reopen(int accId,double reopeningBalance)
 {
     UserDAO dao = new UserDAO();
     DataTable dt = new DataTable();
     BankGeneralAccount bg = new BankGeneralAccount();
     string queryString = "Select * from Account where AccountID=" + accId;
     try
     {
         dao.InsertData(@"use ApteanEdgeBank update Account
     set DateOfClosing=null
     where AccountID =" + accId, UserDAO.connectionString);
         dao.UpdateData("update Account set AccountBalance=" + reopeningBalance + "where AccountID=" + accId, UserDAO.connectionString);
         bg.BgaDeposit(reopeningBalance);
     }
     catch (InvalidOperationException e)
     {
         MessageBox.Show("Account reopen failed!");
     }
 }
        public void BgaWithdraw(double amt)
        {
            UserDAO dao = new UserDAO();
            DataTable dt = new DataTable();
            string connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            dt = dao.GetData("Select AccountBalance from BankGeneralAccount where AccountID=1000", connectionstring);
            bgaBalance = Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            bgaBalance = bgaBalance - amt;
            if (bgaBalance > 0)
            {
                string myQuery = "Update BankGeneralAccount set AccountBalance=" + bgaBalance + " where AccountID= 1000";

                //UserDAO dao = new UserDAO();
                dao.UpdateData(myQuery, connectionstring);

            }
            //string myQuery="up
            else
                System.Windows.Forms.MessageBox.Show("Insufficient Balance in Bank General Account");
        }
Exemplo n.º 9
0
        public void Withdraw(double amount, int accID)
        {
            BankGeneralAccount bg = new BankGeneralAccount();
            UserDAO dao = new UserDAO();
            DataTable dt = new DataTable();
            string connectionstring = "Data Source=WS003LT1550PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            dt = dao.GetData("Select AccountBalance from Account where AccountID=" + accID, connectionstring);
            Balance = Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            Balance = Balance - amount;
            if (Balance > 0)
            {
                string myQuery = "Update Account set AccountBalance=" + Balance + " where AccountID=" + accID;

                //UserDAO dao = new UserDAO();
                dao.UpdateData(myQuery, connectionstring);
                bg.BgaWithdraw(amount);
             }
            //string myQuery="up
            else
                System.Windows.Forms.MessageBox.Show("Your balance is too low!");
        }
Exemplo n.º 10
0
        public void BgaWithdraw(double amt)
        {
            UserDAO   dao = new UserDAO();
            DataTable dt  = new DataTable();
            string    connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";

            dt         = dao.GetData("Select AccountBalance from BankGeneralAccount where AccountID=1000", connectionstring);
            bgaBalance = Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            bgaBalance = bgaBalance - amt;
            if (bgaBalance > 0)
            {
                string myQuery = "Update BankGeneralAccount set AccountBalance=" + bgaBalance + " where AccountID= 1000";

                //UserDAO dao = new UserDAO();
                dao.UpdateData(myQuery, connectionstring);
            }
            //string myQuery="up
            else
            {
                System.Windows.Forms.MessageBox.Show("Insufficient Balance in Bank General Account");
            }
        }
Exemplo n.º 11
0
 public static void Close(int accId)
 {
     UserDAO dao=new UserDAO();
     DataTable dt=new DataTable();
     BankGeneralAccount bg = new BankGeneralAccount();
     string queryString="Select * from Account where AccountID="+accId;
     try
     {
         /*Balance = 0;
         dateClosed = DateTime.Now;
         Console.WriteLine("Account closed on {0}", dateClosed.ToShortDateString());*/
         dt = dao.GetData(queryString, UserDAO.connectionString);
         if (Convert.ToDouble(dt.Rows[0]["AccountBalance"]) != 0.0)
         {
            DialogResult result= MessageBox.Show("Your account balance is greater than 0! The balance must be 0 to close an account. Would you like to clear your account balance?","Account Balance is not 0!",MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                //set closing date for the account. Deduct the remaining balance from bank general account and set the current balance to 0
                dao.InsertData(@"use ApteanEdgeBank update Account
     set DateOfClosing= cast(getdate() as date)
     where AccountID =" + accId, UserDAO.connectionString);
                bg.BgaWithdraw(Convert.ToDouble(dt.Rows[0]["AccountBalance"]));
                dao.UpdateData("update Account set AccountBalance=0 where AccountID=" + accId, UserDAO.connectionString);
            }
         }
         else
         {
             dao.InsertData(@"use ApteanEdgeBank update Account
     set DateOfClosing= cast(getdate() as date)
     where AccountID =" + accId, UserDAO.connectionString);
         }
     }
     catch (InvalidOperationException e)
     {
         MessageBox.Show("Account closure failed!");
     }
 }
Exemplo n.º 12
0
        public override void Deposit(double amount,int accID)
        {
            UserDAO dao = new UserDAO();
            DataTable dt = new DataTable();
            string connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            BankGeneralAccount bg = new BankGeneralAccount();
            dt = dao.GetData("Select AccountBalance from Account where AccountID=" + accID, connectionstring);
            Balance = Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            if ((Balance + amount) <= 5000)
            {

            Balance = Balance + amount;
            string myQuery = "Update Account set AccountBalance=" + Balance + " where AccountID="+accID;

            //UserDAO dao = new UserDAO();
            dao.UpdateData(myQuery, connectionstring);
            bg.BgaDeposit(amount);
            AccountActivityLedger Ledger = new AccountActivityLedger();
            Ledger.AddAccountActivity(accID, "Deposit", amount, DateTime.Now);
            MessageBox.Show("Amount deposited successfully!");
            }

            else
            {
            MessageBox.Show("Balance greater than limit!");
            }
        }
Exemplo n.º 13
0
        public override void Deposit(double amount,int accId)
        {
            UserDAO dao=new UserDAO();
            DataTable dt=new DataTable();
            string connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            BankGeneralAccount bg = new BankGeneralAccount();
            dt=dao.GetData("Select AccountBalance from Account where AccountID="+accId,connectionstring);
            Balance=Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            Balance=Balance+amount;
            string myQuery = "Update Account set AccountBalance=" + Balance + " where AccountID="+accId;

            //UserDAO dao = new UserDAO();
            dao.UpdateData(myQuery, connectionstring);
            bg.BgaDeposit(amount);
            AccountActivityLedger Ledger = new AccountActivityLedger();
            Ledger.AddAccountActivity(accId, "Deposit", amount, DateTime.Now);
        }
Exemplo n.º 14
0
        public override void Deposit(double amount, int accID)
        {
            BankGeneralAccount bg = new BankGeneralAccount();
            UserDAO dao = new UserDAO();
            DataTable dt = new DataTable();
            string connectionstring = "Data Source=WS003LT1550PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            dt = dao.GetData("Select AccountBalance from Account where AccountID=" + accID, connectionstring);
            Balance = Convert.ToDouble(dt.Rows[0]["AccountBalance"]);
            if ((Balance + amount) < 5000)
            {

                Balance = Balance + amount;
                string myQuery = "Update Account set AccountBalance=" + Balance + " where AccountID=" + accID;

                //UserDAO dao = new UserDAO();
                dao.UpdateData(myQuery, connectionstring);
                bg.BgaDeposit(amount);
            }

            else
            {
                System.Windows.Forms.MessageBox.Show("Balance greater than limit!");
            }
        }