private void AdminForm_Load(object sender, EventArgs e) { adminReservedGridView.DataSource = mediaLogic.ListReserve(); RefreshReservedList(); RefreshUserList(); RefreshGenreList(); RefreshDirectorList(); RefreshLanguageList(); RefreshMediaList(); userLevelComboBox.DataSource = Enum.GetValues(typeof(AppEnum.UserLevel)); MediaDataGridView.DataSource = mediaLogic.ListMedia(); genreComboBox.DataSource = mediaLogic.ListGenre(); genreComboBox.DisplayMember = "PairName"; genreComboBox.ValueMember = "PairId"; languageComboBox.DataSource = mediaLogic.ListLanguage(); languageComboBox.DisplayMember = "PairName"; languageComboBox.ValueMember = "PairId"; directorComboBox.DataSource = mediaLogic.ListDirector(); directorComboBox.DisplayMember = "PairName"; directorComboBox.ValueMember = "PairId"; borrowGridView.DataSource = mediaLogic.ListBorrow(); }
private void reserveButton_Click(object sender, EventArgs e) { try { if (mediaLogic.ListBorrow(media.MediaId).Count <= 0) { try { if (mediaLogic.ListReserve(media.MediaId).Count <= 0) { int affectedRows = mediaLogic.InsertReserve(CurrentUser.UserID, media.MediaId, DateTime.Today.ToString("dd/MM/yyyy")); //change this according to the computers date layout either dd/MM/yyyy or MM/dd/yyyy MessageBox.Show("A reservation has been made"); } else { MessageBox.Show(media.MediaName + " this media is already reserved"); } RefreshUserList(); } catch (Exception ex) { MessageBox.Show("Please select a media"); } } else { MessageBox.Show(media.MediaName + " is not available for reservation"); } } catch (Exception ex) { MessageBox.Show("Please select a media"); } }
private void MediaBrowser_Load(object sender, EventArgs e) { mediaGridView.DataSource = mediaLogic.ListMedia(); userLabel.Text = "Username: "******"PairName"; borrowMediaComboBox.ValueMember = "PairId"; }