Beispiel #1
0
 public bool AddHall(Hall hall)
 {
     if (!hallStorage.ContainsKey(hall.GetId()))
     {
         hallStorage.Add(hall.GetId(), hall);
         return(true);
     }
     else
     {
         MessageBox.Show("Такой зал уже добавлен",
                         "Ошибка",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Information,
                         MessageBoxDefaultButton.Button1,
                         MessageBoxOptions.DefaultDesktopOnly
                         );
         return(false);
     }
 }
Beispiel #2
0
        public CreateTickets(Session session)
        {
            InitializeComponent();
            Hall hall = DataBase.hallStorage.GetStorage()[session.GetHall()];

            label5.Text = session.GetFilm().GetName();
            label6.Text = session.GetFilm().GetDuration().ToString();
            label7.Text = hall.GetId().ToString();
            label8.Text = session.GetPrice().ToString();

            Button[,] button = new Button[hall.GetCol(), hall.GetRow()];


            int X = 15;
            int Y = 120;



            for (int i = 0; i < hall.GetCol(); i++)
            {
                for (int j = 0; j < hall.GetRow(); j++)
                {
                    button[i, j]         = new Button();
                    button[i, j].Text    = "";
                    button[i, j].Width   = 20;
                    button[i, j].Height  = 20;
                    button[i, j].Visible = true;

                    if (hall.GetPlaces()[i, j])
                    {
                        button[i, j].BackColor = Color.Red;
                    }
                    else
                    {
                        button[i, j].BackColor = Color.Green;
                    }

                    button[i, j].Location = new Point(X + 22 * j + 2, Y + 22 * i);

                    this.Controls.Add(button[i, j]);
                }
            }
        }