-
Notifications
You must be signed in to change notification settings - Fork 0
/
Santri.py
61 lines (50 loc) · 1.92 KB
/
Santri.py
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
from model import Model
from User import User
from DBConnector import DBConnect
import datetime
class Santri(User):
tgl = datetime.date.today().strftime('%Y-%m-%d')
def __init__(self, inputEmail=None):
super().__init__("santri", [
"nama", "email", "password", "alamat", "no_hp", "perguruan_tinggi", "prodi", "kamar_id"])
# variable privet
if inputEmail == None:
pass
else:
self.__email = inputEmail
connection = DBConnect()
query = "SELECT password FROM " + self.table + \
" WHERE email='%s'" % (self.__email)
result = connection.executeRead(query)
self.__password = result[0][0]
# penggunaan __call__
def __call__(self, email):
print("Trimakasih Kang", email,
"Telah melakukan Pembayaran SPP :)")
def getPassword(self):
return self.__password
def setPassword(self, passwordBaru):
self.__password = passwordBaru
connection = DBConnect()
query = "UPDATE "+self.table + \
" SET password= '%s' WHERE email = '%s'" % (
self.__password, self.__email)
connection.execute(query)
print("===Password Berhasil Dirubah===")
def getID(self):
connection = DBConnect()
query = "SELECT * from "+self.table + \
" WHERE email= '%s'" % (self.__email)
hasil = connection.executeRead(query)
return hasil[0][0]
def bayarSPP(self, nominal, email):
connection = DBConnect()
query = "INSERT INTO transaksi (tgl_pembayaran, nominal, jenis_transaksi, santri_id) VALUES ('%s',%s,'spp', %s)" % (
Santri.tgl, nominal, self.getID())
connection.execute(query)
print("===Bayar SPP Berhasil===")
# santri1 = Santri("b")
# # santri1.getPassword()
# print(santri1.getPassword())
# santri1.setPassword("d")
# print(santri1.getPassword())