Exemplo n.º 1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            statusTicketList.AddStatusTicketInList(statusTicketList.StatusTicketList.Count() + 1, user.UserId,
                                                   Convert.ToInt32(TicketInput.Text), "Продано", DatePicker.Value, TimePicker.Value.TimeOfDay);
            ticketsList.AddTicketInList(ticketsList.Tickets.Count() + 1,
                                        sessionList.Sessions.Find(x => x.FilmSession.FilmName == SessionInput.Text),
                                        Convert.ToInt32(PlaceNumberInput.Text), Convert.ToInt32(RowInput.Text),
                                        AgeVistorPicker.Value, Convert.ToInt32(PriceInput.Text));
            WritingInDatabase writing = new WritingInDatabase();

            writing.WriteInDatabase(ticketsList.Tickets.Last());
            writing.WriteInDatabase(statusTicketList.StatusTicketList.Last());
            LoadDataGridView();
        }
Exemplo n.º 2
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            HallPlaces.Controls.Clear();
            if (SeatingCapacityInput.Text == "" || PlacesInRowInput.Text == "" || SeatingCapacityInput.Text == "0" ||
                PlacesInRowInput.Text == "0")
            {
                MessageBox.Show("Нельзя создать пустой зал");
            }
            else
            {
                int id = 1;
                if (hallsList.Halls.Count != 0)
                {
                    id = hallsList.Halls.Count + 1;
                }
                hallsList.AddHallInList(id, NameHallInput.Text,
                                        Convert.ToInt32(SeatingCapacityInput.Text), Convert.ToInt32(PlacesInRowInput.Text));

                WritingInDatabase writing = new WritingInDatabase();

                writing.WriteInDatabase(hallsList.Halls.Last());

                FillingPlaces(hallsList.Halls.Last());

                sourceData.ResetBindings(false);

                LoadSchemeOfHall(Convert.ToInt32(SeatingCapacityInput.Text), Convert.ToInt32(PlacesInRowInput.Text));
            }
        }
Exemplo n.º 3
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            cashiersList.AddCashierInList(cashiersList.Cashiers.Max().UserId + 1, LastNameInput.Text,
                                          FirstNameInput.Text, SecondNameInput.Text, "Cashier", LoginInput.Text, PasswordInput.Text);
            WritingInDatabase writing = new WritingInDatabase();

            writing.WriteInDatabase(cashiersList.Cashiers.Last());
            sourceData.ResetBindings(false);
        }
Exemplo n.º 4
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            percentList.AddPercentInList(percentList.Percents.Max().PercentId + 1,
                                         DiscountOrMarkupInput.Text, DescriptionInput.Text, Convert.ToInt32(PercentInput.Text));
            WritingInDatabase writing = new WritingInDatabase();

            writing.WriteInDatabase(percentList.Percents.Last());
            sourceData.ResetBindings(false);
        }
Exemplo n.º 5
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            //sourceData.DataSource = films.Films;
            filmsList.AddFilmInList(filmsList.Films.Max().FilmId + 1, NameFilmInput.Text, Convert.ToInt32(FilmLengthInput.Text),
                                    Convert.ToInt32(AgeLimitInput.Text), Convert.ToInt32(PriceInput.Text));
            WritingInDatabase writing = new WritingInDatabase();

            writing.WriteInDatabase(filmsList.Films.Last());
            sourceData.ResetBindings(false); //подтверждает изменения
            // не работает так: dataGridViewFilm.Rows.Add(NameFilmInput.Text, FilmLengthInput.Text, AgeLimitInput.Text, PriceInput.Text);
        }
Exemplo n.º 6
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            sessionsList.AddSessionInList(filmList.Films.Last().FilmId + 1,
                                          filmList.Films.Find(x => x.FilmName == FilmComboBox.Text),
                                          hallList.Halls.Find(x => x.HallName == HallComboBox.Text),
                                          DateInputPicker.Value, TimeInputPicker.Value.TimeOfDay);
            WritingInDatabase writing = new WritingInDatabase();

            writing.WriteInDatabase(sessionsList.Sessions.Last());
            LoadDataGridView();
        }
Exemplo n.º 7
0
        private void FillingPlaces(Hall hall)
        {
            int hallId                = hall.HallId;
            int seatingCapacity       = hall.SeatingCapacity;
            int placesInRowLimit      = hall.PlacesInRow;
            WritingInDatabase writing = new WritingInDatabase();
            int  placeId              = placesList.Places.Count() + 1;
            int  rows       = 0;
            bool notEven    = false;
            int  leftPlaces = seatingCapacity % placesInRowLimit;

            if (leftPlaces != 0)
            {
                rows    = (seatingCapacity / placesInRowLimit) + 1;
                notEven = true;
            }
            else
            {
                rows = seatingCapacity / placesInRowLimit;
            }
            for (int i = 1; i <= rows; i++)
            {
                if (i == rows && notEven)
                {
                    placesInRowLimit = leftPlaces;
                }
                for (int j = 1; j <= placesInRowLimit; j++)
                {
                    PlaceInHall place = new PlaceInHall(placeId, hallId, i, j);
                    hall.Places.Add(place);
                    placesList.Places.Add(place);
                    placeId++;
                }
            }
            writing.WriteInDatabase(hall.Places);
        }