示例#1
0
        public Boolean addTicket(string titlu, int rand, int loc, string data)
        {
            FilmService f  = new FilmService();
            int         id = ticketDAO.findIDFilm(titlu);

            if (validateTicket(titlu, rand, loc))
            {
                ticketDAO.insertTicket(id, rand, loc, data);
                f.updateBilete(titlu, f.getNrBilete(titlu) - 1);
                return(true);
            }
            return(false);
        }
示例#2
0
        public Boolean validateTicket(string titlu, int rand, int loc)
        {
            List <Ticket> tickets  = ticketDAO.viewTickets();
            FilmService   f        = new FilmService();
            int           nrBilete = f.getNrBilete(titlu);

            foreach (Ticket t in tickets)
            {
                if ((rand == t.getRand()) && (loc == t.getLoc()) && (nrBilete != 0))
                {
                    return(false);
                }
            }

            return(true);
        }