public ExecuteQuery ( string query ) : |
||
query | string | |
return |
public static DataTable GetSubjectsDataTable(DBDriver db) { try { return db.ExecuteQuery(String.Format(@"SELECT * FROM subjects order by id")); } catch(Exception e) { MessageBox.Show(e.Message); return null; } }
static public DataTable GetGroupsDataTable(DBDriver db) { try { return(db.ExecuteQuery(String.Format(@"SELECT * FROM groups order by id"))); } catch (Exception e) { MessageBox.Show(e.Message); return(null); } }
public bool CheckIfExists() { DataTable result = null; bool res = false; try { result = db.ExecuteQuery(String.Format("SELECT dbo.users_check(N'{0}', '{1}') AS RESULT", this.name, this.passwd)); } catch (SqlException e) { throw e; } catch (Exception e) { throw e; } finally { if (result != null) { if (result.Rows.Count == 1) { if ((bool)result.Rows[0]["RESULT"]) { res = true; } result.Dispose(); } } } return(res); }
public static DataTable GetAppointedTestForUser(DBDriver db, int userId) { return db.ExecuteQuery(String.Format(@"SELECT test_id, mark, test_time FROM users_tests WHERE user_id = {0}", userId)); }
static public DataTable GetQuestionsDataTableByTestId(DBDriver db, int testId) { return(db.ExecuteQuery(String.Format(@"SELECT * FROM questions WHERE test_id = {0}", testId))); }
static public DataTable GetTestsDataTableBySubjectId(DBDriver db, int subjectId) { return(db.ExecuteQuery(String.Format(@"SELECT * FROM tests WHERE subject_id = {0}", subjectId))); }
static public DataTable GetTestsDataTable(DBDriver db) { return(db.ExecuteQuery(String.Format(@"SELECT * FROM tests"))); }
public static DataTable GetUsersDataTable(DBDriver db) { return db.ExecuteQuery(String.Format(@"SELECT * FROM users")); }
public static DataTable GetTutorsDataTable(DBDriver db) { //return db.ExecuteQuery(String.Format(@"SELECT users.id, users.real_name, users.name, users.passwd, users.email, users.additional_contats, users.last_login_date, users.registration_date, users.last_edit_date, groups.name as 'group_name' FROM users, groups WHERE users.role_id = 2")); return db.ExecuteQuery(String.Format(@"SELECT users.id, users.real_name, users.name, users.passwd, users.email, users.additional_contacts, users.last_login_date, users.registration_date, users.last_edit_date, users.group_id FROM users WHERE users.role_id = 2")); }
public static DataTable GetQuestionsDataTableByTestId(DBDriver db, int testId) { return db.ExecuteQuery(String.Format(@"SELECT * FROM questions WHERE test_id = {0}", testId)); }
static public DataTable GetTutorsDataTable(DBDriver db) { //return db.ExecuteQuery(String.Format(@"SELECT users.id, users.real_name, users.name, users.passwd, users.email, users.additional_contats, users.last_login_date, users.registration_date, users.last_edit_date, groups.name as 'group_name' FROM users, groups WHERE users.role_id = 2")); return(db.ExecuteQuery(String.Format(@"SELECT users.id, users.real_name, users.name, users.passwd, users.email, users.additional_contacts, users.last_login_date, users.registration_date, users.last_edit_date, users.group_id FROM users WHERE users.role_id = 2"))); }
static public DataTable GetAppointedTestForUser(DBDriver db, int userId) { return(db.ExecuteQuery(String.Format(@"SELECT test_id, mark, test_time FROM users_tests WHERE user_id = {0}", userId))); }
public static DataTable GetTestsDataTableBySubjectId(DBDriver db, int subjectId) { return db.ExecuteQuery(String.Format(@"SELECT * FROM tests WHERE subject_id = {0}", subjectId)); }
static public DataTable GetAnswersDataTableByQuestionId(DBDriver db, int questionId) { return(db.ExecuteQuery(String.Format(@"SELECT * FROM answers WHERE question_id = {0}", questionId))); }
public static DataTable GetAnswersDataTableByQuestionId(DBDriver db, int questionId) { return db.ExecuteQuery(String.Format(@"SELECT * FROM answers WHERE question_id = {0}", questionId)); }