-
Notifications
You must be signed in to change notification settings - Fork 0
/
StorageController.h
82 lines (66 loc) · 2.66 KB
/
StorageController.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef STORAGECONTROLLER_H
#define STORAGECONTROLLER_H
#pragma warning(disable:4786)
#include "Connection.h"
#include "User.h"
#include "Student.h"
#include "IndexedList.h"
//#include <afxcmn.h>
//#include <iostream>
using namespace std;
class CStorageController {
public:
CStorageController();
~CStorageController();
CIndexedList GetSchoolYearList();
vector<string> GetUserList();
CUser GetUser( string username, string adminPassword="" );
bool ValidateUser( string username, string password );
bool CreateUser( string username );
bool ChangeAdminPassword( string newPassword );
bool UpdateUser( string username, CUser newUser, string adminPassword="" );
bool DeleteUser( string username );
bool GetStudentList( CTable& table, string first, string last, string ssn, int year );
void GetAssessmentRecord( CConnection* conn, CAssessmentRecord& record, int recordID );
bool GetStudent( CStudent& student, string ssn, int year, CConnection* conn=NULL );
CIndexedList GetList( string listName, CConnection* conn=NULL );
bool StudentExists( string ssn );
bool CreateStudent( string ssn, int schoolYearID );
bool ChangeSSN( string oldSSN, string newSSN );
void UpdatePerson( string personID, CPerson& person, CConnection& conn );
void UpdateAssessmentRecord( CConnection* conn, CAssessmentRecord& record );
bool UpdateStudent( CStudent& student );
bool DeleteStudentYear( string ssn, int schoolYearID );
bool RemoveListItem( string listName, int index );
bool AddListItem( string listName, int index, string value );
bool ModifyListItem( string listName, int index, string value );
bool OpenForAuth( CConnection* conn );
bool OpenForReading( CConnection* conn );
bool OpenForWriting( CConnection* conn );
bool OpenForAdmin( CConnection* conn );
//void BeginBackup( vector<string> tables, ostream& newOut, CProgressCtrl* newProgress );
//bool ContinueBackup();
bool SafeAuthQuery( CTable& table, string sql, string error, CConnection* conn=NULL );
bool SafeQuery( CTable& table, string sql, string error, CConnection* conn=NULL );
bool SafeUpdate( string sql, string error );
bool SafeAdminUpdate( string sql, string error );
private:
// backup data
/*vector<string> backupTables;
bool needNewTable;
int currentTable;
int currentRow;
CProgressCtrl* progress;
CTable currentRS;
ostream& backupOut;*/
};
// with the preprocessor directives below, any file which includes this one has access
// to the global "storage" object, except the file which instantiates the object by
// defining DECLARE_STORAGE
//#ifdef DECLARE_STORAGE
// CStorageController storage;
//#else
// extern CStorageController storage;
//#endif
//
#endif