-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorderbook.cpp
More file actions
91 lines (84 loc) · 2.41 KB
/
Copy pathorderbook.cpp
File metadata and controls
91 lines (84 loc) · 2.41 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include "orderbook.h"
#include "ui_orderbook.h"
#include "allclass.h"
#include <QString>
#include <QMessageBox>
#include <string>
orderbook::orderbook(QWidget *parent) :
QDialog(parent),
ui(new Ui::orderbook)
{
ui->setupUi(this);
}
orderbook::~orderbook()
{
delete ui;
}
bool isClient5(QString clientid);
bool isBook5(QString bookID);
extern book_shelf library;
extern int orderowetoomuch;
extern int orderbookdeleted;
extern int order_succeed;
extern int order_book_in_library;
extern string str;
void orderbook::on_pushButton_clicked()
{
QString bookID = ui->bookid->text();
if(bookID == NULL||!isBook5(bookID))
QMessageBox::warning(this, tr("提示!"),
tr("请检查书ID!"),
QMessageBox::Yes);
else
{
library.order_book(bookID.toStdString(),str);
if(orderowetoomuch)
{
QMessageBox::warning(this, tr("提示!"),
tr("您欠款过多!"),
QMessageBox::Yes);
orderowetoomuch=0;
}
else if(order_book_in_library)
{
QMessageBox::warning(this, tr("提示!"),
tr("该书在馆内,您可以直接借!"),
QMessageBox::Yes);
order_book_in_library = 0;
}
else if(orderbookdeleted)
{
QMessageBox::warning(this, tr("提示!"),
tr("该书已不在库!"),
QMessageBox::Yes);
}
else if(order_succeed)
{
QMessageBox::warning(this, tr("提示!"),
tr("预约成功!"),
QMessageBox::Yes);
order_succeed = 0;
}
this->close();
}
}
bool isClient5(QString clientid)
{
for(int i=0; i< library.suclient.size();++i)
{
QString q1 = QString::fromStdString(library.suclient[i].clid);
if(!QString::compare(clientid,q1))
return true;
}
return false;
}
bool isBook5(QString bookID)
{
for(int i = 0; i<library.booklib.size();++i)
{
QString q1 = QString::fromStdString(library.booklib[i].id);
if(!QString::compare(bookID,q1))
return true;
}
return false;
}