コード例 #1
0
 def __init__(self):
     self.user = User()
     self.myTickets = MyTickets()
     self.cinema = Cinema()
     self.film = Film()
     self.time = Time()
     self.place = Place()
     self.db = DB()
コード例 #2
0
 def getListTime(self, cinemaID, filmID):
     self.listTime = []
     db = DB()
     for db in DB().select("Times", "*", "cinema_id="+str(cinemaID)+" AND film_id="+str(filmID)):
         arr = {}
         arr["id"] = db[0]
         arr['time'] = db[3]
         arr['price'] = db[4]
         self.listTime.append(arr)
コード例 #3
0
ファイル: film.py プロジェクト: mnurtay/python3
 def getListFilm(self):
     self.listFilm = []
     for db in DB().select("Films", "*"):
         arr = []
         arr.append(db[0])
         arr.append(db[1])
         self.listFilm.append(arr)
コード例 #4
0
 def getListPlaces(self, timeID):
     self.listPlace = []
     for db in DB().select("Halls", "*", "time_id=" + str(timeID)):
         arr = {}
         arr["id"] = db[0]
         arr['place'] = db[2]
         arr['status'] = db[3]
         self.listPlace.append(arr)
コード例 #5
0
ファイル: user.py プロジェクト: mnurtay/python3
class User:
    def __init__(self):
        self.id = None
        self.login = None
        self.password = None
        self.name = None
        self.db = DB()
    
    def checkUser(self, login, password):
        user = None
        try:
            user = self.db.select("Users", "*", "login='******';")
        except:
            return False
        if user:
            if user[0][1]==login and user[0][2]==password:
                self.id = int(user[0][0])
                self.name = user[0][3]
                self.surname = user[0][4]
                self.login = user[0][1]
                self.password = user[0][2]
                return True
        return False

    
    def createUser(self, login, password, name, surname):
        user = None
        try:
            user = self.db.select("Users", "*", "login='******';")
        except:
            pass
        if user:
            return False
        user = self.db.select("Users", "*")
        if user:
            self.id = int(user[len(user)-1][0])+1
        else:
            self.id = 1
        self.name = name
        self.login = login
        self.password = password
        self.surname = surname
        self.db.insertUser(self.id, login, password, name, surname)
        return True
        
コード例 #6
0
class Model:
    def __init__(self):
        self.user = User()
        self.myTickets = MyTickets()
        self.cinema = Cinema()
        self.film = Film()
        self.time = Time()
        self.place = Place()
        self.db = DB()
        
    def setCinemaAndFilm(self, cinema, film):
        self.cinema.setCinema(cinema[0], cinema[1])
        self.film.setFilm(film[0], film[1])
        self.time.getListTime(cinema[0], film[0])
    
    def setTime(self, time):
        self.time.setTime(time)
        self.place.getListPlaces(time['id'])
    
    def saveTicket(self, place):
        self.place.setPlace(place)
        totalPrice = self.time.price * len(self.place.place)
        self.db.insertTicket(self.user.id, self.cinema.name, self.film.name, self.time.time, self.place.place, self.time.price, totalPrice)
コード例 #7
0
 def setPlace(self, place):
     self.place = place
     for item in self.listPlace:
         if item['place'] in place:
             DB().change("Halls", "status=1", "id=" + str(item['id']))
コード例 #8
0
ファイル: user.py プロジェクト: mnurtay/python3
 def __init__(self):
     self.id = None
     self.login = None
     self.password = None
     self.name = None
     self.db = DB()
コード例 #9
0
ファイル: cinema.py プロジェクト: mnurtay/python3
 def getListCinema(self):
     self.listCinema = []
     db = DB()
     data = db.select('Cinemas', ['id', 'name'])
     for item in data:
         self.listCinema.append(item)