Exemplo n.º 1
0
        //tickettypes ophalen
        public static ObservableCollection <TicketType> GetTicketTypes()
        {
            ObservableCollection <TicketType> ticketTypes = new ObservableCollection <TicketType>();

            string       sSQL   = "Select * FROM TicketType";
            DbDataReader reader = Database.GetData(sSQL);

            while (reader.Read())
            {
                TicketType t = new TicketType();


                int ID = (int)reader["ID"];
                t._ID              = Convert.ToString(ID);
                t.Name             = !Convert.IsDBNull((string)reader["Name"]) ? (string)reader["Name"] : "";
                t.Price            = Convert.ToInt32(!Convert.IsDBNull((decimal)reader["Price"]) ? (decimal)reader["Price"] : 0);
                t.AvailableTickets = !Convert.IsDBNull((int)reader["AvailableTickets"]) ? (int)reader["AvailableTickets"] : 0;

                ticketTypes.Add(t);
            }


            return(ticketTypes);
        }
Exemplo n.º 2
0
        public static TicketType GetTicketByName(String TicketName)
        {
            ObservableCollection <TicketType> TicketNames = TicketType.GetTicketTypes();

            return(TicketNames.Where(tt => tt._Name == TicketName).SingleOrDefault());
        }
Exemplo n.º 3
0
        public static TicketType GetTicketTypeByID(String TicketTypeID)
        {
            ObservableCollection <TicketType> TicketID = TicketType.GetTicketTypes();

            return(TicketID.Where(tt => tt._ID == TicketTypeID).SingleOrDefault());
        }