-
Notifications
You must be signed in to change notification settings - Fork 0
/
Customer.h
106 lines (74 loc) · 1.8 KB
/
Customer.h
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef CUSTOMER_H
#define CUSTOMER_H
#include <string>
#include <iostream>
#include <sstream>
#include <mysql.h>
#include <functional>
#include "sha256.h"
#include <boost/algorithm/string.hpp> // toLower string
#include <iomanip>
#include <vector>
#include "Vendor.h"
#include <ctime>
#include <time.h>
#include "External.h"
#include <cmath> // round off number
using namespace std;
#pragma once
struct CustomerDetails {
int id;
string username;
string password;
string name;
string phone;
string address;
};
struct CustomerOrders {
int id;
int total_quantity;
double total_price;
};
struct OrderDetails {
//int id;
int cust_order_id;
int product_id;
int quantity;
};
class Customer {
private:
//int custNum
int custID; // before this in string
string custName, custUsername, custPass, custAddress, custPhone;
CustomerDetails data[100];
vector<vector<string>> order; // 2d vector array to store order details when ordering
CustomerOrders cust_order[100];
OrderDetails order_detail[100];
vector<vector<string>> prev_order;
vector<vector<string>> graph;
public:
Customer();
Customer(string, string);
~Customer();
bool login(string, string, int);
void registerCustomer(MYSQL*);
string inputNoPhone();
int fetchData(MYSQL_RES*);
int fetchOrderData(MYSQL*);
int fetchOrderDetails(MYSQL*);
int fetchPreviousOrder(MYSQL*, TableOrder&);
void viewPreviousOrderDetails(MYSQL*, int, int&);
void viewProfile(function<void()>, MYSQL*);
//void selectProduct(Vendor, int, int, double&);
bool selectProduct(Vendor, int, int, double&, int);
void insertOrder(MYSQL*, int);
void clearOrder();
vector<vector<string>> getOrder();
bool checkOrder();
void displayPreviousOrder(int, int, TextTable&);
void displayChart(MYSQL*);
string getName();
int getID();
string getPassword();
};
#endif