/// <summary> /// Gets all possible rates /// </summary> /// <param name="output"></param> /// <returns></returns> public static bool FetchAll(ref List <Rate> output) { output = new List <Rate>(); SQLiteDataReader reader = DBI.DoQuery( "SELECT * FROM Rate ORDER BY id ASC;"); while (reader != null && reader.Read()) { output.Add(Rate.Factory(reader)); } return(true); }
/// <summary> /// Fetches all possible hulls /// </summary> /// <param name="output"></param> /// <returns></returns> public static bool FetchAll(ref List <Hull> output) { output = new List <Hull>(); SQLiteDataReader reader = DBI.DoQuery( "SELECT * FROM Hull ORDER BY ordering ASC;"); while (reader != null && reader.Read()) { Hull h = Hull.Factory(reader); output.Add(h); } return(true); }
/// <summary> /// Fetches all possible assignment roles /// </summary> /// <param name="output"></param> /// <returns></returns> public static bool FetchAll(ref List <AssignmentRole> output) { output = new List <AssignmentRole>(); SQLiteDataReader reader = DBI.DoQuery( "SELECT * FROM AssignmentRole;"); while (reader != null && reader.Read()) { AssignmentRole ar = AssignmentRole.Factory(reader); output.Add(ar); } return(true); }
/// <summary> /// Gets a list of all users /// </summary> /// <param name="output"></param> /// <returns></returns> public static bool FetchAll(ref List <User> output) { output = new List <User>(); SQLiteDataReader reader = DBI.DoQuery( "SELECT * FROM User WHERE id != 0"); while (reader != null && reader.Read()) { User u = User.Factory(reader); output.Add(u); } return(true); }
/// <summary> /// Gets the list of all ships which are active or drydocked. /// </summary> /// <param name="output"></param> /// <returns></returns> public static bool FetchAvailable(ref List <UserShip> output) { output = new List <UserShip>(); SQLiteDataReader reader = DBI.DoQuery( @"SELECT * FROM UserShip WHERE status = 0 OR status = 3;" ); while (reader != null && reader.Read()) { UserShip us = UserShip.Factory(reader); output.Add(us); } return(true); }
/// <summary> /// Fetches all operation roles which can be assigned to a boat /// </summary> /// <param name="output"></param> /// <returns></returns> public static bool FetchAllBoats(ref List <OperationRole> output) { output = new List <OperationRole>(); SQLiteDataReader reader = DBI.DoQuery( @"SELECT * FROM OperationRole WHERE onBoats = 1 ORDER BY id ASC;" ); while (reader != null && reader.Read()) { output.Add(OperationRole.Factory(reader)); } return(true); }
/// <summary> /// Gets the list of all ships. /// Does not include ships which were destroyed or decommed /// more than a month ago /// </summary> /// <param name="output"></param> /// <returns></returns> public static bool FetchRegistry(ref List <UserShip> output) { output = new List <UserShip>(); SQLiteDataReader reader = DBI.DoQuery( @"SELECT * FROM UserShip WHERE (status != 1 AND status != 4) OR statusDate > strftime('%s', 'now', '-7 days');" ); while (reader != null && reader.Read()) { UserShip us = UserShip.Factory(reader); output.Add(us); } return(true); }
/// <summary> /// Gets a list of all users without a current assignment /// </summary> /// <param name="output"></param> /// <returns></returns> public static bool FetchAllUnassigned(ref List <User> output) { output = new List <User>(); SQLiteDataReader reader = DBI.DoQuery( @"SELECT u.id, u.name, u.auth0, u.rank, u.rate, u.created FROM User u WHERE u.id NOT IN (SELECT user FROM Assignment WHERE until IS NULL) AND u.id != 0;" ); while (reader != null && reader.Read()) { User u = User.Factory(reader); output.Add(u); } return(true); }