-
Notifications
You must be signed in to change notification settings - Fork 0
/
Account.cpp
102 lines (76 loc) · 2.24 KB
/
Account.cpp
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
#include "Account.h"
#include <iostream>
using namespace std;
//Constructor
Account::Account(): name{""}, address{""}, phone_number{""}, email{""}, password{""}, salary{0}, isAdmin{false}, dob{new Time(0)}, join_date{new Time(0)}, leave_date{new Time(0)} {};
Account::Account(string n, string ad, string p_n, string em, string pass, int sl, bool admin, Time* birth, Time* join, Time* leave): name{n}, address{ad}, phone_number{p_n}, email{em}, password{pass}, salary{sl}, isAdmin{admin}, dob{birth}, join_date{join}, leave_date{leave} {};
//Getter
string Account::get_string(string n){
if(n == "name")
return name;
else if(n == "address")
return address;
else if(n == "phone_number")
return phone_number;
else if(n == "email")
return email;
else if(n == "password")
return password;
return "ERROR";
}
int Account::get_salary(){
return salary;
}
bool Account::get_admin(){
return isAdmin;
}
Time* Account::get_time(string n){
if(n == "dob")
return dob;
else if(n == "join")
return join_date;
else if(n == "leave")
return leave_date;
return nullptr;
}
//Setter
void Account::set_string(string n, string data){
if(n == "name")
name = data;
else if(n == "address")
address= data;
else if(n == "phone_number")
phone_number= data;
else if(n == "email")
email= data;
else if(n == "password")
password= data;
}
void Account::set_salary(int data){
salary = data;
}
void Account::set_admin(bool data){
isAdmin = data;
}
void Account::set_time(string n, Time* data){
if(n == "dob")
dob = data;
else if(n == "join")
join_date = data;
else if(n == "leave")
leave_date = data;
}
void Account::check_in(map<string, vector<pair<Time*, Time*>> > &attend){
attend[email].push_back(make_pair(new Time(), nullptr));
}
void Account::check_out(map<string, vector<pair<Time*, Time*>> > &attend){
attend[email][attend[email].size()-1].second = new Time();
}
void Account::get_info(map<string, Account*> &db){
}
void Account::createacc(map<string, Account*> &db){
}
void Account::editacc(map<string, Account*> &db){
}
void Account::deleteacc(map<string, Account*> &db){
}