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); }
private bool CheckIfExists(int Acct_No) { command.Connection = connection; command.CommandText = "SELECT * FROM Customer_Accounts WHERE Acct_No = " + Acct_No; EmpressDataReader temp = command.ExecuteReader(); temp.Read(); temp.Close(); if (temp.HasRows == false) { return(false); } return(true); }