Ejemplo 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!");
            }
        }
Ejemplo n.º 2
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!");
        }
        private void BankAccountBalance_Load(object sender, EventArgs e)
        {
            BankGeneralAccount bg = new BankGeneralAccount();

            bg.GetAccountBalance();
            label1.Text = label1.Text + Convert.ToString(bg.bgaBalance);
        }
Ejemplo n.º 4
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!");
            }
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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!");
     }
 }
Ejemplo n.º 7
0
        public override int Create(string accType, DateTime open, double balance)
        {
            /* accountID=ID;
             * dateOpened=open;
             * Balance=balance;
             * Console.WriteLine("Chequing Acoount:");
             * Console.WriteLine("Account ID:{0}\nDate Opened:{1}\nBalance:{2}", accountID, dateOpened, Balance);*/

            string             myQuery          = "insert into Account values(" + accType + "," + balance + "," + "'" + open + "'" + "," + "null" + ")";
            string             connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            BankGeneralAccount bg  = new BankGeneralAccount();
            UserDAO            dao = new UserDAO();

            dao.InsertData(myQuery, connectionstring);
            bg.BgaDeposit(balance);
            DataTable dataTable = dao.GetData("use ApteanEdgeBank select max(AccountID) as max from Account", UserDAO.connectionString);
            int       AccountID = Convert.ToInt32(dataTable.Rows[0]["max"]);

            return(AccountID);
            //dao.InsertData("use ApteanEdgeBank insert into CustomerAccount values(" + CustomerID + "," + AccountID + ")", UserDAO.connectionString);
        }
Ejemplo n.º 8
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!");
        }
Ejemplo n.º 9
0
        public override int Create(string accType, DateTime open, double balance)
        {
            if (balance <= Limit)
            {
                dateOpened = open;
                Balance    = balance;
                string             myQuery          = "insert into Account values(" + accType + "," + balance + "," + "'" + open + "'" + "," + "null" + ")";
                string             connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
                BankGeneralAccount bg  = new BankGeneralAccount();
                UserDAO            dao = new UserDAO();
                dao.InsertData(myQuery, connectionstring);
                bg.BgaDeposit(balance);
                DataTable dataTable = dao.GetData("use ApteanEdgeBank select max(AccountID) as max from Account", UserDAO.connectionString);
                int       AccountID = Convert.ToInt32(dataTable.Rows[0]["max"]);
                return(AccountID);
            }

            else
            {
                MessageBox.Show("Balance is greater than limit!");
                return(0);
            }
        }
Ejemplo n.º 10
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!");
     }
 }
Ejemplo n.º 11
0
        public override int Create(string accType,DateTime open,double balance)
        {
            /* accountID=ID;
            dateOpened=open;
            Balance=balance;
            Console.WriteLine("Chequing Acoount:");
            Console.WriteLine("Account ID:{0}\nDate Opened:{1}\nBalance:{2}", accountID, dateOpened, Balance);*/

            string myQuery = "insert into Account values("+accType+","+balance+","+"'"+open+"'"+","+"null"+")";
            string connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
            BankGeneralAccount bg = new BankGeneralAccount();
            UserDAO dao = new UserDAO();
            dao.InsertData(myQuery, connectionstring);
            bg.BgaDeposit(balance);
            DataTable dataTable = dao.GetData("use ApteanEdgeBank select max(AccountID) as max from Account", UserDAO.connectionString);
            int AccountID = Convert.ToInt32(dataTable.Rows[0]["max"]);
            return AccountID;
            //dao.InsertData("use ApteanEdgeBank insert into CustomerAccount values(" + CustomerID + "," + AccountID + ")", UserDAO.connectionString);
        }
Ejemplo 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!");
            }
        }
Ejemplo n.º 13
0
        public override int Create(string accType,DateTime open,double balance)
        {
            if (balance <= Limit)
              {

                dateOpened = open;
                Balance = balance;
                string myQuery = "insert into Account values(" + accType + "," + balance + "," + "'" + open + "'" + "," + "null" + ")";
                string connectionstring = "Data Source=WS003LT1553PRD;Initial Catalog=ApteanEdgeBank;User=sa;Password=abc-123";
                BankGeneralAccount bg = new BankGeneralAccount();
                UserDAO dao = new UserDAO();
                dao.InsertData(myQuery, connectionstring);
                bg.BgaDeposit(balance);
                DataTable dataTable = dao.GetData("use ApteanEdgeBank select max(AccountID) as max from Account", UserDAO.connectionString);
                int AccountID = Convert.ToInt32(dataTable.Rows[0]["max"]);
                return AccountID;
             }

             else
            {
                MessageBox.Show("Balance is greater than limit!");
                return 0;
            }
        }
Ejemplo n.º 14
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);
        }
Ejemplo n.º 15
0
 private void BankAccountBalance_Load(object sender, EventArgs e)
 {
     BankGeneralAccount bg = new BankGeneralAccount();
     bg.GetAccountBalance();
     label1.Text = label1.Text + Convert.ToString(bg.bgaBalance);
 }
Ejemplo n.º 16
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!");
            }
        }