Ejemplo n.º 1
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.º 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"]);
            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.º 3
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.º 4
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.º 5
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.º 6
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.º 7
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.º 8
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.º 9
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.º 10
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!");
            }
        }