Exemple #1
0
        private tblJeu jeuToTblJeu(Jeu p)
        {
            tblJeu jeu = new tblJeu();
            tblTheme theme = new tblTheme();
            tblPlateforme plate = new tblPlateforme();

            jeu.IdJeu = p.idJeu;
            jeu.NomJeu = p.nomJeu;
            jeu.DescJeu = p.descJeu;
            jeu.CoteESRB = p.coteESRB;
            jeu.IdGenre = p.idGenre;
            jeu.IdMode = p.idMode;
            jeu.InfoSupJeu = p.infoSupJeu;

            foreach (Theme item in p.lstTheme)
            {
                theme = new tblTheme();
                theme.IdTheme = item.idTheme;
                jeu.tblTheme.Add(theme);
            }
            foreach (plateforme item in p.lstPlateforme)
            {
                plate = new tblPlateforme();
                plate.IdPlateforme = item.idPlate;
                jeu.tblPlateforme.Add(plate);
            }
            return jeu;
        }
Exemple #2
0
        public void modifier(Jeu j)
        {
            tblJeu nouv = jeuToTblJeu(j);
            nouv.IdJeu = j.idJeu;

            rJeuSQL.setJeu(nouv);
        }
Exemple #3
0
        private void ajout()
        {
            DialogResult r;
            Jeu j = new Jeu();
            List<Theme> lstTheme = new List<Theme>();
            List<plateforme> lstPlateforme = new List<plateforme>();

            if (txtNom.Text.Trim().Length == 0 || txtDesc.Text.Trim().Length == 0)
            {
                MessageBox.Show("Les champs obligatoires ne sont pas bien remplis",
                    "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                tblJeu nouvJeu = new tblJeu();
                nouvJeu.NomJeu = txtNom.Text.Trim();
                nouvJeu.DescJeu = txtDesc.Text.Trim();
                nouvJeu.CoteESRB = cboxCote.Text.Trim();
                nouvJeu.InfoSupJeu = rtxtInfoSup.Text.Trim();
                if (cboxGenre.Text != "")
                {
                    foreach (var g in RequeteSql.rechercheGenre(cboxGenre.Text))
                    {
                        nouvJeu.IdGenre = g.IdGenre;
                    }
                }
                if (cboxMode.Text != "")
                {
                    foreach (var g in RequeteSql.rechercheMode(cboxMode.Text))
                    {
                        nouvJeu.IdMode = g.IdMode;
                    }
                }

                foreach (var item in tvAllTheme.Nodes)
                {
                    lstTheme.Add(((Theme)((TreeNode)item).Tag));
                }

                foreach (var item in tvAllPlateforme.Nodes)
                {
                    lstPlateforme.Add(((plateforme)((TreeNode)item).Tag));
                }

                j = new Jeu(nouvJeu);
                j.lstTheme = lstTheme;
                j.lstPlateforme = lstPlateforme;

                r = MessageBox.Show("Voulez-vous enregistrer?", "Enregistrement", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (r == DialogResult.Yes)
                {
                    cj.ajouter(j);
                    this.Close();
                }
            }
        }
Exemple #4
0
 public List<Jeu> rechercher(string chaine)
 {
     List<Jeu> lstJeu = new List<Jeu>();
     foreach (var j in rJeuSQL.srchJeu(chaine))
     {
         Jeu jeu = new Jeu(j);
         lstJeu.Add(jeu);
     }
     return lstJeu;
 }
Exemple #5
0
 public List<Jeu> chargerDonnees()
 {
     List<Jeu> lstJeu = new List<Jeu>();
     foreach (var j in rJeuSQL.getAllJeu())
     {
         Jeu jeu = new Jeu(j);
         lstJeu.Add(jeu);
     }
     return lstJeu;
 }
Exemple #6
0
        public frmDetJeu(Jeu jeu)
        {
            InitializeComponent();
            type = "modif";

            jeuBase = jeu;
            this.txtID.ReadOnly = true;
            txtID.Text = jeu.idJeu.ToString();
            this.txtNom.ReadOnly = true;
            txtNom.Text = jeu.nomJeu;
            this.txtDesc.ReadOnly = true;
            txtDesc.Text = jeu.descJeu;

            this.btnAjoutPlateforme.Enabled = false;
            this.btnRetirerPlateforme.Enabled = false;
            this.btnAjoutTheme.Enabled = false;
            this.btnRetirerTheme.Enabled = false;

            this.cboxCote.Enabled = false;
            this.cboxCote.Text = jeu.coteESRB;
            this.cboxGenre.Enabled = false;
            string nomGenre = "";
            if (jeu.idGenre != 0)
            {
                nomGenre = RequeteSql.rechercheGenre(jeu.idGenre.ToString()).First().NomGenre;
            }
            cboxGenre.Text = nomGenre;
            this.cboxMode.Enabled = false;
            string nomMode = "";
            if (jeu.idMode != 0)
            {
                nomMode = RequeteSql.rechercheMode(jeu.idMode.ToString()).First().NomMode;
            }
            cboxMode.Text = nomMode;
            this.rtxtInfoSup.ReadOnly = true;
            rtxtInfoSup.Text = jeu.infoSupJeu;

            foreach (Theme theme in jeu.lstTheme)
            {
                TreeNode tntemp = tvSelectTheme.Nodes.Add(theme.nomTheme);
                tntemp.Tag = theme;
            }

            foreach (plateforme plate in jeu.lstPlateforme)
            {
                TreeNode tntemp = tvSelectPlateforme.Nodes.Add(plate.nomPlate);
                tntemp.Tag = plate;
            }

            this.btnEnregistrer.Enabled = false;
            this.btnAjoutPlateforme.Enabled = false;
            this.btnAjoutTheme.Enabled = false;

            this.btnActiverModif.Enabled = true;
        }
Exemple #7
0
 public void ajouter(Jeu j)
 {
     var ajout = jeuToTblJeu(j);
     try
     {
         rJeuSQL.addJeu(ajout);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemple #8
0
        private tblJeu jeuToTblJeu(Jeu p)
        {
            tblJeu jeu = new tblJeu();
            tblTheme theme = new tblTheme();
            tblPlateforme plate = new tblPlateforme();
            tblSysExp systemp = new tblSysExp();

            jeu.IdJeu = p.idJeu;
            jeu.NomJeu = p.nomJeu;
            jeu.DescJeu = p.descJeu;
            jeu.CoteESRB = p.coteESRB;
            jeu.IdGenre = p.idGenre;
            jeu.IdMode = p.idMode;
            jeu.InfoSupJeu = p.infoSupJeu;

            foreach (Theme item in p.lstTheme)
            {
                theme = new tblTheme();
                //Peut être que c'est ici que sa chie
                theme.IdTheme = item.idTheme;
                theme.NomTheme = item.nomTheme;
                theme.ComTheme = item.comTheme;
                jeu.tblTheme.Add(theme);
            }
            foreach (plateforme item in p.lstPlateforme)
            {
                plate = new tblPlateforme();
                plate.IdPlateforme = item.idPlate;
                plate.CodePlateforme = item.codePlate;
                plate.NomPlateforme = item.nomPlate;
                plate.CodeCategorie = item.codeCateg;
                plate.CPU = item.cpuPlate;
                plate.CarteMere = item.carteMerePlate;
                plate.RAM = item.ramPlate;
                plate.Stockage = item.stockage;
                plate.DescPlateforme = item.descPlate;
                plate.InfoSupPlateforme = item.infoSupPlate;

                foreach (SystemeExploitation item2 in item.lstSysExpPlate)
                {
                    systemp = new tblSysExp();
                    systemp.CodeSysExp = item2.CodeSysExp;
                    systemp.EditionSysExp = item2.editSysExp;
                    systemp.IdSysExp = item2.idSysExp;
                    systemp.InfoSupSysExp = item2.infoSysExp;
                    systemp.NomSysExp = item2.nomSysExp;
                    systemp.Tag = item2.tagSysExp;
                    systemp.VersionSysExp = item2.versionSysExp;
                    plate.tblSysExp.Add(systemp);
                }
            }
            return jeu;
        }
Exemple #9
0
 public void ajouter(Jeu j)
 {
     var ajout = jeuToTblJeu(j);
     try
     {
         rJeuSQL.addJeu(ajout);
     }
     catch (Exception)
     {
         throw new Exception("dshfdhfisknfkjseh");
     }
 }
Exemple #10
0
        public frmDetJeu(Jeu jeu)
        {
            InitializeComponent();
            type = "modif";

            //Mettre en ReadOnly
            this.txtDesc.Enabled = false;
            this.txtID.Enabled = false;
            this.txtNom.Enabled = false;
            this.rtxtInfoSup.Enabled = false;
            this.cboxGenre.Enabled = false;
            this.cboxMode.Enabled = false;

            this.btnEnregistrer.Enabled = false;
            this.btnAjoutPlateforme.Enabled = false;
            this.btnAjoutTheme.Enabled = false;
        }
Exemple #11
0
        public void detailsJeu_Click(object sender, EventArgs e)
        {
            if (dataGridJeu.SelectedRows.Count == 1)
            {
                Jeu temp = new Jeu();
                foreach (var j in rJeuSQL.srchIdJeu(Convert.ToInt32(dataGridJeu.Rows[presentRow].Tag)))
                {
                    temp = new Jeu(j);
                }

                var frmDetails = new frmDetJeu(temp);

                frmDetails.ShowDialog();
                chargerDonnees();
            }
            else
            {
                MessageBox.Show("Plusieurs lignes ont été sélectionnées", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #12
0
        public frmDetJeu(Jeu jeu)
        {
            InitializeComponent();
            type = "modif";

            //Mettre en ReadOnly
            this.txtID.ReadOnly = true;
            txtID.Text = jeu.idJeu.ToString();
            this.txtNom.ReadOnly = true;
            txtNom.Text = jeu.nomJeu;
            this.txtDesc.ReadOnly = true;
            txtDesc.Text = jeu.descJeu;

            this.btnAjoutPlateforme.Enabled = false;
            this.btnRetirerPlateforme.Enabled = false;
            this.btnAjoutTheme.Enabled = false;
            this.btnRetirerTheme.Enabled = false;

            this.cboxCote.Enabled = false;
            this.cboxCote.Text = jeu.coteESRB;
            this.cboxGenre.Enabled = false;
            //A changer pour le nom du genre
            cboxGenre.Text = jeu.idGenre.ToString();
            this.cboxMode.Enabled = false;
            //A changer pour le nom du mode
            cboxMode.Text = jeu.idMode.ToString();

            this.rtxtInfoSup.ReadOnly = true;
            rtxtInfoSup.Text = jeu.infoSupJeu;

            this.btnEnregistrer.Enabled = false;
            this.btnAjoutPlateforme.Enabled = false;
            this.btnAjoutTheme.Enabled = false;

            this.btnActiverModif.Enabled = true;
        }
Exemple #13
0
        public frmDetJeu(Jeu jeu)
        {
            InitializeComponent();
            type = "modif";

            jeuBase = jeu;
            this.txtID.ReadOnly = true;
            txtID.Text = jeu.idJeu.ToString();
            this.txtNom.ReadOnly = true;
            txtNom.Text = jeu.nomJeu;
            this.txtDesc.ReadOnly = true;
            txtDesc.Text = jeu.descJeu;

            this.btnAjoutPlateforme.Enabled = false;
            this.btnRetirerPlateforme.Enabled = false;
            this.btnAjoutTheme.Enabled = false;
            this.btnRetirerTheme.Enabled = false;

            this.cboxCote.Enabled = false;
            this.cboxCote.Text = jeu.coteESRB;
            this.cboxGenre.Enabled = false;
            string nomGenre = "";
            if (jeu.idGenre != 0)
            {
                nomGenre = RequeteSql.rechercheGenre(jeu.idGenre.ToString()).First().NomGenre;
            }
            cboxGenre.Text = nomGenre;
            this.cboxMode.Enabled = false;
            string nomMode = "";
            if (jeu.idMode != 0)
            {
                nomMode = RequeteSql.rechercheMode(jeu.idMode.ToString()).First().NomMode;
            }
            cboxMode.Text = nomMode;
            this.rtxtInfoSup.ReadOnly = true;
            rtxtInfoSup.Text = jeu.infoSupJeu;

            foreach (Theme theme in jeu.lstTheme)
            {
                TreeNode tntemp = tvSelectTheme.Nodes.Add(theme.nomTheme);
                tblTheme temp = new tblTheme();
                temp.IdTheme = theme.idTheme;
                temp.NomTheme = theme.nomTheme;
                temp.ComTheme = theme.comTheme;
                tntemp.Tag = temp;
            }

            foreach (plateforme p in jeu.lstPlateforme)
            {
                TreeNode tntemp = tvSelectPlateforme.Nodes.Add(p.nomPlate);
                tblPlateforme plate = new tblPlateforme();
                plate.IdPlateforme = p.idPlate;
                plate.CodePlateforme = p.codePlate;
                plate.NomPlateforme = p.nomPlate;
                plate.CodeCategorie = p.codeCateg;
                plate.CPU = p.cpuPlate;
                plate.CarteMere = p.carteMerePlate;
                plate.RAM = p.ramPlate;
                plate.Stockage = p.stockage;
                plate.DescPlateforme = p.descPlate;
                plate.InfoSupPlateforme = p.infoSupPlate;

                foreach (SystemeExploitation item2 in p.lstSysExpPlate)
                {
                    tblSysExp systemp = new tblSysExp();
                    systemp.CodeSysExp = item2.CodeSysExp;
                    systemp.EditionSysExp = item2.editSysExp;
                    systemp.IdSysExp = item2.idSysExp;
                    systemp.InfoSupSysExp = item2.infoSysExp;
                    systemp.NomSysExp = item2.nomSysExp;
                    systemp.Tag = item2.tagSysExp;
                    systemp.VersionSysExp = item2.versionSysExp;
                    plate.tblSysExp.Add(systemp);
                }
                tntemp.Tag = plate;
            }

            this.btnEnregistrer.Enabled = false;
            this.btnAjoutPlateforme.Enabled = false;
            this.btnAjoutTheme.Enabled = false;

            this.btnActiverModif.Enabled = true;
        }
Exemple #14
0
        private void btnCopier_Click(object sender, EventArgs e)
        {
            var copieJeu = new tblJeu();
            var lstTheme = new List<Theme>();
            var lstPlateforme = new List<plateforme>();
            frmDetJeu frmDetails;

            copieJeu.NomJeu = txtNom.Text.Trim();
            copieJeu.DescJeu = txtDesc.Text.Trim();
            copieJeu.CoteESRB = cboxCote.Text.Trim();
            copieJeu.InfoSupJeu = rtxtInfoSup.Text.Trim();
            copieJeu.Actif = true;
            if (cboxGenre.Text != "")
            {
                foreach (var g in RequeteSql.rechercheGenre(cboxGenre.Text))
                {
                    copieJeu.IdGenre = g.IdGenre;
                }
            }
            if (cboxMode.Text != "")
            {
                foreach (var g in RequeteSql.rechercheMode(cboxMode.Text))
                {
                    copieJeu.IdMode = g.IdMode;
                }
            }

            foreach (TreeNode item in tvSelectTheme.Nodes)
            {
                Theme temp = new Theme((tblTheme)item.Tag);
                lstTheme.Add(temp);
            }

            foreach (TreeNode item in tvSelectPlateforme.Nodes)
            {
                plateforme temp = new plateforme((tblPlateforme)item.Tag);
                lstPlateforme.Add(temp);
            }

            Jeu j = new Jeu(copieJeu);
            j.lstTheme = lstTheme;
            j.lstPlateforme = lstPlateforme;

            frmDetails = new frmDetJeu(j);
            frmDetails.type = "copie";
            frmDetails.ShowDialog();
            //Je sais pas si faut retourner sur l'original
            //this.Close();
        }
Exemple #15
0
        private void ajout()
        {
            DialogResult r;
            Jeu j = new Jeu();
            List<Theme> lstTheme = new List<Theme>();
            List<plateforme> lstPlateforme = new List<plateforme>();

            if (txtNom.Text.Trim().Length == 0 || txtDesc.Text.Trim().Length == 0)
            {
                MessageBox.Show("Les champs obligatoires ne sont pas bien remplis",
                    "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                tblJeu nouvJeu = new tblJeu();
                nouvJeu.NomJeu = txtNom.Text.Trim();
                nouvJeu.DescJeu = txtDesc.Text.Trim();
                nouvJeu.CoteESRB = cboxCote.Text.Trim();
                nouvJeu.InfoSupJeu = rtxtInfoSup.Text.Trim();
                nouvJeu.Actif = true;
                if (cboxGenre.Text != "")
                {
                    foreach (var g in RequeteSql.rechercheGenre(cboxGenre.Text))
                    {
                        nouvJeu.IdGenre = g.IdGenre;
                    }
                }
                if (cboxMode.Text != "")
                {
                    foreach (var g in RequeteSql.rechercheMode(cboxMode.Text))
                    {
                        nouvJeu.IdMode = g.IdMode;
                    }
                }

                foreach (var item in tvSelectTheme.Nodes)
                {
                    Theme temp = new Theme();
                    temp.idTheme = Convert.ToInt32(((TreeNode)item).Tag);
                    temp.nomTheme = ((TreeNode)item).Text;
                    foreach (var t in RequeteSql.srchTheme(temp.nomTheme))
                    {
                        temp.comTheme = t.ComTheme;
                    }
                    lstTheme.Add(temp);
                }

                foreach (var item in tvSelectPlateforme.Nodes)
                {
                    plateforme temp = new plateforme();
                    //string chaine =  + "%%" + (((TreeNode)item).Text);
                    foreach (var p in RequeteSql.srchPlateforme(((((TreeNode)item).Tag).ToString())))
                    {
                        if (p.NomPlateforme == ((TreeNode)item).Text)
                        {
                            temp = new plateforme(p);
                            foreach (tblSysExp s in p.tblSysExp)
                            {
                                SystemeExploitation SEtemp = new SystemeExploitation(s);
                                temp.lstSysExpPlate.Add(SEtemp);
                            }
                        }
                    }
                    lstPlateforme.Add(temp);
                }

                j = new Jeu(nouvJeu);
                j.lstTheme = lstTheme;
                j.lstPlateforme = lstPlateforme;

                r = MessageBox.Show("Voulez-vous enregistrer?", "Enregistrement", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (r == DialogResult.Yes)
                {
                    cj.ajouter(j);
                    this.Close();
                }
            }
        }
Exemple #16
0
        private void dataGridJeu_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                presentRow = e.RowIndex;
                dataGridJeu.Rows[e.RowIndex].Selected = true;
                if (dataGridJeu.SelectedRows.Count == 1)
                {
                    Jeu temp = new Jeu();
                    foreach (var j in rJeuSQL.srchIdJeu(Convert.ToInt32(dataGridJeu.Rows[e.RowIndex].Tag)))
                    {
                        temp = new Jeu(j);
                    }

                    var frmDetails = new frmDetJeu(temp);

                    frmDetails.ShowDialog();
                    chargerDonnees();
                }
                else
                {
                    MessageBox.Show("Plusieurs lignes ont été sélectionnées", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #17
0
        private void modifierJeu()
        {
            DialogResult r;
            var nouvJeu = new tblJeu();
            var lstTheme = new List<Theme>();
            var lstPlateforme = new List<plateforme>();

            if (txtNom.Text.Trim().Length == 0 || txtDesc.Text.Trim().Length == 0)
            {
                MessageBox.Show("Les champs obligatoires ne sont pas bien remplis.",
                    "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                nouvJeu.NomJeu = txtNom.Text.Trim();
                nouvJeu.DescJeu = txtDesc.Text.Trim();
                nouvJeu.CoteESRB = cboxCote.Text.Trim();
                nouvJeu.InfoSupJeu = rtxtInfoSup.Text.Trim();
                nouvJeu.Actif = true;
                if (cboxGenre.Text != "")
                {
                    foreach (var g in RequeteSql.rechercheGenre(cboxGenre.Text))
                    {
                        nouvJeu.IdGenre = g.IdGenre;
                    }
                }
                if (cboxMode.Text != "")
                {
                    foreach (var g in RequeteSql.rechercheMode(cboxMode.Text))
                    {
                        nouvJeu.IdMode = g.IdMode;
                    }
                }

                foreach (TreeNode item in tvSelectTheme.Nodes)
                {
                    Theme temp = new Theme((tblTheme)item.Tag);
                    lstTheme.Add(temp);
                }

                foreach (TreeNode item in tvSelectPlateforme.Nodes)
                {
                    plateforme temp = new plateforme((tblPlateforme)item.Tag);
                    lstPlateforme.Add(temp);
                }

                Jeu j = new Jeu(nouvJeu);
                j.lstTheme = lstTheme;
                j.lstPlateforme = lstPlateforme;

                r = MessageBox.Show("Voulez-vous enregistrer?",
                    "Enregistrement", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (r == DialogResult.Yes)
                {
                    cj.modifier(j);
                    this.Close();
                }
            }
        }