-
Notifications
You must be signed in to change notification settings - Fork 1
/
staffpanel.cpp
91 lines (73 loc) · 1.86 KB
/
staffpanel.cpp
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
83
84
85
86
87
88
89
90
91
#include "staffpanel.h"
#include "ui_staffpanel.h"
StaffPanel::StaffPanel(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::StaffPanel)
{
ui->setupUi(this);
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("data.sqlite3");
db.open();
// set a "cursor"
query = QSqlQuery(db);
//Name And Address Of the Institution as saved in databse
if(!query.exec("SELECT institution_name, institution_address FROM users WHERE access = 1")) qDebug() << "Error while Extracting name and address";
query.first();
ui->inst_name->setText(query.value(0).toString());
ui->inst_address->setText(query.value(1).toString());
if (query.isActive()){
qDebug()<<"Connection Successful";
query.first();
}else{
qDebug()<< "Database connection:Error";
}
}
StaffPanel::~StaffPanel()
{
delete ui;
db.close();
}
void StaffPanel::on_addStudent_clicked() //When Add Stuent Option is Choosen
{
hide();
addstd = new add_Student;
addstd -> showMaximized();
}
void StaffPanel::on_viewStudent_clicked()
{
hide();
viewrec = new viewstdrecord;
viewrec -> showMaximized();
}
void StaffPanel::on_viewTable_clicked()
{
hide();
viewstudenttab = new viewstdtable;
viewstudenttab -> showMaximized();
}
void StaffPanel::on_modifyStudent_clicked()
{
hide();
modstd = new modifyStudent;
modstd -> showMaximized();
}
void StaffPanel::on_exitStaff_clicked()
{
close();
}
void StaffPanel::on_deleteStudent_clicked()
{
hide();
delstd = new deleteStudent ;
delstd -> showMaximized();
}
void StaffPanel::on_changeStaffPass_clicked()
{
change_pass = new changepassword;
change_pass -> show();
}
void StaffPanel::on_about_clicked()
{
abt = new About;
abt -> show();
}