public void Add() { bool isNew = false; for (int i = From; i < To + 1; i++) { HallPlace hall = new HallPlace(i, isNew, this.Id); HallPlaces.Add(hall); } }
public FormBuyTickets() { InitializeComponent(); Person.Load(); Hall.Load(); HallSector.Load(); HallPlace.Load(); HallPerson.Load(); Film.Load(); Person.Load(); PersonTicket.Load(); SessionFilm.Load(); }
private void FormBuyTickets_FormClosed(object sender, FormClosedEventArgs e) { Base <Person> .TextSave(); Base <Person> .Json(); Person.Save(); Hall.Save(); HallSector.Save(); HallPlace.Save(); HallSpace.Save(); HallAdding.Save(); HallPerson.Save(); Film.Save(); Person.Save(); PersonTicket.Save(); SessionFilm.Save(); }
private void btnCheck_Click_1(object sender, EventArgs e) { double x = 0; double z = 0; HallPlace place = null; if (tBPlace.Text != "" && TbCode.Text != "") { foreach (var item in HallPlace.Items.Values) { if (Int32.Parse(tBPlace.Text) == item.Place) { place = item; } } if (place.IsSold == false) { if (tBFilm.Text != "") { foreach (var item in Hall.Items.Values) { foreach (var price in item.HallSectors) { foreach (var places in price.HallPlaces) { if (place == places) { x = price.Price; } } } } if (tBAmountP.Text == null) { MessageBox.Show("Please select and input all fields", "Etantion", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { int g = Int32.Parse(tBAmountP.Text); double k = Code(TbCode.Text); if (k == 0) { z = x; } else { z = g * x * k / 100; } tBPrice.Text = z + "UAH"; } } else { MessageBox.Show("There are any films in this hall", "Sorry", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("This place is sold", "Etantion", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Please select and input all fields", "Etantion", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnBuy_Click_1(object sender, EventArgs e) { HallPlace place = null; if (tBPlace.Text != "" && TbCode.Text != "" && tBCard.Text != "") { foreach (var item in ((Hall)cBCinema.SelectedItem).HallSectors) { foreach (var elem in item.HallPlaces) { if (elem.Place == Int32.Parse(tBPlace.Text)) { place = elem; break; } } } if (place.IsSold == false) { if (tBFilm.Text != "") { bool b = false; string z; double price = place.HallSector.Price; place.IsSold = true; foreach (var item in Person.Items.Values) { z = item.GetCode.ToString(); if (TbCode.Text == z) { b = true; } } foreach (var item in SessionFilm.Items.Values) { if ((Hall)cBCinema.SelectedItem == item.Hall) { Ticket ticket = new Ticket(price, b, item.Hall, item.Film, place.Id); } } Clear(); check = new FormTicketCheck(); check.ShowDialog(); } else { MessageBox.Show("There are any films in this hall", "Sorry", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("This place is already sold"); } } else { MessageBox.Show("Please select and input all fields", "Etantion", MessageBoxButtons.OK, MessageBoxIcon.Information); } }