Ejemplo n.º 1
0
        /// <summary>
        /// load the form and the data that are useful for the good use of the form (video game's types)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmVideoGame_Load(object sender, EventArgs e)
        {
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            //We assume that the videogame release will not be announced before two years.
            dtpDateOutput.MaxDate = DateTime.Today.AddYears(2);
            //We assume no video game existed before 01.01.1950
            dtpDateOutput.MinDate = DateTime.Parse("01.01.1950");

            try
            {
                connection = new ConnectionBD();

                List <string> lstTypeVG = connection.GetTypeVG();
                foreach (string typeVG in lstTypeVG)
                {
                    cboTypeVG.Items.Add(typeVG);
                }
            } catch (Exception vgex)
            {
                MessageBox.Show(vgex.Message);
            }
            cmdDeletePlatform.Enabled = false;
            cmdDeleteDev.Enabled      = false;
            cmdDeleteEditor.Enabled   = false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// display the datagrid (columns, header and data)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmVideoGamesList_Load(object sender, EventArgs e)
        {
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            dgvVideoGamesList.ColumnCount = 6;
            //option for display
            dgvVideoGamesList.ColumnHeadersDefaultCellStyle.BackColor = Color.Navy;
            dgvVideoGamesList.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
            dgvVideoGamesList.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            dgvVideoGamesList.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
            dgvVideoGamesList.CellBorderStyle          = DataGridViewCellBorderStyle.Single;
            dgvVideoGamesList.GridColor = Color.Black;

            //columns name
            dgvVideoGamesList.Columns[0].Name         = "Nom";
            dgvVideoGamesList.Columns[1].Name         = "Date de sortie";
            dgvVideoGamesList.Columns[2].Name         = "Développeur";
            dgvVideoGamesList.Columns[3].Name         = "Editeur";
            dgvVideoGamesList.Columns[4].Name         = "Type";
            dgvVideoGamesList.Columns[5].Name         = "Id";
            dgvVideoGamesList.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;

            dgvVideoGamesList.ReadOnly                 = true;
            dgvVideoGamesList.AllowUserToAddRows       = false;
            dgvVideoGamesList.AllowUserToDeleteRows    = false;
            dgvVideoGamesList.AllowUserToOrderColumns  = false;
            dgvVideoGamesList.AllowUserToResizeColumns = false;
            dgvVideoGamesList.AllowUserToResizeRows    = false;
            dgvVideoGamesList.AllowDrop                = false;

            //connect to the database
            try
            {
                connection = new ConnectionBD();

                //get the list of video games and display it
                List <VideoGame> listVideoGames = connection.GetVideoGames();
                foreach (VideoGame vg in listVideoGames)
                {
                    dgvVideoGamesList.Rows.Add(vg.DisplayRow());
                }

                cmdDisplay.Enabled = false;
                cmdModify.Enabled  = false;
                cmdDelete.Enabled  = false;
            } catch (Exception vgex)
            {
                MessageBox.Show(vgex.Message);
                Close();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// load the form and the data that are useful for the good use of the form (video game's types)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmVideoGame_Load(object sender, EventArgs e)
        {
            connection = new ConnectionBD();

            try
            {
                List <string> lstTypeVG = connection.GetTypeVG();
                foreach (string typeVG in lstTypeVG)
                {
                    cboTypeVG.Items.Add(typeVG);
                }
            } catch (VgSQLException vgex)
            {
                MessageBox.Show(vgex.Message);
            }
            cmdDeletePlatform.Enabled = false;
            cmdDeleteDev.Enabled      = false;
            cmdDeleteEditor.Enabled   = false;
        }
Ejemplo n.º 4
0
 public void SetConnection(ConnectionBD conn)
 {
     connection = conn;
 }