|
| class | User |
| | the class repesenting the User in the datbase matching the Users table with properties for Id, Username, RoleId and Password. This class is used to deserialize user information retrieved from the database and to create new users when saving to the database. It provides a structured way to represent user data within the application and facilitates interactions with the database for user-related operations. More...
|
| class | StructureInfo |
| | the class representing the structure information retrieved from the database, including properties for Id, AssignmentId, StudentId, StudentName, AssignmentTitle and SubmittedAt. More...
|
| class | Assignment |
| | the class representing an assignment in the database with properties for Id, Title, Description and TeacherId. More...
|
| class | Roles |
| | the class representing user roles in the database with static readonly properties for Teacher and Student role IDs. More...
|
|
|
| Game1Database (ImGuiLogger logger) |
|
void | TestConnection () |
| List< int > | GetStudents () |
| | Retrieves a list of student IDs from the database by executing a SQL query that selects the IDs of users with a role_id of 2 (indicating they are students). The method opens a connection to the database, executes the query, and reads the results into a list of integers. If there are any issues during the database connection or query execution, it logs the error message using the ImGuiLogger and rethrows the exception for further handling. This method provides a way to programmatically access student information from the database for use in the application.
|
| List< int > | GetTeachers () |
| | Retrieves a list of teacher IDs from the database by executing a SQL query that selects the IDs of users with a role_id of 1 (indicating they are teachers). The method opens a connection to the database, executes the query, and reads the results into a list of integers. If there are any issues during the database connection or query execution, it logs the error message using the ImGuiLogger and rethrows the exception for further handling. This method provides a way to programmatically access teacher information from the database for use in the application.
|
| List< User > | GetTeachersWithInfo () |
| | Retrieves a list of teacher information from the database by executing a SQL query that selects the id, username, role_id, and password of users with a role_id of 1 (indicating they are teachers). The method opens a connection to the database, executes the query, and reads the results into a list of User objects containing the relevant information. If there are any issues during the database connection or query execution, it logs the error message using the ImGuiLogger and rethrows the exception for further handling. This method provides a way to programmatically access detailed teacher information from the database for use in the application.
|
| Dictionary< string, string > | GetStudentStructures (int studentId) |
| | Retrieves a dictionary of student structures from the database for a given student ID by executing a SQL query that selects the content of structures associated with the specified student. The method opens a connection to the database, executes the query, and reads the results into a dictionary where the key is "content" and the value is the JSON string representing the structure. If there are any issues during the database connection or query execution, it logs the error message using the ImGuiLogger and rethrows the exception for further handling. This method provides a way to programmatically access a student's saved structures from the database for use in the application.
|
| User | GetUser (string user) |
| | Retrieves a user from the database based on the provided username or user ID. If the input can be parsed as an integer, it treats it as a user ID and retrieves the user by ID. Otherwise, it treats the input as a username and retrieves the user by username. The method opens a connection to the database, executes the appropriate SQL query, and reads the results into a User object containing the relevant information. If there are any issues during the database connection or query execution, it logs the error message using the ImGuiLogger and rethrows the exception for further handling. This method provides a way to programmatically access user information from the database based on either username or user ID for use in the application.
|
| int | CreateUser (string username, int roleId) |
| | Creates a new user in the database with the specified username and role ID.
|
| int | CreateAssignment (string title, string description, DateTime? dueDate, int teacherId) |
| | Creates a new assignment in the database with the specified title, description, due date, and teacher ID.
|
| List< StructureInfo > | GetStructuresForUser (int userId) |
| | gets all structures owned by the given userid
|
| string | GetStructureContent (int structureId) |
| | Retrieves the content of a structure from the database based on the provided structure ID. The method opens a connection to the database, executes a SQL query to select the content of the structure with the specified ID, and returns the content as a string. If there are any issues during the database connection or query execution, it logs the error message using the ImGuiLogger and rethrows the exception for further handling. This method provides a way to programmatically access the content of a specific structure from the database for use in the application.
|
| int | SaveStructureWithName (int studentId, string contentJson, string title=null, int? assignmentId=null) |
| | saves a structure to the database with the given student ID, content JSON, title and assignment ID.
|
| List< Assignment > | GetAssignmentsForTeacher (int teacherId) |
| | lists all assignments for a given teacher ID by querying the database and returns a list of Assignment objects
|
| List< StructureInfo > | GetStructuresForAssignment (int assignmentId) |
| | returns a list of structures for a given assignment ID used for teachers to view all student submissions for a given assignment
|
| List< User > PhysicsCSAlevlProject.Game1Database.GetTeachersWithInfo |
( |
| ) |
|
|
inline |
Retrieves a list of teacher information from the database by executing a SQL query that selects the id, username, role_id, and password of users with a role_id of 1 (indicating they are teachers). The method opens a connection to the database, executes the query, and reads the results into a list of User objects containing the relevant information. If there are any issues during the database connection or query execution, it logs the error message using the ImGuiLogger and rethrows the exception for further handling. This method provides a way to programmatically access detailed teacher information from the database for use in the application.
- Returns