Example #1
0
        /***********************************************/

        /******Button to add a new client and sale a ticket****/
        private void AddButton_Click_2(object sender, RoutedEventArgs e)
        {
            if (movie_read.Content.Equals("") || typeCombo.Text.ToString().Equals("") || NameTextBox.Text.ToString().Equals("") || seatLabel.Content.Equals(""))
            {
                MessageBox.Show("Wszytkie pola muszą być uzupełnione!!!", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                TicketType convert_type(string val)
                {
                    switch (val)
                    {
                    case "sprzedaż":
                        return(TicketType.sale);

                    case "rezerwacja":
                        return(TicketType.reservation);

                    default:
                        return(TicketType.reservation);
                    }
                }

                long   epochTicks = new DateTime(1970, 1, 1).Ticks;
                long   unixTime   = ((DateTime.UtcNow.Ticks - epochTicks) / TimeSpan.TicksPerSecond);
                string type       = typeCombo.Text.ToString();

                /****New entry to our list of ticket*********/
                CinemaModel entry = new CinemaModel(unixTime, convert_type(type), NameTextBox.Text.ToString(), movie_read.Content.ToString(), roomNumber, Seat);
                CinemaService.AddEntry(entry);

                RoomMovies.Add(entry);
                ListWithOneMovieOnly.Add(entry);

                /********Clear labels*****/
                typeCombo.Text = "";
                NameTextBox.Clear();
                seatLabel.Content = "";
            }
        }
Example #2
0
 //delete ticket
 public static void DeleteEntry(CinemaModel entry)
 {
     Data.Remove(entry);
 }
Example #3
0
 //add new customer and ticket
 public static void AddEntry(CinemaModel entry)
 {
     Data.Add(entry);
 }