public List <ViewObject> viewTransactions(int acct)
 {
     try
     {
         List <ViewObject> viewObjects = new List <ViewObject>();
         if (CheckIfExists(acct) == false)
         {
             return(null);
         }
         viewCommand.Parameters[0].Value = acct;
         viewCommand.Parameters[1].Value = acct;
         rd = viewCommand.ExecuteReader();
         while (rd.Read())
         {
             ViewObject temp = new ViewObject(rd.GetInt16(0), rd.GetInt16(1), rd.GetString(2).TrimEnd(), rd.GetInt16(3), rd.GetString(4).TrimEnd(), rd.GetDouble(5), rd.GetDateTime(6));
             viewObjects.Add(temp);
         }
         rd.Close();
         return(viewObjects);
     }
     catch (EmpressException e)
     {
         //Console.WriteLine("Error code :" + e.ErrorCode);
         //Console.WriteLine("Error message: " + e.Message);
         //Console.WriteLine(e.StackTrace);
     }
     catch (Exception e)
     {
         //Console.WriteLine("Error message: " + e.Message);
         //Console.WriteLine(e.StackTrace);
     }
     return(null);
 }
        public void makeTransaction(int source_acct, int dist_acct, double amount)
        {
            try
            {
                command.Connection  = connection;
                command.CommandText = "START WORK";
                command.ExecuteNonQuery();

                sourceUpdate.CommandText = "UPDATE Customer_Accounts SET Balance TO Balance - " + amount + " WHERE Acct_No = " + source_acct;
                sourceUpdate.ExecuteNonQuery();

                distUpdate.CommandText = "UPDATE Customer_Accounts SET Balance TO Balance + " + amount + " WHERE Acct_No = " + dist_acct;
                distUpdate.ExecuteNonQuery();

                rd = transIdUpdate.ExecuteReader();
                int transId = 0;
                while (rd.Read())
                {
                    transId = rd.GetInt16(0);
                }

                insertCommand.CommandText = "INSERT INTO transactions VALUES ( " + transId + ", " + source_acct + ", " + dist_acct + ", " + amount + ",  CURRENT_TIMESTAMP)";
                insertCommand.ExecuteNonQuery();

                command.CommandText = "COMMIT WORK";
                command.ExecuteNonQuery();
            }
            catch (EmpressException e)
            {
                command.Connection  = connection;
                command.CommandText = "ROLLBACK WORK";
                command.ExecuteNonQuery();
                throw new MoneyTransferException(e.ErrorCode);
                //Console.WriteLine("Error code :" + e.ErrorCode);
                //Console.WriteLine("Error message: " + e.Message);
                //Console.WriteLine(e.StackTrace);
            }
            catch (Exception e)
            {
                //Console.WriteLine("Error message: " + e.Message);
                //Console.WriteLine(e.StackTrace);
            }
        }