-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.cpp
More file actions
70 lines (60 loc) · 1.49 KB
/
search.cpp
File metadata and controls
70 lines (60 loc) · 1.49 KB
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
#include "search.h"
#include "ui_search.h"
#include <ctime>
#include <cmath>
search::search(QWidget *parent) :
QDialog(parent),
ui(new Ui::search)
{
ui->setupUi(this);
}
search::~search()
{
delete ui;
}
void search::on_searchbutton_clicked()
{
found=false;
double time_taken;
int temp = ui->patientnoedit->text().toInt();
clock_t begin_time=clock();
p=bigdata.searchBST(temp);
clock_t end = clock();
time_taken = double(end-begin_time)/CLOCKS_PER_SEC;
qDebug()<<time_taken;
if(p.patientNo!=-1){
found=true;
ui->label_2->setText(QString::number(time_taken,'g',15)+"s");
}
else
ui->label_2->setText("Entry not found!!");
ui->fname->setText("Name: "+p.fname);
ui->lname->setText(p.lname);
ui->age->setText("Age: "+ QString::number(p.age));
ui->gender->setText("Gender: "+p.gender);
ui->patienttype->setText(p.patienttype);
ui->dateofdischarge->setText("Date of discharge: "+ p.dateofDischarge);
ui->dateofvisit->setText("Date of Visit: "+p.dateofVisit);
ui->detail->setText("Patient Info: "+p.detail);
}
void search::on_deletebutton_clicked()
{
bigdata.Delete(bigdata.root, p);
}
void search::on_editbutton_clicked()
{
if(found){
bigdata.Delete(bigdata.root, p);
this->hide();
Edit_data newedit(&p);
newedit.show();
newedit.exec();
}
}
void search::on_backbutton_clicked()
{
this->hide();
menu backed;
backed.show();
backed.exec();
}