-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSellerSignup.cpp
More file actions
64 lines (58 loc) · 1.84 KB
/
SellerSignup.cpp
File metadata and controls
64 lines (58 loc) · 1.84 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
#include "SellerSignup.h"
#include "LoginMenu.h"
#include "ui_SellerSignup.h"
#include "Seller.h"
#include <QMessageBox>
sellerSignUp::sellerSignUp(QWidget *parent) :
QDialog(parent),
ui(new Ui::sellerSignUp)
{
ui->setupUi(this);
QPixmap bkgnd("D:/qt/login.jpg");
bkgnd = bkgnd.scaled(this->size(), Qt::IgnoreAspectRatio);
QPalette palette;
palette.setBrush(QPalette::Background, bkgnd);
this->setPalette(palette);
}
sellerSignUp::~sellerSignUp()
{
delete ui;
}
void sellerSignUp::on_pushButton_clicked()
{
QString name;
QString email;
QString password;
bool flag = false;
name = ui->sellername->text();
email = ui->selleremail->text();
password = ui->sellerpassword->text();
if(supermarketobject.customers.empty())
{
supermarketobject.readAllFiles();
}
for (int i = 0 ; i < this->supermarketobject.sellers.size() ; i++)
{
if(this->supermarketobject.sellers[i].getEmail() == email)
{
flag = true;
QMessageBox::critical(this , "SIGN UP" , "EMAIL ALREADY EXISTS");
}
else if (email.isEmpty() || name.isEmpty() || password.isEmpty()){
flag=true;
QMessageBox::critical(this , "SIGN UP" , "Please Fill All Data");
}
}
if (!flag)
{
Seller temp (this->supermarketobject.generateId(),name,email,password,0,0,0);
this->supermarketobject.sellers.push_back(temp);
this->supermarketobject.writeToFileFromSeller();
QMessageBox::information(this , "SIGN UP" , "SUCCESS");
this->hide();
loginmenu login;
login.setModal(true);
login.setWindowFlags(Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint);
login.exec();
}
}