Пример #1
0
 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;
     }
 }
Пример #2
0
 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;
     }
 }