public fAdminFilms(AuthorisedUser user) { InitializeComponent(); if (user.GetType() == typeof(AdminUser)) { this.user = user; //класс, считывающий данные из бд и это в List засунуть; ReadingFromDateBase reading = new ReadingFromDateBase(); filmsList = reading.ReadFilms(); sourceData.DataSource = filmsList.Films; dataGridViewFilm.DataSource = sourceData; dataGridViewFilm.Columns[0].Visible = false; dataGridViewFilm.Columns[1].HeaderText = "Название"; dataGridViewFilm.Columns[2].HeaderText = "Длительность"; dataGridViewFilm.Columns[3].HeaderText = "Ограничение"; dataGridViewFilm.Columns[4].HeaderText = "Цена"; } else { this.user = user; //класс, считывающий данные из бд и это в List засунуть; ReadingFromDateBase reading = new ReadingFromDateBase(); filmsList = reading.ReadFilms(); sourceData.DataSource = filmsList.Films; dataGridViewFilm.DataSource = sourceData; dataGridViewFilm.Columns[0].Visible = false; AddButton.Visible = false; UpdateButton.Visible = false; DeleteButton.Visible = false; } }
public fHalls(AuthorisedUser user) { InitializeComponent(); if (user.GetType() == typeof(AdminUser)) { this.user = user; ReadingFromDateBase reading = new ReadingFromDateBase(); hallsList = reading.ReadHalls(); placesList = reading.ReadAllPlacesOfAllHalls(); sourceData.DataSource = hallsList.Halls; dataGridViewHalls.DataSource = sourceData; dataGridViewHalls.Columns[0].Visible = false; dataGridViewHalls.Columns[1].HeaderText = "Название"; dataGridViewHalls.Columns[2].HeaderText = "Кол-во мест"; dataGridViewHalls.Columns[3].HeaderText = "Кол-во мест в ряду"; } else { this.user = user; ReadingFromDateBase reading = new ReadingFromDateBase(); hallsList = reading.ReadHalls(); placesList = reading.ReadAllPlacesOfAllHalls(); sourceData.DataSource = hallsList.Halls; dataGridViewHalls.DataSource = sourceData; dataGridViewHalls.Columns[0].Visible = false; dataGridViewHalls.Columns[1].HeaderText = "Название"; dataGridViewHalls.Columns[2].HeaderText = "Кол-во мест"; dataGridViewHalls.Columns[3].HeaderText = "Кол-во мест в ряду"; AddButton.Visible = false; UpdateButton.Visible = false; DeleteButton.Visible = false; } }
public fCashiers(AuthorisedUser user) { InitializeComponent(); if (user.GetType() == typeof(AdminUser)) { this.user = user; //класс, считывающий данные из бд и это в List засунуть; ReadingFromDateBase reading = new ReadingFromDateBase(); reading.ReadFromDateBase(); cashiersList = new ListOfCashiers(reading.cashierList); sourceData.DataSource = cashiersList.Cashiers; dataGridViewCashiers.DataSource = sourceData; dataGridViewCashiers.Columns[0].Visible = false; dataGridViewCashiers.Columns[1].HeaderText = "Фамилия"; dataGridViewCashiers.Columns[2].HeaderText = "Имя"; dataGridViewCashiers.Columns[3].HeaderText = "Отчество"; dataGridViewCashiers.Columns[4].Visible = false; dataGridViewCashiers.Columns[5].HeaderText = "Логин"; dataGridViewCashiers.Columns[6].HeaderText = "Пароль"; } else { //класс, считывающий данные из бд и это в List засунуть; MessageBox.Show("Запрещено"); this.Close(); } }
public fPercents(AuthorisedUser user) { InitializeComponent(); if (user.GetType() == typeof(AdminUser)) { this.user = user; ReadingFromDateBase reading = new ReadingFromDateBase(); percentList = reading.ReadPercentages(); sourceData.DataSource = percentList.Percents; dataGridViewPercents.DataSource = sourceData; dataGridViewPercents.Columns[0].Visible = false; dataGridViewPercents.Columns[1].HeaderText = "Скидка/Наценка"; dataGridViewPercents.Columns[2].HeaderText = "Описание"; dataGridViewPercents.Columns[3].HeaderText = "Процент"; } else { this.user = user; ReadingFromDateBase reading = new ReadingFromDateBase(); percentList = reading.ReadPercentages(); sourceData.DataSource = percentList.Percents; dataGridViewPercents.DataSource = sourceData; dataGridViewPercents.Columns[0].Visible = false; dataGridViewPercents.Columns[1].HeaderText = "Скидка/Наценка"; dataGridViewPercents.Columns[2].HeaderText = "Описание"; dataGridViewPercents.Columns[3].HeaderText = "Процент"; AddButton.Visible = false; UpdateButton.Visible = false; DeleteButton.Visible = false; this.Close(); } }
public fSessions(AuthorisedUser user) { this.user = user; InitializeComponent(); if (user.GetType() == typeof(AdminUser)) { ReadingFromDateBase reading = new ReadingFromDateBase(); sessionsList = reading.ReadSessions(); foreach (var i in sessionsList.Sessions) { filmIds.Add(i.FilmSession.FilmId); hallIds.Add(i.HallSession.HallId); } LoadDataGridView(); filmList = reading.ReadFilms(); hallList = reading.ReadHalls(); FilmComboBox.DataSource = filmList.Films; FilmComboBox.DisplayMember = "FilmName"; FilmComboBox.ValueMember = "FilmId"; HallComboBox.DataSource = hallList.Halls; HallComboBox.DisplayMember = "HallName"; HallComboBox.ValueMember = "HallId"; } else { this.user = user; ReadingFromDateBase reading = new ReadingFromDateBase(); sessionsList = reading.ReadSessions(); foreach (var i in sessionsList.Sessions) { filmIds.Add(i.FilmSession.FilmId); hallIds.Add(i.HallSession.HallId); } for (int i = 0; i < sourceData.Count; i++) { dataGridViewSessions[2, i].Value = filmIds[i]; } LoadDataGridView(); filmList = reading.ReadFilms(); hallList = reading.ReadHalls(); FilmComboBox.DataSource = filmList.Films; FilmComboBox.DisplayMember = "FilmName"; FilmComboBox.ValueMember = "FilmId"; HallComboBox.DataSource = hallList.Halls; HallComboBox.DisplayMember = "HallName"; HallComboBox.ValueMember = "HallId"; AddButton.Visible = false; UpdateButton.Visible = false; DeleteButton.Visible = false; } }
private void SelectedPlaceInHall(object sender, EventArgs e) { Button clickedButton = (Button)sender; RowInput.Text = clickedButton.Name; PlaceInput.Text = clickedButton.Text; if (user.GetType() == typeof(CashierUser)) { this.Hide(); fTickets console = new fTickets(user, session, Convert.ToInt32(RowInput.Text), Convert.ToInt32(PlaceInput.Text), session.FilmSession.Price); console.ShowDialog(); this.Show(); } }
private void dataGridViewSessions_CellClick(object sender, DataGridViewCellEventArgs e) { indexRow = e.RowIndex; if (e.RowIndex != -1) // исключает ошибки(когда нажимается на столбец) { FilmComboBox.Text = dataGridViewSessions.Rows[indexRow].Cells[1].Value.ToString(); HallComboBox.Text = dataGridViewSessions.Rows[indexRow].Cells[2].Value.ToString(); DateInputPicker.Value = Convert.ToDateTime(dataGridViewSessions.Rows[indexRow].Cells[3].Value.ToString()); TimeInputPicker.Value = Convert.ToDateTime(dataGridViewSessions.Rows[indexRow].Cells[4].Value.ToString()); if (user.GetType() == typeof(CashierUser)) { this.Hide(); Session session = sessionsList.Sessions[indexRow]; fHalls console = new fHalls(user, session); console.ShowDialog(); this.Show(); } } }
public fHalls(AuthorisedUser user, Session session) { InitializeComponent(); this.user = user; this.session = session; if (user.GetType() == typeof(CashierUser)) { Hall currentHall = session.HallSession; sourceData.DataSource = currentHall; dataGridViewHalls.DataSource = sourceData; dataGridViewHalls.Columns[0].Visible = false; dataGridViewHalls.Columns[1].HeaderText = "Название"; dataGridViewHalls.Columns[2].HeaderText = "Кол-во мест"; dataGridViewHalls.Columns[3].HeaderText = "Кол-во мест в ряду"; dataGridViewHalls.Visible = false; foreach (Control i in this.Controls) { i.Visible = false; } HallPlaces.Visible = true; ExitButton.Visible = true; LoadSchemeOfHall(session.HallSession.SeatingCapacity, session.HallSession.PlacesInRow); } }