-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidator.cpp
More file actions
39 lines (34 loc) · 1.33 KB
/
validator.cpp
File metadata and controls
39 lines (34 loc) · 1.33 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
#include "validator.h"
#include "user.h"
#include "product.h"
validator::validator()
{
}
bool validator::userValidator(QString name, QString username, QString password, QString phone, QString address){
if (name.length() >= 3) {
if (username.length() >= 4) {
if (password.length() >= 4) {
if (phone.length() == 11) {
if (address.length() >= 4) {
return true;
}
}
}
}
}
return false;
}
bool validator::productValidator(QString username, QString name, QString brand, QString category, qint64 count, qint64 price, QString size, QString weight)
{
if(user::checkCustomer(username) && product::checkProduct(name,username) && brand.length() > 0 && category.length() > 0 && count > 0 && price > 0 && size.length() > 0 && weight.length() > 0){
return true;
}
return false;
}
bool validator::productValidatorForEdit(QString username, QString name, QString brand, QString category, qint64 count, qint64 price, QString size, QString weight)
{
if(user::checkCustomer(username) && name.length() > 0 && brand.length() > 0 && category.length() > 0 && count > 0 && price > 0 && size.length() > 0 && weight.length() > 0){
return true;
}
return false;
}